version:1.5.2

fix:
update:增加通话白名单,整点报时选项
This commit is contained in:
2025-03-19 17:30:48 +08:00
parent 4275dbfff0
commit dc2db5b8f2
42 changed files with 2412 additions and 136 deletions

View File

@@ -154,15 +154,23 @@
android:name=".activity.setting.SettingActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".activity.setting.TimeActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".activity.sim.SimCardActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".activity.phone.WhiteListActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".activity.contact.ContactListActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".activity.dock.DockActivity"
android:launchMode="singleTask"
@@ -225,13 +233,13 @@
<activity
android:name=".activity.FlashlightActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".activity.NetworkActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".activity.selectnumber.SelectNumberActivity"
android:launchMode="singleTask"
@@ -254,8 +262,8 @@
<activity
android:name=".activity.contact.AddContactActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".activity.callwechat.CallWechatActivity"
android:launchMode="singleTask"

View File

@@ -0,0 +1,25 @@
package com.zkwl.system.apiservice.contact;
import java.util.List;
interface IZkwlContactManager {
void addBlockedContactNumber(String phoneNumber);
void deleteBlockedContactNumber(String phoneNumber);
void deleteAllBlockedContactNumbers();
List<String> getAllBlockedContactNumbers();
void addWhitelistContactNumber(String phoneNumber);
void deleteWhitelistContactNumber(String phoneNumber);
void deleteAllWhitelistContactNumbers();
List<String> getAllWhitelistContactNumbers();
void hangUpPhone();
}

View File

@@ -22,7 +22,6 @@ import android.os.Bundle;
import android.provider.CallLog;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.speech.tts.TextToSpeech;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -65,6 +64,7 @@ import com.xxpatx.os.bean.AppInfo;
import com.xxpatx.os.bean.DesktopIcon;
import com.xxpatx.os.bean.DockApp;
import com.xxpatx.os.bean.MapBean;
import com.xxpatx.os.bean.SystemSettings;
import com.xxpatx.os.bean.TestAppInfo;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.databinding.ActivityMainBinding;
@@ -74,6 +74,7 @@ import com.xxpatx.os.fragment.home.HomeFragment;
import com.xxpatx.os.fragment.settings.SettingsFragment;
import com.xxpatx.os.manager.AmapManager;
import com.xxpatx.os.manager.DesktopIconManager;
import com.xxpatx.os.manager.SpeechManager;
import com.xxpatx.os.service.NotificationService;
import com.xxpatx.os.utils.ApkUtils;
import com.xxpatx.os.utils.AppUsedTimeUtils;
@@ -92,7 +93,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import me.jessyan.autosize.AutoSizeCompat;
import me.jessyan.autosize.AutoSizeConfig;
@@ -100,7 +100,7 @@ import me.jessyan.autosize.AutoSizeConfig;
import static com.arialyy.aria.core.inf.IEntity.STATE_RUNNING;
public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBinding> implements NetworkUtils.OnNetworkStatusChangedListener,
NotificationService.NotificationListener, TextToSpeech.OnInitListener {
NotificationService.NotificationListener {
private static final String TAG = "MainActivity";
@@ -690,6 +690,16 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
});
mViewModel.getTestApp();
mViewModel.mSystemSettingsData.observe(this, new Observer<SystemSettings>() {
@Override
public void onChanged(SystemSettings systemSettings) {
if (systemSettings.getPhone_white_list() == 1) {
mViewModel.getContact();
}
}
});
mViewModel.getSetting();
registReceiver();
initAmap();
}
@@ -1266,11 +1276,10 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
boolean voiceBroadcast = mMMKV.decodeBool(CommonConfig.VOICE_BROADCAST, false);
Log.e(TAG, "onReceive: voiceBroadcast = " + voiceBroadcast);
if (voiceBroadcast) {
mTextToSpeech = new TextToSpeech(MainActivity.this, MainActivity.this);
if (TextUtils.isEmpty(number)) {
mPhoneInfo = "未知号码来电";
SpeechManager.getInstance().speak("未知号码来电");
} else {
mPhoneInfo = "来自" + getContactName(number) + number + "的电话";
SpeechManager.getInstance().speak("来自" + getContactName(number) + number + "的电话");
}
}
}
@@ -1278,35 +1287,6 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
}
}
private TextToSpeech mTextToSpeech;
private String mPhoneInfo;
@Override
public void onInit(int status) {
//初始化成功
if (status == TextToSpeech.SUCCESS) {
Log.e(TAG, "init success");
//设置语言
int result = mTextToSpeech.setLanguage(Locale.CHINA);
if (result != TextToSpeech.LANG_COUNTRY_AVAILABLE
&& result != TextToSpeech.LANG_AVAILABLE) {
} else {
//设置音调
mTextToSpeech.setPitch(1.0f);
//设置语速1.0为正常语速
mTextToSpeech.setSpeechRate(1.0f);
//播放
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(mPhoneInfo);
mTextToSpeech.speak(stringBuilder.toString(), TextToSpeech.QUEUE_ADD, null);
}
} else {
Log.e(TAG, "init fail");
Toaster.showLong("TTS初始化失败");
}
}
private void setTime() {
LiveEventBus
.get("time")
@@ -1345,25 +1325,32 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
return Settings.Secure.getInt(getContentResolver(), "flashlight_enabled", 0) == 1;
}
private void speak(String text) {
SpeechManager.getInstance().speakApp("正在打开 " + text);
}
public class BtnClick {
public void dialer(View view) {
// startActivity(new Intent(Intent.ACTION_DIAL));
startActivity(new Intent(MainActivity.this, PhoneActivity.class));
speak("拨号");
}
public void wechat(View v) {
// ApkUtils.openPackage(MainActivity.this, "com.android.mms");
ApkUtils.openPackage(MainActivity.this, "com.tencent.mm");
speak("微信");
}
public void toTiktok(View v) {
// ApkUtils.openPackage(MainActivity.this, "com.mediatek.camera");
ApkUtils.openPackage(MainActivity.this, "com.ss.android.ugc.aweme");
speak("抖音");
}
public void toCamera(View v) {
ApkUtils.openPackage(MainActivity.this, "com.mediatek.camera");
speak("相机");
}
public void toCalendar(View v) {

View File

@@ -31,12 +31,14 @@ import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.bean.Contact;
import com.xxpatx.os.bean.DesktopIcon;
import com.xxpatx.os.bean.SnInfo;
import com.xxpatx.os.bean.SystemSettings;
import com.xxpatx.os.bean.TestAppInfo;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.databinding.ActivityMainBinding;
import com.xxpatx.os.db.ContactCacheUtils;
import com.xxpatx.os.gson.GsonUtils;
import com.xxpatx.os.manager.AppManager;
import com.xxpatx.os.manager.ContactManager;
import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.service.main.MainService;
import com.xxpatx.os.utils.ActivationUtil;
@@ -452,4 +454,77 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
});
}
public MutableLiveData<SystemSettings> mSystemSettingsData = new MutableLiveData<>();
public void getSetting() {
NetInterfaceManager.getInstance().getSettingControl()
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getSetting", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<SystemSettings> baseResponse) {
Log.e("getSetting", "onNext: " + baseResponse);
if (baseResponse.code == 200) {
SystemSettings systemSettings = baseResponse.data;
mSystemSettingsData.setValue(systemSettings);
mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, systemSettings.getHour_notify());
mMMKV.encode(CommonConfig.VOICE_SPEAKER_KEY, systemSettings.getVoice_speaker());
mMMKV.encode(CommonConfig.PHONE_WHITE_LIST, systemSettings.getPhone_white_list());
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getSetting", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("getSetting", "onComplete: ");
}
});
}
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("getContact", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<List<Contact>> listBaseResponse) {
Log.e("getContact", "onNext: " + listBaseResponse);
if (listBaseResponse.code == 200) {
int phone_white_list = mMMKV.decodeInt(CommonConfig.PHONE_WHITE_LIST, 0);
if (phone_white_list == 1) {
ContactManager.getInstance().deleteAllWhitelist();
List<Contact> contactList = listBaseResponse.data;
for (Contact contact : contactList) {
if (TextUtils.isEmpty(contact.getMobile())) continue;
ContactManager.getInstance().addWhiteList(contact.getMobile());
}
}
} else {
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getContact", "onError: ");
}
@Override
public void onComplete() {
Log.e("getContact", "onComplete: ");
}
});
}
}

View File

@@ -0,0 +1,80 @@
package com.xxpatx.os.activity.phone;
import android.content.Context;
import android.telecom.TelecomManager;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.tencent.mmkv.MMKV;
import com.xxpatx.os.R;
import com.xxpatx.os.adapter.WhiteListAdapter;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.databinding.ActivityWhiteListBinding;
import com.xxpatx.os.manager.ContactManager;
public class WhiteListActivity extends BaseMvvmActivity<WhiteListViewModel, ActivityWhiteListBinding> {
private static final String TAG = "WhiteListActivity";
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
private WhiteListAdapter mWhiteListAdapter;
private TelecomManager mTelecomManager;
@Override
protected int getLayoutId() {
return R.layout.activity_white_list;
}
@Override
protected void initDataBinding() {
mViewModel.setCtx(this);
mViewModel.setVDBinding(mViewDataBinding);
mViewModel.setLifecycle(getLifecycleSubject());
mViewDataBinding.setClick(new BtnClick());
}
@Override
protected void initView() {
mWhiteListAdapter = new WhiteListAdapter();
mWhiteListAdapter.setListChangeListener(new WhiteListAdapter.ListChangeListener() {
@Override
public void onChanged() {
mWhiteListAdapter.setPhoneList(ContactManager.getInstance().getWhiteListData());
}
});
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mViewDataBinding.recyclerView.setLayoutManager(linearLayoutManager);
mViewDataBinding.recyclerView.setAdapter(mWhiteListAdapter);
int phone_white_list = mMMKV.decodeInt(CommonConfig.PHONE_WHITE_LIST, 0);
mViewDataBinding.setWhiteList(phone_white_list == 1);
}
@Override
protected void initData() {
mTelecomManager = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
mWhiteListAdapter.setPhoneList(ContactManager.getInstance().getWhiteListData());
}
@Override
protected void onResume() {
super.onResume();
}
public class BtnClick {
public void exit(View view) {
finish();
}
public void openWhiteList(View view) {
// int phone_white_list = mMMKV.decodeInt(CommonConfig.PHONE_WHITE_LIST, 0);
}
}
}

View File

@@ -0,0 +1,18 @@
package com.xxpatx.os.activity.phone;
import com.trello.rxlifecycle4.android.ActivityEvent;
import com.xxpatx.os.base.mvvm.BaseViewModel;
import com.xxpatx.os.databinding.ActivityWhiteListBinding;
public class WhiteListViewModel extends BaseViewModel<ActivityWhiteListBinding, ActivityEvent> {
@Override
public ActivityWhiteListBinding getVDBinding() {
return binding;
}
@Override
public void onDestroy() {
}
}

View File

@@ -22,6 +22,7 @@ import com.tencent.mmkv.MMKV;
import com.xxpatx.os.BuildConfig;
import com.xxpatx.os.R;
import com.xxpatx.os.activity.dock.DockActivity;
import com.xxpatx.os.activity.phone.WhiteListActivity;
import com.xxpatx.os.activity.sim.SimCardActivity;
import com.xxpatx.os.activity.tts.TtsActivity;
import com.xxpatx.os.activity.update.UpdateActivity;
@@ -30,7 +31,6 @@ import com.xxpatx.os.bean.AppInfo;
import com.xxpatx.os.bean.SystemSettings;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.databinding.ActivitySettingBinding;
import com.xxpatx.os.dialog.CustomDialog;
import com.xxpatx.os.service.WeAccessibilityService;
import com.xxpatx.os.service.main.MainService;
import com.xxpatx.os.utils.AccessibilityUtils;
@@ -127,14 +127,18 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
Log.e(TAG, "initView: dialTone = " + dialTone);
mViewDataBinding.setDialTone(dialTone);
int code = Settings.System.getInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, 0);
int code = Settings.System.getInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, 1);
boolean statusBar = code == 1;
Log.e(TAG, "setStatusBar: statusBar = " + statusBar);
mViewDataBinding.setStatusBar(statusBar);
boolean hourly_time = mMMKV.decodeBool(CommonConfig.HOURLY_TIME_SIGNAL_KEY, false);
boolean hourly_time = mMMKV.decodeInt(CommonConfig.HOURLY_TIME_SIGNAL_KEY, 0) == 1;
Log.e(TAG, "setHourlyTimeSignal: hourly_time = " + hourly_time);
mViewDataBinding.setHourlyTime(hourly_time);
boolean voiceSpeaker = mMMKV.decodeInt(CommonConfig.VOICE_SPEAKER_KEY, 0) == 1;
Log.e(TAG, "appSpeak: voiceSpeaker = " + voiceSpeaker);
mViewDataBinding.setVoiceSpeaker(voiceSpeaker);
}
private static final int REQUEST_CODE_DRAW_OVER_OTHER_APPS_PERMISSION = 200;
@@ -292,6 +296,13 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
}
}
public void appSpeak(View view) {
boolean voiceSpeaker = mMMKV.decodeInt(CommonConfig.VOICE_SPEAKER_KEY, 0) == 1;
Log.e(TAG, "appSpeak: voiceSpeaker = " + voiceSpeaker);
mViewDataBinding.setVoiceSpeaker(!voiceSpeaker);
mMMKV.encode(CommonConfig.VOICE_SPEAKER_KEY, voiceSpeaker ? 0 : 1);
}
public void setDialTone(View view) {
boolean dialTone = mMMKV.decodeBool(CommonConfig.DISABLE_DIAL_TONE_MODIFY, true);
Log.e(TAG, "setDialTone: dialTone = " + dialTone);
@@ -300,36 +311,37 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
}
public void setHourlyTimeSignal(View view) {
boolean hourly_time = mMMKV.decodeBool(CommonConfig.HOURLY_TIME_SIGNAL_KEY, false);
Log.e(TAG, "setHourlyTimeSignal: hourly_time = " + hourly_time);
if (!hourly_time) {
CustomDialog customDialog = new CustomDialog(SettingActivity.this);
customDialog.setTitle("温馨提示")
.setMessage("整点报时时间为7点至21点")
.setOnClickBottomListener(new CustomDialog.OnClickBottomListener() {
@Override
public void onPositiveClick() {
mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, true);
mViewDataBinding.setHourlyTime(true);
Intent intent = new Intent(MainService.XXOS_ACTION_TIME_CHANGED);
sendBroadcast(intent);
customDialog.dismiss();
}
@Override
public void onNegtiveClick() {
customDialog.dismiss();
}
});
customDialog.show();
} else {
mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, false);
mViewDataBinding.setHourlyTime(false);
}
startActivity(new Intent(SettingActivity.this, TimeActivity.class));
// boolean hourly_time = mMMKV.decodeBool(CommonConfig.HOURLY_TIME_SIGNAL_KEY, false);
// Log.e(TAG, "setHourlyTimeSignal: hourly_time = " + hourly_time);
// if (!hourly_time) {
// CustomDialog customDialog = new CustomDialog(SettingActivity.this);
// customDialog.setTitle("温馨提示")
// .setMessage("整点报时时间为7点至21点")
// .setOnClickBottomListener(new CustomDialog.OnClickBottomListener() {
// @Override
// public void onPositiveClick() {
// mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, true);
// mViewDataBinding.setHourlyTime(true);
// Intent intent = new Intent(MainService.XXOS_ACTION_TIME_CHANGED);
// sendBroadcast(intent);
// customDialog.dismiss();
// }
//
// @Override
// public void onNegtiveClick() {
// customDialog.dismiss();
// }
// });
// customDialog.show();
// } else {
// mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, false);
// mViewDataBinding.setHourlyTime(false);
// }
}
public void setStatusBar(View view) {
boolean statusBar = Settings.System.getInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, 0) == 1;
boolean statusBar = Settings.System.getInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, 1) == 1;
String statusbarStatus;
if (statusBar) {
statusbarStatus = CommonConfig.ACTION_HIDE_STATUS_BAR;
@@ -345,6 +357,10 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
Settings.System.putInt(getContentResolver(), CommonConfig.ACTION_STATUS_BAR_STATE, statusBar ? 0 : 1);
}
public void setBlacklist(View view) {
startActivity(new Intent(SettingActivity.this, WhiteListActivity.class));
}
public void setSimCard(View view) {
startActivity(new Intent(SettingActivity.this, SimCardActivity.class));
}

View File

@@ -77,6 +77,7 @@ public class SettingViewModel extends BaseViewModel<ActivitySettingBinding, Acti
Log.e("getSystemSettings", "onNext: " + systemSettingsBaseResponse);
if (systemSettingsBaseResponse.code == 200) {
SystemSettings systemSettings = systemSettingsBaseResponse.data;
mSystemSettingsData.setValue(systemSettings);
}
}

View File

@@ -0,0 +1,132 @@
package com.xxpatx.os.activity.setting;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.Switch;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tencent.mmkv.MMKV;
import com.xxpatx.os.R;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.databinding.ActivityTimeBinding;
import com.xxpatx.os.gson.GsonUtils;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
public class TimeActivity extends BaseMvvmActivity<TimeViewModel, ActivityTimeBinding> {
private static final String TAG = "TimeActivity";
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
private List<Integer> mTimeList;
@Override
protected int getLayoutId() {
return R.layout.activity_time;
}
@Override
protected void initDataBinding() {
mViewModel.setCtx(this);
mViewModel.setVDBinding(mViewDataBinding);
mViewModel.setLifecycle(getLifecycleSubject());
mViewDataBinding.setClick(new BtnClick());
}
@Override
protected void initView() {
String timeString = mMMKV.decodeString(CommonConfig.TIME_HOUR_LIST_KEY);
if (TextUtils.isEmpty(timeString)) {
mTimeList = new ArrayList<>();
} else {
Gson gson = new Gson();
Type type = new TypeToken<List<Integer>>() {
}.getType();
try {
mTimeList = gson.fromJson(timeString, type);
} catch (Exception e) {
Log.e(TAG, "getLocalContact: " + e.getMessage());
mMMKV.remove(CommonConfig.TIME_HOUR_LIST_KEY);
mTimeList = new ArrayList<>();
}
}
mTimeList.forEach(new Consumer<Integer>() {
@Override
public void accept(Integer integer) {
Log.e(TAG, "accept: " + integer);
int layoutID = getResources().getIdentifier("sw_time_" + integer, "id", getPackageName());
Switch aSwitch = getWindow().findViewById(layoutID);
if (aSwitch != null) {
aSwitch.setChecked(true);
}
}
});
boolean hourly_time = mMMKV.decodeInt(CommonConfig.HOURLY_TIME_SIGNAL_KEY, 0) == 1;
mViewDataBinding.swTimeHour.setChecked(hourly_time);
mViewDataBinding.swTimeHour.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, b ? 1 : 0);
}
});
mViewDataBinding.swTime0.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 0));
mViewDataBinding.swTime1.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 1));
mViewDataBinding.swTime2.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 2));
mViewDataBinding.swTime3.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 3));
mViewDataBinding.swTime4.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 4));
mViewDataBinding.swTime5.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 5));
mViewDataBinding.swTime6.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 6));
mViewDataBinding.swTime7.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 7));
mViewDataBinding.swTime8.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 8));
mViewDataBinding.swTime9.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 9));
mViewDataBinding.swTime10.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 10));
mViewDataBinding.swTime11.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 11));
mViewDataBinding.swTime12.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 12));
mViewDataBinding.swTime13.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 13));
mViewDataBinding.swTime14.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 14));
mViewDataBinding.swTime15.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 15));
mViewDataBinding.swTime16.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 16));
mViewDataBinding.swTime17.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 17));
mViewDataBinding.swTime18.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 18));
mViewDataBinding.swTime19.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 19));
mViewDataBinding.swTime20.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 20));
mViewDataBinding.swTime21.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 21));
mViewDataBinding.swTime22.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 22));
mViewDataBinding.swTime23.setOnCheckedChangeListener((compoundButton, b) -> setTime(b, 23));
}
@Override
protected void initData() {
}
private void setTime(boolean open, Integer integer) {
if (mTimeList == null) {
mTimeList = new ArrayList<>();
}
if (open) {
mTimeList.add(integer);
} else {
mTimeList.remove(integer);
}
Log.e(TAG, "setTime: " + GsonUtils.toJSONString(mTimeList));
mMMKV.encode(CommonConfig.TIME_HOUR_LIST_KEY, GsonUtils.toJSONString(mTimeList));
}
public class BtnClick {
public void exit(View view) {
finish();
}
}
}

View File

@@ -0,0 +1,18 @@
package com.xxpatx.os.activity.setting;
import com.trello.rxlifecycle4.android.ActivityEvent;
import com.xxpatx.os.base.mvvm.BaseViewModel;
import com.xxpatx.os.databinding.ActivityTimeBinding;
public class TimeViewModel extends BaseViewModel<ActivityTimeBinding, ActivityEvent> {
@Override
public ActivityTimeBinding getVDBinding() {
return binding;
}
@Override
public void onDestroy() {
}
}

View File

@@ -3,17 +3,14 @@ package com.xxpatx.os.activity.tts;
import android.content.Intent;
import android.speech.tts.TextToSpeech;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import com.hjq.toast.Toaster;
import com.xxpatx.os.R;
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
import com.xxpatx.os.databinding.ActivityTtsBinding;
import com.xxpatx.os.manager.SpeechManager;
import java.util.Locale;
public class TtsActivity extends BaseMvvmActivity<TtsViewModel, ActivityTtsBinding> implements TextToSpeech.OnInitListener {
public class TtsActivity extends BaseMvvmActivity<TtsViewModel, ActivityTtsBinding> {
private static final String TAG = "TtsActivity";
@@ -47,40 +44,13 @@ public class TtsActivity extends BaseMvvmActivity<TtsViewModel, ActivityTtsBindi
if (TextUtils.isEmpty(mBody)) {
finish();
} else {
mTextToSpeech = new TextToSpeech(this, this);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("收到来自").append(mSender).append("的短信").append(mBody);
SpeechManager.getInstance().speak(stringBuilder.toString());
mViewDataBinding.setBody(mBody);
}
}
@Override
public void onInit(int status) {
//初始化成功
if (status == TextToSpeech.SUCCESS) {
Log.e(TAG, "init success");
//设置语言
int result = mTextToSpeech.setLanguage(Locale.CHINA);
if (result != TextToSpeech.LANG_COUNTRY_AVAILABLE
&& result != TextToSpeech.LANG_AVAILABLE) {
Toaster.showLong("TTS暂不支持这种语音的朗读");
finish();
} else {
//设置音调
mTextToSpeech.setPitch(1.0f);
//设置语速1.0为正常语速
mTextToSpeech.setSpeechRate(1.0f);
//播放
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("收到来自").append(mSender).append("的短信").append(mBody);
mTextToSpeech.speak(stringBuilder.toString(), TextToSpeech.QUEUE_ADD, null);
}
} else {
Log.e(TAG, "init fail");
Toaster.showLong("TTS初始化失败");
finish();
}
}
@Override
protected void onDestroy() {
super.onDestroy();

View File

@@ -17,6 +17,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.xxpatx.os.R;
import com.xxpatx.os.activity.phone.PhoneActivity;
import com.xxpatx.os.bean.DockApp;
import com.xxpatx.os.manager.SpeechManager;
import com.xxpatx.os.service.NotificationService;
import com.xxpatx.os.utils.ApkUtils;
@@ -91,10 +92,12 @@ public class DockAppGridAdapter extends BaseAdapter {
public void onClick(View view) {
switch (pkg) {
case "xxpatx.os.dialer":
speak("电话");
mContext.startActivity(new Intent(mContext, PhoneActivity.class));
break;
default:
ApkUtils.openPackage(mContext, pkg, dockApp.getClassName());
speak(dockApp.getAppName());
}
}
});
@@ -135,6 +138,10 @@ public class DockAppGridAdapter extends BaseAdapter {
return result;
}
private void speak(String text) {
SpeechManager.getInstance().speakApp("正在打开 " + text);
}
static class ViewHolder {
ConstraintLayout root;
ImageView iv_icon;

View File

@@ -0,0 +1,80 @@
package com.xxpatx.os.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.tencent.mmkv.MMKV;
import com.xxpatx.os.R;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.manager.ContactManager;
import java.util.List;
public class WhiteListAdapter extends RecyclerView.Adapter<WhiteListAdapter.Holder> {
private static final String TAG = "WhiteListAdapter";
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
private Context mContext;
private List<String> mPhoneList;
public void setPhoneList(List<String> phoneList) {
mPhoneList = phoneList;
Log.e(TAG, "setPhoneList: " + mPhoneList);
notifyDataSetChanged();
}
public void setListChangeListener(ListChangeListener listChangeListener) {
mListChangeListener = listChangeListener;
}
private ListChangeListener mListChangeListener;
public interface ListChangeListener {
public void onChanged();
}
@NonNull
@Override
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
mContext = parent.getContext();
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_black_list, parent, false));
}
@Override
public void onBindViewHolder(@NonNull Holder holder, int position) {
String phone = mPhoneList.get(position);
holder.tv_number.setText(phone);
holder.tv_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//移除黑名单
ContactManager.getInstance().deleteWhitelist(phone);
mListChangeListener.onChanged();
}
});
}
@Override
public int getItemCount() {
return mPhoneList == null ? 0 : mPhoneList.size();
}
public class Holder extends RecyclerView.ViewHolder {
TextView tv_number, tv_delete;
public Holder(@NonNull View itemView) {
super(itemView);
tv_number = itemView.findViewById(R.id.tv_number);
tv_delete = itemView.findViewById(R.id.tv_delete);
}
}
}

View File

@@ -24,7 +24,9 @@ import com.xxpatx.os.manager.AmapManager;
import com.xxpatx.os.manager.AppManager;
import com.xxpatx.os.manager.AppStatusManager;
import com.xxpatx.os.manager.ConnectManager;
import com.xxpatx.os.manager.ContactManager;
import com.xxpatx.os.manager.DesktopIconManager;
import com.xxpatx.os.manager.SpeechManager;
import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.push.PushManager;
import com.xxpatx.os.service.main.MainService;
@@ -47,6 +49,7 @@ public class BaseApplication extends Application {
// 初始化 Toast 框架
Toaster.init(this);
SpeechManager.init(this);
CrashReport.initCrashReport(getApplicationContext(), "09fec11058", false);
CrashReport.setDeviceModel(getApplicationContext(), Build.MODEL);
@@ -82,6 +85,7 @@ public class BaseApplication extends Application {
WechatContactManager.init(this);
ContactCacheUtils.init(this);
DesktopIconManager.init(this);
ContactManager.init(this);
}
private void aliyunPushInit() {

View File

@@ -0,0 +1,17 @@
package com.xxpatx.os.bean;
import java.io.Serializable;
public class ClockSetting implements Serializable {
private static final long serialVersionUID = 6468022565585720520L;
String clock;
public String getClock() {
return clock;
}
public void setClock(String clock) {
this.clock = clock;
}
}

View File

@@ -22,9 +22,9 @@ public class DockApp implements Serializable {
this.className = className;
}
public DockApp(String packageName, String className) {
public DockApp(String packageName, String appName) {
this.packageName = packageName;
this.className = className;
this.appName = appName;
}
public DockApp(String packageName) {
@@ -67,7 +67,7 @@ public class DockApp implements Serializable {
DockApp d = (DockApp) obj;
return
// Objects.equals(appName, d.appName);&&
Objects.equals(packageName, d.packageName);
Objects.equals(packageName, d.packageName);
// && Objects.equals(className, d.className);
} else {
return false;

View File

@@ -70,7 +70,12 @@ public class SystemSettings implements Serializable {
int exit_ctrl;
int connect_page_ctrl;
int connect_edit_ctrl;
int contact_desktop;
int desktop_location;
int hour_notify;
int wechat_auto_accept;
int voice_speaker;
int phone_white_list;
public int getQch_restore() {
return qch_restore;
@@ -545,6 +550,46 @@ public class SystemSettings implements Serializable {
this.desktop_location = desktop_location;
}
public int getContact_desktop() {
return contact_desktop;
}
public void setContact_desktop(int contact_desktop) {
this.contact_desktop = contact_desktop;
}
public int getHour_notify() {
return hour_notify;
}
public void setHour_notify(int hour_notify) {
this.hour_notify = hour_notify;
}
public int getWechat_auto_accept() {
return wechat_auto_accept;
}
public void setWechat_auto_accept(int wechat_auto_accept) {
this.wechat_auto_accept = wechat_auto_accept;
}
public int getVoice_speaker() {
return voice_speaker;
}
public void setVoice_speaker(int voice_speaker) {
this.voice_speaker = voice_speaker;
}
public int getPhone_white_list() {
return phone_white_list;
}
public void setPhone_white_list(int phone_white_list) {
this.phone_white_list = phone_white_list;
}
@Override
public String toString() {
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();

View File

@@ -3,6 +3,10 @@ package com.xxpatx.os.config;
public class CommonConfig {
public static final String MMKV_ID = "InterProcessKV";
public static final String ACTION_ADD_BLOCKED_CONTACT_NUMBER = "action.com.zkwl.addBlockedContactNumber";
public static final String ACTION_DELETE_BLOCKED_CONTACT_NUMBER = "action.com.zkwl.deleteBlockedContactNumber";
public static final String TEMP_PHONE_BLACK_LIST_KEY = "temp_phone_black_list";
/*保存的应用版本号*/
public final static String APP_VERSION_CODE = "APP_VERSION_CODE";
@@ -101,6 +105,10 @@ public class CommonConfig {
public static final String VOICE_BROADCAST = "voice_broadcast_key";
/*微信语音自动接听*/
public static final String WECHAT_CALL_AUTO_ACCEPT = "wechat_call_auto_accept";
/*app启动播报*/
public static final String VOICE_SPEAKER_KEY = "voice_speaker";
/*电话白名单*/
public static final String PHONE_WHITE_LIST = "phone_white_list";
/*本地设置的*/
/*悬浮窗*/
@@ -142,5 +150,5 @@ public class CommonConfig {
public static final String AMAP_LOCATION_MAP_BEAN = "AMapLocation_MapBean_key";
public static final String AMAP_LOCATION_DISTRICT = "AMapLocationMapBean_key";
public static final String TIME_HOUR_LIST_KEY = "time_hour_list";
}

View File

@@ -9,7 +9,7 @@ public class ContactCacheHelper extends SQLiteOpenHelper {
public static final int DATABASE_VERSION = 1;
public static final String DATABASE_NAME = "ContactDatabase.db";
public static final String TABLE_ALARM = "ContactTable";
public static final String TABLE_Contact = "ContactTable";
public static final String KEY_ID = "id";
public static final String KEY_NAME = "name";
@@ -19,7 +19,7 @@ public class ContactCacheHelper extends SQLiteOpenHelper {
public static final String KEY_TAG = "tag";
private static final String CREATE_CONTACT_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_ALARM +
private static final String CREATE_CONTACT_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_Contact +
"("
+ KEY_ID + " INTEGER,"
+ KEY_NAME + " TEXT,"

View File

@@ -76,7 +76,7 @@ public class ContactCacheUtils {
long id = 0;
mDatabase.beginTransaction();
try {
id = mDatabase.insertWithOnConflict(ContactCacheHelper.TABLE_ALARM, null, values, SQLiteDatabase.CONFLICT_REPLACE);
id = mDatabase.insertWithOnConflict(ContactCacheHelper.TABLE_Contact, null, values, SQLiteDatabase.CONFLICT_REPLACE);
mDatabase.setTransactionSuccessful();
} catch (Exception e) {
Log.e(TAG, "addContact: " + e.getMessage());
@@ -100,7 +100,7 @@ public class ContactCacheUtils {
mDatabase.beginTransaction();
try {
for (ContentValues v : contentValuesList) {
mDatabase.insertWithOnConflict(ContactCacheHelper.TABLE_ALARM, null, v, SQLiteDatabase.CONFLICT_REPLACE);
mDatabase.insertWithOnConflict(ContactCacheHelper.TABLE_Contact, null, v, SQLiteDatabase.CONFLICT_REPLACE);
}
mDatabase.setTransactionSuccessful();
} catch (Exception e) {
@@ -127,7 +127,7 @@ public class ContactCacheUtils {
long id = 0;
mDatabase.beginTransaction();
try {
id = mDatabase.delete(ContactCacheHelper.TABLE_ALARM, " id =" + rowId, null);
id = mDatabase.delete(ContactCacheHelper.TABLE_Contact, " id =" + rowId, null);
mDatabase.setTransactionSuccessful();
} catch (Exception e) {
Log.e(TAG, "deleteContact: " + e.getMessage());
@@ -145,7 +145,7 @@ public class ContactCacheUtils {
*/
public List<Contact> getDatabaseContact() {
List<Contact> list = new ArrayList<>();
String selectQuery = "SELECT * FROM " + ContactCacheHelper.TABLE_ALARM;
String selectQuery = "SELECT * FROM " + ContactCacheHelper.TABLE_Contact;
Cursor cursor = mDatabase.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {

View File

@@ -39,6 +39,7 @@ import com.xxpatx.os.dialog.DailyAppDialog;
import com.xxpatx.os.dialog.ShortcutDialog;
import com.xxpatx.os.manager.AppManager;
import com.xxpatx.os.manager.AppStatusManager;
import com.xxpatx.os.manager.SpeechManager;
import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.service.NotificationService;
import com.xxpatx.os.shortcut.ShortcutPkgInfo;
@@ -239,6 +240,7 @@ public class AppListFragment extends BaseFragment {
DesktopIcon desktopIcon = mDesktopIcons.get(index);
if (desktopIcon != null) {
Log.e(TAG, "onItemClick: " + desktopIcon.getPackage());
speak(desktopIcon.getTitle());
if (desktopIcon instanceof ShortcutPkgInfo) {
try {
ActivityOptions activityOptions = ActivityOptions.makeClipRevealAnimation(v, v.getScrollX(), v.getScrollY(), v.getMeasuredWidth(), v.getMeasuredHeight());
@@ -482,4 +484,8 @@ public class AppListFragment extends BaseFragment {
// outState.putParcelableArrayList("applicationInfos", mDesktopIcons);
// super.onSaveInstanceState(outState);
}
private void speak(String text) {
SpeechManager.getInstance().speakApp("正在打开 " + text);
}
}

View File

@@ -38,6 +38,7 @@ import com.xxpatx.os.bean.MapBean;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.databinding.FragmentHomeBinding;
import com.xxpatx.os.dialog.SingleDialog;
import com.xxpatx.os.manager.SpeechManager;
import com.xxpatx.os.push.PushManager;
import com.xxpatx.os.utils.ApkUtils;
import com.xxpatx.os.utils.DayUtils;
@@ -63,8 +64,8 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
// private HomeAppAdapter mHomeAppAdapter;
// private NotificationAdapter notificationAdapter;
private CameraManager cameraManager;
private boolean flashing = false;
private CameraManager mCameraManager;
private boolean mFlashing = false;
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
@@ -141,7 +142,7 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
mViewModel.setVDBinding(mViewDataBinding);
mViewModel.setLifecycle(getLifecycleSubject());
mViewDataBinding.setClick(new BtnClick());
cameraManager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE);
mCameraManager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE);
}
@Override
@@ -452,24 +453,32 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
}
}
private void speak(String text) {
SpeechManager.getInstance().speakApp("正在打开 " + text);
}
public class BtnClick {
public void toSn(View view) {
if (!ApkUtils.openPackage(mContext, "com.xxpatx.sn")) {
Toaster.show("打开失败,请检查应用是否安装");
}
speak("设备绑定");
}
public void addContact(View view) {
startActivity(new Intent(mContext, AddContactActivity.class));
speak("新建亲友");
}
public void openWifi(View view) {
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
speak("WiFi设置");
}
public void openNetwork(View view) {
// startActivity(new Intent(Settings.ACTION_DATA_USAGE_SETTINGS));
startActivity(new Intent(mContext, NetworkActivity.class));
speak("流量设置");
}
public void openFlash(View view) {
@@ -484,14 +493,17 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
// Log.e(TAG, "openFlash: " + e.getMessage());
// Toaster.show("打开手电筒失败");
// }
speak("手电筒");
}
public void openCalendar(View view) {
ApkUtils.openApp(mContext, "com.honghui.huangli");
speak("万年历");
}
public void toWeather(View view) {
startActivity(new Intent(mContext, WeatherActivity.class));
speak("天气");
}
public void openSettings(View view) {

View File

@@ -34,6 +34,7 @@ import com.xxpatx.os.bean.SystemSettings;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.databinding.FragmentSettingsBinding;
import com.xxpatx.os.manager.AmapManager;
import com.xxpatx.os.manager.SpeechManager;
import com.xxpatx.os.utils.ApkUtils;
import com.xxpatx.os.utils.DayUtils;
import com.xxpatx.os.utils.TimeUtils;
@@ -260,6 +261,7 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
filter.addAction(CommonConfig.UIUIAIOS_UPDATE_DESKTOP_LOCATION);
mContext.registerReceiver(mDesktopLocationReceiver, filter);
}
private DesktopLocationReceiver mDesktopLocationReceiver;
class DesktopLocationReceiver extends BroadcastReceiver {
@@ -282,6 +284,9 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
}
}
private void speak(String text) {
SpeechManager.getInstance().speakApp("正在打开 " + text);
}
public class BtnClick {
public void openCalendar(View view) {
@@ -294,14 +299,17 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
public void openSettings(View view) {
startActivity(new Intent(mContext, SettingActivity.class));
speak("辅助功能");
}
public void toVideoplayer(View view) {
ApkUtils.openPackage(mContext, "com.xxpatx.jtxc", "com.xxpatx.jtxc.activity.main.MainActivity");
speak("家庭控件");
}
public void openAlarmClock(View view) {
startActivity(new Intent(mContext, AlarmListActivity.class));
speak("爱心闹钟");
}
public void openEmergency(View view) {
@@ -311,20 +319,24 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
} else {
startActivity(new Intent(mContext, EmergencyActivity.class));
}
speak("紧急呼叫");
}
public void toAppstore(View view) {
if (!ApkUtils.openPackage(mContext, "com.xxpatx.store")) {
Toaster.show("打开失败,请检查应用是否安装");
}
speak("应用市场");
}
public void dailyApp(View view) {
startActivity(new Intent(getCtx(), DailyAppActivity.class));
speak("更多应用");
}
public void getAddress(View view) {
Toaster.show("正在更新定位信息");
speak("正在更新定位信息");
AmapManager.getInstance().startLocation();
}

View File

@@ -0,0 +1,126 @@
package com.xxpatx.os.manager;
import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import com.xxpatx.os.config.CommonConfig;
import com.zkwl.system.apiservice.contact.IZkwlContactManager;
import java.util.ArrayList;
import java.util.List;
public class ContactManager {
private static final String TAG = "ContactManager";
@SuppressLint("StaticFieldLeak")
private static ContactManager sInstance;
private Context mContext;
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
private IZkwlContactManager mZkwlContactManager;
private ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(TAG, "onServiceConnected");
mZkwlContactManager = IZkwlContactManager.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.d(TAG, "onServiceDisconnected");
mZkwlContactManager = null;
}
};
private ContactManager(Context context) {
if (context == null) {
throw new RuntimeException("Context is NULL");
}
this.mContext = context.getApplicationContext();
bindService();
}
public static void init(Context context) {
if (sInstance == null) {
Log.e(TAG, "init: ");
sInstance = new ContactManager(context);
}
}
public static ContactManager getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You must be init ContactManager first");
}
return sInstance;
}
private void bindService() {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.zkwl.system.apiservice", "com.zkwl.system.apiservice.ZkwlContactManagerService"));
mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
}
public List<String> getWhiteListData() {
if (mZkwlContactManager == null) {
Toaster.show("服务未连接");
bindService();
} else {
try {
return mZkwlContactManager.getAllWhitelistContactNumbers();
} catch (RemoteException e) {
e.printStackTrace();
}
}
return new ArrayList<>();
}
public void addWhiteList(String phone) {
if (mZkwlContactManager == null) {
Toaster.show("服务未连接");
bindService();
} else {
try {
mZkwlContactManager.addWhitelistContactNumber(phone);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
public void deleteWhitelist(String phone) {
if (mZkwlContactManager == null) {
Toaster.show("服务未连接");
bindService();
} else {
try {
mZkwlContactManager.deleteWhitelistContactNumber(phone);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
public void deleteAllWhitelist() {
if (mZkwlContactManager == null) {
Toaster.show("服务未连接");
bindService();
} else {
try {
mZkwlContactManager.deleteAllWhitelistContactNumbers();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -48,10 +48,10 @@ public class DesktopIconManager {
public List<DockApp> getDefaultDockApp() {
List<DockApp> dockApps = new ArrayList<>();
dockApps.add(new DockApp("xxpatx.os.dialer"));
dockApps.add(new DockApp("com.tencent.mm"));
dockApps.add(new DockApp("com.ss.android.ugc.aweme"));
dockApps.add(new DockApp(getDefaultCameraPackageName()));
dockApps.add(new DockApp("xxpatx.os.dialer", "电话"));
dockApps.add(new DockApp("com.tencent.mm", "微信"));
dockApps.add(new DockApp("com.ss.android.ugc.aweme", "抖音"));
dockApps.add(new DockApp(getDefaultCameraPackageName(), "相机"));
return dockApps;
}

View File

@@ -0,0 +1,102 @@
package com.xxpatx.os.manager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.speech.tts.TextToSpeech;
import android.text.TextUtils;
import android.util.Log;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import com.xxpatx.os.config.CommonConfig;
import java.util.Locale;
public class SpeechManager implements TextToSpeech.OnInitListener {
private static final String TAG = "SpeechManager";
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
@SuppressLint("StaticFieldLeak")
private static SpeechManager sInstance;
private Context mContext;
private TextToSpeech mTextToSpeech;
private boolean mInitSuccess = false;
private SpeechManager(Context context) {
if (context == null) {
throw new RuntimeException("Context is NULL");
}
this.mContext = context.getApplicationContext();
this.mTextToSpeech = new TextToSpeech(mContext, this);
}
public static void init(Context context) {
if (sInstance == null) {
Log.e(TAG, "init: ");
sInstance = new SpeechManager(context);
}
}
public static SpeechManager getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You must be init SpeechManager first");
}
return sInstance;
}
@Override
public void onInit(int status) {
//初始化成功
if (status == TextToSpeech.SUCCESS) {
mInitSuccess = true;
Log.e(TAG, "init success");
//设置语言
int result = mTextToSpeech.setLanguage(Locale.CHINA);
if (result != TextToSpeech.LANG_COUNTRY_AVAILABLE
&& result != TextToSpeech.LANG_AVAILABLE) {
} else {
//设置音调
mTextToSpeech.setPitch(1.0f);
//设置语速1.0为正常语速
mTextToSpeech.setSpeechRate(1.0f);
}
} else {
mInitSuccess = false;
Log.e(TAG, "init fail");
Toaster.showLong("TTS初始化失败");
}
}
public void speak(String text) {
if (mTextToSpeech == null) {
this.mTextToSpeech = new TextToSpeech(mContext, this);
Log.e(TAG, "speak: TextToSpeech is null");
Toaster.show("文字转语音引擎初始化失败");
return;
}
if (!mInitSuccess) {
this.mTextToSpeech = new TextToSpeech(mContext, this);
Log.e(TAG, "speak: TextToSpeech init failed");
Toaster.show("文字转语音引擎初始化失败");
return;
}
if (TextUtils.isEmpty(text)) {
Log.e(TAG, "speak: text is empty");
return;
}
mTextToSpeech.speak(text, TextToSpeech.QUEUE_ADD, null);
}
public void speakApp(String text) {
boolean voice_speaker = mMMKV.decodeBool(CommonConfig.VOICE_SPEAKER_KEY, false);
Log.e(TAG, "speakApp: " + voice_speaker);
if (voice_speaker) {
speak(text);
}
}
}

View File

@@ -3,6 +3,7 @@ package com.xxpatx.os.network;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
@@ -21,6 +22,7 @@ import com.xxpatx.os.bean.AlarmClockId;
import com.xxpatx.os.bean.AppInfo;
import com.xxpatx.os.bean.ArticleList;
import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.bean.ClockSetting;
import com.xxpatx.os.bean.Contact;
import com.xxpatx.os.bean.DemandBean;
import com.xxpatx.os.bean.ExpressData;
@@ -45,6 +47,7 @@ import com.xxpatx.os.disklrucache.CacheHelper;
import com.xxpatx.os.gson.GsonUtils;
import com.xxpatx.os.manager.ConnectManager;
import com.xxpatx.os.manager.ConnectMode;
import com.xxpatx.os.manager.ContactManager;
import com.xxpatx.os.network.api.qweather.LookupApi;
import com.xxpatx.os.network.api.uiui.ActivityListApi;
import com.xxpatx.os.network.api.uiui.AddressIndexApi;
@@ -85,6 +88,7 @@ import com.xxpatx.os.network.api.uiui.order.OrderIndexApi;
import com.xxpatx.os.network.api.uiui.pay.GoodsBuyApi;
import com.xxpatx.os.network.api.uiui.pay.OrderPayApi;
import com.xxpatx.os.network.api.uiui.pay.OrderPayCheckApi;
import com.xxpatx.os.network.api.uiui.sn.ClockSettingApi;
import com.xxpatx.os.network.api.uiui.sn.FamilyAddressApi;
import com.xxpatx.os.network.api.uiui.sn.SendScreenshotApi;
import com.xxpatx.os.network.api.uiui.sn.SettingApi;
@@ -427,6 +431,14 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse<ClockSetting>> getClockSettingObservable() {
return mRetrofit.create(ClockSettingApi.class)
.getClockSetting(Utils.getSerial())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
/*
*闹钟相关
*/
@@ -1168,6 +1180,8 @@ public class NetInterfaceManager {
mMMKV.encode("is_shopping", systemSettings.getIs_shopping());
mMMKV.encode("is_info", systemSettings.getIs_info());
String s = systemSettings.getSetting_sos();
mMMKV.encode(CommonConfig.PHONE_WHITE_LIST, systemSettings.getPhone_white_list());
} else {
mCacheHelper.put(UrlAddress.GET_SETTINGS, "");
if (callback != null) callback.setContact(null);
@@ -1242,6 +1256,16 @@ public class NetInterfaceManager {
ContactsUtils.saveContactPhone(mContext, contactList);
List<Contact> emergencyConcacts = contactList.stream().filter(contact -> contact.getIs_urgent() == 1).collect(Collectors.toList());
mMMKV.putString(CommonConfig.EMERGENCY_CONTACT_LIST_KEY, GsonUtils.toJSONString(emergencyConcacts));
int phone_white_list = mMMKV.decodeInt(CommonConfig.PHONE_WHITE_LIST, 0);
if (phone_white_list == 1) {
ContactManager.getInstance().deleteAllWhitelist();
for (Contact contact : contactList) {
if (TextUtils.isEmpty(contact.getMobile())) continue;
ContactManager.getInstance().addWhiteList(contact.getMobile());
}
}
if (callback != null) {
callback.setContact(contactList);
}
@@ -1264,7 +1288,6 @@ public class NetInterfaceManager {
Log.e("getContactList", "onComplete: ");
if (callback != null) callback.onComplete();
}
};
}

View File

@@ -70,6 +70,9 @@ public class UrlAddress {
/*编号查询联系人*/
public static final String MAIL_LIST_BY_ID = "MailList/mailListById";
/*整点报时设置*/
public static final String CLOCK_SETTING = "sn/clock-setting";
/**
* 应用统计
*/

View File

@@ -0,0 +1,16 @@
package com.xxpatx.os.network.api.uiui.sn;
import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.bean.ClockSetting;
import com.xxpatx.os.network.UrlAddress;
import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface ClockSettingApi {
@GET(UrlAddress.CLOCK_SETTING)
Observable<BaseResponse<ClockSetting>> getClockSetting(
@Query("sn") String sn
);
}

View File

@@ -49,6 +49,9 @@ public class WeAccessibilityService extends AccessibilityService {
private static final String CALL_TEXT = "语音通话";
private static final String RECEIVE_DESCRIPTION = "接听";
private static final String HANDS_FREE_TEXT = "扬声器已关";
private static final String DIALER_HANDS_FREE_TEXT = "免提";
private static final String DIALER_HANDS_FREE_CLOSE_TEXT = "免提,已关闭";
public static final int TYPE_VOICE = 0;
public static final int TYPE_VIDEO = 1;
@@ -138,6 +141,10 @@ public class WeAccessibilityService extends AccessibilityService {
Log.e(TAG, "_onAccessibilityEvent: " + mCurrentStep);
switch (mCurrentStep) {
case WAITING:
if (!TextUtils.isEmpty(event.getPackageName()) && "com.android.dialer".equals(event.getPackageName())) {
Log.e(TAG, "_onAccessibilityEvent: to dialer hands free");
mCurrentStep = Step.DIALER_HANDS_FREE;
}
break;
default:
if (!TextUtils.isEmpty(event.getClassName())) {
@@ -158,12 +165,22 @@ public class WeAccessibilityService extends AccessibilityService {
return;
}
if (stepAnswer(Property.DESCRIPTION, RECEIVE_DESCRIPTION)) {
mCurrentStep = Step.WAITING;
mCurrentStep = Step.WECHAT_HANDS_FREE;
Toast.makeText(this, "已自动接听视频/语音", Toast.LENGTH_LONG).show();
} else {
// clickAnswer();
}
break;
case WECHAT_HANDS_FREE:
handsFree(Property.DESCRIPTION, HANDS_FREE_TEXT);
break;
case DIALER_HANDS_FREE:
if (findHandsFree(Property.DESCRIPTION, DIALER_HANDS_FREE_CLOSE_TEXT)) {
dialerHandsFree(Property.TEXT, DIALER_HANDS_FREE_TEXT);
} else {
mCurrentStep = Step.WAITING;
}
break;
case CLICK_HOME://主页能找到直接点击进去更多
stepHome(Property.TEXT, mName);
break;
@@ -524,6 +541,51 @@ public class WeAccessibilityService extends AccessibilityService {
}
}
private boolean dialerHandsFree(Property type, String text) {
AccessibilityNodeInfo node = findNode(getWindows(), type, text);
if (node != null) {
Rect rect = new Rect();
node.getBoundsInScreen(rect);
Log.e(TAG, "dialerHandsFree: rect = " + rect);
clickNode(node);
Log.e(TAG, "dialerHandsFree: mCurrentStep: " + mCurrentStep + " done");
mCurrentStep = Step.WAITING;
Log.e(TAG, "dialerHandsFree: next: " + mCurrentStep);
return true;
} else {
return false;
}
}
private boolean findHandsFree(Property type, String text) {
AccessibilityNodeInfo node = findNode(getWindows(), type, text);
if (node != null) {
Log.e(TAG, "findHandsFree: true");
return true;
} else {
Log.e(TAG, "findHandsFree: false");
return false;
}
}
private boolean handsFree(Property type, String text) {
AccessibilityNodeInfo node = findNode(getWindows(), type, text);
if (node != null) {
Point point = getPointtByNode(node);
Log.e(TAG, "handsFree: " + point);
clickByPoint(point.x, point.y - 50);
clickByPoint(point.x, point.y);
// clickNode(node);
Log.e(TAG, "handsFree: mCurrentStep " + mCurrentStep + " done");
mCurrentStep = Step.WAITING;
Log.e(TAG, "handsFree: next " + mCurrentStep);
return true;
} else {
Log.e(TAG, "handsFree: not found");
return false;
}
}
//根据节点信息可获得对应的xy坐标
static Point getPointtByNode(AccessibilityNodeInfo node) {
if (node == null) {
@@ -609,6 +671,8 @@ public class WeAccessibilityService extends AccessibilityService {
private enum Step {
WAITING,
WECHAT_HANDS_FREE,
DIALER_HANDS_FREE,
CLICK_HOME,
CLICK_QUICK_WECHAT_CALL,
CLICK_TARGET,

View File

@@ -13,6 +13,10 @@ public class MainSContact {
void editAlarmClock();
void updateAlarmClock();
void deleteAlarmClock();
void getClockSetting();
void getContact();
}
public interface MainSView extends BaseView {
@@ -21,5 +25,9 @@ public class MainSContact {
void editAlarmClockFinish();
void updateAlarmClockFinish();
void deleteAlarmClockFinish();
void getClockSettingFinish();
void getContactFinish();
}
}

View File

@@ -12,12 +12,17 @@ import com.xxpatx.os.alarm.AlarmClockData;
import com.xxpatx.os.alarm.AlarmUtils;
import com.xxpatx.os.bean.AlarmClockId;
import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.bean.ClockSetting;
import com.xxpatx.os.bean.Contact;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.gson.GsonUtils;
import com.xxpatx.os.manager.ContactManager;
import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.utils.Utils;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -292,6 +297,86 @@ public class MainSPresenter implements MainSContact.Presenter {
}
}
@Override
public void getClockSetting() {
NetInterfaceManager.getInstance().getClockSettingObservable()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(new Observer<BaseResponse<ClockSetting>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getClockSetting", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<ClockSetting> baseResponse) {
Log.e("getClockSetting", "onNext: " + baseResponse);
if (baseResponse.code == 200) {
ClockSetting clockSetting = baseResponse.data;
String time = clockSetting.getClock();
List<Integer> integers = new ArrayList<>();
List<String> timeLsit = new ArrayList<>(Arrays.asList(time.split(",")));
for (String s : timeLsit) {
integers.add(Integer.parseInt(s));
}
mMMKV.encode(CommonConfig.TIME_HOUR_LIST_KEY, GsonUtils.toJSONString(integers));
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getClockSetting", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("getClockSetting", "onComplete: ");
}
});
}
@Override
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("getContact", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<List<Contact>> listBaseResponse) {
Log.e("getContact", "onNext: " + listBaseResponse);
if (listBaseResponse.code == 200) {
int phone_white_list = mMMKV.decodeInt(CommonConfig.PHONE_WHITE_LIST, 0);
if (phone_white_list == 1) {
ContactManager.getInstance().deleteAllWhitelist();
List<Contact> contactList = listBaseResponse.data;
for (Contact contact : contactList) {
if (TextUtils.isEmpty(contact.getMobile())) continue;
ContactManager.getInstance().addWhiteList(contact.getMobile());
}
} else {
ContactManager.getInstance().deleteAllWhitelist();
}
} else {
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getContact", "onError: ");
}
@Override
public void onComplete() {
Log.e("getContact", "onComplete: ");
}
});
}
/**
* 创建被观察者集合
*

View File

@@ -42,6 +42,7 @@ import com.xxpatx.os.base.rx.BaseRxService;
import com.xxpatx.os.bean.AppInfo;
import com.xxpatx.os.bean.BaseResponse;
import com.xxpatx.os.config.CommonConfig;
import com.xxpatx.os.manager.ContactManager;
import com.xxpatx.os.network.NetInterfaceManager;
import com.xxpatx.os.receiver.SmsReceiver;
import com.xxpatx.os.utils.ApkUtils;
@@ -55,6 +56,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.HashSet;
@@ -98,6 +100,8 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
private static final String XXOS_ACTION_TIME_TICK = "xxos_time_tick";
public static final String XXOS_ACTION_TIME_CHANGED = "xxos_time_changed";
private List<Integer> mTimeList;
public MainService() {
}
@@ -111,6 +115,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
public void onConnected(NetworkUtils.NetworkType networkType) {
if (isScreenOn()) {
mPresenter.addAlarmClock();
mPresenter.getClockSetting();
}
}
@@ -254,7 +259,22 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
@Override
public void onNext(@NonNull Integer hour) {
Log.e("mTimeSignalCallback", "onNext: " + hour);
if (hour > 6 && hour < 22) {
String timeString = mMMKV.decodeString(CommonConfig.TIME_HOUR_LIST_KEY);
if (TextUtils.isEmpty(timeString)) {
mTimeList = new ArrayList<>();
} else {
Gson gson = new Gson();
Type type = new TypeToken<List<Integer>>() {
}.getType();
try {
mTimeList = gson.fromJson(timeString, type);
} catch (Exception e) {
Log.e(TAG, "getLocalContact: " + e.getMessage());
mMMKV.remove(CommonConfig.TIME_HOUR_LIST_KEY);
mTimeList = new ArrayList<>();
}
}
if (mTimeList.indexOf(hour) != -1) {
mSoundPool.play(soundMap.get(hour), 1, 1, 0, 0, 1);
} else {
/*10点到86点不报时*/
@@ -272,6 +292,14 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
Log.e("mTimeSignalCallback", "onComplete: ");
}
});
mPresenter.getClockSetting();
int phone_white_list = mMMKV.decodeInt(CommonConfig.PHONE_WHITE_LIST, 0);
if (phone_white_list == 1) {
mPresenter.getContact();
} else {
ContactManager.getInstance().deleteAllWhitelist();
}
}
private void setAlarmTime() {
@@ -333,6 +361,16 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
mPresenter.getAlarmClock();
}
@Override
public void getClockSettingFinish() {
}
@Override
public void getContactFinish() {
}
@Override
public void onDestroy() {
super.onDestroy();
@@ -486,7 +524,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
private TimeSignalCallback mTimeSignalCallback;
private void hourlyTimeSignal() {
boolean hourly_time = mMMKV.decodeBool(CommonConfig.HOURLY_TIME_SIGNAL_KEY, false);
boolean hourly_time = mMMKV.decodeInt(CommonConfig.HOURLY_TIME_SIGNAL_KEY, 0) == 1;
if (hourly_time) {
Calendar cal = Calendar.getInstance();
int hour = cal.get(Calendar.HOUR_OF_DAY);
@@ -502,7 +540,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
}
private void alarmWakeup() {
boolean hourly_time = mMMKV.decodeBool(CommonConfig.HOURLY_TIME_SIGNAL_KEY, false);
boolean hourly_time = mMMKV.decodeInt(CommonConfig.HOURLY_TIME_SIGNAL_KEY, 0) == 1;
if (hourly_time) {
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
@@ -521,6 +559,9 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
IntentFilter filter = new IntentFilter();
filter.addAction(HOURLY_TIME_SIGNAL_KEY);
filter.addAction(WECHAT_AUTO_ACCEPT);
filter.addAction(VOICE_SPEAKER_KEY);
filter.addAction(PHONE_WHITE_LIST);
filter.addAction(HOURLY_TIME_SLOT_KEY);
registerReceiver(mTimeSignalReceiver, filter);
}
@@ -528,6 +569,9 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
private static final String HOURLY_TIME_SIGNAL_KEY = "hourly_time_signal";
private static final String WECHAT_AUTO_ACCEPT = "wechat_auto_accept";
private static final String VOICE_SPEAKER_KEY = "voice_speaker";
private static final String PHONE_WHITE_LIST = "phone_white_list";
private static final String HOURLY_TIME_SLOT_KEY = "HOURLY_TIME_SLOT";
private class TimeSignalReceiver extends BroadcastReceiver {
@@ -543,13 +587,31 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
case HOURLY_TIME_SIGNAL_KEY:
int hour_notify = intent.getIntExtra("hour_notify", 0);
Log.e("TimeSignalReceiver", "onReceive: hour_notify = " + hour_notify);
mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, hour_notify == 1);
mMMKV.encode(CommonConfig.HOURLY_TIME_SIGNAL_KEY, hour_notify);
break;
case WECHAT_AUTO_ACCEPT:
int wechat_auto_accept = intent.getIntExtra("wechat_auto_accept", 0);
Log.e("TimeSignalReceiver", "onReceive: wechat_auto_accept = " + wechat_auto_accept);
mMMKV.encode(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, wechat_auto_accept == 1);
break;
case VOICE_SPEAKER_KEY:
int voice_speaker = intent.getIntExtra("voice_speaker", 0);
Log.e("TimeSignalReceiver", "onReceive: voice_speaker = " + voice_speaker);
mMMKV.encode(CommonConfig.VOICE_SPEAKER_KEY, voice_speaker == 1);
break;
case PHONE_WHITE_LIST:
int phone_white_list = intent.getIntExtra("phone_white_list", 0);
Log.e("TimeSignalReceiver", "onReceive: phone_white_list = " + phone_white_list);
mMMKV.encode(CommonConfig.PHONE_WHITE_LIST, phone_white_list);
if (phone_white_list == 1) {
mPresenter.getContact();
} else {
ContactManager.getInstance().deleteAllWhitelist();
}
break;
case HOURLY_TIME_SLOT_KEY:
mPresenter.getClockSetting();
break;
default:
}

View File

@@ -66,7 +66,7 @@ public class Utils {
Log.e("e", "读取设备序列号异常:" + e.toString());
}
if (BuildConfig.DEBUG) {
// return "TYZ185P5250101467";
// return "TYZ185P5250100275";
}
return serial;
}

View File

@@ -288,6 +288,56 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:onClick="@{click::setBlacklist}">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="电话白名单设置"
android:textColor="@color/black"
android:textSize="22sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:maxLines="1"
android:text="未开启"
android:textColor="@color/setting_disable_color"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/icon_more"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="60dp"

View File

@@ -37,6 +37,10 @@
<variable
name="hourly_time"
type="Boolean" />
<variable
name="voiceSpeaker"
type="Boolean" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@@ -332,6 +336,95 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:onClick="@{click::appSpeak}">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="应用启动播报"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:maxLines="1"
android:text='@{voiceSpeaker?"已开启":"未开启"}'
android:textColor="@{voiceSpeaker?@color/setting_enable_color:@color/setting_disable_color}"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="未开启" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:onClick="@{click::setBlacklist}">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="电话白名单设置"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:maxLines="1"
android:text="未开启"
android:textColor="@color/setting_disable_color"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/icon_more"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="80dp"

View File

@@ -18,7 +18,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="64dp"
android:background="@drawable/general_setting_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@@ -0,0 +1,923 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.setting.TimeActivity">
<data>
<variable
name="click"
type="com.xxpatx.os.activity.setting.TimeActivity.BtnClick" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@drawable/general_setting_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_cancel"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="8dp"
android:adjustViewBounds="true"
android:onClick="@{click::exit}"
android:scaleType="centerInside"
android:src="@drawable/add_contact_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="整点报时"
android:textColor="@color/white"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_confirm"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:src="@drawable/icon_confirm"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout3">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout11"
android:layout_width="match_parent"
android:layout_height="64dp"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="整点报时"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout11">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="0点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="1点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="2点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="3点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="4点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="5点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="6点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="7点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="8点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="9点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="10点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="11点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="12点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="13点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="14点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="15点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="16点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="17点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="18点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="19点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="20点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="21点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="22点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<TextView
android:id="@+id/tv_time_23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="23点"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/sw_time_23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.phone.WhiteListActivity">
<data>
<variable
name="click"
type="com.xxpatx.os.activity.phone.WhiteListActivity.BtnClick" />
<variable
name="whiteList"
type="Boolean" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@drawable/general_setting_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_cancel"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="8dp"
android:adjustViewBounds="true"
android:onClick="@{click::exit}"
android:scaleType="centerInside"
android:src="@drawable/add_contact_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="电话白名单设置"
android:textColor="@color/white"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_confirm"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:src="@drawable/icon_confirm"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout13"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/white"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:text="白名单开关"
android:textColor="@color/black"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:maxLines="1"
android:onClick="@{click::openWhiteList}"
android:text='@{whiteList?"已开启":"未开启"}'
android:textColor="@{whiteList?@color/setting_enable_color:@color/setting_disable_color}"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="未开启" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout13">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:text="以下号码为白名单列表,添加的联系人会默认加入白名单"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout15" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@drawable/phone_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2">
<TextView
android:id="@+id/tv_number"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingStart="8dp"
android:textColor="@color/black"
android:textSize="22sp"
app:layout_constraintEnd_toStartOf="@+id/tv_delete"
app:layout_constraintStart_toStartOf="parent"
tools:text="1234567890" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="删除"
android:textSize="20sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@color/gray"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -6,4 +6,4 @@
android:canRetrieveWindowContent="true"
android:description="@string/accessibility_service_description"
android:notificationTimeout="100"
android:packageNames="com.tencent.mm" />
android:packageNames="com.tencent.mm,com.android.dialer" />