Compare commits
8 Commits
powerbell-
...
powerbell-
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d69d4da09 | |||
| c98685440d | |||
| 7183338c97 | |||
| e18ed1b0fd | |||
| 98c334f442 | |||
| 9d42a3e1e9 | |||
| 411af44303 | |||
| 9afb072351 |
87
.github/workflows/android.yml
vendored
87
.github/workflows/android.yml
vendored
@@ -1,87 +0,0 @@
|
||||
name: Android CI
|
||||
|
||||
# 触发器
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- *-beta
|
||||
pull_request:
|
||||
tags:
|
||||
- *-beta
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# 设置 JDK 环境
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
# 获取应用打包秘钥库
|
||||
- name: Checkout Android Keystore
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: zhangsken/keystore # 存储应用打包用的 keystore 的仓库(格式:用户名/仓库名)
|
||||
token: ${{ secrets.APP_SECRET_TOKEN_1 }} # 连接仓库的 token , 需要单独配置
|
||||
path: keystore # 仓库的根目录名
|
||||
|
||||
# 打包 Stage Release 版本应用
|
||||
- name: Build with Gradle
|
||||
run: bash ./gradlew assembleBetaRelease
|
||||
# 创建release
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.APP_SECRET_TOKEN_1 }}
|
||||
# GitHub 会自动创建 GITHUB_TOKEN 密码以在工作流程中使用。
|
||||
# 您可以使用 GITHUB_TOKEN 在工作流程运行中进行身份验证。
|
||||
# 当您启用 GitHub Actions 时,GitHub 在您的仓库中安装 GitHub 应用程序。
|
||||
# GITHUB_TOKEN 密码是一种 GitHub 应用程序 安装访问令牌。
|
||||
# 您可以使用安装访问令牌代表仓库中安装的 GitHub 应用程序 进行身份验证。
|
||||
# 令牌的权限仅限于包含您的工作流程的仓库。 更多信息请参阅“GITHUB_TOKEN 的权限”。
|
||||
# 在每个作业开始之前, GitHub 将为作业提取安装访问令牌。 令牌在作业完成后过期。
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
# 获取 APK 版本号
|
||||
- name: Get Version Name
|
||||
uses: actions/github-script@v3
|
||||
id: get-version
|
||||
with:
|
||||
script: |
|
||||
const str=process.env.GITHUB_REF;
|
||||
return str.substring(str.indexOf("v"));
|
||||
result-encoding: string
|
||||
# 上传至 Release 的资源
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.APP_SECRET_TOKEN_1 }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }} # 上传网址,无需改动
|
||||
#asset_path: app/build/outputs/apk/release/app-release.apk # 上传路径(Release)
|
||||
asset_path: app/build/outputs/apk/beta/release/app-beta-release.apk # 上传路径(WinBoll Stage Release)
|
||||
asset_name: WinBoll-${{steps.get-version.outputs.result}}0.apk # 资源名
|
||||
asset_content_type: application/vnd.android.package-archiv # 资源类型
|
||||
|
||||
# 存档打包的文件
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build
|
||||
path: app/build/outputs # 将打包之后的文件全部上传(里面会有混淆的 map 文件)
|
||||
@@ -87,7 +87,7 @@ dependencies {
|
||||
//api 'cc.winboll.studio:libappbase:15.12.2'
|
||||
|
||||
// WinBoLL备用库 jitpack.io 地址
|
||||
api 'com.github.ZhanGSKen:AES:aes-v15.12.8'
|
||||
api 'com.github.ZhanGSKen:AES:aes-v15.12.9'
|
||||
api 'com.github.ZhanGSKen:APPBase:appbase-v15.14.1'
|
||||
|
||||
//api fileTree(dir: 'libs', include: ['*.aar'])
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Wed Dec 31 20:53:46 HKT 2025
|
||||
stageCount=46
|
||||
#Mon Jan 05 19:22:24 HKT 2026
|
||||
stageCount=47
|
||||
libraryProject=
|
||||
baseVersion=15.14
|
||||
publishVersion=15.14.45
|
||||
publishVersion=15.14.46
|
||||
buildCount=0
|
||||
baseBetaVersion=15.14.46
|
||||
baseBetaVersion=15.14.47
|
||||
|
||||
@@ -15,19 +15,21 @@ import cc.winboll.studio.powerbell.utils.NotificationManagerUtils;
|
||||
import cc.winboll.studio.powerbell.views.MemoryCachedBackgroundView;
|
||||
|
||||
/**
|
||||
* 应用全局入口类(适配Android API 30,基于Java 7编写)
|
||||
* 应用全局入口类
|
||||
* 适配:Java7 语法规范 | Android API30 系统版本
|
||||
* 核心策略:极致强制缓存 - 无论内存紧张程度,永不自动清理任何缓存(Bitmap/视图控件/路径记录)
|
||||
*
|
||||
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
|
||||
* @Version 1.0.0
|
||||
* @Date 2025-12-29
|
||||
* @Date 2025-12-29 15:30:00
|
||||
* @LastModified 2026-01-02 19:01:00
|
||||
*/
|
||||
public class App extends GlobalApplication {
|
||||
|
||||
// ==================== 常量定义 ====================
|
||||
|
||||
// ====================================== 常量区 - 置顶排序 (按功能归类) ======================================
|
||||
// 基础日志TAG
|
||||
private static final String TAG = "App";
|
||||
// 缓存保护专用TAG
|
||||
private static final String CACHE_PROTECT_TAG = "FORCE_CACHE_PROTECT";
|
||||
// 电池无效值常量(修复拼写错误:INVALID_BATTERY_VALUE)
|
||||
private static final int INVALID_BATTERY_VALUE = -1;
|
||||
|
||||
// 组件跳转常量
|
||||
@@ -40,268 +42,278 @@ public class App extends GlobalApplication {
|
||||
public static final String ACTION_SWITCHTO_CN1 = "cc.winboll.studio.powerbell.App.ACTION_SWITCHTO_CN1";
|
||||
public static final String ACTION_SWITCHTO_CN2 = "cc.winboll.studio.powerbell.App.ACTION_SWITCHTO_CN2";
|
||||
|
||||
// ==================== 静态属性 ====================
|
||||
|
||||
// ====================================== 静态属性区 - 全局单例/状态 (按核心程度排序) ======================================
|
||||
// 应用单例
|
||||
private static App sApp;
|
||||
|
||||
// 配置与缓存
|
||||
// 配置与缓存工具 (全局单例)
|
||||
public static AppConfigUtils sAppConfigUtils;
|
||||
private static AppCacheUtils sAppCacheUtils;
|
||||
|
||||
// 资源与视图缓存(强制驻留)
|
||||
// 资源与视图缓存 (强制驻留,极致缓存核心)
|
||||
public static BackgroundSourceUtils sBackgroundSourceUtils;
|
||||
public static BitmapCacheUtils sBitmapCacheUtils;
|
||||
private static MemoryCachedBackgroundView sMemoryCachedBackgroundView;
|
||||
|
||||
// 状态
|
||||
// 系统状态 (电池电量)
|
||||
public static volatile int sQuantityOfElectricity = INVALID_BATTERY_VALUE;
|
||||
|
||||
// 系统工具
|
||||
// 系统工具 (通知管理器)
|
||||
private static NotificationManagerUtils sNotificationManagerUtils;
|
||||
|
||||
// ==================== 成员属性 ====================
|
||||
|
||||
// ====================================== 成员属性区 - 非静态成员 (广播接收器) ======================================
|
||||
private GlobalApplicationReceiver mGlobalReceiver;
|
||||
|
||||
// ==================== 公共静态方法 (工具/单例) ====================
|
||||
|
||||
// ====================================== 公共静态方法 - 单例/工具获取 (对外入口) ======================================
|
||||
/**
|
||||
* 获取应用单例
|
||||
* 获取应用全局单例实例
|
||||
* @return 应用单例App实例
|
||||
*/
|
||||
public static App getInstance() {
|
||||
LogUtils.d(TAG, "getInstance() called | Result: " + sApp);
|
||||
LogUtils.d(TAG, "【getInstance】应用单例获取方法调用 | 当前实例:" + sApp);
|
||||
return sApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置工具实例
|
||||
* 获取配置工具类单例实例
|
||||
* @param context 上下文对象
|
||||
* @return 配置工具类AppConfigUtils实例
|
||||
*/
|
||||
public static AppConfigUtils getAppConfigUtils(Context context) {
|
||||
String contextName = context != null ? context.getClass().getSimpleName() : "null";
|
||||
LogUtils.d(TAG, "getAppConfigUtils() called with: context = [" + contextName + "]");
|
||||
String contextClass = context != null ? context.getClass().getSimpleName() : "null";
|
||||
LogUtils.d(TAG, "【getAppConfigUtils】配置工具获取方法调用 | 入参Context类型:" + contextClass);
|
||||
|
||||
if (sAppConfigUtils == null) {
|
||||
sAppConfigUtils = AppConfigUtils.getInstance(context);
|
||||
LogUtils.d(TAG, "getAppConfigUtils: Initialized new instance");
|
||||
LogUtils.d(TAG, "【getAppConfigUtils】配置工具实例为空,已初始化新实例");
|
||||
}
|
||||
return sAppConfigUtils;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存工具实例
|
||||
* 获取缓存工具类单例实例
|
||||
* @param context 上下文对象
|
||||
* @return 缓存工具类AppCacheUtils实例
|
||||
*/
|
||||
public static AppCacheUtils getAppCacheUtils(Context context) {
|
||||
String contextName = context != null ? context.getClass().getSimpleName() : "null";
|
||||
LogUtils.d(TAG, "getAppCacheUtils() called with: context = [" + contextName + "]");
|
||||
String contextClass = context != null ? context.getClass().getSimpleName() : "null";
|
||||
LogUtils.d(TAG, "【getAppCacheUtils】缓存工具获取方法调用 | 入参Context类型:" + contextClass);
|
||||
|
||||
if (sAppCacheUtils == null) {
|
||||
sAppCacheUtils = AppCacheUtils.getInstance(context);
|
||||
LogUtils.d(TAG, "getAppCacheUtils: Initialized new instance");
|
||||
LogUtils.d(TAG, "【getAppCacheUtils】缓存工具实例为空,已初始化新实例");
|
||||
}
|
||||
return sAppCacheUtils;
|
||||
}
|
||||
|
||||
// ==================== 公共成员方法 (业务) ====================
|
||||
|
||||
// ====================================== 公共成员方法 - 业务逻辑 (实例方法) ======================================
|
||||
/**
|
||||
* 清除电池历史数据
|
||||
*/
|
||||
public void clearBatteryHistory() {
|
||||
LogUtils.d(TAG, "clearBatteryHistory() called");
|
||||
LogUtils.d(TAG, "【clearBatteryHistory】清除电池历史数据方法调用");
|
||||
if (sAppCacheUtils != null) {
|
||||
sAppCacheUtils.clearBatteryHistory();
|
||||
LogUtils.d(TAG, "clearBatteryHistory: Success");
|
||||
LogUtils.d(TAG, "【clearBatteryHistory】电池历史数据清除成功");
|
||||
} else {
|
||||
LogUtils.w(TAG, "clearBatteryHistory: Failed, sAppCacheUtils is null");
|
||||
LogUtils.w(TAG, "【clearBatteryHistory】电池历史数据清除失败 | 缓存工具实例sAppCacheUtils为空");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动清理所有缓存(仅主动调用生效)
|
||||
*/
|
||||
public static void manualClearAllCache() {
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "manualClearAllCache() called - Manual trigger only");
|
||||
|
||||
if (sBitmapCacheUtils != null) {
|
||||
sBitmapCacheUtils.clearAllCache();
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "manualClearAllCache: Bitmap cache cleared");
|
||||
}
|
||||
|
||||
// 仅置空引用,不销毁实例(符合极致缓存策略)
|
||||
if (sMemoryCachedBackgroundView != null) {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "manualClearAllCache: View cache reference cleared");
|
||||
sMemoryCachedBackgroundView = null;
|
||||
}
|
||||
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "manualClearAllCache: Manual cleanup finished");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视图缓存实例
|
||||
* @return 视图缓存MemoryCachedBackgroundView实例
|
||||
*/
|
||||
public MemoryCachedBackgroundView getMemoryCachedBackgroundView() {
|
||||
LogUtils.d(TAG, "getMemoryCachedBackgroundView() called | Current: " + sMemoryCachedBackgroundView);
|
||||
LogUtils.d(TAG, "【getMemoryCachedBackgroundView】视图缓存获取方法调用 | 当前实例:" + sMemoryCachedBackgroundView);
|
||||
return sMemoryCachedBackgroundView;
|
||||
}
|
||||
|
||||
// ====================================== 公共静态方法 - 业务逻辑 (全局工具方法) ======================================
|
||||
/**
|
||||
* 发送通知消息
|
||||
* 手动清理所有缓存(仅主动调用生效,符合极致缓存策略)
|
||||
*/
|
||||
public static void manualClearAllCache() {
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "【manualClearAllCache】手动清理缓存方法调用 | 仅主动触发生效");
|
||||
|
||||
// 清理Bitmap缓存
|
||||
if (sBitmapCacheUtils != null) {
|
||||
sBitmapCacheUtils.clearAllCache();
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【manualClearAllCache】Bitmap缓存已清理");
|
||||
}
|
||||
|
||||
// 仅置空视图缓存引用,不销毁实例(极致缓存策略)
|
||||
if (sMemoryCachedBackgroundView != null) {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【manualClearAllCache】视图缓存引用已置空 | 实例保留");
|
||||
sMemoryCachedBackgroundView = null;
|
||||
}
|
||||
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "【manualClearAllCache】手动清理缓存操作完成");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送通知消息(仅调试模式下生效)
|
||||
* @param title 通知标题
|
||||
* @param content 通知内容
|
||||
*/
|
||||
public static void notifyMessage(String title, String content) {
|
||||
LogUtils.d(TAG, "notifyMessage() called with: title = [" + title + "], content = [" + content + "]");
|
||||
LogUtils.d(TAG, "【notifyMessage】发送通知消息方法调用 | 标题:" + title + " | 内容:" + content);
|
||||
|
||||
boolean canSend = isDebugging() && sApp != null && sNotificationManagerUtils != null;
|
||||
if (canSend) {
|
||||
NotificationMessage message = new NotificationMessage(title, content, "");
|
||||
sNotificationManagerUtils.showMessageNotification(sApp, message);
|
||||
LogUtils.d(TAG, "notifyMessage: Sent successfully");
|
||||
LogUtils.d(TAG, "【notifyMessage】通知消息发送成功");
|
||||
} else {
|
||||
LogUtils.d(TAG, "notifyMessage: Send failed, conditions not met");
|
||||
LogUtils.d(TAG, "【notifyMessage】通知消息发送失败 | 条件不满足:调试模式=" + isDebugging() + " | 应用实例=" + (sApp != null) + " | 通知工具=" + (sNotificationManagerUtils != null));
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 生命周期方法 ====================
|
||||
|
||||
// ====================================== 生命周期方法 - 应用全局生命周期 (重写父类方法) ======================================
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
LogUtils.d(TAG, "onCreate() called | Initializing application...");
|
||||
LogUtils.d(TAG, "【onCreate】应用启动生命周期方法调用 | 开始初始化应用...");
|
||||
|
||||
// 初始化应用单例与调试模式
|
||||
sApp = this;
|
||||
setIsDebugging(BuildConfig.DEBUG);
|
||||
LogUtils.d(TAG, "onCreate: Debug mode = " + BuildConfig.DEBUG);
|
||||
LogUtils.d(TAG, "【onCreate】应用单例已初始化 | 调试模式:" + BuildConfig.DEBUG);
|
||||
|
||||
// 初始化核心组件
|
||||
initBaseTools();
|
||||
initUtils();
|
||||
initReceiver();
|
||||
|
||||
LogUtils.d(TAG, "onCreate: Application initialization completed. Force-cache strategy active.");
|
||||
LogUtils.d(TAG, "【onCreate】应用初始化完成 | 极致强制缓存策略已激活");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
LogUtils.d(TAG, "onTerminate() called | Releasing non-cache resources");
|
||||
LogUtils.d(TAG, "【onTerminate】应用终止生命周期方法调用 | 开始释放非缓存资源...");
|
||||
|
||||
// 仅释放非缓存资源
|
||||
// 释放非缓存资源
|
||||
ToastUtils.release();
|
||||
releaseNotificationManager();
|
||||
releaseReceiver();
|
||||
|
||||
// 核心策略:不清理缓存
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "onTerminate: Force-cache active, caches remain in memory");
|
||||
LogUtils.d(TAG, "onTerminate: Non-cache resources released");
|
||||
// 核心策略:不清理任何缓存
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "【onTerminate】极致缓存策略生效 | 所有缓存将保留在内存中");
|
||||
LogUtils.d(TAG, "【onTerminate】非缓存资源释放完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
super.onTrimMemory(level);
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "onTrimMemory() called with level: " + level + " | Ignoring, caches protected");
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "【onTrimMemory】系统内存修剪回调 | 内存等级:" + level + " | 忽略修剪,缓存强制保护");
|
||||
logDetailedCacheStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "onLowMemory() called | Force-cache active, no cleanup performed");
|
||||
LogUtils.w(CACHE_PROTECT_TAG, "【onLowMemory】系统低内存回调 | 极致缓存策略生效 | 不执行任何缓存清理操作");
|
||||
logDetailedCacheStatus();
|
||||
}
|
||||
|
||||
// ==================== 私有初始化方法 ====================
|
||||
|
||||
// ====================================== 私有初始化方法 - 组件初始化 (按依赖顺序排序) ======================================
|
||||
/**
|
||||
* 初始化基础工具类
|
||||
* 初始化基础工具类(Activity管理、Toast、通知管理器)
|
||||
*/
|
||||
private void initBaseTools() {
|
||||
LogUtils.d(TAG, "initBaseTools: Starting...");
|
||||
LogUtils.d(TAG, "【initBaseTools】基础工具类初始化开始...");
|
||||
WinBoLLActivityManager.init(this);
|
||||
ToastUtils.init(this);
|
||||
sNotificationManagerUtils = new NotificationManagerUtils(this);
|
||||
LogUtils.d(TAG, "initBaseTools: Completed");
|
||||
LogUtils.d(TAG, "【initBaseTools】基础工具类初始化完成");
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化核心工具与缓存(极致强制驻留)
|
||||
* 初始化核心工具与缓存(极致强制驻留,缓存核心)
|
||||
*/
|
||||
private void initUtils() {
|
||||
LogUtils.d(TAG, "initUtils: Starting with force-cache strategy");
|
||||
LogUtils.d(TAG, "【initUtils】核心工具与缓存初始化开始 | 极致缓存策略激活");
|
||||
|
||||
// 1. 配置与基础缓存
|
||||
// 1. 配置与基础缓存工具初始化
|
||||
sAppConfigUtils = getAppConfigUtils(this);
|
||||
sAppCacheUtils = getAppCacheUtils(this);
|
||||
|
||||
// 2. 资源与Bitmap缓存
|
||||
// 2. 资源与Bitmap缓存工具初始化(永久驻留)
|
||||
sBackgroundSourceUtils = BackgroundSourceUtils.getInstance(this);
|
||||
sBackgroundSourceUtils.loadSettings();
|
||||
sBitmapCacheUtils = BitmapCacheUtils.getInstance();
|
||||
LogUtils.d(TAG, "initUtils: Resource & Bitmap tools initialized (Permanent)");
|
||||
LogUtils.d(TAG, "【initUtils】资源与Bitmap缓存工具初始化完成 | 永久驻留内存");
|
||||
|
||||
// 3. 视图缓存
|
||||
// 3. 视图缓存初始化(永久驻留,无实例则创建)
|
||||
sMemoryCachedBackgroundView = MemoryCachedBackgroundView.getLastInstance(this);
|
||||
if (sMemoryCachedBackgroundView == null) {
|
||||
sMemoryCachedBackgroundView = MemoryCachedBackgroundView.getInstance(this, sBackgroundSourceUtils.getCurrentBackgroundBean(), true);
|
||||
LogUtils.d(TAG, "initUtils: View cache - New instance created");
|
||||
LogUtils.d(TAG, "【initUtils】视图缓存无现有实例,已创建新实例");
|
||||
}
|
||||
LogUtils.d(TAG, "initUtils: View cache initialized (Permanent)");
|
||||
LogUtils.d(TAG, "【initUtils】视图缓存初始化完成 | 永久驻留内存");
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册全局广播接收器
|
||||
*/
|
||||
private void initReceiver() {
|
||||
LogUtils.d(TAG, "initReceiver: Starting...");
|
||||
LogUtils.d(TAG, "【initReceiver】全局广播接收器注册开始...");
|
||||
mGlobalReceiver = new GlobalApplicationReceiver(this);
|
||||
mGlobalReceiver.registerAction();
|
||||
LogUtils.d(TAG, "initReceiver: Completed");
|
||||
LogUtils.d(TAG, "【initReceiver】全局广播接收器注册完成");
|
||||
}
|
||||
|
||||
// ==================== 私有释放方法 ====================
|
||||
|
||||
// ====================================== 私有释放方法 - 资源释放 (按创建逆序排序) ======================================
|
||||
/**
|
||||
* 释放广播接收器
|
||||
* 释放全局广播接收器
|
||||
*/
|
||||
private void releaseReceiver() {
|
||||
LogUtils.d(TAG, "releaseReceiver: Starting...");
|
||||
LogUtils.d(TAG, "【releaseReceiver】全局广播接收器释放开始...");
|
||||
if (mGlobalReceiver != null) {
|
||||
mGlobalReceiver.unregisterAction();
|
||||
mGlobalReceiver = null;
|
||||
LogUtils.d(TAG, "releaseReceiver: Completed");
|
||||
LogUtils.d(TAG, "【releaseReceiver】全局广播接收器释放完成");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放通知管理器
|
||||
* 释放通知管理器资源
|
||||
*/
|
||||
private void releaseNotificationManager() {
|
||||
LogUtils.d(TAG, "releaseNotificationManager: Starting...");
|
||||
LogUtils.d(TAG, "【releaseNotificationManager】通知管理器资源释放开始...");
|
||||
if (sNotificationManagerUtils != null) {
|
||||
sNotificationManagerUtils.release();
|
||||
sNotificationManagerUtils = null;
|
||||
LogUtils.d(TAG, "releaseNotificationManager: Completed");
|
||||
LogUtils.d(TAG, "【releaseNotificationManager】通知管理器资源释放完成");
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 私有辅助方法 ====================
|
||||
|
||||
// ====================================== 私有辅助方法 - 日志/工具 (辅助功能) ======================================
|
||||
/**
|
||||
* 记录当前缓存详细状态(用于调试监控)
|
||||
* 记录当前缓存详细状态(用于调试监控,极致缓存策略监控)
|
||||
*/
|
||||
private void logDetailedCacheStatus() {
|
||||
LogUtils.d(TAG, "logDetailedCacheStatus: Reporting cache state");
|
||||
LogUtils.d(TAG, "【logDetailedCacheStatus】缓存状态监控日志开始...");
|
||||
|
||||
// Bitmap缓存状态
|
||||
if (sBitmapCacheUtils != null) {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "Cache Status: BitmapCache [Valid]");
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【缓存状态】BitmapCache - 有效");
|
||||
try {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "Cache Detail: Bitmap Count = " + sBitmapCacheUtils.getCacheCount());
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【缓存详情】Bitmap缓存数量:" + sBitmapCacheUtils.getCacheCount());
|
||||
} catch (Exception e) {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "Cache Detail: Failed to get bitmap count - " + e.getMessage());
|
||||
LogUtils.e(CACHE_PROTECT_TAG, "【缓存详情】获取Bitmap缓存数量失败", e);
|
||||
}
|
||||
} else {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【缓存状态】BitmapCache - 未初始化");
|
||||
}
|
||||
|
||||
// 视图缓存状态
|
||||
if (sMemoryCachedBackgroundView != null) {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "Cache Status: ViewCache [Valid]");
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "Cache Detail: View Instance Count = " + MemoryCachedBackgroundView.getInstanceCount());
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【缓存状态】ViewCache - 有效");
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【缓存详情】视图实例数量:" + MemoryCachedBackgroundView.getInstanceCount());
|
||||
} else {
|
||||
LogUtils.d(CACHE_PROTECT_TAG, "【缓存状态】ViewCache - 引用已置空(实例可能保留)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,118 +13,131 @@
|
||||
android:gravity="center_vertical"
|
||||
style="@style/DefaultAToolbar"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_frame"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TTS语音服务设置:"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="<仅限在切换充电状态时,发送的TTS语音提醒。用于提醒用户当前的服务设置状态。>"
|
||||
android:textSize="12sp"/>
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="用电提醒启用时的TTS贴心服务"
|
||||
android:onClick="onEnableUsePowerTts"
|
||||
android:id="@+id/activitysettingsCheckBox1"/>
|
||||
android:background="@drawable/bg_frame"
|
||||
android:padding="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="充电提醒启用时的TTS贴心服务"
|
||||
android:onClick="onEnableChargeTts"
|
||||
android:id="@+id/activitysettingsCheckBox2"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TTS语音服务设置:"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="<仅限在切换充电状态时,发送的TTS语音提醒。用于提醒用户当前的服务设置状态。>"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="用电提醒启用时的TTS贴心服务"
|
||||
android:onClick="onEnableUsePowerTts"
|
||||
android:id="@+id/activitysettingsCheckBox1"/>
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="充电提醒启用时的TTS贴心服务"
|
||||
android:onClick="onEnableChargeTts"
|
||||
android:id="@+id/activitysettingsCheckBox2"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="检查TTS语音悬浮窗权限"
|
||||
android:padding="10dp"
|
||||
android:onClick="onCheckTTSDrawOverlaysPermission"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_frame"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="电量图表绘制风格设置:"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<cc.winboll.studio.powerbell.views.BatteryStyleView
|
||||
android:id="@+id/battery_style_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1200dp"
|
||||
app:batteryPreviewColor="@color/colorPrimary"
|
||||
app:previewBatteryValue="100"
|
||||
app:defaultSelectedStyle="zebra_style"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right">
|
||||
android:background="@drawable/bg_frame"
|
||||
android:padding="10dp">
|
||||
|
||||
<Button
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="检查TTS语音悬浮窗权限"
|
||||
android:padding="10dp"
|
||||
android:onClick="onCheckTTSDrawOverlaysPermission"/>
|
||||
android:text="米盟广告SDK设置:"/>
|
||||
|
||||
<cc.winboll.studio.libaes.views.ADsControlView
|
||||
android:id="@+id/ads_control_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_frame"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="米盟广告SDK设置:"/>
|
||||
|
||||
<cc.winboll.studio.libaes.views.ADsControlView
|
||||
android:id="@+id/ads_control_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_frame"
|
||||
android:padding="10dp"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="电量图表绘制风格设置:"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<cc.winboll.studio.powerbell.views.BatteryStyleView
|
||||
android:id="@+id/battery_style_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1200dp"
|
||||
app:batteryPreviewColor="@color/colorPrimary"
|
||||
app:previewBatteryValue="100"
|
||||
app:defaultSelectedStyle="zebra_style"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user