From 10b8da2e2140ba91708b5441ceb989b8c9d13aee Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 22 Oct 2025 18:35:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BA=94=E7=94=A8=E7=94=B5?= =?UTF-8?q?=E9=87=8F=E6=8A=A5=E5=91=8A=E6=98=BE=E7=A4=BA=E9=A3=8E=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E7=B2=BE=E7=AE=80=E5=86=97=E4=BD=99=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- powerbell/build.properties | 4 +- .../activities/BatteryReportActivity.java | 60 +++---------------- 2 files changed, 10 insertions(+), 54 deletions(-) diff --git a/powerbell/build.properties b/powerbell/build.properties index c41fd01..52f4335 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Wed Oct 22 10:25:50 GMT 2025 +#Wed Oct 22 10:33:32 GMT 2025 stageCount=16 libraryProject= baseVersion=15.4 publishVersion=15.4.15 -buildCount=1 +buildCount=2 baseBetaVersion=15.4.16 diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BatteryReportActivity.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BatteryReportActivity.java index 9e63ea5..7a6bf84 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BatteryReportActivity.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BatteryReportActivity.java @@ -36,8 +36,6 @@ import cc.winboll.studio.libappbase.LogUtils; public class BatteryReportActivity extends Activity { public static final String TAG = "BatteryReportActivity"; - // 目标应用包名常量(统一维护,数据计算核心标识) - private static final String TARGET_APP_PACKAGE = "cc.winboll.studio.mymessagemanager"; private RecyclerView rvBatteryReport; private BatteryReportAdapter adapter; @@ -78,8 +76,6 @@ public class BatteryReportActivity extends Activity { loadAllAppPackage(); // 2. 预缓存所有包名对应的应用名称(为搜索名称做准备) preCacheAllAppNames(); - // 3. 强制添加目标应用(包名兜底) - //forceAddTargetPackage(); // 4. 首次获取运行时长(key:包名) appRunTimeCache = getAppRunTime(); // 5. 更新时长到数据模型(用包名匹配) @@ -157,7 +153,7 @@ public class BatteryReportActivity extends Activity { dataList.add(new AppBatteryModel(packageName, "0.0", 0)); } - LogUtils.d(TAG, "应用包名列表加载完成,共添加" + dataList.size() + "个包名。" ); + LogUtils.d(TAG, "应用包名列表加载完成,共添加" + dataList.size() + "个包名。"); } /** @@ -194,31 +190,6 @@ public class BatteryReportActivity extends Activity { } } - /** - * 强制添加目标包名(兜底逻辑,仅操作包名) - */ - private void forceAddTargetPackage() { - // 1. 先检查列表中是否已存在目标包名 - boolean isTargetExists = false; - for (AppBatteryModel model : dataList) { - if (TARGET_APP_PACKAGE.equals(model.getPackageName())) { - isTargetExists = true; - break; - } - } - - if (isTargetExists) { - LogUtils.d(TAG, "目标包名已在列表中,无需重复添加"); - return; - } - - // 2. 仅用包名创建模型,强制添加(不依赖名称查询) - dataList.add(0, new AppBatteryModel(TARGET_APP_PACKAGE, "0.0", 0)); - // 同步更新名称缓存 - packageToAppNameCache.put(TARGET_APP_PACKAGE, getAppNameByPackage(TARGET_APP_PACKAGE)); - LogUtils.d(TAG, "强制添加目标包名成功:" + TARGET_APP_PACKAGE); - } - /** * 更新运行时长到模型(用包名匹配,不涉及名称) */ @@ -251,7 +222,6 @@ public class BatteryReportActivity extends Activity { filteredList.addAll(dataList); } else { String lowerKeyword = keyword.toLowerCase(); // 统一转为小写,实现不区分大小写搜索 - boolean isTargetMatched = false; for (AppBatteryModel model : dataList) { String packageName = model.getPackageName(); @@ -266,21 +236,7 @@ public class BatteryReportActivity extends Activity { if (isMatched) { filteredList.add(model); - // 检查是否是目标包名 - if (TARGET_APP_PACKAGE.equals(packageName)) { - isTargetMatched = true; - } - } - } - // 兜底:目标包名未匹配时强制添加 - if (!isTargetMatched) { - for (AppBatteryModel model : dataList) { - if (TARGET_APP_PACKAGE.equals(model.getPackageName())) { - filteredList.add(0, model); - LogUtils.d(TAG, "搜索兜底:强制添加目标包名到结果列表"); - break; - } } } } @@ -512,13 +468,13 @@ public class BatteryReportActivity extends Activity { holder.tvConsumption.setText(consumptionText); // 优化显示:目标应用文字标蓝(通过包名匹配) - if (BatteryReportActivity.TARGET_APP_PACKAGE.equals(packageName)) { - holder.tvAppName.setTextColor(mContext.getResources().getColor(android.R.color.holo_blue_dark)); - holder.tvConsumption.setTextColor(mContext.getResources().getColor(android.R.color.holo_blue_dark)); - } else { - holder.tvAppName.setTextColor(mContext.getResources().getColor(android.R.color.black)); - holder.tvConsumption.setTextColor(mContext.getResources().getColor(android.R.color.darker_gray)); - } + + holder.tvAppName.setTextColor(mContext.getResources().getColor(android.R.color.holo_blue_dark)); + holder.tvConsumption.setTextColor(mContext.getResources().getColor(android.R.color.holo_blue_dark)); + + //holder.tvAppName.setTextColor(mContext.getResources().getColor(android.R.color.black)); + //holder.tvConsumption.setTextColor(mContext.getResources().getColor(android.R.color.darker_gray)); + // 调整文字大小(提升可读性) holder.tvAppName.setTextSize(16);