Compare commits

...

37 Commits

Author SHA1 Message Date
ZhanGSKen
b961468e1e <powerbell>APK 15.0.2 release Publish. 2025-03-25 02:42:42 +08:00
ZhanGSKen
575ef9aac0 内容提供配置调整 2025-03-25 02:42:10 +08:00
ZhanGSKen
16b118f83b <powerbell>APK 15.0.1 release Publish. 2025-03-25 02:36:56 +08:00
ZhanGSKen
1eeba4e4c6 <powerbell>APK 15.0.0 release Publish. 2025-03-25 02:34:56 +08:00
ZhanGSKen
66eb8e06ea 应用介绍页基本调试完成 2025-03-25 02:30:45 +08:00
ZhanGSKen
51775620db 更新类库,调试应用介绍... 2025-03-24 20:24:31 +08:00
ZhanGSKen
deaa9caadd Merge remote-tracking branch 'origin/appbase' into powerbell 2025-03-24 14:33:17 +08:00
ZhanGSKen
c203557a6a <libappbase>Library Release 15.0.9 2025-03-24 14:06:30 +08:00
ZhanGSKen
00b619ee99 <appbase>APK 15.0.9 release Publish. 2025-03-24 14:06:10 +08:00
ZhanGSKen
3a6fb3e17c 更新日志标题栏风格 2025-03-24 14:04:59 +08:00
ZhanGSKen
5411d5e590 <libappbase>Library Release 15.0.8 2025-03-24 08:04:42 +08:00
ZhanGSKen
facf0b001d <appbase>APK 15.0.8 release Publish. 2025-03-24 08:04:27 +08:00
ZhanGSKen
df58c0355c 更新编译工具版本 2025-03-24 08:03:17 +08:00
ZhanGSKen
e657e45218 <libappbase>Library Release 15.0.7 2025-03-24 07:45:34 +08:00
ZhanGSKen
c22946f0a5 <appbase>APK 15.0.7 release Publish. 2025-03-24 07:44:12 +08:00
ZhanGSKen
1363a7dcce <appbase>APK 15.0.6 release Publish. 2025-03-24 07:43:28 +08:00
ZhanGSKen
e0ca5725f1 保持与旧版Gradle插件的兼容 2025-03-24 07:39:20 +08:00
ZhanGSKen
3c4988532f 函数命名更新 2025-03-24 07:30:59 +08:00
ZhanGSKen
b0a34579fa 命名空间重构 2025-03-24 07:17:22 +08:00
ZhanGSKen
58af5ba074 <powerbell>APK 4.0.7 release Publish. 2025-03-22 16:06:33 +08:00
ZhanGSKen
19743d30ef 修复编译参数 2025-03-22 16:05:10 +08:00
ZhanGSKen
3c2b720e20 调整背景图片设置窗口按钮布局 2025-03-22 16:03:08 +08:00
ZhanGSKen
5a052e4b22 添加电池报告窗口雏形 2025-03-22 15:54:18 +08:00
ZhanGSKen
4ccf6824a6 <powerbell>APK 4.0.6 release Publish. 2025-03-22 06:01:46 +08:00
ZhanGSKen
508c8b0b97 适配小米15,修改通知模块。 2025-03-22 05:53:58 +08:00
ZhanGSKen
0d21994291 编译配置精简 2025-03-22 03:06:40 +08:00
ZhanGSKen
dd08747edb 更新WinBoll maven库下载顺序 2025-03-21 00:42:41 +08:00
ZhanGSKen
603640b3cb <libappbase>Library Release 15.0.5 2025-03-18 10:15:14 +08:00
ZhanGSKen
5b06ce9699 <appbase>APK 15.0.5 release Publish. 2025-03-18 10:14:53 +08:00
ZhanGSKen
363fc6c7c1 修复编译参数 2025-03-18 10:13:01 +08:00
ZhanGSKen
7f43f8b5c5 <libappbase>Library Release 15.0.4 2025-03-18 10:09:49 +08:00
ZhanGSKen
a117e6e110 <appbase>APK 15.0.4 release Publish. 2025-03-18 10:09:21 +08:00
ZhanGSKen
c1f576e343 分开APP应用主题设置与类库主题预定设置。 2025-03-18 10:08:31 +08:00
ZhanGSKen
1dad84b65e <libappbase>Library Release 15.0.3 2025-03-17 09:51:28 +08:00
ZhanGSKen
1ae377e665 <appbase>APK 15.0.3 release Publish. 2025-03-17 09:51:04 +08:00
ZhanGSKen
02fa0a4134 优化调试窗口 2025-03-17 09:40:03 +08:00
ZhanGSKen
a730aa3f92 优化日志UI 2025-03-17 09:37:12 +08:00
76 changed files with 904 additions and 323 deletions

View File

@@ -18,8 +18,8 @@ def genVersionName(def versionName){
} }
android { android {
compileSdkVersion 30 compileSdkVersion 32
buildToolsVersion "30.0.3" buildToolsVersion "32.0.0"
defaultConfig { defaultConfig {
applicationId "cc.winboll.studio.appbase" applicationId "cc.winboll.studio.appbase"

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sat Mar 15 15:30:02 HKT 2025 #Mon Mar 24 14:06:25 HKT 2025
stageCount=3 stageCount=10
libraryProject=libappbase libraryProject=libappbase
baseVersion=15.0 baseVersion=15.0
publishVersion=15.0.2 publishVersion=15.0.9
buildCount=0 buildCount=0
baseBetaVersion=15.0.3 baseBetaVersion=15.0.10

View File

@@ -7,7 +7,7 @@
android:name=".App" android:name=".App"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/MyAppTheme" android:theme="@style/MyAPPBaseTheme"
android:resizeableActivity="true"> android:resizeableActivity="true">
<activity <activity
@@ -49,6 +49,12 @@
android:name=".services.MainService" android:name=".services.MainService"
android:exported="true"/> android:exported="true"/>
<service android:name="cc.winboll.studio.appbase.services.TestDemoBindService"
android:exported="true"/>
<service android:name="cc.winboll.studio.appbase.services.TestDemoService"
android:exported="true"/>
<service android:name=".services.AssistantService"/> <service android:name=".services.AssistantService"/>
<receiver android:name="cc.winboll.studio.appbase.receivers.MainReceiver"> <receiver android:name="cc.winboll.studio.appbase.receivers.MainReceiver">
@@ -81,13 +87,13 @@
</receiver> </receiver>
<receiver android:name=".widgets.APPNewsWidgetClickListener"> <receiver android:name=".receivers.APPNewsWidgetClickListener">
<intent-filter> <intent-filter>
<action android:name="cc.winboll.studio.appbase.widgets.APPNewsWidgetClickListener.ACTION_PRE"/> <action android:name="cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener.ACTION_PRE"/>
<action android:name="cc.winboll.studio.appbase.widgets.APPNewsWidgetClickListener.ACTION_NEXT"/> <action android:name="cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener.ACTION_NEXT"/>
</intent-filter> </intent-filter>
@@ -97,12 +103,6 @@
android:name="android.max_aspect" android:name="android.max_aspect"
android:value="4.0"/> android:value="4.0"/>
<service android:name="cc.winboll.studio.appbase.services.TestDemoBindService"
android:exported="true"/>
<service android:name="cc.winboll.studio.appbase.services.TestDemoService"
android:exported="true"/>
</application> </application>
</manifest> </manifest>

View File

@@ -89,7 +89,7 @@ public class MainActivity extends Activity {
startService(intentService); startService(intentService);
} }
public void onTestSOS(View view) { public void onTestDemoServiceSOS(View view) {
Intent intent = new Intent(this, TestDemoService.class); Intent intent = new Intent(this, TestDemoService.class);
stopService(intent); stopService(intent);
if (App.isDebuging()) { if (App.isDebuging()) {

View File

@@ -7,7 +7,7 @@ package cc.winboll.studio.appbase;
import android.content.Context; import android.content.Context;
import android.service.quicksettings.Tile; import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService; import android.service.quicksettings.TileService;
import cc.winboll.studio.appbase.beans.MainServiceBean; import cc.winboll.studio.appbase.models.MainServiceBean;
import cc.winboll.studio.appbase.services.MainService; import cc.winboll.studio.appbase.services.MainService;
public class MyTileService extends TileService { public class MyTileService extends TileService {

View File

@@ -1,4 +1,4 @@
package cc.winboll.studio.appbase.beans; package cc.winboll.studio.appbase.models;
/** /**
* @Author ZhanGSKen@AliYun.Com * @Author ZhanGSKen@AliYun.Com

View File

@@ -1,4 +1,4 @@
package cc.winboll.studio.appbase.beans; package cc.winboll.studio.appbase.models;
/** /**
* @Author ZhanGSKen@AliYun.Com * @Author ZhanGSKen@AliYun.Com

View File

@@ -1,4 +1,4 @@
package cc.winboll.studio.appbase.beans; package cc.winboll.studio.appbase.models;
/** /**
* @Author ZhanGSKen@AliYun.Com * @Author ZhanGSKen@AliYun.Com

View File

@@ -1,4 +1,4 @@
package cc.winboll.studio.appbase.beans; package cc.winboll.studio.appbase.models;
/** /**
* @Author ZhanGSKen@AliYun.Com * @Author ZhanGSKen@AliYun.Com

View File

@@ -1,13 +1,13 @@
package cc.winboll.studio.appbase.widgets; package cc.winboll.studio.appbase.receivers;
/** /**
* @Author ZhanGSKen@AliYun.Com * @Author ZhanGSKen@AliYun.Com
* @Date 2025/02/15 17:20:46 * @Date 2025/03/24 07:11:44
* @Describe WidgetButtonClickListener
*/ */
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
public class APPNewsWidgetClickListener extends BroadcastReceiver { public class APPNewsWidgetClickListener extends BroadcastReceiver {

View File

@@ -10,7 +10,7 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import cc.winboll.studio.appbase.beans.WinBollNewsBean; import cc.winboll.studio.appbase.models.WinBollNewsBean;
import cc.winboll.studio.appbase.services.MainService; import cc.winboll.studio.appbase.services.MainService;
import cc.winboll.studio.appbase.widgets.APPNewsWidget; import cc.winboll.studio.appbase.widgets.APPNewsWidget;
import cc.winboll.studio.libappbase.AppUtils; import cc.winboll.studio.libappbase.AppUtils;

View File

@@ -11,7 +11,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.appbase.beans.MainServiceBean; import cc.winboll.studio.appbase.models.MainServiceBean;
import cc.winboll.studio.appbase.services.AssistantService; import cc.winboll.studio.appbase.services.AssistantService;
import cc.winboll.studio.appbase.services.MainService; import cc.winboll.studio.appbase.services.MainService;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;

View File

@@ -18,7 +18,7 @@ import android.content.ServiceConnection;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.appbase.MyTileService; import cc.winboll.studio.appbase.MyTileService;
import cc.winboll.studio.appbase.beans.MainServiceBean; import cc.winboll.studio.appbase.models.MainServiceBean;
import cc.winboll.studio.appbase.handlers.MainServiceHandler; import cc.winboll.studio.appbase.handlers.MainServiceHandler;
import cc.winboll.studio.appbase.receivers.MainReceiver; import cc.winboll.studio.appbase.receivers.MainReceiver;
import cc.winboll.studio.appbase.services.AssistantService; import cc.winboll.studio.appbase.services.AssistantService;

View File

@@ -10,7 +10,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.appbase.beans.TestDemoBindServiceBean; import cc.winboll.studio.appbase.models.TestDemoBindServiceBean;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.sos.WinBoll; import cc.winboll.studio.libappbase.sos.WinBoll;
import cc.winboll.studio.appbase.App; import cc.winboll.studio.appbase.App;

View File

@@ -10,7 +10,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.appbase.beans.TestDemoServiceBean; import cc.winboll.studio.appbase.models.TestDemoServiceBean;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.sos.WinBoll; import cc.winboll.studio.libappbase.sos.WinBoll;

View File

@@ -12,15 +12,16 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import cc.winboll.studio.appbase.R; import cc.winboll.studio.appbase.R;
import cc.winboll.studio.appbase.beans.WinBollNewsBean; import cc.winboll.studio.appbase.models.WinBollNewsBean;
import cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener;
import cc.winboll.studio.libappbase.AppUtils; import cc.winboll.studio.libappbase.AppUtils;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.sos.APPModel;
import cc.winboll.studio.libappbase.sos.WinBoll;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import cc.winboll.studio.libappbase.sos.APPModel;
import cc.winboll.studio.libappbase.sos.WinBoll;
public class APPNewsWidget extends AppWidgetProvider { public class APPNewsWidget extends AppWidgetProvider {

View File

@@ -72,6 +72,26 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="right"> android:gravity="right">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="StartCenter"
android:textAllCaps="false"
android:onClick="onStartCenter"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="StopCenter"
android:textAllCaps="false"
android:onClick="onStopCenter"/>
</LinearLayout>
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@@ -105,54 +125,41 @@
</LinearLayout> </LinearLayout>
</HorizontalScrollView> </HorizontalScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout <HorizontalScrollView
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content">
android:layout_height="wrap_content">
<Button <LinearLayout
android:layout_width="wrap_content" android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="SartTestDemoBindService" android:layout_height="wrap_content">
android:textAllCaps="false"
android:onClick="onSartTestDemoBindService"/>
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="StopTestDemoBindService" android:text="SartTestDemoBindService"
android:textAllCaps="false" android:textAllCaps="false"
android:onClick="onStopTestDemoBindService"/> android:onClick="onSartTestDemoBindService"/>
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="StopTestDemoBindServiceNoSettings" android:text="StopTestDemoBindService"
android:textAllCaps="false" android:textAllCaps="false"
android:onClick="onStopTestDemoBindServiceNoSettings"/> android:onClick="onStopTestDemoBindService"/>
</LinearLayout> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="StopTestDemoBindServiceNoSettings"
android:textAllCaps="false"
android:onClick="onStopTestDemoBindServiceNoSettings"/>
</LinearLayout>
</HorizontalScrollView> </HorizontalScrollView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="StartCenter"
android:textAllCaps="false"
android:onClick="onStartCenter"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="StopCenter"
android:textAllCaps="false"
android:onClick="onStopCenter"/>
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -171,24 +178,24 @@
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TestSOS" android:text="TestDemoServiceSOS"
android:textAllCaps="false" android:textAllCaps="false"
android:onClick="onTestSOS"/> android:onClick="onTestDemoServiceSOS"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<cc.winboll.studio.libappbase.LogView
android:layout_height="500dp"
android:layout_width="match_parent"
android:id="@+id/activitymainLogView1"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<cc.winboll.studio.libappbase.LogView
android:layout_height="300dp"
android:layout_width="match_parent"
android:id="@+id/activitymainLogView1"/>
</LinearLayout> </LinearLayout>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#005800FF</color> <color name="colorPrimary">#FF00B322</color>
<color name="colorPrimaryDark">#005800FF</color> <color name="colorPrimaryDark">#FF005C12</color>
<color name="colorAccent">#005800FF</color> <color name="colorAccent">#FF8DFFA2</color>
<color name="colorText">#FFFFFB8D</color>
</resources> </resources>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="MyAppTheme" parent="APPBaseTheme"> <style name="MyAPPBaseTheme" parent="APPBaseTheme">
<item name="attrColorPrimary">@color/colorPrimary</item> <item name="attrColorPrimary">@color/colorPrimary</item>
<item name="themeGlobalCrashActivity">@style/MyGlobalCrashActivityTheme</item> <item name="themeGlobalCrashActivity">@style/MyGlobalCrashActivityTheme</item>
</style> </style>

View File

@@ -1,6 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
repositories { repositories {
// Nexus Maven 库地址
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
maven { url 'https://maven.aliyun.com/repository/public/' } maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' } maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
@@ -9,13 +15,6 @@ buildscript {
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
mavenCentral() mavenCentral()
google() google()
// Nexus Maven 库地址
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
mavenLocal() mavenLocal()
} }
dependencies { dependencies {
@@ -27,6 +26,12 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
// Nexus Maven 库地址
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
maven { url 'https://maven.aliyun.com/repository/public/' } maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' } maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
@@ -35,13 +40,6 @@ allprojects {
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
mavenCentral() mavenCentral()
google() google()
// Nexus Maven 库地址
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
mavenLocal() mavenLocal()
} }
ext { ext {

View File

@@ -17,3 +17,5 @@ org.gradle.jvmargs=-Xmx2048m
android.useAndroidX=false android.useAndroidX=false
# Automatically convert third-party libraries to use AndroidX # Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false android.enableJetifier=false
# 保持与旧版Gradle插件的兼容
android.disableAutomaticComponentCreation=true

View File

@@ -17,3 +17,5 @@ org.gradle.jvmargs=-Xmx2048m
android.useAndroidX=true android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX # Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true android.enableJetifier=true
# 保持与旧版Gradle插件的兼容
android.disableAutomaticComponentCreation=true

View File

@@ -4,8 +4,8 @@ apply from: '../.winboll/winboll_lib_build.gradle'
apply from: '../.winboll/winboll_lint_build.gradle' apply from: '../.winboll/winboll_lint_build.gradle'
android { android {
compileSdkVersion 30 compileSdkVersion 32
buildToolsVersion "30.0.3" buildToolsVersion "32.0.0"
defaultConfig { defaultConfig {
minSdkVersion 26 minSdkVersion 26

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sat Mar 15 15:29:07 HKT 2025 #Mon Mar 24 14:06:10 HKT 2025
stageCount=3 stageCount=10
libraryProject=libappbase libraryProject=libappbase
baseVersion=15.0 baseVersion=15.0
publishVersion=15.0.2 publishVersion=15.0.9
buildCount=0 buildCount=0
baseBetaVersion=15.0.3 baseBetaVersion=15.0.10

View File

@@ -190,6 +190,7 @@ public class LogView extends RelativeLayout {
// 加载标签表 // 加载标签表
mListViewTags = findViewById(cc.winboll.studio.libappbase.R.id.tags_listview); mListViewTags = findViewById(cc.winboll.studio.libappbase.R.id.tags_listview);
mListViewTags.setVerticalOffset(10);
mTAGListAdapter = new TAGListAdapter(mContext, mapTAGList); mTAGListAdapter = new TAGListAdapter(mContext, mapTAGList);
mListViewTags.setAdapter(mTAGListAdapter); mListViewTags.setAdapter(mTAGListAdapter);

View File

@@ -12,7 +12,9 @@ import android.widget.ListView;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
public class HorizontalListView extends ListView { public class HorizontalListView extends ListView {
public static final String TAG = "HorizontalListView"; public static final String TAG = "HorizontalListView";
int verticalOffset = 0;
public HorizontalListView(Context context) { public HorizontalListView(Context context) {
super(context); super(context);
@@ -25,25 +27,10 @@ public class HorizontalListView extends ListView {
public HorizontalListView(Context context, AttributeSet attrs, int defStyle) { public HorizontalListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
} }
// @Override
// protected void onLayout(boolean changed, int l, int t, int r, int b) { public void setVerticalOffset(int verticalOffset) {
// super.onLayout(changed, l, t, r, b); this.verticalOffset = verticalOffset;
// int childCount = getChildCount(); }
// int left = getPaddingLeft();
// // 获取HorizontalListView的高度
// int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
// for (int i = 0; i < childCount; i++) {
// View child = getChildAt(i);
// int width = child.getMeasuredWidth();
// int height = child.getMeasuredHeight();
// // 计算子项在垂直方向上的居中偏移量
// int verticalOffset = (viewHeight - height) / 2;
// // 设置子视图的位置,实现水平布局并垂直居中
// child.layout(left, getPaddingTop() + verticalOffset, left + width, getPaddingTop() + verticalOffset + height);
// left += width;
// }
// }
//
@Override @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) { protected void onLayout(boolean changed, int l, int t, int r, int b) {
@@ -52,7 +39,7 @@ public class HorizontalListView extends ListView {
int left = getPaddingLeft(); int left = getPaddingLeft();
int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom(); int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
LogUtils.d(TAG, String.format("HorizontalListView的高度 %d", viewHeight)); LogUtils.d(TAG, String.format("HorizontalListView的高度 %d", viewHeight));
int verticalOffset = 20;
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
View child = getChildAt(i); View child = getChildAt(i);
// 计算每个子视图的宽度和高度 // 计算每个子视图的宽度和高度
@@ -60,7 +47,7 @@ public class HorizontalListView extends ListView {
int height = child.getMeasuredHeight(); int height = child.getMeasuredHeight();
//LogUtils.d(TAG, String.format("child : width %d , height %d", width, height)); //LogUtils.d(TAG, String.format("child : width %d , height %d", width, height));
// 设置子视图的位置,实现水平布局 // 设置子视图的位置,实现水平布局
child.layout(left, verticalOffset, left + width, verticalOffset + height); child.layout(left, verticalOffset, left + width, verticalOffset + height);
left += width; left += width;
} }
@@ -68,15 +55,11 @@ public class HorizontalListView extends ListView {
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int newHeightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); int newHeightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
//super.onMeasure(widthMeasureSpec, newHeightMeasureSpec); //super.onMeasure(widthMeasureSpec, newHeightMeasureSpec);
int newWidthMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); int newWidthMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
//LogUtils.d(TAG, String.format("newWidthMeasureSpec %d, newHeightMeasureSpec %d", newWidthMeasureSpec, newHeightMeasureSpec)); //LogUtils.d(TAG, String.format("newWidthMeasureSpec %d, newHeightMeasureSpec %d", newWidthMeasureSpec, newHeightMeasureSpec));
super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec); super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec);
// ViewGroup.LayoutParams params = getLayoutParams();
// params.width = getMeasuredWidth();
} }
} }

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#000000" /> <!-- 这里可调整边框宽度和颜色 -->
<solid android:color="@android:color/transparent" />
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
</shape>

View File

@@ -10,8 +10,8 @@
<shape android:shape="rectangle" > <shape android:shape="rectangle" >
<gradient <gradient
android:angle="270" android:angle="270"
android:endColor="#0F000000" android:endColor="@color/colorAccent"
android:startColor="#0F000000" /> android:startColor="@color/colorAccent" />
<corners <corners
android:bottomLeftRadius="6dip" android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip" android:bottomRightRadius="6dip"

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 阴影部分 -->
<!-- 个人觉得更形象的表达top代表下边的阴影高度left代表右边的阴影宽度。其实也就是相对应的offsetsolid中的颜色是阴影的颜色也可以设置角度等等 -->
<item
android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp">
<shape android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="@color/colorPrimary"
android:startColor="@color/colorPrimary" />
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
</shape>
</item>
<!-- 背景部分 -->
<!-- 形象的表达bottom代表背景部分在上边缘超出阴影的高度right代表背景部分在左边超出阴影的宽度相对应的offset -->
<item
android:left="3dp"
android:top="3dp"
android:right="3dp"
android:bottom="5dp">
<shape android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="@color/colorPrimary"
android:startColor="@color/colorPrimary" />
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
</shape>
</item>
</layer-list>

View File

@@ -5,18 +5,18 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#FFEEEEEE"> android:background="@drawable/bg_border_round">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="@dimen/button_height"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:id="@+id/viewlogtagTextView1"/> android:id="@+id/viewlogtagTextView1"/>
<CheckBox <CheckBox
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="@dimen/button_height"
android:id="@+id/viewlogtagCheckBox1"/> android:id="@+id/viewlogtagCheckBox1"/>
</LinearLayout> </LinearLayout>

View File

@@ -12,7 +12,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:background="@drawable/bg_shadow" android:background="@drawable/bg_toolbar_log"
android:id="@+id/viewlogRelativeLayoutToolbar"> android:id="@+id/viewlogRelativeLayoutToolbar">
<Button <Button
@@ -72,27 +72,29 @@
android:layout_below="@+id/viewlogRelativeLayoutToolbar" android:layout_below="@+id/viewlogRelativeLayoutToolbar"
android:id="@+id/viewlogLinearLayout1" android:id="@+id/viewlogLinearLayout1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:background="#FFC0F4C2"> android:background="@drawable/bg_toolbar_log">
<CheckBox <CheckBox
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="@dimen/button_height"
android:text="ALL" android:text="ALL"
android:id="@+id/viewlogCheckBox1"/> android:id="@+id/viewlogCheckBox1"
android:background="@drawable/bg_border_round"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"/>
<HorizontalScrollView <HorizontalScrollView
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_border"
android:scrollbars="none" android:scrollbars="none"
android:layout_weight="1.0" android:padding="5dp"
android:background="#FF97F2E3"> android:layout_weight="1.0">
<cc.winboll.studio.libappbase.views.HorizontalListView <cc.winboll.studio.libappbase.views.HorizontalListView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/view_border" android:id="@+id/tags_listview"/>
android:id="@+id/tags_listview"
android:paddingLeft="10dp"/>
</HorizontalScrollView> </HorizontalScrollView>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 定义一个名为text_size_normal的尺寸值为16sp -->
<dimen name="text_size_normal">16sp</dimen>
<!-- 定义一个名为margin_small的尺寸值为8dp -->
<dimen name="margin_small">8dp</dimen>
<!-- 定义一个名为image_width的尺寸值为200dp -->
<dimen name="button_height">24dp</dimen>
</resources>

View File

@@ -19,17 +19,17 @@ def genVersionName(def versionName){
android { android {
compileSdkVersion 32 compileSdkVersion 32
buildToolsVersion "33.0.3" buildToolsVersion "32.0.0"
defaultConfig { defaultConfig {
applicationId "cc.winboll.studio.powerbell" applicationId "cc.winboll.studio.powerbell"
minSdkVersion 24 minSdkVersion 26
targetSdkVersion 30 targetSdkVersion 29
versionCode 6 versionCode 6
// versionName 更新后需要手动设置 // versionName 更新后需要手动设置
// .winboll/winbollBuildProps.properties 文件的 stageCount=0 // .winboll/winbollBuildProps.properties 文件的 stageCount=0
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
versionName "4.0" versionName "15.0"
if(true) { if(true) {
versionName = genVersionName("${versionName}") versionName = genVersionName("${versionName}")
} }
@@ -41,15 +41,35 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
} }
dependencies { dependencies {
api 'cc.winboll.studio:winboll-shared:1.8.0' api fileTree(dir: 'libs', include: ['*.jar'])
// 应用介绍页类库
api 'io.github.medyo:android-about-page:2.0.0'
// SSH
api 'com.jcraft:jsch:0.1.55'
// Html 解析
api 'org.jsoup:jsoup:1.13.1'
// 二维码类库
api 'com.google.zxing:core:3.4.1'
api 'com.journeyapps:zxing-android-embedded:3.6.0'
// 网络连接类库
api 'com.squareup.okhttp3:okhttp:4.4.1'
// AndroidX 类库
api 'androidx.appcompat:appcompat:1.1.0'
api 'com.google.android.material:material:1.4.0'
//api 'androidx.viewpager:viewpager:1.0.0'
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
//api 'androidx.fragment:fragment:1.1.0'
api 'cc.winboll.studio:libappbase:15.0.9'
api 'cc.winboll.studio:libapputils:15.0.15'
api 'cc.winboll.studio:libaes:15.0.7'
/*api 'cc.winboll.studio:winboll-shared:1.8.0'
api 'io.github.medyo:android-about-page:2.0.0' api 'io.github.medyo:android-about-page:2.0.0'
api 'com.github.getActivity:ToastUtils:10.5' api 'com.github.getActivity:ToastUtils:10.5'
api 'com.jcraft:jsch:0.1.55' api 'com.jcraft:jsch:0.1.55'
@@ -67,6 +87,5 @@ dependencies {
api 'com.squareup.okhttp3:okhttp:4.4.1' api 'com.squareup.okhttp3:okhttp:4.4.1'
api 'cc.winboll.studio:libaes:7.6.0' api 'cc.winboll.studio:libaes:7.6.0'
*/
api fileTree(dir: 'libs', include: ['*.jar'])
} }

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Thu Jan 02 11:13:45 HKT 2025 #Tue Mar 25 02:42:42 HKT 2025
stageCount=6 stageCount=3
libraryProject= libraryProject=
baseVersion=4.0 baseVersion=15.0
publishVersion=4.0.5 publishVersion=15.0.2
buildCount=0 buildCount=0
baseBetaVersion=4.0.6 baseBetaVersion=15.0.3

View File

@@ -6,20 +6,18 @@
tools:replace="android:icon" tools:replace="android:icon"
android:icon="@drawable/ic_launcher_beta"> android:icon="@drawable/ic_launcher_beta">
<!-- Put flavor specific code here -->
<provider <provider
tools:replace="android:authorities"
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="cc.winboll.studio.powerbell.beta.fileprovider" android:authorities="cc.winboll.studio.powerbell.beta.fileprovider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
tools:replace="android:resource"
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider"/> android:resource="@xml/file_provider"/>
</provider> </provider>
</application> </application>
</manifest> </manifest>

View File

@@ -2,10 +2,9 @@
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.winboll.studio.powerbell"> package="cc.winboll.studio.powerbell">
<uses-permission android:name="android.permission.CAMERA" /> <!-- 拍摄照片和视频 -->
<uses-feature android:name="android.hardware.camera" /> <uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera.autofocus" />
<!-- 运行前台服务 --> <!-- 运行前台服务 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
@@ -22,8 +21,15 @@
<!-- MANAGE_EXTERNAL_STORAGE --> <!-- MANAGE_EXTERNAL_STORAGE -->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<!-- 显示通知 -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<application <application
android:name=".GlobalApplication" android:name=".App"
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
@@ -34,7 +40,8 @@
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:launchMode="singleTask"> android:launchMode="singleTask"
android:exported="true">
<intent-filter> <intent-filter>
@@ -110,6 +117,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.BatteryReporterActivity"/>
<activity android:name="cc.winboll.studio.powerbell.activities.AboutActivity"/> <activity android:name="cc.winboll.studio.powerbell.activities.AboutActivity"/>
</application> </application>

View File

@@ -1,15 +1,14 @@
package cc.winboll.studio.powerbell; package cc.winboll.studio.powerbell;
import android.content.Context; import android.content.Context;
import android.view.Gravity; import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.powerbell.receivers.GlobalApplicationReceiver; import cc.winboll.studio.powerbell.receivers.GlobalApplicationReceiver;
import cc.winboll.studio.powerbell.utils.AppCacheUtils; import cc.winboll.studio.powerbell.utils.AppCacheUtils;
import cc.winboll.studio.powerbell.utils.AppConfigUtils; import cc.winboll.studio.powerbell.utils.AppConfigUtils;
import cc.winboll.studio.shared.app.WinBollApplication; import cc.winboll.studio.libapputils.bean.DebugBean;
import com.hjq.toast.ToastUtils;
import com.hjq.toast.style.WhiteToastStyle;
public class GlobalApplication extends WinBollApplication { public class App extends GlobalApplication {
public static final String TAG = "GlobalApplication"; public static final String TAG = "GlobalApplication";
@@ -21,13 +20,22 @@ public class GlobalApplication extends WinBollApplication {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
// 设置应用调试标志
DebugBean debugBean = DebugBean.loadBean(this, DebugBean.class);
if (debugBean == null) {
//ToastUtils.show("debugBean == null");
setIsDebuging(this, false);
} else {
//ToastUtils.show("saveDebugStatus(" + String.valueOf(debugBean.isDebuging()) + ")");
setIsDebuging(this, debugBean.isDebuging());
}
// 初始化 Toast 框架 // 初始化 Toast 框架
ToastUtils.init(this); //ToastUtils.init(this);
// 设置 Toast 布局样式 // 设置 Toast 布局样式
//ToastUtils.setView(R.layout.toast_custom_view); //ToastUtils.setView(R.layout.toast_custom_view);
ToastUtils.setStyle(new WhiteToastStyle()); //ToastUtils.setStyle(new WhiteToastStyle());
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); //ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
// 设置数据配置存储工具 // 设置数据配置存储工具
_mAppConfigUtils = getAppConfigUtils(this); _mAppConfigUtils = getAppConfigUtils(this);

View File

@@ -12,14 +12,14 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
import cc.winboll.studio.libaes.views.AToolbar; import cc.winboll.studio.libaes.views.AToolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.powerbell.MainActivity; import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.activities.AboutActivity; import cc.winboll.studio.powerbell.activities.AboutActivity;
import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity; import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity;
import cc.winboll.studio.powerbell.activities.BatteryReporterActivity;
import cc.winboll.studio.powerbell.activities.ClearRecordActivity; import cc.winboll.studio.powerbell.activities.ClearRecordActivity;
import cc.winboll.studio.powerbell.fragments.MainViewFragment; import cc.winboll.studio.powerbell.fragments.MainViewFragment;
import cc.winboll.studio.powerbell.utils.NotificationUtils;
import cc.winboll.studio.shared.log.LogUtils;
import cc.winboll.studio.shared.log.LogView;
public class MainActivity extends Activity { public class MainActivity extends Activity {
public static final String TAG = "MainActivity"; public static final String TAG = "MainActivity";
@@ -28,7 +28,7 @@ public class MainActivity extends Activity {
public static MainActivity _mMainActivity; public static MainActivity _mMainActivity;
LogView mLogView; LogView mLogView;
//ArrayList<Fragment> mlistFragment; //ArrayList<Fragment> mlistFragment;
GlobalApplication mApplication; App mApplication;
//AppConfigUtils mAppConfigUtils; //AppConfigUtils mAppConfigUtils;
Menu mMenu; Menu mMenu;
Fragment mCurrentShowFragment; Fragment mCurrentShowFragment;
@@ -48,12 +48,13 @@ public class MainActivity extends Activity {
mLogView.updateLogView(); mLogView.updateLogView();
_mMainActivity = MainActivity.this; _mMainActivity = MainActivity.this;
mApplication = (GlobalApplication) getApplication(); mApplication = (App) getApplication();
//mAppConfigUtils = AppConfigUtils.getInstance(mApplication); //mAppConfigUtils = AppConfigUtils.getInstance(mApplication);
// 初始化工具栏 // 初始化工具栏
mAToolbar = (AToolbar) findViewById(R.id.toolbar); mAToolbar = (AToolbar) findViewById(R.id.toolbar);
setActionBar(mAToolbar); setActionBar(mAToolbar);
//mAToolbar.setSubtitle("Main");
mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText); mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
if (mMainViewFragment == null) { if (mMainViewFragment == null) {
@@ -64,8 +65,10 @@ public class MainActivity extends Activity {
} }
showFragment(mMainViewFragment); showFragment(mMainViewFragment);
NotificationUtils notificationUtils = new NotificationUtils(this); // NotificationHelper notificationUtils = new NotificationHelper(this);
notificationUtils.createNotificationChannel(); // notificationUtils.createNotificationChannels();
} }
void showFragment(Fragment fragment) { void showFragment(Fragment fragment) {
@@ -113,7 +116,7 @@ public class MainActivity extends Activity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
// 回到窗口自动取消提醒消息 // 回到窗口自动取消提醒消息
NotificationUtils.cancelRemindNotification(this); //NotificationHelper.cancelRemindNotification(this);
reloadBackground(); reloadBackground();
} }
@@ -140,8 +143,11 @@ public class MainActivity extends Activity {
super.onOptionsItemSelected(item); super.onOptionsItemSelected(item);
int menuItemId = item.getItemId(); int menuItemId = item.getItemId();
if (menuItemId == R.id.action_about) { if (menuItemId == R.id.action_about) {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
} else if (menuItemId == R.id.action_battery_reporter) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setClass(this, AboutActivity.class); intent.setClass(this, BatteryReporterActivity.class);
startActivity(intent); startActivity(intent);
} else if (menuItemId == R.id.action_clearrecord) { } else if (menuItemId == R.id.action_clearrecord) {
Intent intent = new Intent(); Intent intent = new Intent();

View File

@@ -1,42 +1,65 @@
package cc.winboll.studio.powerbell.activities; package cc.winboll.studio.powerbell.activities;
/** /**
* @Author ZhanGSKen@QQ.COM * @Author ZhanGSKen@AliYun.Com
* @Date 2024/07/12 13:33:59 * @Date 2025/03/25 01:16:32
* @Describe AboutActivity * @Describe 应用介绍窗口
*/ */
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.ViewGroup;
import android.widget.LinearLayout;
import cc.winboll.studio.libaes.views.AToolbar; import cc.winboll.studio.libaes.views.AToolbar;
import cc.winboll.studio.libaes.winboll.APPInfo;
import cc.winboll.studio.libaes.winboll.AboutView;
import cc.winboll.studio.powerbell.R; import cc.winboll.studio.powerbell.R;
public class AboutActivity extends Activity { public class AboutActivity extends Activity {
public static final String TAG = "AboutActivity"; Context mContext;
AToolbar mAToolbar; public static final String TAG = "AboutActivity";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about); setContentView(R.layout.activity_about);
mContext = this;
// 初始化工具栏 // 初始化工具栏
mAToolbar = (AToolbar) findViewById(R.id.toolbar); AToolbar mAToolbar = (AToolbar) findViewById(R.id.toolbar);
setActionBar(mAToolbar);
//mAToolbar.setTitle(getTitle() + "-" + getString(R.string.subtitle_activity_backgroundpicture));
mAToolbar.setSubtitle(R.string.subtitle_activity_about);
mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
mAToolbar.setSubtitleTextAppearance(this, R.style.Toolbar_SubTitleText);
//mAToolbar.setBackgroundColor(getColor(R.color.colorPrimary));
setActionBar(mAToolbar); setActionBar(mAToolbar);
mAToolbar.setSubtitle(getString(R.string.text_about));
//mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true);
mAToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override AboutView aboutView = CreateAboutView();
public void onClick(View v) { // 在 Activity 的 onCreate 或其他生命周期方法中调用
finish(); LinearLayout llRoot = findViewById(R.id.root_ll);
} //layout.setOrientation(LinearLayout.VERTICAL);
}); // 创建布局参数(宽度和高度)
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
);
llRoot.addView(aboutView, params);
}
public AboutView CreateAboutView() {
String szBranchName = "powerbell";
APPInfo appInfo = new APPInfo();
appInfo.setAppName(getString(R.string.app_name));
appInfo.setAppIcon(R.drawable.ic_launcher);
appInfo.setAppDescription(getString(R.string.app_description));
appInfo.setAppGitName("APP");
appInfo.setAppGitOwner("Studio");
appInfo.setAppGitAPPBranch(szBranchName);
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=PowerBell");
appInfo.setAppAPKName("PowerBell");
appInfo.setAppAPKFolderName("PowerBell");
return new AboutView(mContext, appInfo);
} }
} }

View File

@@ -13,6 +13,8 @@ import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
import cc.winboll.studio.libaes.views.AToolbar; import cc.winboll.studio.libaes.views.AToolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.powerbell.R; import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity; import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity;
import cc.winboll.studio.powerbell.beans.BackgroundPictureBean; import cc.winboll.studio.powerbell.beans.BackgroundPictureBean;
@@ -20,8 +22,6 @@ import cc.winboll.studio.powerbell.dialogs.BackgroundPicturePreviewDialog;
import cc.winboll.studio.powerbell.utils.BackgroundPictureUtils; import cc.winboll.studio.powerbell.utils.BackgroundPictureUtils;
import cc.winboll.studio.powerbell.utils.FileUtils; import cc.winboll.studio.powerbell.utils.FileUtils;
import cc.winboll.studio.powerbell.utils.UriUtil; import cc.winboll.studio.powerbell.utils.UriUtil;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.toast.ToastUtils;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@@ -84,8 +84,8 @@ implements BackgroundPicturePreviewDialog.IOnRecivedPictureListener {
setActionBar(mAToolbar); setActionBar(mAToolbar);
//mAToolbar.setTitle(getTitle() + "-" + getString(R.string.subtitle_activity_backgroundpicture)); //mAToolbar.setTitle(getTitle() + "-" + getString(R.string.subtitle_activity_backgroundpicture));
mAToolbar.setSubtitle(R.string.subtitle_activity_backgroundpicture); mAToolbar.setSubtitle(R.string.subtitle_activity_backgroundpicture);
mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText); //mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
mAToolbar.setSubtitleTextAppearance(this, R.style.Toolbar_SubTitleText); //mAToolbar.setSubtitleTextAppearance(this, R.style.Toolbar_SubTitleText);
//mAToolbar.setBackgroundColor(getColor(R.color.colorPrimary)); //mAToolbar.setBackgroundColor(getColor(R.color.colorPrimary));
setActionBar(mAToolbar); setActionBar(mAToolbar);
getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true);

View File

@@ -0,0 +1,51 @@
package cc.winboll.studio.powerbell.activities;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/22 14:20:15
*/
import android.app.Activity;
import android.os.Bundle;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.adapters.BatteryAdapter;
import cc.winboll.studio.powerbell.beans.BatteryData;
import java.util.Arrays;
import java.util.List;
public class BatteryReporterActivity extends Activity {
public static final String TAG = "BatteryReporterActivity";
private RecyclerView rvBatteryReport;
private BatteryAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_battery_reporter);
rvBatteryReport = findViewById(R.id.rvBatteryReport);
setupRecyclerView();
loadSampleData();
}
private void setupRecyclerView() {
adapter = new BatteryAdapter();
rvBatteryReport.setLayoutManager(new LinearLayoutManager(this));
rvBatteryReport.setAdapter(adapter);
rvBatteryReport.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
}
private void loadSampleData() {
List<BatteryData> dataList = Arrays.asList(
new BatteryData(95, "01:23:45", "00:05:12"),
new BatteryData(80, "02:15:30", "00:10:00"),
new BatteryData(65, "03:45:15", "00:15:30"),
new BatteryData(50, "05:00:00", "00:20:45")
);
adapter.updateData(dataList);
}
}

View File

@@ -7,14 +7,14 @@ import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar; import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
import cc.winboll.studio.libaes.views.AToolbar; import cc.winboll.studio.libaes.views.AToolbar;
import cc.winboll.studio.powerbell.GlobalApplication; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.R; import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.beans.BatteryInfoBean; import cc.winboll.studio.powerbell.beans.BatteryInfoBean;
import cc.winboll.studio.powerbell.receivers.ControlCenterServiceReceiver; import cc.winboll.studio.powerbell.receivers.ControlCenterServiceReceiver;
import cc.winboll.studio.powerbell.utils.AppCacheUtils; import cc.winboll.studio.powerbell.utils.AppCacheUtils;
import cc.winboll.studio.powerbell.utils.StringUtils; import cc.winboll.studio.powerbell.utils.StringUtils;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.toast.ToastUtils;
import java.util.ArrayList; import java.util.ArrayList;
public class ClearRecordActivity extends Activity { public class ClearRecordActivity extends Activity {
@@ -23,21 +23,21 @@ public class ClearRecordActivity extends Activity {
AToolbar mAToolbar; AToolbar mAToolbar;
TextView mtvRecordText; TextView mtvRecordText;
GlobalApplication mApplication; App mApplication;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_clearrecord); setContentView(R.layout.activity_clearrecord);
mApplication = (GlobalApplication) getApplication(); mApplication = (App) getApplication();
// 初始化工具栏 // 初始化工具栏
mAToolbar = (AToolbar) findViewById(R.id.toolbar); mAToolbar = (AToolbar) findViewById(R.id.toolbar);
setActionBar(mAToolbar); setActionBar(mAToolbar);
//mAToolbar.setTitle(getTitle() + " - " + getString(R.string.subtitle_activity_clearrecord)); //mAToolbar.setTitle(getTitle() + " - " + getString(R.string.subtitle_activity_clearrecord));
mAToolbar.setSubtitle(R.string.subtitle_activity_clearrecord); mAToolbar.setSubtitle(R.string.subtitle_activity_clearrecord);
mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText); //mAToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
mAToolbar.setSubtitleTextAppearance(this, R.style.Toolbar_SubTitleText); //mAToolbar.setSubtitleTextAppearance(this, R.style.Toolbar_SubTitleText);
//mAToolbar.setBackgroundColor(getColor(R.color.colorPrimary)); //mAToolbar.setBackgroundColor(getColor(R.color.colorPrimary));
setActionBar(mAToolbar); setActionBar(mAToolbar);
getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true);

View File

@@ -0,0 +1,61 @@
package cc.winboll.studio.powerbell.adapters;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/22 14:38:55
* @Describe 电池报告数据适配器
*/
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.adapters.BatteryAdapter;
import cc.winboll.studio.powerbell.beans.BatteryData;
import java.util.ArrayList;
import java.util.List;
public class BatteryAdapter extends RecyclerView.Adapter<BatteryAdapter.ViewHolder> {
public static final String TAG = "BatteryAdapter";
private List<BatteryData> dataList = new ArrayList<>();
public void updateData(List<BatteryData> newData) {
dataList = newData;
notifyDataSetChanged();
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_battery_report, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
BatteryData item = dataList.get(position);
holder.tvLevel.setText(String.format("%d%%", item.getCurrentLevel()));
holder.tvDischargeTime.setText("使用时间: " + item.getDischargeTime());
holder.tvChargeTime.setText("充电时间: " + item.getChargeTime());
}
@Override
public int getItemCount() {
return dataList.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
TextView tvLevel;
TextView tvDischargeTime;
TextView tvChargeTime;
ViewHolder(View itemView) {
super(itemView);
tvLevel = itemView.findViewById(R.id.tvLevel);
tvDischargeTime = itemView.findViewById(R.id.tvDischargeTime);
tvChargeTime = itemView.findViewById(R.id.tvChargeTime);
}
}
}

View File

@@ -7,7 +7,7 @@ package cc.winboll.studio.powerbell.beans;
*/ */
import android.util.JsonReader; import android.util.JsonReader;
import android.util.JsonWriter; import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean; import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;

View File

@@ -7,7 +7,7 @@ package cc.winboll.studio.powerbell.beans;
*/ */
import android.util.JsonReader; import android.util.JsonReader;
import android.util.JsonWriter; import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean; import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException; import java.io.IOException;
public class BackgroundPictureBean extends BaseBean { public class BackgroundPictureBean extends BaseBean {

View File

@@ -0,0 +1,26 @@
package cc.winboll.studio.powerbell.beans;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/22 14:30:51
* @Describe 电池报告数据模型
*/
public class BatteryData {
public static final String TAG = "BatteryData";
private int currentLevel;
private String dischargeTime;
private String chargeTime;
public BatteryData(int currentLevel, String dischargeTime, String chargeTime) {
this.currentLevel = currentLevel;
this.dischargeTime = dischargeTime;
this.chargeTime = chargeTime;
}
public int getCurrentLevel() { return currentLevel; }
public String getDischargeTime() { return dischargeTime; }
public String getChargeTime() { return chargeTime; }
}

View File

@@ -2,7 +2,7 @@ package cc.winboll.studio.powerbell.beans;
import android.util.JsonReader; import android.util.JsonReader;
import android.util.JsonWriter; import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean; import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;

View File

@@ -7,7 +7,7 @@ package cc.winboll.studio.powerbell.beans;
*/ */
import android.util.JsonReader; import android.util.JsonReader;
import android.util.JsonWriter; import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean; import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException; import java.io.IOException;
public class ControlCenterServiceBean extends BaseBean { public class ControlCenterServiceBean extends BaseBean {

View File

@@ -1,5 +1,4 @@
package cc.winboll.studio.powerbell.dialogs; package cc.winboll.studio.powerbell.dialogs;
import cc.winboll.studio.powerbell.R;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -10,12 +9,13 @@ import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.MainActivity; import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity; import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity;
import cc.winboll.studio.powerbell.utils.BackgroundPictureUtils; import cc.winboll.studio.powerbell.utils.BackgroundPictureUtils;
import cc.winboll.studio.powerbell.utils.FileUtils; import cc.winboll.studio.powerbell.utils.FileUtils;
import cc.winboll.studio.powerbell.utils.UriUtil; import cc.winboll.studio.powerbell.utils.UriUtil;
import cc.winboll.studio.shared.log.LogUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View File

@@ -17,7 +17,8 @@ import android.widget.LinearLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.Switch; import android.widget.Switch;
import android.widget.TextView; import android.widget.TextView;
import cc.winboll.studio.powerbell.GlobalApplication; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.R; import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity; import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity;
import cc.winboll.studio.powerbell.beans.BackgroundPictureBean; import cc.winboll.studio.powerbell.beans.BackgroundPictureBean;
@@ -27,7 +28,6 @@ import cc.winboll.studio.powerbell.utils.BackgroundPictureUtils;
import cc.winboll.studio.powerbell.utils.ServiceUtils; import cc.winboll.studio.powerbell.utils.ServiceUtils;
import cc.winboll.studio.powerbell.views.BatteryDrawable; import cc.winboll.studio.powerbell.views.BatteryDrawable;
import cc.winboll.studio.powerbell.views.VerticalSeekBar; import cc.winboll.studio.powerbell.views.VerticalSeekBar;
import cc.winboll.studio.shared.log.LogUtils;
import java.io.File; import java.io.File;
public class MainViewFragment extends Fragment { public class MainViewFragment extends Fragment {
@@ -78,7 +78,7 @@ public class MainViewFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.fragment_mainview, container, false); mView = inflater.inflate(R.layout.fragment_mainview, container, false);
_mMainViewFragment = MainViewFragment.this; _mMainViewFragment = MainViewFragment.this;
mAppConfigUtils = GlobalApplication.getAppConfigUtils(getActivity()); mAppConfigUtils = App.getAppConfigUtils(getActivity());
// 获取指定ID的View实例 // 获取指定ID的View实例
final View mainImageView = mView.findViewById(R.id.fragmentmainviewImageView1); final View mainImageView = mView.findViewById(R.id.fragmentmainviewImageView1);

View File

@@ -4,11 +4,11 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.beans.AppConfigBean; import cc.winboll.studio.powerbell.beans.AppConfigBean;
import cc.winboll.studio.powerbell.services.ControlCenterService; import cc.winboll.studio.powerbell.services.ControlCenterService;
import cc.winboll.studio.powerbell.utils.AppConfigUtils; import cc.winboll.studio.powerbell.utils.AppConfigUtils;
import cc.winboll.studio.powerbell.utils.BatteryUtils; import cc.winboll.studio.powerbell.utils.BatteryUtils;
import cc.winboll.studio.shared.log.LogUtils;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
public class ControlCenterServiceReceiver extends BroadcastReceiver { public class ControlCenterServiceReceiver extends BroadcastReceiver {
@@ -52,6 +52,13 @@ public class ControlCenterServiceReceiver extends BroadcastReceiver {
appConfigBean.setCurrentValue(nTheQuantityOfElectricity); appConfigBean.setCurrentValue(nTheQuantityOfElectricity);
appConfigBean.setIsCharging(isCharging); appConfigBean.setIsCharging(isCharging);
mwrService.get().startRemindThread(appConfigBean); mwrService.get().startRemindThread(appConfigBean);
// 保存电池报告
// 示例数据更新逻辑
// List<BatteryData> newData = new ArrayList<>(adapter.getDataList());
// newData.add(0, new BatteryData(percentage, "00:00:00", "00:00:00"));
// adapter.updateData(newData);
// 保存好新的电池状态标志 // 保存好新的电池状态标志
_mIsCharging = isCharging; _mIsCharging = isCharging;
_mnTheQuantityOfElectricityOld = nTheQuantityOfElectricity; _mnTheQuantityOfElectricityOld = nTheQuantityOfElectricity;

View File

@@ -4,18 +4,18 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import cc.winboll.studio.powerbell.GlobalApplication; import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.fragments.MainViewFragment; import cc.winboll.studio.powerbell.fragments.MainViewFragment;
import cc.winboll.studio.powerbell.utils.AppConfigUtils; import cc.winboll.studio.powerbell.utils.AppConfigUtils;
import cc.winboll.studio.powerbell.utils.BatteryUtils; import cc.winboll.studio.powerbell.utils.BatteryUtils;
import cc.winboll.studio.powerbell.utils.NotificationUtils; import cc.winboll.studio.powerbell.utils.NotificationHelper;
public class GlobalApplicationReceiver extends BroadcastReceiver { public class GlobalApplicationReceiver extends BroadcastReceiver {
public static final String TAG = "GlobalApplicationReceiver"; public static final String TAG = "GlobalApplicationReceiver";
AppConfigUtils mAppConfigUtils; AppConfigUtils mAppConfigUtils;
GlobalApplication mGlobalApplication; App mGlobalApplication;
// 存储电量指示值, // 存储电量指示值,
// 用于校验电量消息时的电量变化 // 用于校验电量消息时的电量变化
static volatile int _mnTheQuantityOfElectricityOld = -1; static volatile int _mnTheQuantityOfElectricityOld = -1;
@@ -24,10 +24,10 @@ public class GlobalApplicationReceiver extends BroadcastReceiver {
// 便利封装 registerAction() 函数 // 便利封装 registerAction() 函数
GlobalApplicationReceiver mReceiver; GlobalApplicationReceiver mReceiver;
public GlobalApplicationReceiver(GlobalApplication globalApplication) { public GlobalApplicationReceiver(App globalApplication) {
mReceiver = this; mReceiver = this;
mGlobalApplication = globalApplication; mGlobalApplication = globalApplication;
mAppConfigUtils = GlobalApplication.getAppConfigUtils(mGlobalApplication); mAppConfigUtils = App.getAppConfigUtils(mGlobalApplication);
} }
@Override @Override
@@ -45,9 +45,9 @@ public class GlobalApplicationReceiver extends BroadcastReceiver {
// 新电池状态标志某一个有变化就更新显示信息 // 新电池状态标志某一个有变化就更新显示信息
if (_mIsCharging != isCharging || _mnTheQuantityOfElectricityOld != nTheQuantityOfElectricity) { if (_mIsCharging != isCharging || _mnTheQuantityOfElectricityOld != nTheQuantityOfElectricity) {
// 电池状态改变先取消旧的提醒消息 // 电池状态改变先取消旧的提醒消息
NotificationUtils.cancelRemindNotification(context); //NotificationHelper.cancelRemindNotification(context);
GlobalApplication.getAppCacheUtils(context).addChangingTime(nTheQuantityOfElectricity); App.getAppCacheUtils(context).addChangingTime(nTheQuantityOfElectricity);
MainViewFragment.sendMsgCurrentValueBattery(nTheQuantityOfElectricity); MainViewFragment.sendMsgCurrentValueBattery(nTheQuantityOfElectricity);
// 保存好新的电池状态标志 // 保存好新的电池状态标志
_mIsCharging = isCharging; _mIsCharging = isCharging;

View File

@@ -9,10 +9,10 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import cc.winboll.studio.powerbell.GlobalApplication; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.services.ControlCenterService; import cc.winboll.studio.powerbell.services.ControlCenterService;
import cc.winboll.studio.powerbell.utils.ServiceUtils; import cc.winboll.studio.powerbell.utils.ServiceUtils;
import cc.winboll.studio.shared.log.LogUtils;
public class MainReceiver extends BroadcastReceiver { public class MainReceiver extends BroadcastReceiver {
@@ -27,7 +27,7 @@ public class MainReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String szAction = intent.getAction(); String szAction = intent.getAction();
if (szAction.equals(ACTION_BOOT_COMPLETED)) { if (szAction.equals(ACTION_BOOT_COMPLETED)) {
boolean isEnableService = GlobalApplication.getAppConfigUtils(context).getIsEnableService(); boolean isEnableService = App.getAppConfigUtils(context).getIsEnableService();
if (isEnableService) { if (isEnableService) {
if (ServiceUtils.isServiceAlive(context.getApplicationContext(), ControlCenterService.class.getName()) == false) { if (ServiceUtils.isServiceAlive(context.getApplicationContext(), ControlCenterService.class.getName()) == false) {
LogUtils.d(TAG, "wakeupAndBindMain() Wakeup... ControlCenterService"); LogUtils.d(TAG, "wakeupAndBindMain() Wakeup... ControlCenterService");

View File

@@ -6,7 +6,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.powerbell.GlobalApplication; import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.services.ControlCenterService; import cc.winboll.studio.powerbell.services.ControlCenterService;
import cc.winboll.studio.powerbell.utils.AppConfigUtils; import cc.winboll.studio.powerbell.utils.AppConfigUtils;
import cc.winboll.studio.powerbell.utils.ServiceUtils; import cc.winboll.studio.powerbell.utils.ServiceUtils;
@@ -29,7 +29,7 @@ public class AssistantService extends Service {
public void onCreate() { public void onCreate() {
//LogUtils.d(TAG, "onCreate"); //LogUtils.d(TAG, "onCreate");
super.onCreate(); super.onCreate();
mAppConfigUtils = GlobalApplication.getAppConfigUtils(this); mAppConfigUtils = App.getAppConfigUtils(this);
//mMyBinder = new MyBinder(); //mMyBinder = new MyBinder();
if (mMyServiceConnection == null) { if (mMyServiceConnection == null) {

View File

@@ -8,14 +8,19 @@ package cc.winboll.studio.powerbell.services;
* Android Service之onStartCommand方法研究 * Android Service之onStartCommand方法研究
* https://blog.csdn.net/cyp331203/article/details/38920491 * https://blog.csdn.net/cyp331203/article/details/38920491
*/ */
import cc.winboll.studio.powerbell.R; import android.app.Notification;
import android.app.Service; import android.app.Service;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.powerbell.GlobalApplication; import android.widget.RemoteViews;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.beans.AppConfigBean; import cc.winboll.studio.powerbell.beans.AppConfigBean;
import cc.winboll.studio.powerbell.beans.NotificationMessage; import cc.winboll.studio.powerbell.beans.NotificationMessage;
import cc.winboll.studio.powerbell.handlers.ControlCenterServiceHandler; import cc.winboll.studio.powerbell.handlers.ControlCenterServiceHandler;
@@ -24,11 +29,9 @@ import cc.winboll.studio.powerbell.services.AssistantService;
import cc.winboll.studio.powerbell.threads.RemindThread; import cc.winboll.studio.powerbell.threads.RemindThread;
import cc.winboll.studio.powerbell.utils.AppCacheUtils; import cc.winboll.studio.powerbell.utils.AppCacheUtils;
import cc.winboll.studio.powerbell.utils.AppConfigUtils; import cc.winboll.studio.powerbell.utils.AppConfigUtils;
import cc.winboll.studio.powerbell.utils.NotificationUtils; import cc.winboll.studio.powerbell.utils.NotificationHelper;
import cc.winboll.studio.powerbell.utils.ServiceUtils; import cc.winboll.studio.powerbell.utils.ServiceUtils;
import cc.winboll.studio.powerbell.utils.StringUtils; import cc.winboll.studio.powerbell.utils.StringUtils;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.toast.ToastUtils;
public class ControlCenterService extends Service { public class ControlCenterService extends Service {
@@ -43,7 +46,8 @@ public class ControlCenterService extends Service {
AppConfigUtils mAppConfigUtils; AppConfigUtils mAppConfigUtils;
AppCacheUtils mAppCacheUtils; AppCacheUtils mAppCacheUtils;
// 前台服务通知工具 // 前台服务通知工具
NotificationUtils mNotificationUtils; NotificationHelper mNotificationHelper;
Notification notification;
RemindThread mRemindThread; RemindThread mRemindThread;
ControlCenterServiceHandler mControlCenterServiceHandler; ControlCenterServiceHandler mControlCenterServiceHandler;
MyServiceConnection mMyServiceConnection; MyServiceConnection mMyServiceConnection;
@@ -64,9 +68,11 @@ public class ControlCenterService extends Service {
super.onCreate(); super.onCreate();
_mControlCenterService = ControlCenterService.this; _mControlCenterService = ControlCenterService.this;
isServiceRunning = false; isServiceRunning = false;
mAppConfigUtils = GlobalApplication.getAppConfigUtils(this); mAppConfigUtils = App.getAppConfigUtils(this);
mAppCacheUtils = GlobalApplication.getAppCacheUtils(this); mAppCacheUtils = App.getAppCacheUtils(this);
mNotificationUtils = new NotificationUtils(ControlCenterService.this); mNotificationHelper = new NotificationHelper(ControlCenterService.this);
if (mMyServiceConnection == null) { if (mMyServiceConnection == null) {
mMyServiceConnection = new MyServiceConnection(); mMyServiceConnection = new MyServiceConnection();
} }
@@ -92,10 +98,16 @@ public class ControlCenterService extends Service {
// 唤醒守护进程 // 唤醒守护进程
wakeupAndBindAssistant(); wakeupAndBindAssistant();
// 显示前台通知栏 // 显示前台通知栏
NotificationMessage notificationMessage=createNotificationMessage(); // 在Service中
//Toast.makeText(getApplication(), "", Toast.LENGTH_SHORT).show(); NotificationHelper helper = new NotificationHelper(this);
mNotificationUtils.createForegroundNotification(this, notificationMessage); Intent intent = new Intent(this, MainActivity.class);
mNotificationUtils.createRemindNotification(this, notificationMessage); notification = helper.showForegroundNotification(intent, getString(R.string.app_name), "Service Running, Click to open app");
startForeground(NotificationHelper.FOREGROUND_NOTIFICATION_ID, notification);
// NotificationMessage notificationMessage=createNotificationMessage();
// //Toast.makeText(getApplication(), "", Toast.LENGTH_SHORT).show();
// mNotificationUtils.createForegroundNotification(this, notificationMessage);
// mNotificationUtils.createRemindNotification(this, notificationMessage);
if (mControlCenterServiceReceiver == null) { if (mControlCenterServiceReceiver == null) {
// 注册广播接收器 // 注册广播接收器
@@ -118,7 +130,7 @@ public class ControlCenterService extends Service {
} }
NotificationMessage createNotificationMessage() { NotificationMessage createNotificationMessage() {
String szTitle = ((GlobalApplication)getApplication()).getString(R.string.app_name); String szTitle = ((App)getApplication()).getString(R.string.app_name);
String szContent = getValuesString() + " {?} " + StringUtils.formatPCMListString(mAppCacheUtils.getArrayListBatteryInfo()); String szContent = getValuesString() + " {?} " + StringUtils.formatPCMListString(mAppCacheUtils.getArrayListBatteryInfo());
return new NotificationMessage(szTitle, szContent); return new NotificationMessage(szTitle, szContent);
} }
@@ -126,19 +138,19 @@ public class ControlCenterService extends Service {
// 更新前台通知 // 更新前台通知
// //
public void updateServiceNotification() { public void updateServiceNotification() {
mNotificationUtils.updateForegroundNotification(ControlCenterService.this, createNotificationMessage()); //mNotificationUtils.updateForegroundNotification(ControlCenterService.this, createNotificationMessage());
} }
// 更新前台通知 // 更新前台通知
// //
public void updateServiceNotification(NotificationMessage notificationMessage) { public void updateServiceNotification(NotificationMessage notificationMessage) {
mNotificationUtils.updateForegroundNotification(ControlCenterService.this, notificationMessage); //mNotificationUtils.updateForegroundNotification(ControlCenterService.this, notificationMessage);
} }
// 更新前台通知 // 更新前台通知
// //
public void updateRemindNotification(NotificationMessage notificationMessage) { public void updateRemindNotification(NotificationMessage notificationMessage) {
mNotificationUtils.updateRemindNotification(ControlCenterService.this, notificationMessage); //mNotificationUtils.updateRemindNotification(ControlCenterService.this, notificationMessage);
} }
// 唤醒和绑定守护进程 // 唤醒和绑定守护进程
@@ -234,10 +246,32 @@ public class ControlCenterService extends Service {
} }
public void appenRemindMSG(String szRemindMSG) { public void appenRemindMSG(String szRemindMSG) {
NotificationMessage notificationMessage = createNotificationMessage(); String msg = "";
notificationMessage.setRemindMSG(szRemindMSG); for (int i = 0; i < 20; i++) {
//LogUtils.d(TAG, "notificationMessage : " + notificationMessage.getRemindMSG()); msg += szRemindMSG;
updateRemindNotification(notificationMessage); }
NotificationHelper helper = new NotificationHelper(ControlCenterService.this);
Intent intent = new Intent(ControlCenterService.this, MainActivity.class);
helper.showTemporaryNotification(intent, getString(R.string.app_name), msg);
// NotificationMessage notificationMessage = createNotificationMessage();
// notificationMessage.setRemindMSG(szRemindMSG);
// //LogUtils.d(TAG, "notificationMessage : " + notificationMessage.getRemindMSG());
// updateRemindNotification(notificationMessage);
}
// 设置颜色背景
public static RemoteViews setLinearLayoutColor(RemoteViews remoteViews, int viewId, int color) {
remoteViews.setInt(viewId, "setBackgroundColor", color);
return remoteViews;
}
// 设置Drawable背景
public static RemoteViews setLinearLayoutDrawable(RemoteViews remoteViews, int viewId, int drawableRes) {
remoteViews.setInt(viewId, "setBackgroundResource", drawableRes);
return remoteViews;
} }
// //

View File

@@ -2,8 +2,8 @@ package cc.winboll.studio.powerbell.threads;
import android.content.Context; import android.content.Context;
import android.os.Message; import android.os.Message;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.handlers.ControlCenterServiceHandler; import cc.winboll.studio.powerbell.handlers.ControlCenterServiceHandler;
import cc.winboll.studio.shared.log.LogUtils;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
public class RemindThread extends Thread { public class RemindThread extends Thread {

View File

@@ -1,8 +1,8 @@
package cc.winboll.studio.powerbell.utils; package cc.winboll.studio.powerbell.utils;
import android.content.Context; import android.content.Context;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.beans.BatteryInfoBean; import cc.winboll.studio.powerbell.beans.BatteryInfoBean;
import cc.winboll.studio.shared.log.LogUtils;
import java.util.ArrayList; import java.util.ArrayList;
public class AppCacheUtils { public class AppCacheUtils {

View File

@@ -2,14 +2,14 @@ package cc.winboll.studio.powerbell.utils;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import cc.winboll.studio.powerbell.GlobalApplication; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.MainActivity; import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.beans.AppConfigBean; import cc.winboll.studio.powerbell.beans.AppConfigBean;
import cc.winboll.studio.powerbell.beans.ControlCenterServiceBean; import cc.winboll.studio.powerbell.beans.ControlCenterServiceBean;
import cc.winboll.studio.powerbell.dialogs.YesNoAlertDialog; import cc.winboll.studio.powerbell.dialogs.YesNoAlertDialog;
import cc.winboll.studio.powerbell.fragments.MainViewFragment; import cc.winboll.studio.powerbell.fragments.MainViewFragment;
import cc.winboll.studio.powerbell.services.ControlCenterService; import cc.winboll.studio.powerbell.services.ControlCenterService;
import cc.winboll.studio.shared.log.LogUtils;
import java.io.File; import java.io.File;
// 应用配置工具类 // 应用配置工具类
@@ -42,7 +42,7 @@ public class AppConfigUtils {
volatile String mszBackgroundFileName = ""; volatile String mszBackgroundFileName = "";
// 保存应用实例 // 保存应用实例
GlobalApplication mApplication; App mApplication;
AppConfigUtils(Context context) { AppConfigUtils(Context context) {
mContext = context; mContext = context;
@@ -193,7 +193,7 @@ public class AppConfigUtils {
// //
void saveConfigData() { void saveConfigData() {
// 更新配置先取消一下旧的的提醒消息 // 更新配置先取消一下旧的的提醒消息
NotificationUtils.cancelRemindNotification(mContext); //NotificationHelper.cancelRemindNotification(mContext);
AppConfigBean.saveBean(mContext, mAppConfigBean); AppConfigBean.saveBean(mContext, mAppConfigBean);
// 通知活动窗口和服务配置已更新 // 通知活动窗口和服务配置已更新

View File

@@ -2,7 +2,7 @@ package cc.winboll.studio.powerbell.utils;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import cc.winboll.studio.shared.log.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;

View File

@@ -3,7 +3,7 @@ package cc.winboll.studio.powerbell.utils;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import cc.winboll.studio.shared.log.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;

View File

@@ -0,0 +1,150 @@
package cc.winboll.studio.powerbell.utils;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/22 04:39:40
* @Describe 通知工具类
*/
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.widget.RemoteViews;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import cc.winboll.studio.powerbell.R;
public class NotificationHelper {
public static final String TAG = "NotificationHelper";
// 渠道ID和名称
private static final String CHANNEL_ID_FOREGROUND = "foreground_channel";
private static final String CHANNEL_NAME_FOREGROUND = "Foreground Service";
private static final String CHANNEL_ID_TEMPORARY = "temporary_channel";
private static final String CHANNEL_NAME_TEMPORARY = "Temporary Notifications";
// 通知ID
public static final int FOREGROUND_NOTIFICATION_ID = 1001;
public static final int TEMPORARY_NOTIFICATION_ID = 2001;
private final Context mContext;
private final NotificationManager mNotificationManager;
public NotificationHelper(Context context) {
mContext = context;
mNotificationManager = context.getSystemService(NotificationManager.class);
createNotificationChannels();
}
@RequiresApi(api = Build.VERSION_CODES.O)
private void createNotificationChannels() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createForegroundChannel();
createTemporaryChannel();
}
}
@RequiresApi(api = Build.VERSION_CODES.O)
private void createForegroundChannel() {
NotificationChannel channel = new NotificationChannel(
CHANNEL_ID_FOREGROUND,
CHANNEL_NAME_FOREGROUND,
NotificationManager.IMPORTANCE_LOW
);
channel.setDescription("Persistent service notifications");
channel.setSound(null, null);
channel.enableVibration(false);
mNotificationManager.createNotificationChannel(channel);
}
@RequiresApi(api = Build.VERSION_CODES.O)
private void createTemporaryChannel() {
NotificationChannel channel = new NotificationChannel(
CHANNEL_ID_TEMPORARY,
CHANNEL_NAME_TEMPORARY,
NotificationManager.IMPORTANCE_HIGH
);
channel.setDescription("Temporary alert notifications");
channel.setSound(null, null);
channel.enableVibration(true);
channel.setVibrationPattern(new long[]{100, 200, 300, 400});
channel.setBypassDnd(true);
mNotificationManager.createNotificationChannel(channel);
}
// 显示常驻通知(通常用于前台服务)
public Notification showForegroundNotification(Intent intent, String title, String content) {
PendingIntent pendingIntent = createPendingIntent(intent);
Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_FOREGROUND)
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher))
.setContentTitle(title)
.setContentText(content)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_LOW)
.setOngoing(true)
.build();
mNotificationManager.notify(FOREGROUND_NOTIFICATION_ID, notification);
return notification;
}
// 显示临时通知(自动消失)
public void showTemporaryNotification(Intent intent, String title, String content) {
PendingIntent pendingIntent = createPendingIntent(intent);
Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_TEMPORARY)
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher))
.setContentTitle(title)
.setContentText(content)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(true)
.setVibrate(new long[]{100, 200, 300, 400})
.build();
mNotificationManager.notify(TEMPORARY_NOTIFICATION_ID, notification);
}
// 创建自定义布局通知(可扩展)
public void showCustomNotification(Intent intent, RemoteViews contentView, RemoteViews bigContentView) {
PendingIntent pendingIntent = createPendingIntent(intent);
Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_TEMPORARY)
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pendingIntent)
.setContent(contentView)
.setCustomBigContentView(bigContentView)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(true)
.build();
mNotificationManager.notify(TEMPORARY_NOTIFICATION_ID + 1, notification);
}
// 取消所有通知
public void cancelAllNotifications() {
mNotificationManager.cancelAll();
}
// 创建PendingIntent兼容不同API版本
private PendingIntent createPendingIntent(Intent intent) {
int flags = PendingIntent.FLAG_UPDATE_CURRENT;
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// flags |= PendingIntent.FLAG_IMMUTABLE;
// }
return PendingIntent.getActivity(
mContext,
0,
intent,
flags
);
}
}

View File

@@ -18,14 +18,15 @@ import android.media.RingtoneManager;
import android.os.Build; import android.os.Build;
import android.view.View; import android.view.View;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import androidx.annotation.RequiresApi;
import cc.winboll.studio.powerbell.MainActivity; import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.R; import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.beans.NotificationMessage; import cc.winboll.studio.powerbell.beans.NotificationMessage;
import cc.winboll.studio.powerbell.services.ControlCenterService; import cc.winboll.studio.powerbell.services.ControlCenterService;
public class NotificationUtils { public class NotificationUtils2 {
public static final String TAG = NotificationUtils.class.getSimpleName(); public static final String TAG = NotificationHelper.class.getSimpleName();
Context mContext; Context mContext;
NotificationManager mNotificationManager; NotificationManager mNotificationManager;
@@ -45,19 +46,53 @@ public class NotificationUtils {
private static String _mszChannelIDRemind = "2"; private static String _mszChannelIDRemind = "2";
private static String _mszChannelNameRemind = "Remind"; private static String _mszChannelNameRemind = "Remind";
public NotificationUtils(Context context) { // public NotificationUtils(Context context) {
// mContext = context;
// mNotificationManager = (NotificationManager) context.getSystemService(
// Context.NOTIFICATION_SERVICE);
// }
public NotificationUtils2(Context context) {
mContext = context; mContext = context;
mNotificationManager = (NotificationManager) context.getSystemService( mNotificationManager = context.getSystemService(NotificationManager.class);
Context.NOTIFICATION_SERVICE); //createNotificationChannels();
} }
public void createNotificationChannel() { @RequiresApi(api = Build.VERSION_CODES.O)
NotificationChannel channel1 = new NotificationChannel(_mszChannelIDService, _mszChannelNameService, NotificationManager.IMPORTANCE_DEFAULT); public void createNotificationChannels() {
channel1.setSound(null, null); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mNotificationManager.createNotificationChannel(channel1); createServiceChannel();
NotificationChannel channel2 = new NotificationChannel(_mszChannelIDRemind, _mszChannelNameRemind, NotificationManager.IMPORTANCE_HIGH); createRemindChannel();
channel2.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE), Notification.AUDIO_ATTRIBUTES_DEFAULT); }
mNotificationManager.createNotificationChannel(channel2); }
@RequiresApi(api = Build.VERSION_CODES.O)
private void createServiceChannel() {
NotificationChannel channel = new NotificationChannel(
_mszChannelIDService,
_mszChannelNameService,
NotificationManager.IMPORTANCE_LOW
);
channel.setDescription("Background service updates");
channel.setSound(null, null);
channel.enableVibration(false);
mNotificationManager.createNotificationChannel(channel);
}
@RequiresApi(api = Build.VERSION_CODES.O)
private void createRemindChannel() {
NotificationChannel channel = new NotificationChannel(
_mszChannelIDRemind,
_mszChannelNameRemind,
NotificationManager.IMPORTANCE_HIGH
);
channel.setDescription("Critical reminders");
channel.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM), null);
channel.enableVibration(true);
channel.setVibrationPattern(new long[]{100, 200, 300, 400});
channel.setBypassDnd(true);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
mNotificationManager.createNotificationChannel(channel);
} }
// 创建并发送服务通知 // 创建并发送服务通知

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1dp"
android:color="#E0E0E0"/>
</shape>

View File

@@ -6,20 +6,26 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<cc.winboll.studio.libaes.views.AToolbar <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height" android:layout_height="wrap_content">
android:id="@+id/toolbar"
style="@style/DefaultAToolbar"/>
<cc.winboll.studio.shared.view.AboutView <cc.winboll.studio.libaes.views.AToolbar
app:appname="PowerBell" android:layout_width="match_parent"
app:appprojectname="PowerBell" android:layout_height="@dimen/toolbar_height"
app:appdescription="@string/app_description" android:id="@+id/toolbar"
app:appicon="@drawable/ic_launcher" android:gravity="center_vertical"
android:layout_width="match_parent" style="@style/DefaultAToolbar"/>
android:layout_height="match_parent"
android:id="@+id/activityaboutAboutView1"/> </LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:id="@+id/root_ll"/>
</LinearLayout> </LinearLayout>

View File

@@ -26,29 +26,27 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/toolbar"> android:layout_below="@id/toolbar">
<LinearLayout <RelativeLayout
android:orientation="horizontal" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:gravity="right">
<cc.winboll.studio.libaes.views.AButton <cc.winboll.studio.libaes.views.AButton
android:layout_width="180dp" android:layout_width="160dp"
android:layout_height="36dp" android:layout_height="36dp"
android:text="Origin BG" android:text="Origin BG"
android:layout_gravity="center_vertical" android:id="@+id/activitybackgroundpictureAButton5"
android:layout_margin="10dp" android:layout_alignParentLeft="true"
android:id="@+id/activitybackgroundpictureAButton5"/> android:layout_margin="5dp"/>
<cc.winboll.studio.libaes.views.AButton <cc.winboll.studio.libaes.views.AButton
android:layout_width="180dp" android:layout_width="160dp"
android:layout_height="36dp" android:layout_height="36dp"
android:text="Received BG" android:text="Received BG"
android:layout_gravity="center_vertical" android:id="@+id/activitybackgroundpictureAButton4"
android:layout_margin="10dp" android:layout_alignParentRight="true"
android:id="@+id/activitybackgroundpictureAButton4"/> android:layout_margin="5dp"/>
</LinearLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="电池使用报告"
android:textSize="24sp"
android:fontFamily="sans-serif-medium"
android:layout_marginBottom="16dp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvBatteryReport"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@drawable/divider_line"
android:dividerHeight="1dp"/>
</LinearLayout>

View File

@@ -33,10 +33,10 @@
</LinearLayout> </LinearLayout>
<cc.winboll.studio.shared.log.LogView <cc.winboll.studio.libappbase.LogView
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="200dp"
android:id="@+id/logview"/> android:id="@+id/logview"/>
</LinearLayout> </LinearLayout>

View File

@@ -0,0 +1,11 @@
<?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"
android:id="@+id/ll_notification">
</LinearLayout>

View File

@@ -0,0 +1,17 @@
<?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"
android:id="@+id/ll_notification">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text"
android:id="@+id/info_tv"/>
</LinearLayout>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="12dp"
android:gravity="center_vertical"
android:background="@android:color/white">
<TextView
android:id="@+id/tvLevel"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:textSize="18sp"
android:fontFamily="sans-serif-medium"/>
<TextView
android:id="@+id/tvDischargeTime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16sp"
android:paddingStart="16dp"/>
<TextView
android:id="@+id/tvChargeTime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16sp"
android:paddingStart="16dp"/>
</LinearLayout>

View File

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

View File

@@ -1,9 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<attr name="appTheme" format="reference"/>
<declare-styleable name="AToolbar">
<attr name="attrAToolbarStartColor" format="color" />
<attr name="attrAToolbarCenterColor" format="color" />
<attr name="attrAToolbarEndColor" format="color" />
</declare-styleable>
</resources> </resources>

View File

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

View File

@@ -12,6 +12,7 @@
</style> </style>
<style name="DefaultAToolbar"> <style name="DefaultAToolbar">
<item name="attrAToolbarTitleTextColor">#FF000000</item>
<item name="attrAToolbarStartColor">@color/colorShuiDark</item> <item name="attrAToolbarStartColor">@color/colorShuiDark</item>
<item name="attrAToolbarCenterColor">@color/colorShui</item> <item name="attrAToolbarCenterColor">@color/colorShui</item>
<item name="attrAToolbarEndColor">@color/colorShuiAccent</item> <item name="attrAToolbarEndColor">@color/colorShuiAccent</item>

View File

@@ -4,20 +4,18 @@
<application> <application>
<!-- Put flavor specific code here -->
<provider <provider
tools:replace="android:authorities"
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="cc.winboll.studio.powerbell.fileprovider" android:authorities="cc.winboll.studio.powerbell.fileprovider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
tools:replace="android:resource"
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider"/> android:resource="@xml/file_provider"/>
</provider> </provider>
</application> </application>
</manifest> </manifest>