version:1.0.9
update: bugfixes:修复微信无法自动接听,修复闹钟闪退
This commit is contained in:
@@ -15,8 +15,8 @@ android {
|
||||
applicationId "com.xxpatx.os"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
versionCode 1008
|
||||
versionName "1.0.7"
|
||||
versionCode 1010
|
||||
versionName "1.0.9"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
7
app/proguard-rules.pro
vendored
7
app/proguard-rules.pro
vendored
@@ -118,6 +118,7 @@
|
||||
java.lang.Object writeReplace();
|
||||
java.lang.Object readResolve();
|
||||
}
|
||||
|
||||
# 保留R文件中所有静态字段,以保证正确找到每个资源的ID
|
||||
-keepclassmembers class **.R$* {
|
||||
public static <fields>;
|
||||
@@ -194,6 +195,12 @@
|
||||
<methods>;
|
||||
}
|
||||
|
||||
-keep class com.xxpatx.os.alarm.AlarmClockData { *; }
|
||||
-keepclassmembers class com.xxpatx.os.alarm.AlarmClockData {
|
||||
<fields>;
|
||||
<methods>;
|
||||
}
|
||||
|
||||
#----------------------------- 第三方类库 ------------------------------------------
|
||||
#添加第三方类库的混淆规则
|
||||
#Adjust sdk
|
||||
|
||||
@@ -200,7 +200,7 @@ public class PortAlarmActivity extends BaseMvvmActivity<PortAlarmViewModel, Acti
|
||||
// swipeRefreshLayout.setRefreshing(false);
|
||||
mViewDataBinding.clNodata.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.rvData.setVisibility(View.GONE);
|
||||
Toaster.show("没有数据");
|
||||
// Toaster.show("没有数据");
|
||||
} else {
|
||||
mAlarmAdapter.setAlarmClockData(localAddAlarm);
|
||||
// swipeRefreshLayout.setRefreshing(false);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xxpatx.os.alarm.AlarmClockData;
|
||||
import com.xxpatx.os.base.mvvm.BaseViewModel;
|
||||
@@ -31,7 +32,7 @@ public class PortAlarmViewModel extends BaseViewModel<ActivityAlarmPortBinding,
|
||||
|
||||
}
|
||||
|
||||
private MutableLiveData<List<AlarmClockData>> mAlarmClockData =new MutableLiveData<>();
|
||||
private MutableLiveData<List<AlarmClockData>> mAlarmClockData = new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<List<AlarmClockData>> getAlarmClockData() {
|
||||
return mAlarmClockData;
|
||||
@@ -72,7 +73,12 @@ public class PortAlarmViewModel extends BaseViewModel<ActivityAlarmPortBinding,
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AlarmClockData>> listBaseResponse) {
|
||||
Log.e("getAlarmClock", "onNext: " + listBaseResponse);
|
||||
mAlarmClockData.setValue(listBaseResponse.data);
|
||||
if (listBaseResponse.code == 200) {
|
||||
mAlarmClockData.setValue(listBaseResponse.data);
|
||||
} else {
|
||||
Toaster.showLong(listBaseResponse.msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,6 +53,11 @@ public class EditContactActivity extends BaseMvvmActivity<EditContactViewModel,
|
||||
private String mPictrueFilePath;
|
||||
private Contact mContact;
|
||||
|
||||
@Override
|
||||
public boolean setfitWindow() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_edit_contact;
|
||||
|
||||
@@ -3,21 +3,29 @@ package com.xxpatx.os.activity.emergency;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.adapter.SosNnmberAdapter;
|
||||
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xxpatx.os.bean.BaseResponse;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.ActivityEmergencyBinding;
|
||||
import com.xxpatx.os.manager.AmapManager;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
import com.xxpatx.os.receiver.BootReceiver;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
@@ -28,16 +36,16 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
public class EmergencyActivity extends BaseMvvmActivity<EmergencyViewModel, ActivityEmergencyBinding> {
|
||||
private String TAG = "EmergencyActivity";
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
private SosNnmberAdapter mSosNnmberAdapter;
|
||||
|
||||
private Disposable subscribe;
|
||||
private String TAG = "EmergencyActivity";
|
||||
private boolean needDial = false;
|
||||
private boolean isCalling = false;
|
||||
// private List<Contact> phoneListSet;
|
||||
// private CacheHelper mCacheHelper;
|
||||
private List<Contact> phoneList;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -54,41 +62,21 @@ public class EmergencyActivity extends BaseMvvmActivity<EmergencyViewModel, Acti
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// mCacheHelper = new CacheHelper(this);
|
||||
|
||||
//发送紧急广播
|
||||
Intent bootIntent = new Intent(BootReceiver.SOS);
|
||||
bootIntent.setComponent(new ComponentName("com.xxpatx.sn", "com.xxpatx.sn.receiver.BootReceiver"));
|
||||
sendBroadcast(bootIntent);
|
||||
// Intent bootIntent = new Intent(BootReceiver.SOS);
|
||||
// bootIntent.setComponent(new ComponentName("com.xxpatx.sn", "com.xxpatx.sn.receiver.BootReceiver"));
|
||||
// sendBroadcast(bootIntent);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mViewDataBinding.rvContact.setLayoutManager(linearLayoutManager);
|
||||
mSosNnmberAdapter = new SosNnmberAdapter();
|
||||
mViewDataBinding.rvContact.setAdapter(mSosNnmberAdapter);
|
||||
|
||||
AmapManager.getInstance().startLocation();
|
||||
|
||||
|
||||
Intent intent = getIntent();
|
||||
// String contactList = intent.getStringExtra("contactList");
|
||||
// if (TextUtils.isEmpty(contactList)) {
|
||||
// finish();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// String jsonString = mCacheHelper.getAsString(UrlAddress.GET_MAIL_LIST);
|
||||
// //为 "" 是已经请求成功的
|
||||
// if (jsonString == null) {
|
||||
// return;
|
||||
// }
|
||||
// Gson gson = new Gson();
|
||||
// Type type = new TypeToken<List<Contact>>() {
|
||||
// }.getType();
|
||||
// List<Contact> contactList = gson.fromJson(jsonString, type);
|
||||
// if (contactList == null || contactList.size() == 0) {
|
||||
// return;
|
||||
// }
|
||||
String phone = mMMKV.decodeString(CommonConfig.EMERGENCY_CONTACT_KEY, "");
|
||||
|
||||
// phoneListSet = new ArrayList<String>();
|
||||
// Log.e(TAG, "onCreate: " + phoneListSet);
|
||||
|
||||
final Long time = 3L;
|
||||
subscribe = Observable.interval(1, TimeUnit.SECONDS)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycleSubject(), ActivityEvent.DESTROY))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {
|
||||
@@ -126,19 +114,20 @@ public class EmergencyActivity extends BaseMvvmActivity<EmergencyViewModel, Acti
|
||||
});
|
||||
|
||||
needDial = true;
|
||||
if (TextUtils.isEmpty(phone)) {
|
||||
Toaster.show("没有设置紧急联系人");
|
||||
|
||||
if (phoneList == null || phoneList.isEmpty()) {
|
||||
Toaster.showLong("没有设置紧急联系人");
|
||||
finish();
|
||||
}
|
||||
Intent intent1 = new Intent(Intent.ACTION_CALL);
|
||||
Uri data = Uri.parse("tel:" + phone);
|
||||
intent1.setData(data);
|
||||
startActivity(intent1);
|
||||
isCalling = true;
|
||||
|
||||
// phoneListSet.remove(0);
|
||||
Intent intent = new Intent(Intent.ACTION_CALL);
|
||||
Uri data = Uri.parse("tel:" + phoneList.get(0).getMobile());
|
||||
intent.setData(data);
|
||||
startActivity(intent);
|
||||
phoneList.remove(0);
|
||||
mSosNnmberAdapter.notifyDataSetChanged();
|
||||
isCalling = true;
|
||||
subscribe.dispose();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.ivFinish.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -166,36 +155,68 @@ public class EmergencyActivity extends BaseMvvmActivity<EmergencyViewModel, Acti
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
mViewModel.getContactListData().observe(this, new androidx.lifecycle.Observer<List<Contact>>() {
|
||||
@Override
|
||||
public void onChanged(List<Contact> contacts) {
|
||||
phoneList = contacts;
|
||||
mSosNnmberAdapter.setPhoneNumberList(phoneList);
|
||||
}
|
||||
});
|
||||
mViewModel.getCacheContact();
|
||||
mViewModel.getContact();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Log.e(TAG, "onResume: ");
|
||||
// Log.e(TAG, "onResume: " + phoneListSet);
|
||||
// if (needDial) {
|
||||
// if (phoneListSet == null || phoneListSet.size() == 0) {
|
||||
// return;
|
||||
// }
|
||||
// new Handler().postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Intent intent1 = new Intent(Intent.ACTION_CALL);
|
||||
// String phone = phoneListSet.get(0).getMobile();
|
||||
// Uri data = Uri.parse("tel:" + phone);
|
||||
// intent1.setData(data);
|
||||
// startActivity(intent1);
|
||||
// isCalling = true;
|
||||
// phoneListSet.remove(0);
|
||||
// }
|
||||
// }, 2000);
|
||||
// } else {
|
||||
// if (phoneListSet == null) {
|
||||
// Toaster.show("没有设置紧急联系人");
|
||||
Log.e(TAG, "onStart: ");
|
||||
Log.e(TAG, "onStart: phoneList = " + phoneList);
|
||||
Log.e(TAG, "onStart: needDial = " + needDial);
|
||||
if (needDial) {
|
||||
if (phoneList != null && !phoneList.isEmpty()) {
|
||||
Observable.timer(3, TimeUnit.SECONDS)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycleSubject(), ActivityEvent.DESTROY))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Long>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e(TAG, "timer onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Long aLong) {
|
||||
Log.e(TAG, "timer onNext: " + aLong);
|
||||
Intent intent = new Intent(Intent.ACTION_CALL);
|
||||
String phone = phoneList.get(0).getMobile();
|
||||
isCalling = true;
|
||||
phoneList.remove(0);
|
||||
mSosNnmberAdapter.notifyDataSetChanged();
|
||||
Uri data = Uri.parse("tel:" + phone);
|
||||
intent.setData(data);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e(TAG, "timer onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG, "timer onComplete: ");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Toaster.showLong("已呼叫所有联系人");
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
// if (phoneList == null || phoneList.isEmpty()) {
|
||||
// Toaster.showLong("没有设置紧急联系人");
|
||||
// finish();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,39 @@
|
||||
package com.xxpatx.os.activity.emergency;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xxpatx.os.base.mvvm.BaseViewModel;
|
||||
import com.xxpatx.os.bean.BaseResponse;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.ActivityEmergencyBinding;
|
||||
import com.xxpatx.os.gson.GsonUtils;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
import com.xxpatx.os.network.UrlAddress;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class EmergencyViewModel extends BaseViewModel<ActivityEmergencyBinding, ActivityEvent> {
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public ActivityEmergencyBinding getVDBinding() {
|
||||
return binding;
|
||||
@@ -15,4 +43,79 @@ public class EmergencyViewModel extends BaseViewModel<ActivityEmergencyBinding,
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
private MutableLiveData<List<Contact>> mContactListData = new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<List<Contact>> getContactListData() {
|
||||
return mContactListData;
|
||||
}
|
||||
|
||||
public void getCacheContact() {
|
||||
String jsonString = mMMKV.getString(CommonConfig.EMERGENCY_CONTACT_LIST_KEY, null);
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<Contact>>() {
|
||||
}.getType();
|
||||
if (!TextUtils.isEmpty(jsonString)) {
|
||||
List<Contact> contacts = gson.fromJson(jsonString, type);
|
||||
if (contacts != null) {
|
||||
mContactListData.setValue(contacts);
|
||||
}
|
||||
}
|
||||
getContact();
|
||||
}
|
||||
|
||||
public void getContact() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getContactListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<Contact>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getContactList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<Contact>> listBaseResponse) {
|
||||
Log.e("getContactList", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<Contact> contactList = listBaseResponse.data;
|
||||
if (contactList != null && !contactList.isEmpty()) {
|
||||
List<Contact> emergencyConcacts = contactList.stream().filter(new Predicate<Contact>() {
|
||||
@Override
|
||||
public boolean test(Contact contact) {
|
||||
return contact.getIs_urgent() == 1;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
mMMKV.putString(CommonConfig.EMERGENCY_CONTACT_LIST_KEY, GsonUtils.toJSONString(emergencyConcacts));
|
||||
mContactListData.setValue(emergencyConcacts);
|
||||
}
|
||||
} else {
|
||||
mMMKV.putString(CommonConfig.EMERGENCY_CONTACT_LIST_KEY, "");
|
||||
mContactListData.setValue(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getContactList", "onError: " + e.getMessage());
|
||||
String jsonString = mMMKV.getString(CommonConfig.EMERGENCY_CONTACT_LIST_KEY, null);
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<Contact>>() {
|
||||
}.getType();
|
||||
List<Contact> contacts = gson.fromJson(jsonString, type);
|
||||
if (contacts == null) {
|
||||
mContactListData.setValue(new ArrayList<>());
|
||||
} else {
|
||||
mContactListData.setValue(contacts);
|
||||
}
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getContactList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e(TAG, "onConnected: " + networkType);
|
||||
initAmap();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -215,17 +214,10 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
Log.e(TAG, "onSystemUiVisibilityChange: visibility = " + visibility);
|
||||
if ((visibility) == 0) {
|
||||
// // 导航栏显示中,重新隐藏导航栏
|
||||
new Handler()
|
||||
.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
hideNavigationBar();
|
||||
}
|
||||
}, 3000);
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
|
||||
// 导航栏显示中,重新隐藏导航栏
|
||||
hideNavigationBar();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -447,7 +439,6 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
}
|
||||
Log.e(TAG, "onGranted: 获取权限成功");
|
||||
addData();
|
||||
initAmap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
@@ -77,7 +78,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
||||
}
|
||||
|
||||
private void setStatus() {
|
||||
boolean showFloatWindow = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, false);
|
||||
boolean showFloatWindow = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
||||
Log.e(TAG, "initView: showFloatWindow = " + showFloatWindow);
|
||||
mViewDataBinding.setFloatWindowEnable(showFloatWindow);
|
||||
|
||||
@@ -178,7 +179,7 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
||||
|
||||
public class BtnClick {
|
||||
public void openFloat(View view) {
|
||||
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, false);
|
||||
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
||||
if (floatWindowEnable) {
|
||||
hideFloatingWindow();
|
||||
} else {
|
||||
@@ -230,17 +231,23 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
||||
}
|
||||
|
||||
public void autoAccept(View view) {
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(SettingActivity.this)) {
|
||||
boolean autoAccept = mMMKV.decodeBool(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, true);
|
||||
Log.e(TAG, "autoAccept: autoAccept = " + autoAccept);
|
||||
mViewDataBinding.setAutoAccept(!autoAccept);
|
||||
mMMKV.encode(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, !autoAccept);
|
||||
Intent intent = new Intent(WeAccessibilityService.SETTING_AUTOMATIC_ANSWER_ACTION);
|
||||
intent.putExtra("auto_answer", !autoAccept);
|
||||
boolean floatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
||||
if (floatWindowEnable) {
|
||||
Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗");
|
||||
} else {
|
||||
Toast.makeText(SettingActivity.this, "请在无障碍服务中打开 - 关爱守护快捷服务", Toast.LENGTH_LONG).show();
|
||||
startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(SettingActivity.this)) {
|
||||
boolean autoAccept = mMMKV.decodeBool(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, true);
|
||||
Log.e(TAG, "autoAccept: autoAccept = " + autoAccept);
|
||||
mViewDataBinding.setAutoAccept(!autoAccept);
|
||||
mMMKV.encode(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, !autoAccept);
|
||||
Intent intent = new Intent(WeAccessibilityService.SETTING_AUTOMATIC_ANSWER_ACTION);
|
||||
intent.putExtra("auto_answer", !autoAccept);
|
||||
} else {
|
||||
Toast.makeText(SettingActivity.this, "请在无障碍服务中打开 - 关爱守护快捷服务", Toast.LENGTH_LONG).show();
|
||||
startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setDialTone(View view) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.xxpatx.os.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.ViewHolder> {
|
||||
public class SosNnmberAdapter extends RecyclerView.Adapter<SosNnmberAdapter.ViewHolder> {
|
||||
private List<Contact> phoneNumberList;
|
||||
private Context mContext;
|
||||
|
||||
@@ -26,25 +26,18 @@ public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.View
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new SOSNnmberAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_sosnumber, parent, false));
|
||||
return new SosNnmberAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_sosnumber, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
Contact contact = phoneNumberList.get(position);
|
||||
holder.tv_name.setText(contact.getName());
|
||||
holder.tv_number.setText(contact.getMobile());
|
||||
holder.root.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||
intent.putExtra("setting_sos", contact.getMobile());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,15 +46,14 @@ public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.View
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tv_number;
|
||||
TextView tv_dial;
|
||||
ConstraintLayout root;
|
||||
TextView tv_name,tv_number;
|
||||
|
||||
ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_number = itemView.findViewById(R.id.tv_number);
|
||||
tv_dial = itemView.findViewById(R.id.tv_dial);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
tv_number = itemView.findViewById(R.id.tv_number);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.callwechat.CallWechatActivity;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.utils.AccessibilityUtils;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class WechatContactAdapter extends RecyclerView.Adapter<WechatContactAdap
|
||||
Contact contact = mContactList.get(position);
|
||||
contactHolder.tv_name.setText(contact.getName());
|
||||
contactHolder.tv_phone.setText(contact.getMobile());
|
||||
// Glide.with(contactHolder.iv_head).load(contact.getAvatar()).error(R.drawable.default_avatar).into(contactHolder.iv_head);
|
||||
Glide.with(contactHolder.iv_head).load(contact.getAvatar()).error(R.drawable.default_avatar).into(contactHolder.iv_head);
|
||||
switch (position % 6) {
|
||||
case 0:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround1));
|
||||
@@ -86,13 +87,18 @@ public class WechatContactAdapter extends RecyclerView.Adapter<WechatContactAdap
|
||||
contactHolder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(mContext)) {
|
||||
Intent intent = new Intent(mContext, CallWechatActivity.class);
|
||||
intent.putExtra("WechatInfo", contact);
|
||||
if ("未设置".equals(contact.getName())) {
|
||||
Intent intent = new Intent(mContext, AddWechatContactActivity.class);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
Toast.makeText(mContext, "请在无障碍服务中打开 - 关爱守护快捷服务", Toast.LENGTH_LONG).show();
|
||||
mContext.startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(mContext)) {
|
||||
Intent intent = new Intent(mContext, CallWechatActivity.class);
|
||||
intent.putExtra("WechatInfo", contact);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
Toast.makeText(mContext, "请在无障碍服务中打开 - 关爱守护快捷服务", Toast.LENGTH_LONG).show();
|
||||
mContext.startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,6 +22,10 @@ public class Contact implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
public Contact(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Contact(String name, String mobile, boolean sim) {
|
||||
this.name = name;
|
||||
this.mobile = mobile;
|
||||
|
||||
@@ -71,6 +71,7 @@ public class CommonConfig {
|
||||
public static final String SETTING_CALL_TYPE_KEY = "setting_call_type_key";
|
||||
public static final String SETTING_AUTOMATIC_ANSWER_KEY = "setting_automatic_answer_key";
|
||||
|
||||
public static final String EMERGENCY_CONTACT_LIST_KEY = "emergency_contact_phone_list";
|
||||
public static final String EMERGENCY_CONTACT_KEY = "emergency_contact_phone";
|
||||
public static final String FAMILY_ADDRESS_KEY = "Family_Address";
|
||||
|
||||
|
||||
@@ -195,11 +195,17 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
|
||||
@Override
|
||||
public void onChanged(List<Contact> contacts) {
|
||||
if (contacts == null || contacts.size() == 0) {
|
||||
mViewDataBinding.clNodata.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.rvContact.setVisibility(View.GONE);
|
||||
contacts .add(new Contact("未设置"));
|
||||
contacts .add(new Contact("未设置"));
|
||||
contacts .add(new Contact("未设置"));
|
||||
contacts .add(new Contact("未设置"));
|
||||
contacts .add(new Contact("未设置"));
|
||||
contacts .add(new Contact("未设置"));
|
||||
// mViewDataBinding.clNodata.setVisibility(View.VISIBLE);
|
||||
// mViewDataBinding.rvContact.setVisibility(View.GONE);
|
||||
} else {
|
||||
mViewDataBinding.clNodata.setVisibility(View.GONE);
|
||||
mViewDataBinding.rvContact.setVisibility(View.VISIBLE);
|
||||
// mViewDataBinding.clNodata.setVisibility(View.GONE);
|
||||
// mViewDataBinding.rvContact.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mContactAdapter.setContactList(contacts);
|
||||
}
|
||||
|
||||
@@ -181,6 +181,7 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
}
|
||||
|
||||
public void getAddress(View view) {
|
||||
Toaster.show("正在更新定位信息");
|
||||
AmapManager.getInstance().startLocation();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ public class PushManager {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private static final String JIGUANG_ALARM_CLOCK = "57";
|
||||
private static final String ALARM_CLOCK = "57";
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
case JIGUANG_ALARM_CLOCK:
|
||||
case ALARM_CLOCK:
|
||||
Toaster.debugShow("收到推送消息: 设置闹钟");
|
||||
Intent intent = new Intent(SET_ALARMCLOCK);
|
||||
mContext.sendBroadcast(intent);
|
||||
|
||||
@@ -330,7 +330,7 @@ public class WeAccessibilityService extends AccessibilityService {
|
||||
if (node != null) {
|
||||
Point point = getPointtByNode(node);
|
||||
Log.e(TAG, "stepAnswer: " + point);
|
||||
clickByNode(point.x, point.y + 50);
|
||||
clickByNode(point.x, point.y - 50);
|
||||
// clickNode(node);
|
||||
Log.e(TAG, "stepAnswer: mCurrentStep " + mCurrentStep + " done");
|
||||
mCurrentStep = Step.WAITING;
|
||||
|
||||
@@ -130,7 +130,7 @@ public class MainService extends BaseRxService
|
||||
// ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
// ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
|
||||
mFloatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, false);
|
||||
mFloatWindowEnable = mMMKV.decodeBool(CommonConfig.FLOAT_WINDOW, true);
|
||||
mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||
showPopupWindow();
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_activation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/edit_background"
|
||||
@@ -331,15 +331,16 @@
|
||||
<EditText
|
||||
android:id="@+id/et_activation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@null"
|
||||
android:hint="请输入标题"
|
||||
android:padding="4dp"
|
||||
android:maxLength="13"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColorHint="@color/radio_botton_gray"
|
||||
android:textSize="16sp"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -418,14 +419,14 @@
|
||||
android:id="@+id/tv_add"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:onClick="@{click::submit}"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="center"
|
||||
android:text="添加闹钟"
|
||||
android:background="@drawable/tv_add_alarm_background"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click::submit}"
|
||||
android:text="添加闹钟"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="192dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:text="紧急呼叫功能已开启"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="34sp"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
@@ -30,7 +30,7 @@
|
||||
android:id="@+id/tv_countdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="64dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="倒计时(3)秒"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
@@ -39,6 +39,28 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView12" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="将自动呼叫以下号码"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_countdown" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_contact"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/iv_finish"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_finish"
|
||||
android:layout_width="96dp"
|
||||
|
||||
@@ -7,27 +7,37 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_number"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.4"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:minEms="4"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="拨号" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minEms="11"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_name"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="21321331" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dial"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:text="拨号"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_number"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_number" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user