设置窗口添加“电量通知TTS语音播放选项”。

This commit is contained in:
2026-02-28 20:17:15 +08:00
parent 4b196acfce
commit bc730dffc8
4 changed files with 61 additions and 56 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Wed Feb 04 11:07:22 HKT 2026 #Sat Feb 28 12:14:20 GMT 2026
stageCount=9 stageCount=9
libraryProject= libraryProject=
baseVersion=15.15 baseVersion=15.15
publishVersion=15.15.8 publishVersion=15.15.8
buildCount=0 buildCount=3
baseBetaVersion=15.15.9 baseBetaVersion=15.15.9

View File

@@ -25,7 +25,7 @@ import java.lang.reflect.Field;
* 适配 API30基于 Java7 开发 * 适配 API30基于 Java7 开发
* @Author 豆包&ZhanGSKen<zhangsken@qq.com> * @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @Date 2025年11月27日14时26分00秒 * @Date 2025年11月27日14时26分00秒
* @LastEditTime 2026年01月19日22时18分00秒 * @LastEditTime 2026-02-28
* @Describe 应用设置窗口(主开关联动子开关启用/禁用,主开关关闭则子开关禁用并取消勾选) * @Describe 应用设置窗口(主开关联动子开关启用/禁用,主开关关闭则子开关禁用并取消勾选)
*/ */
public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivity { public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivity {
@@ -39,6 +39,7 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
private CheckBox cbChargeTts; // 充电TTS主开关 private CheckBox cbChargeTts; // 充电TTS主开关
private CheckBox cbUseageTtsBattary; // 用电TTS带电量提醒子开关 private CheckBox cbUseageTtsBattary; // 用电TTS带电量提醒子开关
private CheckBox cbChargeTtsBattary; // 充电TTS带电量提醒子开关 private CheckBox cbChargeTtsBattary; // 充电TTS带电量提醒子开关
private CheckBox cbTtsWhenNotifyBattery; // 👉 新增通知电量时同时播放TTS
// ======================== 接口实现区 ========================= // ======================== 接口实现区 =========================
@Override @Override
@@ -96,6 +97,7 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
cbChargeTts = findViewById(R.id.activitysettingsCheckBox2); cbChargeTts = findViewById(R.id.activitysettingsCheckBox2);
cbUseageTtsBattary = findViewById(R.id.activitysettingsCheckBox3); cbUseageTtsBattary = findViewById(R.id.activitysettingsCheckBox3);
cbChargeTtsBattary = findViewById(R.id.activitysettingsCheckBox4); cbChargeTtsBattary = findViewById(R.id.activitysettingsCheckBox4);
cbTtsWhenNotifyBattery = findViewById(R.id.activitysettingsCheckBox5); // 👉 新增绑定
LogUtils.d(TAG, "initTtsCheckBoxes: TTS复选框绑定完成"); LogUtils.d(TAG, "initTtsCheckBoxes: TTS复选框绑定完成");
} }
@@ -116,6 +118,7 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
cbChargeTts.setChecked(chargeMainOpen); cbChargeTts.setChecked(chargeMainOpen);
cbUseageTtsBattary.setChecked(bean.isEnableUseageTtsWithBattary()); cbUseageTtsBattary.setChecked(bean.isEnableUseageTtsWithBattary());
cbChargeTtsBattary.setChecked(bean.isEnableChargeTtsWithBattary()); cbChargeTtsBattary.setChecked(bean.isEnableChargeTtsWithBattary());
cbTtsWhenNotifyBattery.setChecked(bean.isEnableTtsWhenNotifyBattery()); // 👉 新增赋值
cbUseageTtsBattary.setEnabled(useMainOpen); cbUseageTtsBattary.setEnabled(useMainOpen);
cbChargeTtsBattary.setEnabled(chargeMainOpen); cbChargeTtsBattary.setEnabled(chargeMainOpen);
@@ -138,12 +141,8 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
public void onEnableUsePowerTts(View view) { public void onEnableUsePowerTts(View view) {
boolean isChecked = cbUsePowerTts.isChecked(); boolean isChecked = cbUsePowerTts.isChecked();
LogUtils.d(TAG, "onEnableUsePowerTts: 用电TTS主开关点击切换后状态=" + isChecked); LogUtils.d(TAG, "onEnableUsePowerTts: 用电TTS主开关点击切换后状态=" + isChecked);
cbUsePowerTts.setChecked(isChecked);
// 主开关联动子开关 // 主开关联动子开关
cbUseageTtsBattary.setEnabled(isChecked); cbUseageTtsBattary.setEnabled(isChecked);
// if (!isChecked) {
// cbUseageTtsBattary.setChecked(false);
// }
// 保存配置 // 保存配置
ThoughtfulServiceBean bean = getThoughtfulServiceBean(); ThoughtfulServiceBean bean = getThoughtfulServiceBean();
bean.setIsEnableUsePowerTts(isChecked); bean.setIsEnableUsePowerTts(isChecked);
@@ -157,12 +156,8 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
public void onEnableChargeTts(View view) { public void onEnableChargeTts(View view) {
boolean isChecked = cbChargeTts.isChecked(); boolean isChecked = cbChargeTts.isChecked();
LogUtils.d(TAG, "onEnableChargeTts: 充电TTS主开关点击切换后状态=" + isChecked); LogUtils.d(TAG, "onEnableChargeTts: 充电TTS主开关点击切换后状态=" + isChecked);
cbChargeTts.setChecked(isChecked);
// 主开关联动子开关 // 主开关联动子开关
cbChargeTtsBattary.setEnabled(isChecked); cbChargeTtsBattary.setEnabled(isChecked);
// if (!isChecked) {
// cbChargeTtsBattary.setChecked(false);
// }
// 保存配置 // 保存配置
ThoughtfulServiceBean bean = getThoughtfulServiceBean(); ThoughtfulServiceBean bean = getThoughtfulServiceBean();
bean.setIsEnableChargeTts(isChecked); bean.setIsEnableChargeTts(isChecked);
@@ -176,7 +171,6 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
public void onEnableUseageTtsWithBattary(View view) { public void onEnableUseageTtsWithBattary(View view) {
boolean isChecked = cbUseageTtsBattary.isChecked(); boolean isChecked = cbUseageTtsBattary.isChecked();
LogUtils.d(TAG, "onEnableUseageTtsWithBattary: 用电TTS电量提醒开关点击切换后状态=" + isChecked); LogUtils.d(TAG, "onEnableUseageTtsWithBattary: 用电TTS电量提醒开关点击切换后状态=" + isChecked);
cbUseageTtsBattary.setChecked(isChecked);
ThoughtfulServiceBean bean = getThoughtfulServiceBean(); ThoughtfulServiceBean bean = getThoughtfulServiceBean();
bean.setIsEnableUseageTtsWithBattary(isChecked); bean.setIsEnableUseageTtsWithBattary(isChecked);
ThoughtfulServiceBean.saveBean(this, bean); ThoughtfulServiceBean.saveBean(this, bean);
@@ -189,13 +183,24 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
public void onEnableChargeTtsWithBattary(View view) { public void onEnableChargeTtsWithBattary(View view) {
boolean isChecked = cbChargeTtsBattary.isChecked(); boolean isChecked = cbChargeTtsBattary.isChecked();
LogUtils.d(TAG, "onEnableChargeTtsWithBattary: 充电TTS电量提醒开关点击切换后状态=" + isChecked); LogUtils.d(TAG, "onEnableChargeTtsWithBattary: 充电TTS电量提醒开关点击切换后状态=" + isChecked);
cbChargeTtsBattary.setChecked(isChecked);
ThoughtfulServiceBean bean = getThoughtfulServiceBean(); ThoughtfulServiceBean bean = getThoughtfulServiceBean();
bean.setIsEnableChargeTtsWithBattary(isChecked); bean.setIsEnableChargeTtsWithBattary(isChecked);
ThoughtfulServiceBean.saveBean(this, bean); ThoughtfulServiceBean.saveBean(this, bean);
LogUtils.d(TAG, "onEnableChargeTtsWithBattary: 充电TTS电量提醒状态保存完成"); LogUtils.d(TAG, "onEnableChargeTtsWithBattary: 充电TTS电量提醒状态保存完成");
} }
/**
* 👉 新增允许通知电量消息时同时播放TTS语音
*/
public void onEnableTtsWhenNotifyBattery(View view) {
boolean isChecked = cbTtsWhenNotifyBattery.isChecked();
LogUtils.d(TAG, "onEnableTtsWhenNotifyBattery: 通知电量时播TTS开关状态=" + isChecked);
ThoughtfulServiceBean bean = getThoughtfulServiceBean();
bean.setIsEnableTtsWhenNotifyBattery(isChecked);
ThoughtfulServiceBean.saveBean(this, bean);
LogUtils.d(TAG, "onEnableTtsWhenNotifyBattery: 保存完成");
}
// ======================== 工具方法区 ========================= // ======================== 工具方法区 =========================
/** /**
* 获取配置Bean实例避免重复代码 * 获取配置Bean实例避免重复代码

View File

@@ -24,17 +24,19 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
// JSON序列化字段常量 杜绝硬编码 // JSON序列化字段常量 杜绝硬编码
public static final String JSON_FIELD_IS_ENABLE_CHARGE_TTS = "isEnableChargeTts"; public static final String JSON_FIELD_IS_ENABLE_CHARGE_TTS = "isEnableChargeTts";
public static final String JSON_FIELD_IS_ENABLE_USE_POWER_TTS = "isEnableUsePowerTts"; public static final String JSON_FIELD_IS_ENABLE_USE_POWER_TTS = "isEnableUsePowerTts";
// 新增字段JSON常量
public static final String JSON_FIELD_IS_ENABLE_USAGE_TTS_WITH_BATTERY = "isEnableUseageTtsWithBattary"; public static final String JSON_FIELD_IS_ENABLE_USAGE_TTS_WITH_BATTERY = "isEnableUseageTtsWithBattary";
public static final String JSON_FIELD_IS_ENABLE_CHARGE_TTS_WITH_BATTERY = "isEnableChargeTtsWithBattary"; public static final String JSON_FIELD_IS_ENABLE_CHARGE_TTS_WITH_BATTERY = "isEnableChargeTtsWithBattary";
// 👉 新增通知电量消息时同时播放TTS
public static final String JSON_FIELD_IS_ENABLE_TTS_WHEN_NOTIFY_BATTERY = "isEnableTtsWhenNotifyBattery";
// ====================== 核心成员变量 - 私有封装 ====================== // ====================== 核心成员变量 - 私有封装 ======================
private boolean isEnableChargeTts = false; // 是否启用 充电TTS贴心语音服务 private boolean isEnableChargeTts = false; // 是否启用 充电TTS贴心语音服务
private boolean isEnableUsePowerTts = false; // 是否启用 用电TTS贴心语音服务 private boolean isEnableUsePowerTts = false; // 是否启用 用电TTS贴心语音服务
private boolean isEnableUseageTtsWithBattary = false; // 用电TTS加入电量提醒 private boolean isEnableUseageTtsWithBattary = false; // 用电TTS加入电量提醒
private boolean isEnableChargeTtsWithBattary = false; // 充电TTS加入电量提醒 private boolean isEnableChargeTtsWithBattary = false; // 充电TTS加入电量提醒
private boolean isEnableTtsWhenNotifyBattery = false; // 👉 允许通知电量消息时同时播放TTS语音
// ====================== Parcelable 静态创建器 (API30标准写法 必须public static final) ====================== // ====================== Parcelable 静态创建器 ======================
public static final Creator<ThoughtfulServiceBean> CREATOR = new Creator<ThoughtfulServiceBean>() { public static final Creator<ThoughtfulServiceBean> CREATOR = new Creator<ThoughtfulServiceBean>() {
@Override @Override
public ThoughtfulServiceBean createFromParcel(Parcel source) { public ThoughtfulServiceBean createFromParcel(Parcel source) {
@@ -48,45 +50,34 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
} }
}; };
// ====================== 构造方法区 (无参+有参+Parcel构造 全覆盖) ====================== // ====================== 构造方法区 ======================
/**
* 无参构造 - JSON解析/反射实例化 必备
*/
public ThoughtfulServiceBean() { public ThoughtfulServiceBean() {
LogUtils.d(TAG, "ThoughtfulServiceBean: 无参构造初始化默认禁用所有TTS服务"); LogUtils.d(TAG, "ThoughtfulServiceBean: 无参构造初始化默认禁用所有TTS服务");
} }
/**
* 全参构造 - 手动配置所有服务状态
* @param isEnableChargeTts 充电TTS服务开关
* @param isEnableUsePowerTts 用电TTS服务开关
* @param isEnableUseageTtsWithBattary 用电TTS加电量提醒开关
* @param isEnableChargeTtsWithBattary 充电TTS加电量提醒开关
*/
public ThoughtfulServiceBean(boolean isEnableChargeTts, boolean isEnableUsePowerTts, public ThoughtfulServiceBean(boolean isEnableChargeTts, boolean isEnableUsePowerTts,
boolean isEnableUseageTtsWithBattary, boolean isEnableChargeTtsWithBattary) { boolean isEnableUseageTtsWithBattary, boolean isEnableChargeTtsWithBattary,
boolean isEnableTtsWhenNotifyBattery) {
this.isEnableChargeTts = isEnableChargeTts; this.isEnableChargeTts = isEnableChargeTts;
this.isEnableUsePowerTts = isEnableUsePowerTts; this.isEnableUsePowerTts = isEnableUsePowerTts;
this.isEnableUseageTtsWithBattary = isEnableUseageTtsWithBattary; this.isEnableUseageTtsWithBattary = isEnableUseageTtsWithBattary;
this.isEnableChargeTtsWithBattary = isEnableChargeTtsWithBattary; this.isEnableChargeTtsWithBattary = isEnableChargeTtsWithBattary;
this.isEnableTtsWhenNotifyBattery = isEnableTtsWhenNotifyBattery;
LogUtils.d(TAG, "ThoughtfulServiceBean: 全参构造 | 充电TTS=" + isEnableChargeTts + " | 用电TTS=" + isEnableUsePowerTts LogUtils.d(TAG, "ThoughtfulServiceBean: 全参构造 | 充电TTS=" + isEnableChargeTts + " | 用电TTS=" + isEnableUsePowerTts
+ " | 用电TTS加电量=" + isEnableUseageTtsWithBattary + " | 充电TTS加电量=" + isEnableChargeTtsWithBattary); + " | 用电TTS加电量=" + isEnableUseageTtsWithBattary + " | 充电TTS加电量=" + isEnableChargeTtsWithBattary
+ " | 通知电量时播TTS=" + isEnableTtsWhenNotifyBattery);
} }
/**
* Parcel反序列化构造 - Parcelable必备 私有私有化
*/
private ThoughtfulServiceBean(Parcel in) { private ThoughtfulServiceBean(Parcel in) {
this.isEnableChargeTts = in.readByte() != 0; this.isEnableChargeTts = in.readByte() != 0;
this.isEnableUsePowerTts = in.readByte() != 0; this.isEnableUsePowerTts = in.readByte() != 0;
// 新增字段反序列化
this.isEnableUseageTtsWithBattary = in.readByte() != 0; this.isEnableUseageTtsWithBattary = in.readByte() != 0;
this.isEnableChargeTtsWithBattary = in.readByte() != 0; this.isEnableChargeTtsWithBattary = in.readByte() != 0;
LogUtils.d(TAG, "ThoughtfulServiceBean: Parcel构造解析完成 | 充电TTS=" + isEnableChargeTts + " | 用电TTS=" + isEnableUsePowerTts this.isEnableTtsWhenNotifyBattery = in.readByte() != 0; // 👉 新增反序列化
+ " | 用电TTS加电量=" + isEnableUseageTtsWithBattary + " | 充电TTS加电量=" + isEnableChargeTtsWithBattary); LogUtils.d(TAG, "ThoughtfulServiceBean: Parcel构造解析完成");
} }
// ====================== Getter/Setter 方法区 (封装成员变量 统一访问) ====================== // ====================== Getter/Setter 方法区 ======================
public boolean isEnableChargeTts() { public boolean isEnableChargeTts() {
return isEnableChargeTts; return isEnableChargeTts;
} }
@@ -105,7 +96,6 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
this.isEnableUsePowerTts = isEnableUsePowerTts; this.isEnableUsePowerTts = isEnableUsePowerTts;
} }
// 新增 用电TTS加入电量提醒 Getter/Setter
public boolean isEnableUseageTtsWithBattary() { public boolean isEnableUseageTtsWithBattary() {
return isEnableUseageTtsWithBattary; return isEnableUseageTtsWithBattary;
} }
@@ -115,7 +105,6 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
this.isEnableUseageTtsWithBattary = isEnableUseageTtsWithBattary; this.isEnableUseageTtsWithBattary = isEnableUseageTtsWithBattary;
} }
// 新增 充电TTS加入电量提醒 Getter/Setter
public boolean isEnableChargeTtsWithBattary() { public boolean isEnableChargeTtsWithBattary() {
return isEnableChargeTtsWithBattary; return isEnableChargeTtsWithBattary;
} }
@@ -125,7 +114,17 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
this.isEnableChargeTtsWithBattary = isEnableChargeTtsWithBattary; this.isEnableChargeTtsWithBattary = isEnableChargeTtsWithBattary;
} }
// ====================== 重写父类 BaseBean 核心方法 (JSON序列化/反序列化 业务核心) ====================== // 👉 新增通知电量时播放TTS
public boolean isEnableTtsWhenNotifyBattery() {
return isEnableTtsWhenNotifyBattery;
}
public void setIsEnableTtsWhenNotifyBattery(boolean isEnableTtsWhenNotifyBattery) {
LogUtils.d(TAG, "setIsEnableTtsWhenNotifyBattery: 旧值=" + this.isEnableTtsWhenNotifyBattery + " 新值=" + isEnableTtsWhenNotifyBattery);
this.isEnableTtsWhenNotifyBattery = isEnableTtsWhenNotifyBattery;
}
// ====================== 重写父类 BaseBean 核心方法 ======================
@Override @Override
public String getName() { public String getName() {
String className = ThoughtfulServiceBean.class.getName(); String className = ThoughtfulServiceBean.class.getName();
@@ -133,23 +132,17 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
return className; return className;
} }
/**
* JSON序列化 - 写入所有字段 适配持久化/网络传输
*/
@Override @Override
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException { public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
super.writeThisToJsonWriter(jsonWriter); super.writeThisToJsonWriter(jsonWriter);
jsonWriter.name(JSON_FIELD_IS_ENABLE_CHARGE_TTS).value(this.isEnableChargeTts); jsonWriter.name(JSON_FIELD_IS_ENABLE_CHARGE_TTS).value(this.isEnableChargeTts);
jsonWriter.name(JSON_FIELD_IS_ENABLE_USE_POWER_TTS).value(this.isEnableUsePowerTts); jsonWriter.name(JSON_FIELD_IS_ENABLE_USE_POWER_TTS).value(this.isEnableUsePowerTts);
// 新增字段JSON序列化
jsonWriter.name(JSON_FIELD_IS_ENABLE_USAGE_TTS_WITH_BATTERY).value(this.isEnableUseageTtsWithBattary); jsonWriter.name(JSON_FIELD_IS_ENABLE_USAGE_TTS_WITH_BATTERY).value(this.isEnableUseageTtsWithBattary);
jsonWriter.name(JSON_FIELD_IS_ENABLE_CHARGE_TTS_WITH_BATTERY).value(this.isEnableChargeTtsWithBattary); jsonWriter.name(JSON_FIELD_IS_ENABLE_CHARGE_TTS_WITH_BATTERY).value(this.isEnableChargeTtsWithBattary);
jsonWriter.name(JSON_FIELD_IS_ENABLE_TTS_WHEN_NOTIFY_BATTERY).value(this.isEnableTtsWhenNotifyBattery); // 👉 新增JSON写入
LogUtils.d(TAG, "writeThisToJsonWriter: JSON序列化完成所有TTS服务状态已写入"); LogUtils.d(TAG, "writeThisToJsonWriter: JSON序列化完成所有TTS服务状态已写入");
} }
/**
* JSON反序列化 - 读取字段生成实体 适配数据恢复
*/
@Override @Override
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException { public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
ThoughtfulServiceBean bean = new ThoughtfulServiceBean(); ThoughtfulServiceBean bean = new ThoughtfulServiceBean();
@@ -163,13 +156,15 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
case JSON_FIELD_IS_ENABLE_USE_POWER_TTS: case JSON_FIELD_IS_ENABLE_USE_POWER_TTS:
bean.setIsEnableUsePowerTts(jsonReader.nextBoolean()); bean.setIsEnableUsePowerTts(jsonReader.nextBoolean());
break; break;
// 新增字段反序列化
case JSON_FIELD_IS_ENABLE_USAGE_TTS_WITH_BATTERY: case JSON_FIELD_IS_ENABLE_USAGE_TTS_WITH_BATTERY:
bean.setIsEnableUseageTtsWithBattary(jsonReader.nextBoolean()); bean.setIsEnableUseageTtsWithBattary(jsonReader.nextBoolean());
break; break;
case JSON_FIELD_IS_ENABLE_CHARGE_TTS_WITH_BATTERY: case JSON_FIELD_IS_ENABLE_CHARGE_TTS_WITH_BATTERY:
bean.setIsEnableChargeTtsWithBattary(jsonReader.nextBoolean()); bean.setIsEnableChargeTtsWithBattary(jsonReader.nextBoolean());
break; break;
case JSON_FIELD_IS_ENABLE_TTS_WHEN_NOTIFY_BATTERY:
bean.setIsEnableTtsWhenNotifyBattery(jsonReader.nextBoolean()); // 👉 新增JSON读取
break;
default: default:
jsonReader.skipValue(); jsonReader.skipValue();
LogUtils.w(TAG, "readBeanFromJsonReader: 跳过未知JSON字段 = " + fieldName); LogUtils.w(TAG, "readBeanFromJsonReader: 跳过未知JSON字段 = " + fieldName);
@@ -181,22 +176,19 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
return bean; return bean;
} }
// ====================== 实现 Parcelable 接口方法 (组件间Intent传递必备 API30/Java7完美适配) ====================== // ====================== Parcelable 接口方法 ======================
@Override @Override
public int describeContents() { public int describeContents() {
return 0; // 无文件描述符等特殊内容固定返回0即可 return 0;
} }
/**
* Parcel序列化 - boolean用byte存储(Java7/API30标准写法 避免兼容性问题)
*/
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeByte((byte) (isEnableChargeTts ? 1 : 0)); dest.writeByte((byte) (isEnableChargeTts ? 1 : 0));
dest.writeByte((byte) (isEnableUsePowerTts ? 1 : 0)); dest.writeByte((byte) (isEnableUsePowerTts ? 1 : 0));
// 新增字段Parcel序列化
dest.writeByte((byte) (isEnableUseageTtsWithBattary ? 1 : 0)); dest.writeByte((byte) (isEnableUseageTtsWithBattary ? 1 : 0));
dest.writeByte((byte) (isEnableChargeTtsWithBattary ? 1 : 0)); dest.writeByte((byte) (isEnableChargeTtsWithBattary ? 1 : 0));
dest.writeByte((byte) (isEnableTtsWhenNotifyBattery ? 1 : 0)); // 👉 新增Parcel写入
LogUtils.d(TAG, "writeToParcel: Parcel序列化完成所有TTS服务状态已写入"); LogUtils.d(TAG, "writeToParcel: Parcel序列化完成所有TTS服务状态已写入");
} }

View File

@@ -123,6 +123,14 @@
</LinearLayout> </LinearLayout>
<!-- 👉 你要的新选项允许通知电量消息时同时播放TTS语音 -->
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="允许通知电量消息时同时播放TTS语音"
android:onClick="onEnableTtsWhenNotifyBattery"
android:id="@+id/activitysettingsCheckBox5"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout