mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 13:37:11 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 25a9e4b230 | |||
| 1de0a36d79 | |||
| f7968e55c6 | |||
| 97f42054d2 | |||
| 184ea4fd71 | |||
| 526fa6c241 | |||
| a038a2db97 |
@@ -84,7 +84,7 @@ dependencies {
|
||||
//api 'androidx.fragment:fragment:1.1.0'
|
||||
|
||||
// WinBoLL库 nexus.winboll.cc 地址
|
||||
api 'cc.winboll.studio:libaes:15.20.20'
|
||||
api 'cc.winboll.studio:libaes:15.20.21'
|
||||
api 'cc.winboll.studio:libappbase:15.20.34'
|
||||
|
||||
// WinBoLL备用库 jitpack.io 地址
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Jul 17 22:37:50 HKT 2026
|
||||
stageCount=20
|
||||
#Sat Jul 18 10:07:32 HKT 2026
|
||||
stageCount=25
|
||||
libraryProject=
|
||||
baseVersion=15.15
|
||||
publishVersion=15.15.19
|
||||
publishVersion=15.15.24
|
||||
buildCount=0
|
||||
baseBetaVersion=15.15.20
|
||||
baseBetaVersion=15.15.25
|
||||
|
||||
Vendored
+16
@@ -60,6 +60,22 @@
|
||||
-dontwarn java.util.function.**
|
||||
|
||||
# ============================== 第三方框架专项规则 ==============================
|
||||
# JavaMail / SMTP 邮件发送(APPMSGMailUtils 依赖,防止 R8 混淆导致 SMTP 发送失败)
|
||||
-keep class javax.mail.** { *; }
|
||||
-keep class javax.mail.internet.** { *; }
|
||||
-keep class javax.activation.** { *; }
|
||||
-keep class com.sun.mail.** { *; }
|
||||
-keep class com.sun.mail.util.** { *; }
|
||||
-keep class com.sun.mail.smtp.** { *; }
|
||||
-keep class com.sun.mail.pop3.** { *; }
|
||||
-keep class com.sun.mail.imap.** { *; }
|
||||
-dontwarn javax.mail.**
|
||||
-dontwarn javax.activation.**
|
||||
-dontwarn com.sun.mail.**
|
||||
-dontwarn java.awt.**
|
||||
-dontwarn javax.naming.**
|
||||
-dontwarn javax.net.ssl.**
|
||||
|
||||
# OkHttp 4.4.1(米盟广告请求依赖,完善Lambda兼容)
|
||||
-keep class okhttp3.** { *; }
|
||||
-keep interface okhttp3.** { *; }
|
||||
|
||||
+8
-2
@@ -22,6 +22,7 @@ import cc.winboll.studio.powerbell.models.ThoughtfulServiceBean;
|
||||
import cc.winboll.studio.powerbell.utils.ChargeMailNotifyHelper;
|
||||
import cc.winboll.studio.powerbell.utils.ChargeMailNotifyFloatWindow;
|
||||
import cc.winboll.studio.powerbell.threads.RemindThread;
|
||||
import cc.winboll.studio.powerbell.services.ControlCenterService;
|
||||
import android.widget.Switch;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -262,8 +263,13 @@ public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivit
|
||||
LogUtils.d(TAG, "onChargeMailNotifySwitchChanged: 充电邮件通知开关状态=" + isChecked);
|
||||
ChargeMailNotifyHelper.setEnabled(this, isChecked);
|
||||
updateSMTPConfigViewEnabled(isChecked);
|
||||
// 关闭时停止RemindThread并关闭悬浮窗
|
||||
if (!isChecked) {
|
||||
if (isChecked) {
|
||||
// 开启时重启ControlCenterService
|
||||
LogUtils.d(TAG, "onChargeMailNotifySwitchChanged: 开启充电邮件通知,重启ControlCenterService");
|
||||
stopService(new Intent(this, ControlCenterService.class));
|
||||
startService(new Intent(this, ControlCenterService.class));
|
||||
} else {
|
||||
// 关闭时停止RemindThread并关闭悬浮窗
|
||||
LogUtils.d(TAG, "onChargeMailNotifySwitchChanged: 关闭充电邮件通知,停止RemindThread");
|
||||
RemindThread.stopRemindThread();
|
||||
LogUtils.d(TAG, "onChargeMailNotifySwitchChanged: 关闭充电邮件通知悬浮窗");
|
||||
|
||||
+32
-18
@@ -3,10 +3,12 @@ package cc.winboll.studio.powerbell.handlers;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
import cc.winboll.studio.powerbell.models.NotificationMessage;
|
||||
import cc.winboll.studio.powerbell.models.ThoughtfulServiceBean;
|
||||
import cc.winboll.studio.powerbell.services.ControlCenterService;
|
||||
import cc.winboll.studio.powerbell.threads.TTSRemindThread;
|
||||
import cc.winboll.studio.powerbell.utils.ChargeMailNotifyHelper;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
@@ -85,11 +87,7 @@ public class ControlCenterServiceHandler extends Handler {
|
||||
private void handleRemindMessage(ControlCenterService service, String remindType, int currentBattery, boolean isCharging) {
|
||||
LogUtils.d(TAG, "handleRemindMessage: 开始处理提醒消息 | type=" + remindType + " | battery=" + currentBattery + " | isCharging=" + isCharging);
|
||||
|
||||
// 1. 前置校验:通知工具类+参数有效性
|
||||
if (service.getNotificationManager() == null) {
|
||||
LogUtils.e(TAG, "handleRemindMessage: 通知管理工具类未初始化,无法发送提醒");
|
||||
return;
|
||||
}
|
||||
// 1. 前置校验:参数有效性
|
||||
if (!REMIND_TYPE_CHARGE.equals(remindType) && !REMIND_TYPE_USAGE.equals(remindType)) {
|
||||
LogUtils.w(TAG, "handleRemindMessage: 提醒类型无效,忽略 | type=" + remindType + " | 允许值:" + REMIND_TYPE_CHARGE + "/" + REMIND_TYPE_USAGE);
|
||||
return;
|
||||
@@ -99,24 +97,40 @@ public class ControlCenterServiceHandler extends Handler {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 构建通知模型,使用统一格式
|
||||
NotificationMessage remindMsg = new NotificationMessage();
|
||||
// 2. 构建提醒内容
|
||||
String chargeStateDesc = isCharging ? CHARGE_STATE_CHARGING : CHARGE_STATE_NOT_CHARGING;
|
||||
String content;
|
||||
if (REMIND_TYPE_CHARGE.equals(remindType)) {
|
||||
remindMsg.setTitle(CHARGE_REMIND_TITLE);
|
||||
remindMsg.setContent(String.format(CHARGE_REMIND_CONTENT_FORMAT, currentBattery, chargeStateDesc));
|
||||
remindMsg.setRemindMSG("charge_remind");
|
||||
content = String.format(CHARGE_REMIND_CONTENT_FORMAT, currentBattery, chargeStateDesc);
|
||||
} else {
|
||||
remindMsg.setTitle(USAGE_REMIND_TITLE);
|
||||
remindMsg.setContent(String.format(USAGE_REMIND_CONTENT_FORMAT, currentBattery, chargeStateDesc));
|
||||
remindMsg.setRemindMSG("usage_remind");
|
||||
content = String.format(USAGE_REMIND_CONTENT_FORMAT, currentBattery, chargeStateDesc);
|
||||
}
|
||||
LogUtils.d(TAG, "handleRemindMessage: 通知模型构建完成 | title=" + remindMsg.getTitle() + " | content=" + remindMsg.getContent());
|
||||
LogUtils.d(TAG, "handleRemindMessage: 提醒内容构建完成 | content=" + content);
|
||||
|
||||
// 3. 调用通知工具类发送提醒
|
||||
LogUtils.d(TAG, "handleRemindMessage: 调用通知工具类发送提醒 | remindMSG=" + remindMsg.getRemindMSG());
|
||||
service.getNotificationManager().showRemindNotification(service, remindMsg);
|
||||
LogUtils.d(TAG, "handleRemindMessage: 提醒通知发送流程执行完毕");
|
||||
// 3. 根据 ChargeMailNotify 状态选择提醒方式
|
||||
if (ChargeMailNotifyHelper.isEnabled(service)) {
|
||||
// 启用邮件通知时,使用 Toast 代替通知栏
|
||||
LogUtils.d(TAG, "handleRemindMessage: 充电邮件通知已启用,使用 Toast 提醒");
|
||||
ToastUtils.show(content);
|
||||
} else {
|
||||
// 未启用邮件通知时,使用通知栏提醒
|
||||
if (service.getNotificationManager() == null) {
|
||||
LogUtils.e(TAG, "handleRemindMessage: 通知管理工具类未初始化,无法发送提醒");
|
||||
return;
|
||||
}
|
||||
NotificationMessage remindMsg = new NotificationMessage();
|
||||
if (REMIND_TYPE_CHARGE.equals(remindType)) {
|
||||
remindMsg.setTitle(CHARGE_REMIND_TITLE);
|
||||
remindMsg.setRemindMSG("charge_remind");
|
||||
} else {
|
||||
remindMsg.setTitle(USAGE_REMIND_TITLE);
|
||||
remindMsg.setRemindMSG("usage_remind");
|
||||
}
|
||||
remindMsg.setContent(content);
|
||||
LogUtils.d(TAG, "handleRemindMessage: 调用通知工具类发送提醒 | remindMSG=" + remindMsg.getRemindMSG());
|
||||
service.getNotificationManager().showRemindNotification(service, remindMsg);
|
||||
}
|
||||
LogUtils.d(TAG, "handleRemindMessage: 提醒流程执行完毕");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -95,9 +95,10 @@ public class ControlCenterService extends Service {
|
||||
LogUtils.d(TAG, "onDestroy() 执行:服务销毁流程启动");
|
||||
super.onDestroy();
|
||||
|
||||
// 资源释放顺序:前台服务 → 线程 → 广播接收器 → Handler → 通知 → 引用(避免内存泄漏)
|
||||
// 资源释放顺序:前台服务 → 线程 → 悬浮窗 → 广播接收器 → Handler → 通知 → 引用(避免内存泄漏)
|
||||
stopForegroundService();
|
||||
RemindThread.stopRemindThread();
|
||||
ChargeMailNotifyFloatWindow.dismissWindow();
|
||||
releaseBroadcastReceiver();
|
||||
destroyHandler();
|
||||
releaseNotificationResource();
|
||||
|
||||
@@ -190,11 +190,13 @@ public class RemindThread extends Thread {
|
||||
break;
|
||||
}
|
||||
|
||||
// 启动电量通知 TTS 语音提醒线程
|
||||
TTSRemindThread.start(this.mContext, App.sQuantityOfElectricity, isCharging);
|
||||
// 启动电量通知邮件提醒线程(仅在充电邮件通知功能启用时)
|
||||
// 根据 ChargeMailNotify 功能状态选择提醒方式
|
||||
if (ChargeMailNotifyHelper.isEnabled(this.mContext)) {
|
||||
// 启用电邮件提醒,不使用 TTS
|
||||
APPMSGMailRemindThread.start(this.mContext, App.sQuantityOfElectricity, isCharging);
|
||||
} else {
|
||||
// 未启用邮件提醒,使用 TTS 语音提醒
|
||||
TTSRemindThread.start(this.mContext, App.sQuantityOfElectricity, isCharging);
|
||||
}
|
||||
|
||||
// 安全休眠,保留中断标记
|
||||
@@ -288,10 +290,11 @@ public class RemindThread extends Thread {
|
||||
*/
|
||||
private void cleanThreadStateInternal() {
|
||||
LogUtils.d(TAG, String.format("cleanThreadStateInternal() 调用 | threadId=%d", getId()));
|
||||
TTSRemindThread.stopTTS();
|
||||
// 仅在充电邮件通知功能启用时停止邮件提醒线程
|
||||
// 根据 ChargeMailNotify 功能状态停止对应的提醒线程
|
||||
if (ChargeMailNotifyHelper.isEnabled(this.mContext)) {
|
||||
APPMSGMailRemindThread.stopMail();
|
||||
} else {
|
||||
TTSRemindThread.stopTTS();
|
||||
}
|
||||
isReminding = false;
|
||||
isExist = true;
|
||||
|
||||
@@ -15,11 +15,32 @@
|
||||
android:src="@drawable/ic_email"
|
||||
android:layout_marginRight="8dp"/>
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="充电邮件通知服务已启用"
|
||||
android:textColor="#FF000000"
|
||||
android:textSize="14sp"/>
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="充电邮件通知服务已启用"
|
||||
android:textColor="#FF000000"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TTS语音播放功能已禁用"
|
||||
android:textColor="#FF666666"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="电量提醒通知栏功能已禁用"
|
||||
android:textColor="#FF666666"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user