Compare commits
4 Commits
originmast
...
powerbell-
| Author | SHA1 | Date | |
|---|---|---|---|
| 45400314af | |||
| f53113d0df | |||
| 53fb1ac835 | |||
| be9855b29d |
@@ -18,22 +18,19 @@ def genVersionName(def versionName){
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
// 适配MIUI12
|
||||||
// 关键:改为你已安装的 SDK 32(≥ targetSdkVersion 30,兼容已安装环境)
|
compileSdkVersion 30
|
||||||
compileSdkVersion 32
|
buildToolsVersion "30.0.3"
|
||||||
|
|
||||||
// 直接使用已安装的构建工具 33.0.3(无需修改)
|
|
||||||
buildToolsVersion "33.0.3"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.powerbell"
|
applicationId "cc.winboll.studio.powerbell"
|
||||||
minSdkVersion 23
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 7
|
versionCode 7
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.14"
|
versionName "15.15"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@@ -83,12 +80,12 @@ dependencies {
|
|||||||
//api 'androidx.fragment:fragment:1.1.0'
|
//api 'androidx.fragment:fragment:1.1.0'
|
||||||
|
|
||||||
// WinBoLL库 nexus.winboll.cc 地址
|
// WinBoLL库 nexus.winboll.cc 地址
|
||||||
api 'cc.winboll.studio:libaes:15.12.13'
|
api 'cc.winboll.studio:libaes:15.15.2'
|
||||||
api 'cc.winboll.studio:libappbase:15.14.2'
|
api 'cc.winboll.studio:libappbase:15.15.4'
|
||||||
|
|
||||||
// WinBoLL备用库 jitpack.io 地址
|
// WinBoLL备用库 jitpack.io 地址
|
||||||
//api 'com.github.ZhanGSKen:AES:aes-v15.12.9'
|
//api 'com.github.ZhanGSKen:AES:aes-v15.15.2'
|
||||||
//api 'com.github.ZhanGSKen:APPBase:appbase-v15.14.1'
|
//api 'com.github.ZhanGSKen:APPBase:appbase-v15.15.4'
|
||||||
|
|
||||||
//api fileTree(dir: 'libs', include: ['*.aar'])
|
//api fileTree(dir: 'libs', include: ['*.aar'])
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Wed Jan 07 18:09:34 HKT 2026
|
#Mon Jan 19 20:04:16 HKT 2026
|
||||||
stageCount=50
|
stageCount=2
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.14
|
baseVersion=15.15
|
||||||
publishVersion=15.14.49
|
publishVersion=15.15.1
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.14.50
|
baseBetaVersion=15.15.2
|
||||||
|
|||||||
@@ -301,7 +301,8 @@
|
|||||||
android:process=":main"
|
android:process=":main"
|
||||||
android:stopWithTask="false"/>
|
android:stopWithTask="false"/>
|
||||||
|
|
||||||
<service android:name=".services.ThoughtfulService"
|
<service
|
||||||
|
android:name=".services.ThoughtfulService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:process=":main"
|
android:process=":main"
|
||||||
@@ -324,6 +325,8 @@
|
|||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="4.0"/>
|
android:value="4.0"/>
|
||||||
|
|
||||||
|
<activity android:name="cc.winboll.studio.powerbell.activities.AboutActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -13,13 +13,13 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewStub;
|
import android.view.ViewStub;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import cc.winboll.studio.libaes.activitys.AboutActivity;
|
|
||||||
import cc.winboll.studio.libaes.models.APPInfo;
|
import cc.winboll.studio.libaes.models.APPInfo;
|
||||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||||
import cc.winboll.studio.libaes.utils.DevelopUtils;
|
import cc.winboll.studio.libaes.utils.DevelopUtils;
|
||||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||||
import cc.winboll.studio.libaes.views.ADsBannerView;
|
import cc.winboll.studio.libaes.views.ADsBannerView;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.powerbell.activities.AboutActivity;
|
||||||
import cc.winboll.studio.powerbell.activities.BackgroundSettingsActivity;
|
import cc.winboll.studio.powerbell.activities.BackgroundSettingsActivity;
|
||||||
import cc.winboll.studio.powerbell.activities.BatteryReportActivity;
|
import cc.winboll.studio.powerbell.activities.BatteryReportActivity;
|
||||||
import cc.winboll.studio.powerbell.activities.ClearRecordActivity;
|
import cc.winboll.studio.powerbell.activities.ClearRecordActivity;
|
||||||
@@ -550,7 +550,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
|||||||
LogUtils.d(TAG, "startAboutActivity() 调用");
|
LogUtils.d(TAG, "startAboutActivity() 调用");
|
||||||
Intent aboutIntent = new Intent(getApplicationContext(), AboutActivity.class);
|
Intent aboutIntent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||||
APPInfo appInfo = genDefaultAppInfo();
|
APPInfo appInfo = genDefaultAppInfo();
|
||||||
aboutIntent.putExtra(AboutActivity.EXTRA_APPINFO, appInfo);
|
|
||||||
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), aboutIntent, AboutActivity.class);
|
WinBoLLActivityManager.getInstance().startWinBoLLActivity(getApplicationContext(), aboutIntent, AboutActivity.class);
|
||||||
LogUtils.d(TAG, "startAboutActivity: 关于页面已启动");
|
LogUtils.d(TAG, "startAboutActivity: 关于页面已启动");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package cc.winboll.studio.powerbell.activities;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.models.APPInfo;
|
||||||
|
import cc.winboll.studio.libappbase.views.AboutView;
|
||||||
|
import cc.winboll.studio.powerbell.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
|
||||||
|
* @Date 2026/01/13 11:25
|
||||||
|
* @Describe 应用介绍窗口
|
||||||
|
*/
|
||||||
|
public class AboutActivity extends WinBoLLActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "AboutActivity";
|
||||||
|
private Toolbar mToolbar;
|
||||||
|
@Override
|
||||||
|
public Activity getActivity() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_about);
|
||||||
|
|
||||||
|
// 设置工具栏
|
||||||
|
initToolbar();
|
||||||
|
|
||||||
|
AboutView aboutView = findViewById(R.id.aboutview);
|
||||||
|
aboutView.setAPPInfo(genDefaultAppInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initToolbar() {
|
||||||
|
LogUtils.d(TAG, "initToolbar() 开始初始化");
|
||||||
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
|
if (mToolbar == null) {
|
||||||
|
LogUtils.e(TAG, "initToolbar() | Toolbar未找到");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSupportActionBar(mToolbar);
|
||||||
|
mToolbar.setSubtitle(getTag());
|
||||||
|
mToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LogUtils.d(TAG, "导航栏 点击返回按钮");
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
LogUtils.d(TAG, "initToolbar() 配置完成");
|
||||||
|
}
|
||||||
|
|
||||||
|
private APPInfo genDefaultAppInfo() {
|
||||||
|
LogUtils.d(TAG, "genDefaultAppInfo() 调用");
|
||||||
|
String branchName = "powerbell";
|
||||||
|
APPInfo appInfo = new APPInfo();
|
||||||
|
appInfo.setAppName(getString(R.string.app_name));
|
||||||
|
appInfo.setAppIcon(R.drawable.ic_winboll);
|
||||||
|
appInfo.setAppDescription(getString(R.string.app_description));
|
||||||
|
appInfo.setAppGitName("PowerBell");
|
||||||
|
appInfo.setAppGitOwner("Studio");
|
||||||
|
appInfo.setAppGitAPPBranch(branchName);
|
||||||
|
appInfo.setAppGitAPPSubProjectFolder(branchName);
|
||||||
|
appInfo.setAppHomePage("https://www.winboll.cc/apks/index.php?project=PowerBell");
|
||||||
|
appInfo.setAppAPKName("PowerBell");
|
||||||
|
appInfo.setAppAPKFolderName("PowerBell");
|
||||||
|
LogUtils.d(TAG, "genDefaultAppInfo: 应用信息已生成");
|
||||||
|
return appInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,8 +61,12 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
|
|||||||
if (thoughtfulServiceBean == null) {
|
if (thoughtfulServiceBean == null) {
|
||||||
thoughtfulServiceBean = new ThoughtfulServiceBean();
|
thoughtfulServiceBean = new ThoughtfulServiceBean();
|
||||||
}
|
}
|
||||||
|
// 原有2个复选框赋值
|
||||||
((CheckBox)findViewById(R.id.activitysettingsCheckBox1)).setChecked(thoughtfulServiceBean.isEnableUsePowerTts());
|
((CheckBox)findViewById(R.id.activitysettingsCheckBox1)).setChecked(thoughtfulServiceBean.isEnableUsePowerTts());
|
||||||
((CheckBox)findViewById(R.id.activitysettingsCheckBox2)).setChecked(thoughtfulServiceBean.isEnableChargeTts());
|
((CheckBox)findViewById(R.id.activitysettingsCheckBox2)).setChecked(thoughtfulServiceBean.isEnableChargeTts());
|
||||||
|
// 新增2个复选框赋值
|
||||||
|
((CheckBox)findViewById(R.id.activitysettingsCheckBox3)).setChecked(thoughtfulServiceBean.isEnableUseageTtsWithBattary());
|
||||||
|
((CheckBox)findViewById(R.id.activitysettingsCheckBox4)).setChecked(thoughtfulServiceBean.isEnableChargeTtsWithBattary());
|
||||||
|
|
||||||
LogUtils.d(TAG, "【onCreate】SettingsActivity 初始化完成");
|
LogUtils.d(TAG, "【onCreate】SettingsActivity 初始化完成");
|
||||||
}
|
}
|
||||||
@@ -94,6 +98,7 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
|
|||||||
canDrawOverlays();
|
canDrawOverlays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 原有方法
|
||||||
public void onEnableChargeTts(View view) {
|
public void onEnableChargeTts(View view) {
|
||||||
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
||||||
if (thoughtfulServiceBean == null) {
|
if (thoughtfulServiceBean == null) {
|
||||||
@@ -103,6 +108,7 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
|
|||||||
ThoughtfulServiceBean.saveBean(this, thoughtfulServiceBean);
|
ThoughtfulServiceBean.saveBean(this, thoughtfulServiceBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 原有方法
|
||||||
public void onEnableUsePowerTts(View view) {
|
public void onEnableUsePowerTts(View view) {
|
||||||
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
||||||
if (thoughtfulServiceBean == null) {
|
if (thoughtfulServiceBean == null) {
|
||||||
@@ -112,6 +118,26 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
|
|||||||
ThoughtfulServiceBean.saveBean(this, thoughtfulServiceBean);
|
ThoughtfulServiceBean.saveBean(this, thoughtfulServiceBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增:用电TTS加入电量提醒
|
||||||
|
public void onEnableUseageTtsWithBattary(View view) {
|
||||||
|
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
||||||
|
if (thoughtfulServiceBean == null) {
|
||||||
|
thoughtfulServiceBean = new ThoughtfulServiceBean();
|
||||||
|
}
|
||||||
|
thoughtfulServiceBean.setIsEnableUseageTtsWithBattary(((CheckBox)view).isChecked());
|
||||||
|
ThoughtfulServiceBean.saveBean(this, thoughtfulServiceBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增:充电TTS加入电量提醒
|
||||||
|
public void onEnableChargeTtsWithBattary(View view) {
|
||||||
|
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
||||||
|
if (thoughtfulServiceBean == null) {
|
||||||
|
thoughtfulServiceBean = new ThoughtfulServiceBean();
|
||||||
|
}
|
||||||
|
thoughtfulServiceBean.setIsEnableChargeTtsWithBattary(((CheckBox)view).isChecked());
|
||||||
|
ThoughtfulServiceBean.saveBean(this, thoughtfulServiceBean);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 悬浮窗权限检查与请求
|
* 悬浮窗权限检查与请求
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,10 +24,15 @@ 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_CHARGE_TTS_WITH_BATTERY = "isEnableChargeTtsWithBattary";
|
||||||
|
|
||||||
// ====================== 核心成员变量 - 私有封装 ======================
|
// ====================== 核心成员变量 - 私有封装 ======================
|
||||||
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 isEnableChargeTtsWithBattary = false;// 充电TTS加入电量提醒
|
||||||
|
|
||||||
// ====================== Parcelable 静态创建器 (API30标准写法 必须public static final) ======================
|
// ====================== Parcelable 静态创建器 (API30标准写法 必须public static final) ======================
|
||||||
public static final Creator<ThoughtfulServiceBean> CREATOR = new Creator<ThoughtfulServiceBean>() {
|
public static final Creator<ThoughtfulServiceBean> CREATOR = new Creator<ThoughtfulServiceBean>() {
|
||||||
@@ -55,11 +60,17 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
|
|||||||
* 全参构造 - 手动配置所有服务状态
|
* 全参构造 - 手动配置所有服务状态
|
||||||
* @param isEnableChargeTts 充电TTS服务开关
|
* @param isEnableChargeTts 充电TTS服务开关
|
||||||
* @param isEnableUsePowerTts 用电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) {
|
||||||
this.isEnableChargeTts = isEnableChargeTts;
|
this.isEnableChargeTts = isEnableChargeTts;
|
||||||
this.isEnableUsePowerTts = isEnableUsePowerTts;
|
this.isEnableUsePowerTts = isEnableUsePowerTts;
|
||||||
LogUtils.d(TAG, "ThoughtfulServiceBean: 全参构造 | isEnableChargeTts=" + isEnableChargeTts + " | isEnableUsePowerTts=" + isEnableUsePowerTts);
|
this.isEnableUseageTtsWithBattary = isEnableUseageTtsWithBattary;
|
||||||
|
this.isEnableChargeTtsWithBattary = isEnableChargeTtsWithBattary;
|
||||||
|
LogUtils.d(TAG, "ThoughtfulServiceBean: 全参构造 | 充电TTS=" + isEnableChargeTts + " | 用电TTS=" + isEnableUsePowerTts
|
||||||
|
+ " | 用电TTS加电量=" + isEnableUseageTtsWithBattary + " | 充电TTS加电量=" + isEnableChargeTtsWithBattary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +79,11 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
|
|||||||
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;
|
||||||
LogUtils.d(TAG, "ThoughtfulServiceBean: Parcel构造解析完成 | isEnableChargeTts=" + isEnableChargeTts + " | isEnableUsePowerTts=" + isEnableUsePowerTts);
|
// 新增字段反序列化
|
||||||
|
this.isEnableUseageTtsWithBattary = in.readByte() != 0;
|
||||||
|
this.isEnableChargeTtsWithBattary = in.readByte() != 0;
|
||||||
|
LogUtils.d(TAG, "ThoughtfulServiceBean: Parcel构造解析完成 | 充电TTS=" + isEnableChargeTts + " | 用电TTS=" + isEnableUsePowerTts
|
||||||
|
+ " | 用电TTS加电量=" + isEnableUseageTtsWithBattary + " | 充电TTS加电量=" + isEnableChargeTtsWithBattary);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================== Getter/Setter 方法区 (封装成员变量 统一访问) ======================
|
// ====================== Getter/Setter 方法区 (封装成员变量 统一访问) ======================
|
||||||
@@ -90,6 +105,26 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
|
|||||||
this.isEnableUsePowerTts = isEnableUsePowerTts;
|
this.isEnableUsePowerTts = isEnableUsePowerTts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增 用电TTS加入电量提醒 Getter/Setter
|
||||||
|
public boolean isEnableUseageTtsWithBattary() {
|
||||||
|
return isEnableUseageTtsWithBattary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsEnableUseageTtsWithBattary(boolean isEnableUseageTtsWithBattary) {
|
||||||
|
LogUtils.d(TAG, "setIsEnableUseageTtsWithBattary: 旧值=" + this.isEnableUseageTtsWithBattary + " | 新值=" + isEnableUseageTtsWithBattary);
|
||||||
|
this.isEnableUseageTtsWithBattary = isEnableUseageTtsWithBattary;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增 充电TTS加入电量提醒 Getter/Setter
|
||||||
|
public boolean isEnableChargeTtsWithBattary() {
|
||||||
|
return isEnableChargeTtsWithBattary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsEnableChargeTtsWithBattary(boolean isEnableChargeTtsWithBattary) {
|
||||||
|
LogUtils.d(TAG, "setIsEnableChargeTtsWithBattary: 旧值=" + this.isEnableChargeTtsWithBattary + " | 新值=" + isEnableChargeTtsWithBattary);
|
||||||
|
this.isEnableChargeTtsWithBattary = isEnableChargeTtsWithBattary;
|
||||||
|
}
|
||||||
|
|
||||||
// ====================== 重写父类 BaseBean 核心方法 (JSON序列化/反序列化 业务核心) ======================
|
// ====================== 重写父类 BaseBean 核心方法 (JSON序列化/反序列化 业务核心) ======================
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -106,6 +141,9 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
|
|||||||
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_CHARGE_TTS_WITH_BATTERY).value(this.isEnableChargeTtsWithBattary);
|
||||||
LogUtils.d(TAG, "writeThisToJsonWriter: JSON序列化完成,所有TTS服务状态已写入");
|
LogUtils.d(TAG, "writeThisToJsonWriter: JSON序列化完成,所有TTS服务状态已写入");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +162,13 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
|
|||||||
break;
|
break;
|
||||||
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;
|
||||||
|
// 新增字段反序列化
|
||||||
|
case JSON_FIELD_IS_ENABLE_USAGE_TTS_WITH_BATTERY:
|
||||||
|
bean.setIsEnableUseageTtsWithBattary(jsonReader.nextBoolean());
|
||||||
|
break;
|
||||||
|
case JSON_FIELD_IS_ENABLE_CHARGE_TTS_WITH_BATTERY:
|
||||||
|
bean.setIsEnableChargeTtsWithBattary(jsonReader.nextBoolean());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
jsonReader.skipValue();
|
jsonReader.skipValue();
|
||||||
@@ -149,6 +194,9 @@ public class ThoughtfulServiceBean extends BaseBean implements Parcelable, Seria
|
|||||||
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) (isEnableChargeTtsWithBattary ? 1 : 0));
|
||||||
LogUtils.d(TAG, "writeToParcel: Parcel序列化完成,所有TTS服务状态已写入");
|
LogUtils.d(TAG, "writeToParcel: Parcel序列化完成,所有TTS服务状态已写入");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.powerbell.App;
|
||||||
import cc.winboll.studio.powerbell.models.AppConfigBean;
|
import cc.winboll.studio.powerbell.models.AppConfigBean;
|
||||||
import cc.winboll.studio.powerbell.models.ThoughtfulServiceBean;
|
import cc.winboll.studio.powerbell.models.ThoughtfulServiceBean;
|
||||||
import cc.winboll.studio.powerbell.utils.AppConfigUtils;
|
import cc.winboll.studio.powerbell.utils.AppConfigUtils;
|
||||||
@@ -31,7 +32,7 @@ public class ThoughtfulService extends Service {
|
|||||||
*/
|
*/
|
||||||
public enum ServiceType {
|
public enum ServiceType {
|
||||||
CHARGE_STATE, //充电状态服务
|
CHARGE_STATE, //充电状态服务
|
||||||
DISCHARGE_STATE //放电状态服务
|
DISCHARGE_STATE, //放电状态服务
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================== 对外公开静态启动函数【新增核心】入参Context + 枚举 ======================================
|
// ====================================== 对外公开静态启动函数【新增核心】入参Context + 枚举 ======================================
|
||||||
@@ -95,7 +96,7 @@ public class ThoughtfulService extends Service {
|
|||||||
case DISCHARGE_STATE:
|
case DISCHARGE_STATE:
|
||||||
// 执行【放电状态】对应的业务任务
|
// 执行【放电状态】对应的业务任务
|
||||||
executeDischargeStateTask();
|
executeDischargeStateTask();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogUtils.d(TAG, "【onStartCommand】未知的服务类型,不执行任何任务");
|
LogUtils.d(TAG, "【onStartCommand】未知的服务类型,不执行任何任务");
|
||||||
break;
|
break;
|
||||||
@@ -129,10 +130,16 @@ public class ThoughtfulService extends Service {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
||||||
|
if (thoughtfulServiceBean == null) {
|
||||||
|
thoughtfulServiceBean = new ThoughtfulServiceBean();
|
||||||
|
}
|
||||||
|
|
||||||
if (latestConfig.isEnableChargeReminder()) {
|
if (latestConfig.isEnableChargeReminder()) {
|
||||||
int nChargeReminderValue = latestConfig.getChargeReminderValue();
|
int nChargeReminderValue = latestConfig.getChargeReminderValue();
|
||||||
|
String szCurrentBattery = thoughtfulServiceBean.isEnableChargeTtsWithBattary()? String.format("现在电量为百分之%d。", App.sQuantityOfElectricity) : "";
|
||||||
String szRemind = String.format("限量充电提醒已启用,限量值为百分之%d。", nChargeReminderValue);
|
String szRemind = String.format("限量充电提醒已启用,限量值为百分之%d。", nChargeReminderValue);
|
||||||
szRemind = szRemind + szRemind + szRemind;
|
szRemind = szCurrentBattery + szRemind + szRemind + szRemind;
|
||||||
TTSPlayService.startPlayTTS(this, szRemind);
|
TTSPlayService.startPlayTTS(this, szRemind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,13 +159,21 @@ public class ThoughtfulService extends Service {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThoughtfulServiceBean thoughtfulServiceBean = ThoughtfulServiceBean.loadBean(this, ThoughtfulServiceBean.class);
|
||||||
|
if (thoughtfulServiceBean == null) {
|
||||||
|
thoughtfulServiceBean = new ThoughtfulServiceBean();
|
||||||
|
}
|
||||||
|
|
||||||
if (latestConfig.isEnableUsageReminder()) {
|
if (latestConfig.isEnableUsageReminder()) {
|
||||||
int nUsageReminderValue = latestConfig.getUsageReminderValue();
|
int nUsageReminderValue = latestConfig.getUsageReminderValue();
|
||||||
String szRemind = String.format("电量不足提醒已启用,低电值为百分之%d。", nUsageReminderValue);
|
String szCurrentBattery = thoughtfulServiceBean.isEnableUseageTtsWithBattary()? String.format("现在电量为百分之%d。", App.sQuantityOfElectricity) : "";
|
||||||
|
String szRemind = szCurrentBattery + String.format("电量不足提醒已启用,低电值为百分之%d。", nUsageReminderValue);
|
||||||
|
|
||||||
//szRemind = szRemind + szRemind + szRemind;
|
//szRemind = szRemind + szRemind + szRemind;
|
||||||
TTSPlayService.startPlayTTS(this, szRemind);
|
TTSPlayService.startPlayTTS(this, szRemind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
powerbell/src/main/res/layout/activity_about.xml
Normal file
23
powerbell/src/main/res/layout/activity_about.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<cc.winboll.studio.libaes.views.ASupportToolbar
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height"
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
style="@style/DefaultAToolbar"/>
|
||||||
|
|
||||||
|
<cc.winboll.studio.libappbase.views.AboutView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:id="@+id/aboutview"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -62,6 +62,14 @@
|
|||||||
android:onClick="onEnableUsePowerTts"
|
android:onClick="onEnableUsePowerTts"
|
||||||
android:id="@+id/activitysettingsCheckBox1"/>
|
android:id="@+id/activitysettingsCheckBox1"/>
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="用电TTS加入电量提醒"
|
||||||
|
android:onClick="onEnableUseageTtsWithBattary"
|
||||||
|
android:id="@+id/activitysettingsCheckBox3"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -69,6 +77,14 @@
|
|||||||
android:onClick="onEnableChargeTts"
|
android:onClick="onEnableChargeTts"
|
||||||
android:id="@+id/activitysettingsCheckBox2"/>
|
android:id="@+id/activitysettingsCheckBox2"/>
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="充电TTS加入电量提醒"
|
||||||
|
android:onClick="onEnableChargeTtsWithBattary"
|
||||||
|
android:id="@+id/activitysettingsCheckBox4"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
Reference in New Issue
Block a user