Compare commits

...

3 Commits

Author SHA1 Message Date
de34c33706 <powerbell>APK 15.4.16 release Publish. 2025-10-22 18:58:26 +08:00
ZhanGSKen
10b8da2e21 更新应用电量报告显示风格,精简冗余代码。 2025-10-22 18:36:16 +08:00
ZhanGSKen
ca4e4c7feb 更新源码识别命名 2025-10-22 18:26:54 +08:00
6 changed files with 17 additions and 61 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Oct 22 17:45:14 HKT 2025
stageCount=16
#Wed Oct 22 18:58:26 HKT 2025
stageCount=17
libraryProject=
baseVersion=15.4
publishVersion=15.4.15
publishVersion=15.4.16
buildCount=0
baseBetaVersion=15.4.16
baseBetaVersion=15.4.17

View File

@@ -159,7 +159,7 @@ public class MainActivity extends WinBoLLActivity {
if (menuItemId == R.id.action_about) {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
} else if (menuItemId == R.id.action_battery_reporter) {
} else if (menuItemId == R.id.action_battery_report) {
Intent intent = new Intent();
intent.setClass(this, BatteryReportActivity.class);
startActivity(intent);

View File

@@ -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;
@@ -59,7 +57,7 @@ public class BatteryReportActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_batteryreport);
setContentView(R.layout.activity_battery_report);
// 初始化包管理工具(仅一次,供后续查询名称使用)
mPackageManager = getPackageManager();
@@ -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);

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_battery_reporter"
android:title="@string/item_battery_reporter"/>
android:id="@+id/action_battery_report"
android:title="@string/item_battery_report"/>
<item
android:id="@+id/action_clearrecord"
android:title="@string/item_clearrecord"/>

View File

@@ -6,7 +6,7 @@
<string name="about_crashed">This application has crashed, the author level is limited, please understand!</string>
<string name="item_mainview">Main View</string>
<string name="item_aboutview">About</string>
<string name="item_battery_reporter">Battery Reporter</string>
<string name="item_battery_report">Battery Report</string>
<string name="item_clearrecord">Clear Record</string>
<string name="item_changepicture">Change Picture</string>
<string name="item_devoloperoptionsview">Developer View</string>