diff --git a/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java b/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java index 6392c304..65cd04b8 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java +++ b/app/src/main/java/com/idormy/sms/forwarder/SettingActivity.java @@ -55,6 +55,9 @@ public class SettingActivity extends AppCompatActivity { @SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_sms_template = findViewById(R.id.switch_sms_template); switchSmsTemplate(switch_sms_template); + @SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_enable_phone = findViewById(R.id.switch_enable_phone); + switchEnablePhone(switch_enable_phone); + EditText textSmsTemplate = findViewById(R.id.text_sms_template); editSmsTemplate(textSmsTemplate); } @@ -69,6 +72,16 @@ public class SettingActivity extends AppCompatActivity { }); } + //设置转发来电 + private void switchEnablePhone(@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_enable_phone) { + switch_enable_phone.setChecked(SettingUtil.getSwitchEnablePhone()); + + switch_enable_phone.setOnCheckedChangeListener((buttonView, isChecked) -> { + SettingUtil.switchEnablePhone(isChecked); + Log.d(TAG, "onCheckedChanged:" + isChecked); + }); + } + //设置转发附加信息deviceMark private void editAddExtraDeviceMark(final EditText et_add_extra_device_mark) { et_add_extra_device_mark.setText(SettingUtil.getAddExtraDeviceMark()); diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml index 744fc981..9e21e2c3 100644 --- a/app/src/main/res/layout/activity_setting.xml +++ b/app/src/main/res/layout/activity_setting.xml @@ -334,6 +334,7 @@ tools:ignore="RelativeOverlap" />