From 6ccbaf8c328178d3a3a5ee38e4a94c3002f0d133 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 15 Mar 2025 15:21:41 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B1=BB=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.gradle | 34 ++++--------------- autoinstaller/build.properties | 12 +++---- autoinstaller/src/main/AndroidManifest.xml | 2 +- .../cc/winboll/studio/autoinstaller/App.java | 15 ++++---- .../studio/autoinstaller/FileListener.java | 2 +- .../studio/autoinstaller/MainActivity.java | 10 +++--- .../autoinstaller/beans/AppConfigs.java | 2 +- .../autoinstaller/receivers/MainReceiver.java | 2 +- .../autoinstaller/services/MainService.java | 5 +-- .../autoinstaller/utils/PackageUtil.java | 2 +- .../src/main/res/layout/activity_main.xml | 2 +- autoinstaller/src/main/res/values/styles.xml | 13 +++++++ autoinstaller/src/main/res/values/themes.xml | 14 -------- 13 files changed, 49 insertions(+), 66 deletions(-) create mode 100644 autoinstaller/src/main/res/values/styles.xml delete mode 100644 autoinstaller/src/main/res/values/themes.xml diff --git a/autoinstaller/build.gradle b/autoinstaller/build.gradle index ba56e67..e8f0df5 100644 --- a/autoinstaller/build.gradle +++ b/autoinstaller/build.gradle @@ -18,18 +18,18 @@ def genVersionName(def versionName){ } android { - compileSdkVersion 32 - buildToolsVersion "33.0.3" + compileSdkVersion 30 + buildToolsVersion "30.0.3" defaultConfig { applicationId "cc.winboll.studio.autoinstaller" - minSdkVersion 24 - targetSdkVersion 30 + minSdkVersion 26 + targetSdkVersion 29 versionCode 2 // versionName 更新后需要手动设置 // .winboll/winbollBuildProps.properties 文件的 stageCount=0 // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" - versionName "5.0" + versionName "15.0" if(true) { versionName = genVersionName("${versionName}") } @@ -41,30 +41,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } } dependencies { - api 'cc.winboll.studio:winboll-shared:1.1.0' - api 'io.github.medyo:android-about-page:2.0.0' - api 'com.github.getActivity:ToastUtils:10.5' - api 'com.jcraft:jsch:0.1.55' - api 'org.jsoup:jsoup:1.13.1' - api 'com.squareup.okhttp3:okhttp:4.4.1' - - api 'androidx.appcompat:appcompat:1.0.0' - api 'androidx.fragment:fragment:1.0.0' - api 'com.google.android.material:material:1.0.0' - - api 'androidx.vectordrawable:vectordrawable-animated:1.0.0' - api 'androidx.lifecycle:lifecycle-livedata:1.0.0' - - //api 'cc.winboll.studio:libaes:6.3.2' - //api 'cc.winboll.studio:libapputils:8.3.8' - api fileTree(dir: 'libs', include: ['*.jar']) + implementation 'cc.winboll.studio:libappbase:15.0.0' + implementation 'androidx.appcompat:appcompat:1.1.0' } diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 1db8525..1cf870a 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Thu Jan 02 02:39:56 HKT 2025 -stageCount=4 +#Sat Mar 15 07:19:52 GMT 2025 +stageCount=0 libraryProject= -baseVersion=5.0 -publishVersion=5.0.3 -buildCount=0 -baseBetaVersion=5.0.4 +baseVersion=15.0 +publishVersion=15.0.0 +buildCount=9 +baseBetaVersion=15.0.1 diff --git a/autoinstaller/src/main/AndroidManifest.xml b/autoinstaller/src/main/AndroidManifest.xml index 0da8a10..506ea85 100644 --- a/autoinstaller/src/main/AndroidManifest.xml +++ b/autoinstaller/src/main/AndroidManifest.xml @@ -33,7 +33,7 @@ android:persistent="true" android:supportsRtl="true" android:requestLegacyExternalStorage="true" - android:theme="@style/Theme.Application"> + android:theme="@style/MyAppTheme"> - + + + + diff --git a/autoinstaller/src/main/res/values/themes.xml b/autoinstaller/src/main/res/values/themes.xml deleted file mode 100644 index 89d5280..0000000 --- a/autoinstaller/src/main/res/values/themes.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - \ No newline at end of file From f04f5cf77c02e262f8a74e08f1bc2e1b03d21989 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 15 Mar 2025 15:33:36 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=89=E5=8D=93?= =?UTF-8?q?=E9=80=82=E9=85=8D=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.gradle | 2 +- autoinstaller/build.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoinstaller/build.gradle b/autoinstaller/build.gradle index e8f0df5..77ae304 100644 --- a/autoinstaller/build.gradle +++ b/autoinstaller/build.gradle @@ -45,6 +45,6 @@ android { dependencies { api fileTree(dir: 'libs', include: ['*.jar']) - implementation 'cc.winboll.studio:libappbase:15.0.0' + implementation 'cc.winboll.studio:libappbase:15.0.2' implementation 'androidx.appcompat:appcompat:1.1.0' } diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 1cf870a..5973145 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat Mar 15 07:19:52 GMT 2025 +#Sat Mar 15 07:32:25 GMT 2025 stageCount=0 libraryProject= baseVersion=15.0 publishVersion=15.0.0 -buildCount=9 +buildCount=12 baseBetaVersion=15.0.1 From 5714aed7610a75701612ed29f38520fce8525000 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 15 Mar 2025 15:38:45 +0800 Subject: [PATCH 03/30] APK 15.0.0 release Publish. --- autoinstaller/build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 5973145..26e242a 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat Mar 15 07:32:25 GMT 2025 -stageCount=0 +#Sat Mar 15 15:38:45 HKT 2025 +stageCount=1 libraryProject= baseVersion=15.0 publishVersion=15.0.0 -buildCount=12 +buildCount=0 baseBetaVersion=15.0.1 From e815c08970ea4604715b71097af584f9f38648b4 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 2 Apr 2025 20:41:05 +0800 Subject: [PATCH 04/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B1=BB=E5=BA=93?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E6=8E=89=E4=B8=BB=E7=AA=97=E5=8F=A3=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E7=9A=84=E5=90=90=E5=8F=B8=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestStringToQRCodeViewActivity.java | 36 ------------------- autoinstaller/build.gradle | 27 ++++++++++++-- autoinstaller/build.properties | 4 +-- .../cc/winboll/studio/autoinstaller/App.java | 12 +++---- .../studio/autoinstaller/MainActivity.java | 2 +- 5 files changed, 34 insertions(+), 47 deletions(-) delete mode 100644 apputils/src/main/java/cc/winboll/studio/apputils/TestStringToQRCodeViewActivity.java diff --git a/apputils/src/main/java/cc/winboll/studio/apputils/TestStringToQRCodeViewActivity.java b/apputils/src/main/java/cc/winboll/studio/apputils/TestStringToQRCodeViewActivity.java deleted file mode 100644 index a77addd..0000000 --- a/apputils/src/main/java/cc/winboll/studio/apputils/TestStringToQRCodeViewActivity.java +++ /dev/null @@ -1,36 +0,0 @@ -package cc.winboll.studio.apputils; - -/** - * @Author ZhanGSKen@QQ.COM - * @Date 2025/01/17 19:50:46 - */ -import android.app.Activity; -import android.os.Bundle; -import android.widget.Toolbar; -import cc.winboll.studio.apputils.R; -import cc.winboll.studio.libapputils.views.StringToQrCodeView; - -public class TestStringToQRCodeViewActivity extends Activity { - - public static final String TAG = "TestStringToQrCodeViewActivity"; - - StringToQrCodeView mStringToQrCodeView; -// -// @Override -// public Activity getActivity() { -// return this; -// } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_teststringtoqrcodeview); - - // 初始化工具栏 - Toolbar mToolbar = findViewById(R.id.toolbar); - mToolbar.setSubtitle(TAG); - setActionBar(mToolbar); - - mStringToQrCodeView = findViewById(R.id.activityteststringtoqrcodeviewStringToQrCodeView1); - } -} diff --git a/autoinstaller/build.gradle b/autoinstaller/build.gradle index 77ae304..a17dbc7 100644 --- a/autoinstaller/build.gradle +++ b/autoinstaller/build.gradle @@ -45,6 +45,29 @@ android { dependencies { api fileTree(dir: 'libs', include: ['*.jar']) - implementation 'cc.winboll.studio:libappbase:15.0.2' - implementation 'androidx.appcompat:appcompat:1.1.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 'io.github.medyo:android-about-page:2.0.0' + // 吐司类库 + api 'com.github.getActivity:ToastUtils:10.5' + // 网络连接类库 + 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:libaes:15.2.5' + api 'cc.winboll.studio:libapputils:15.2.1' + api 'cc.winboll.studio:libappbase:15.2.2' } diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 26e242a..aeab1b6 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat Mar 15 15:38:45 HKT 2025 +#Wed Apr 02 12:38:03 GMT 2025 stageCount=1 libraryProject= baseVersion=15.0 publishVersion=15.0.0 -buildCount=0 +buildCount=3 baseBetaVersion=15.0.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java index aa13ae6..515d633 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java @@ -5,10 +5,10 @@ package cc.winboll.studio.autoinstaller; * @Date 2024/04/28 02:39:58 * @Describe 全局应用类 */ - - +import android.view.Gravity; +import cc.winboll.studio.autoinstaller.R; import cc.winboll.studio.libappbase.GlobalApplication; -import cc.winboll.studio.libappbase.utils.ToastUtils; +import com.hjq.toast.ToastUtils; public class App extends GlobalApplication { @@ -17,13 +17,13 @@ public class App extends GlobalApplication { @Override public void onCreate() { super.onCreate(); - setIsDebuging(this, BuildConfig.DEBUG); + // 初始化 Toast 框架 ToastUtils.init(this); // 设置 Toast 布局样式 - //ToastUtils.setView(R.layout.toast_custom_view); + ToastUtils.setView(R.layout.view_toast); //ToastUtils.setStyle(new WhiteToastStyle()); - //ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); + ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); } } diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java index c78493c..11f3e45 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java @@ -140,7 +140,7 @@ public class MainActivity extends Activity { Intent intent = getPackageManager().getLaunchIntentForPackage(mszInstalledPackageName); if (intent != null) { - ToastUtils.show("startActivity"); + //ToastUtils.show("startActivity"); startActivity(intent); } else { // 若没能获取到启动意图,可进行相应提示等操作,比如跳转到应用商店让用户下载该应用(示例) From d507d4ac0615e340648d33a355d81362572a19c7 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 2 Apr 2025 20:45:25 +0800 Subject: [PATCH 05/30] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=90=90=E5=8F=B8=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 ++-- .../java/cc/winboll/studio/autoinstaller/MainActivity.java | 5 ++--- .../winboll/studio/autoinstaller/services/MainService.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index aeab1b6..48f32ad 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Wed Apr 02 12:38:03 GMT 2025 +#Wed Apr 02 12:44:10 GMT 2025 stageCount=1 libraryProject= baseVersion=15.0 publishVersion=15.0.0 -buildCount=3 +buildCount=5 baseBetaVersion=15.0.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java index 11f3e45..63a428d 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java @@ -13,7 +13,6 @@ import android.widget.RadioButton; import android.widget.SimpleAdapter; import android.widget.Switch; import android.widget.TextClock; -import android.widget.Toast; import androidx.core.content.FileProvider; import cc.winboll.studio.autoinstaller.MainActivity; import cc.winboll.studio.autoinstaller.beans.AppConfigs; @@ -22,7 +21,7 @@ import cc.winboll.studio.autoinstaller.utils.NotificationUtil; import cc.winboll.studio.autoinstaller.views.ListViewForScrollView; import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogView; -import cc.winboll.studio.libappbase.utils.ToastUtils; +import com.hjq.toast.ToastUtils; import java.io.File; import java.util.ArrayList; import java.util.List; @@ -197,7 +196,7 @@ public class MainActivity extends Activity { // if (szFilePath.trim().equals("")) { sw.setChecked(false); - Toast.makeText(getApplication(), "监控路径为空。", Toast.LENGTH_SHORT).show(); + ToastUtils.show("监控路径为空。"); return; } diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java index 2bee70f..fe1fe5d 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java @@ -21,7 +21,7 @@ import cc.winboll.studio.autoinstaller.utils.NotificationUtil; import cc.winboll.studio.autoinstaller.utils.PackageUtil; import cc.winboll.studio.autoinstaller.utils.ServiceUtil; import cc.winboll.studio.libappbase.LogUtils; -import cc.winboll.studio.libappbase.utils.ToastUtils; +import com.hjq.toast.ToastUtils; import java.io.File; import java.lang.ref.WeakReference; From b64a229ab18cd7bd852ab5646dd7f04434a6aa0e Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 2 Apr 2025 20:48:37 +0800 Subject: [PATCH 06/30] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 ++-- .../java/cc/winboll/studio/autoinstaller/MainActivity.java | 2 +- .../studio/autoinstaller/{beans => models}/AppConfigs.java | 4 ++-- .../winboll/studio/autoinstaller/receivers/MainReceiver.java | 2 +- .../studio/autoinstaller/services/AssistantService.java | 2 +- .../cc/winboll/studio/autoinstaller/services/MainService.java | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/{beans => models}/AppConfigs.java (97%) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 48f32ad..d068ef7 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Wed Apr 02 12:44:10 GMT 2025 +#Wed Apr 02 12:47:46 GMT 2025 stageCount=1 libraryProject= baseVersion=15.0 publishVersion=15.0.0 -buildCount=5 +buildCount=7 baseBetaVersion=15.0.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java index 63a428d..3b5356e 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java @@ -15,7 +15,7 @@ import android.widget.Switch; import android.widget.TextClock; import androidx.core.content.FileProvider; import cc.winboll.studio.autoinstaller.MainActivity; -import cc.winboll.studio.autoinstaller.beans.AppConfigs; +import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.services.MainService; import cc.winboll.studio.autoinstaller.utils.NotificationUtil; import cc.winboll.studio.autoinstaller.views.ListViewForScrollView; diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/beans/AppConfigs.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java similarity index 97% rename from autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/beans/AppConfigs.java rename to autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java index cd1c031..19bcc05 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/beans/AppConfigs.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java @@ -1,4 +1,4 @@ -package cc.winboll.studio.autoinstaller.beans; +package cc.winboll.studio.autoinstaller.models; /** * @Author ZhanGSKen@QQ.COM @@ -8,7 +8,7 @@ package cc.winboll.studio.autoinstaller.beans; import android.content.Context; import android.util.JsonReader; import android.util.JsonWriter; -import cc.winboll.studio.autoinstaller.beans.AppConfigs; +import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.utils.FileUtil; import cc.winboll.studio.libappbase.LogUtils; import java.io.IOException; diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java index 8eaa204..0c592c8 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java @@ -4,7 +4,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Build; -import cc.winboll.studio.autoinstaller.beans.AppConfigs; +import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.services.MainService; import cc.winboll.studio.libappbase.LogUtils; diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java index 54b83aa..30f0eba 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java @@ -6,7 +6,7 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; -import cc.winboll.studio.autoinstaller.beans.AppConfigs; +import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.utils.ServiceUtil; /** diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java index fe1fe5d..6c06133 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java @@ -14,7 +14,7 @@ import android.widget.Toast; import androidx.core.content.FileProvider; import cc.winboll.studio.autoinstaller.FileListener; import cc.winboll.studio.autoinstaller.MainActivity; -import cc.winboll.studio.autoinstaller.beans.AppConfigs; +import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.services.AssistantService; import cc.winboll.studio.autoinstaller.services.MainService; import cc.winboll.studio.autoinstaller.utils.NotificationUtil; From df55608eb35a06cdeb5866a5941b53cf4643abc4 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 2 Apr 2025 21:22:03 +0800 Subject: [PATCH 07/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=8C=89=E9=92=AE=E7=9A=84=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.gradle | 2 +- autoinstaller/build.properties | 12 +-- .../studio/autoinstaller/MainActivity.java | 20 +++-- .../studio/autoinstaller/models/APKModel.java | 75 +++++++++++++++++++ .../autoinstaller/services/MainService.java | 17 ++++- 5 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/APKModel.java diff --git a/autoinstaller/build.gradle b/autoinstaller/build.gradle index a17dbc7..75ba7ae 100644 --- a/autoinstaller/build.gradle +++ b/autoinstaller/build.gradle @@ -29,7 +29,7 @@ android { // versionName 更新后需要手动设置 // .winboll/winbollBuildProps.properties 文件的 stageCount=0 // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" - versionName "15.0" + versionName "15.2" if(true) { versionName = genVersionName("${versionName}") } diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index d068ef7..4398898 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Wed Apr 02 12:47:46 GMT 2025 -stageCount=1 +#Wed Apr 02 13:23:10 GMT 2025 +stageCount=0 libraryProject= -baseVersion=15.0 -publishVersion=15.0.0 -buildCount=7 -baseBetaVersion=15.0.1 +baseVersion=15.2 +publishVersion=15.2.0 +buildCount=3 +baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java index 3b5356e..63aefc3 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java @@ -2,7 +2,6 @@ package cc.winboll.studio.autoinstaller; import android.app.Activity; import android.content.Intent; -import android.content.pm.PackageManager; import android.graphics.Color; import android.net.Uri; import android.os.Build; @@ -15,6 +14,7 @@ import android.widget.Switch; import android.widget.TextClock; import androidx.core.content.FileProvider; import cc.winboll.studio.autoinstaller.MainActivity; +import cc.winboll.studio.autoinstaller.models.APKModel; import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.services.MainService; import cc.winboll.studio.autoinstaller.utils.NotificationUtil; @@ -31,7 +31,8 @@ public class MainActivity extends Activity { public static final String TAG = "MainActivity"; private static final int INSTALL_PERMISSION_CODE = 1; - + + ArrayList _APKModelList = new ArrayList(); LogView mLogView; TextClock mTextClock; EditText mEditText; @@ -131,12 +132,21 @@ public class MainActivity extends Activity { } + String getLastApkPackageName() { + APKModel.loadBeanList(this, _APKModelList, APKModel.class); + if (_APKModelList.size() > 0) { + return _APKModelList.get(_APKModelList.size() - 1).getApkPackageName(); + } + return ""; + } + public void onOpenAPP(View view) { - if (mszInstalledPackageName.trim().equals("")) { + String szInstalledPackageName = getLastApkPackageName(); + if (szInstalledPackageName.trim().equals("")) { ToastUtils.show("Installed APP package name is null."); return; } - + Intent intent = getPackageManager().getLaunchIntentForPackage(mszInstalledPackageName); if (intent != null) { //ToastUtils.show("startActivity"); @@ -252,8 +262,6 @@ public class MainActivity extends Activity { Intent intentService = new Intent(MainActivity.this, MainService.class); //intentService.putExtra(MainService.EXTRA_APKFILEPATH, szAPKFilePath); startService(intentService); - - } /* diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/APKModel.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/APKModel.java new file mode 100644 index 0000000..cd7c225 --- /dev/null +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/APKModel.java @@ -0,0 +1,75 @@ +package cc.winboll.studio.autoinstaller.models; + +/** + * @Author ZhanGSKen@AliYun.Com + * @Date 2025/04/02 20:50:29 + * @Describe 监控的 APK 安装文件对应的应用信息数据模型 + */ +import android.util.JsonReader; +import android.util.JsonWriter; +import cc.winboll.studio.libappbase.BaseBean; +import java.io.IOException; + +public class APKModel extends BaseBean { + + public static final String TAG = "APPModel"; + + // 每次更新的 APK 文件对应的应用包名称 + String apkPackageName; + + public APKModel() { + this.apkPackageName = ""; + } + + public APKModel(String apkPackageName) { + this.apkPackageName = apkPackageName; + } + + public void setApkPackageName(String apkPackageName) { + this.apkPackageName = apkPackageName; + } + + public String getApkPackageName() { + return apkPackageName; + } + + + + @Override + public String getName() { + return APKModel.class.getName(); + } + + @Override + public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException { + super.writeThisToJsonWriter(jsonWriter); + jsonWriter.name("appPackageName").value(getApkPackageName()); + + } + + @Override + public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException { + if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else { + if (name.equals("appPackageName")) { + setApkPackageName(jsonReader.nextString()); + } else { + return false; + } + } + return true; + } + + @Override + public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException { + jsonReader.beginObject(); + while (jsonReader.hasNext()) { + String name = jsonReader.nextName(); + if (!initObjectsFromJsonReader(jsonReader, name)) { + jsonReader.skipValue(); + } + } + // 结束 JSON 对象 + jsonReader.endObject(); + return this; + } +} diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java index 6c06133..5370b69 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java @@ -14,6 +14,7 @@ import android.widget.Toast; import androidx.core.content.FileProvider; import cc.winboll.studio.autoinstaller.FileListener; import cc.winboll.studio.autoinstaller.MainActivity; +import cc.winboll.studio.autoinstaller.models.APKModel; import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.services.AssistantService; import cc.winboll.studio.autoinstaller.services.MainService; @@ -24,11 +25,13 @@ import cc.winboll.studio.libappbase.LogUtils; import com.hjq.toast.ToastUtils; import java.io.File; import java.lang.ref.WeakReference; +import java.util.ArrayList; public class MainService extends Service { public static String TAG = "MainService"; + ArrayList _APKModelList = new ArrayList(); private static boolean _mIsServiceAlive; //String mszAPKFilePath; //String mszAPKFileName; @@ -177,6 +180,9 @@ public class MainService extends Service { // 调用[应用信息查看器]打开应用包 // private void installAPK(String szAPKFilePath) { + String szAPKPackageName = PackageUtil.getPackageNameFromApk(this, szAPKFilePath); + saveAPKInfo(szAPKPackageName); + long nTimeNow = System.currentTimeMillis(); /*SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault()); @@ -211,15 +217,24 @@ public class MainService extends Service { // void installAPK2(String szAPKFilePath) { LogUtils.d(TAG, "installAPK2()"); + String szAPKPackageName = PackageUtil.getPackageNameFromApk(this, szAPKFilePath); + saveAPKInfo(szAPKPackageName); + Intent intent = new Intent(this, MainActivity.class); intent.setAction(MainActivity.ACTION_NEW_INSTALLTASK); - intent.putExtra(MainActivity.EXTRA_INSTALLED_PACKAGENAME, PackageUtil.getPackageNameFromApk(this, szAPKFilePath)); + intent.putExtra(MainActivity.EXTRA_INSTALLED_PACKAGENAME, szAPKPackageName); intent.putExtra(MainActivity.EXTRA_INSTALLED_APKFILEPATH, szAPKFilePath); // Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.startActivity(intent); } + void saveAPKInfo(String szApkPackageName) { + APKModel.loadBeanList(this, _APKModelList, APKModel.class); + _APKModelList.add(new APKModel(szApkPackageName)); + APKModel.saveBeanList(this, _APKModelList, APKModel.class); + } + // // static class MyHandler extends Handler { From c302179960d250ed8623310f1a3419c120fa0e9b Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 2 Apr 2025 21:25:51 +0800 Subject: [PATCH 08/30] APK 15.2.0 release Publish. --- autoinstaller/build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 4398898..b632046 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Wed Apr 02 13:23:10 GMT 2025 -stageCount=0 +#Wed Apr 02 21:25:51 HKT 2025 +stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=3 +buildCount=0 baseBetaVersion=15.2.1 From 63b1d2deced6f8baba9c52e54ffc561c593348c6 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 10:57:19 +0800 Subject: [PATCH 09/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A3=81=E8=B4=B4?= =?UTF-8?q?=E5=B7=A5=E5=85=B7...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 +- autoinstaller/src/main/AndroidManifest.xml | 15 ++++ .../autoinstaller/AppBaseTileService.java | 83 +++++++++++++++++++ .../studio/autoinstaller/MainActivity.java | 68 ++++++++++++--- .../autoinstaller/models/AppConfigs.java | 31 +++++-- .../autoinstaller/models/MainServiceBean.java | 67 +++++++++++++++ .../autoinstaller/receivers/MainReceiver.java | 2 +- .../services/AssistantService.java | 6 +- .../autoinstaller/services/MainService.java | 15 ++-- .../src/main/res/drawable/ic_cloud.xml | 11 +++ .../main/res/drawable/ic_cloud_outline.xml | 11 +++ autoinstaller/src/main/res/values/strings.xml | 1 + 12 files changed, 284 insertions(+), 30 deletions(-) create mode 100644 autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java create mode 100644 autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/MainServiceBean.java create mode 100644 autoinstaller/src/main/res/drawable/ic_cloud.xml create mode 100644 autoinstaller/src/main/res/drawable/ic_cloud_outline.xml diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index b632046..1bda88a 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Wed Apr 02 21:25:51 HKT 2025 +#Tue Apr 15 02:52:13 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=0 +buildCount=12 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/AndroidManifest.xml b/autoinstaller/src/main/AndroidManifest.xml index 506ea85..89a2c07 100644 --- a/autoinstaller/src/main/AndroidManifest.xml +++ b/autoinstaller/src/main/AndroidManifest.xml @@ -54,6 +54,21 @@ + + + + + + + + + + _APKModelList = new ArrayList(); LogView mLogView; TextClock mTextClock; @@ -61,6 +67,7 @@ public class MainActivity extends Activity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + _MainActivity = this; initView(); if (getIntent().getAction().equals(ACTION_NEW_INSTALLTASK)) { @@ -77,11 +84,7 @@ public class MainActivity extends Activity { mLogView = findViewById(R.id.logview); mLogView.start(); - AppConfigs appConfigs = AppConfigs.loadAppConfigs(this); - if (appConfigs == null) { - appConfigs = new AppConfigs(); - AppConfigs.saveAppConfigs(this, appConfigs); - } + AppConfigs appConfigs = AppConfigs.getInstance(this).loadAppConfigs(this); if (appConfigs.getSetupMode() == AppConfigs.SetupMode.WATCHOUTPUTINSTALLER) { ((RadioButton)findViewById(R.id.activitymainRadioButton1)).setChecked(true); @@ -196,10 +199,15 @@ public class MainActivity extends Activity { } public void onLockPath(View view) { - AppConfigs appConfigs = AppConfigs.loadAppConfigs(this); - Switch sw = (Switch)view; - if (sw.isChecked()) { + setMainServiceStatus(sw.isChecked()); + } + + public void setMainServiceStatus(boolean isEnable) { + AppConfigs appConfigs = AppConfigs.getInstance(this).loadAppConfigs(this); + + Switch sw = (Switch)findViewById(R.id.activitymainSwitch1); + if (isEnable) { String szFilePath = mEditText.getText().toString(); // 设置空路径时退出 @@ -247,7 +255,7 @@ public class MainActivity extends Activity { stopWatchingFile(); } - AppConfigs.saveAppConfigs(this, appConfigs); + AppConfigs.getInstance(this).saveAppConfigs(this, appConfigs); } void stopWatchingFile() { @@ -307,7 +315,7 @@ public class MainActivity extends Activity { }*/ public void onChangeSetupMode(View view) { - AppConfigs appConfigs = AppConfigs.loadAppConfigs(this); + AppConfigs appConfigs = AppConfigs.getInstance(this).loadAppConfigs(this); if (view.getId() == R.id.activitymainRadioButton1) { appConfigs.setSetupMode(AppConfigs.SetupMode.WATCHOUTPUTINSTALLER); @@ -316,6 +324,42 @@ public class MainActivity extends Activity { appConfigs.setSetupMode(AppConfigs.SetupMode.NEWAPKINFONEWAPKINFO); ((RadioButton)findViewById(R.id.activitymainRadioButton1)).setChecked(false); } - AppConfigs.saveAppConfigs(this, appConfigs); + AppConfigs.getInstance(this).saveAppConfigs(this, appConfigs); + } + + // 定义Handler + static Handler _Handler = new Handler() { + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == MSG_UPDATE_STATUS) { + if (_MainActivity != null) { + boolean isEnableMainService = (boolean)msg.obj; + // 处理消息,这里更新 MainService 的状态 + _MainActivity.setMainServiceStatus(isEnableMainService); + } + } + } + }; + + static void updateMainServiceStatus(boolean isEnable) { + if (_Handler != null) { + Message msg = new Message(); + msg.obj = isEnable; + msg.what = MSG_UPDATE_STATUS; + _Handler.sendMessage(msg); + } + } + + public static void stopMainService() { + if (_MainActivity != null && _Handler != null) { + updateMainServiceStatus(false); + } + } + + public static void startMainService() { + if (_MainActivity != null && _Handler != null) { + updateMainServiceStatus(true); + } } } diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java index 19bcc05..ccacfd1 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java @@ -15,6 +15,8 @@ import java.io.IOException; import java.io.Serializable; import java.io.StringReader; import java.io.StringWriter; +import android.drm.DrmConvertedStatus; +import com.hjq.toast.ToastUtils; public class AppConfigs implements Serializable { @@ -26,6 +28,20 @@ public class AppConfigs implements Serializable { NEWAPKINFONEWAPKINFO // 调用[应用信息查看器]打开应用包 }; + static volatile AppConfigs _AppConfigs; + Context mContext; + + AppConfigs(Context context) { + mContext = context; + } + + public static synchronized AppConfigs getInstance(Context context) { + if (_AppConfigs == null) { + _AppConfigs = new AppConfigs(context); + } + return _AppConfigs; + } + // 监控文件路径 private String watchingFilePath = ""; @@ -85,8 +101,8 @@ public class AppConfigs implements Serializable { return ""; } - public static AppConfigs parseAppConfigs(String szAppConfigs) { - AppConfigs appConfigs = new AppConfigs(); + public AppConfigs parseAppConfigs(String szAppConfigs) { + AppConfigs appConfigs = new AppConfigs(mContext); // 创建 JsonWriter 对象 StringReader stringReader = new StringReader(szAppConfigs); JsonReader jsonReader = new @@ -122,19 +138,20 @@ public class AppConfigs implements Serializable { return context.getExternalFilesDir(TAG) + "/" + TAG + ".json"; } - public static AppConfigs loadAppConfigs(Context context) { + public AppConfigs loadAppConfigs(Context context) { AppConfigs appConfigs = null; try { String szJson = FileUtil.readFile(getDataPath(context)); - appConfigs = AppConfigs.parseAppConfigs(szJson); + appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson); } catch (IOException e) { LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); } return appConfigs; } - public static void saveAppConfigs(Context context, AppConfigs appConfigs) { + public void saveAppConfigs(Context context, AppConfigs appConfigs) { try { + ToastUtils.show(String.format("AppConfigs set enable service to %s", appConfigs.isEnableService())); //LogUtils.d(TAG, "appConfigs is : " + appConfigs.toString()); String szJson = appConfigs.toString(); FileUtil.writeFile(getDataPath(context), szJson); @@ -142,4 +159,8 @@ public class AppConfigs implements Serializable { LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); } } + + public void saveAppConfigs() { + saveAppConfigs(mContext, this); + } } diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/MainServiceBean.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/MainServiceBean.java new file mode 100644 index 0000000..f3c484a --- /dev/null +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/MainServiceBean.java @@ -0,0 +1,67 @@ +package cc.winboll.studio.autoinstaller.models; +import android.util.JsonReader; +import android.util.JsonWriter; +import cc.winboll.studio.libappbase.BaseBean; +import java.io.IOException; + +/** + * @Author ZhanGSKen@AliYun.Com + * @Date 2025/04/15 09:27:39 + * @Describe MainServiceBean + */ +public class MainServiceBean extends BaseBean { + + public static final String TAG = "MainServiceBean"; + + boolean isEnable; + + public MainServiceBean() { + this.isEnable = false; + } + + public void setIsEnable(boolean isEnable) { + this.isEnable = isEnable; + } + + public boolean isEnable() { + return isEnable; + } + + @Override + public String getName() { + return MainServiceBean.class.getName(); + } + + @Override + public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException { + super.writeThisToJsonWriter(jsonWriter); + jsonWriter.name("isEnable").value(isEnable()); + + } + + @Override + public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException { + if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else { + if (name.equals("isEnable")) { + setIsEnable(jsonReader.nextBoolean()); + } else { + return false; + } + } + return true; + } + + @Override + public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException { + jsonReader.beginObject(); + while (jsonReader.hasNext()) { + String name = jsonReader.nextName(); + if (!initObjectsFromJsonReader(jsonReader, name)) { + jsonReader.skipValue(); + } + } + // 结束 JSON 对象 + jsonReader.endObject(); + return this; + } +} diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java index 0c592c8..a226fe0 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/receivers/MainReceiver.java @@ -23,7 +23,7 @@ public class MainReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { String szAction = intent.getAction(); if (szAction.equals(ACTION_BOOT_COMPLETED)) { - AppConfigs appConfigs = AppConfigs.loadAppConfigs(context); + AppConfigs appConfigs = AppConfigs.getInstance(context).loadAppConfigs(context); if (appConfigs.isEnableService()) { Intent intentService = new Intent(context, MainService.class); //intentService.putExtra(MainService.EXTRA_APKFILEPATH, appConfigs.getWatchingFilePath()); diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java index 30f0eba..c91a811 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/AssistantService.java @@ -46,7 +46,7 @@ public class AssistantService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { //LogUtils.d(TAG, "call onStartCommand(...)"); run(); - AppConfigs appConfigs = AppConfigs.loadAppConfigs(AssistantService.this); + AppConfigs appConfigs = AppConfigs.getInstance(AssistantService.this).loadAppConfigs(AssistantService.this); return appConfigs.isEnableService() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId); } @@ -68,7 +68,7 @@ public class AssistantService extends Service { // void run() { //LogUtils.d(TAG, "call run()"); - AppConfigs appConfigs = AppConfigs.loadAppConfigs(AssistantService.this); + AppConfigs appConfigs = AppConfigs.getInstance(AssistantService.this).loadAppConfigs(AssistantService.this); if (appConfigs.isEnableService()) { if (mIsThreadAlive == false) { // 设置运行状态 @@ -101,7 +101,7 @@ public class AssistantService extends Service { @Override public void onServiceDisconnected(ComponentName name) { //LogUtils.d(TAG, "call onServiceDisconnected(...)"); - AppConfigs appConfigs = AppConfigs.loadAppConfigs(AssistantService.this); + AppConfigs appConfigs = AppConfigs.getInstance(AssistantService.this).loadAppConfigs(AssistantService.this); if (appConfigs.isEnableService()) { wakeupAndBindMain(); } diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java index 5370b69..d7bfd3e 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java @@ -26,6 +26,7 @@ import com.hjq.toast.ToastUtils; import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; +import cc.winboll.studio.autoinstaller.models.MainServiceBean; public class MainService extends Service { @@ -62,7 +63,7 @@ public class MainService extends Service { private void run() { - AppConfigs appConfigs = AppConfigs.loadAppConfigs(MainService.this); + AppConfigs appConfigs = AppConfigs.getInstance(MainService.this).loadAppConfigs(MainService.this); if (appConfigs.isEnableService()) { if (_mIsServiceAlive == false) { // 设置运行状态 @@ -77,8 +78,8 @@ public class MainService extends Service { startWatchingFile(appConfigs.getWatchingFilePath()); - LogUtils.d(TAG, "running..."); - ToastUtils.show("running..."); + //LogUtils.d(TAG, "running..."); + //ToastUtils.show("running..."); } else { LogUtils.d(TAG, "_mIsServiceAlive is " + Boolean.toString(_mIsServiceAlive)); @@ -105,7 +106,7 @@ public class MainService extends Service { LogUtils.d(TAG, "onStartCommand"); run(); - AppConfigs appConfigs = AppConfigs.loadAppConfigs(MainService.this); + AppConfigs appConfigs = AppConfigs.getInstance(MainService.this).loadAppConfigs(MainService.this); return appConfigs.isEnableService() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId); } @@ -122,7 +123,7 @@ public class MainService extends Service { @Override public void onServiceDisconnected(ComponentName name) { //LogUtils.d(TAG, "call onServiceConnected(...)"); - AppConfigs appConfigs = AppConfigs.loadAppConfigs(MainService.this); + AppConfigs appConfigs = AppConfigs.getInstance(MainService.this).loadAppConfigs(MainService.this); if (appConfigs.isEnableService()) { // 唤醒守护进程 wakeupAndBindAssistant(); @@ -164,7 +165,7 @@ public class MainService extends Service { }); mFileListener.startWatching(); - ToastUtils.show("Start watching."); + //ToastUtils.show("Start watching."); } else { // 父级文件夹不存在,就提示用户 Toast.makeText(getApplication(), fParentDir.toString() + " no exist.", Toast.LENGTH_SHORT).show(); @@ -247,7 +248,7 @@ public class MainService extends Service { switch (message.what) { case MSG_INSTALL_APK: { - AppConfigs appConfigs = AppConfigs.loadAppConfigs(theActivity); + AppConfigs appConfigs = AppConfigs.getInstance(theActivity).loadAppConfigs(theActivity); if (appConfigs.getSetupMode() == AppConfigs.SetupMode.WATCHOUTPUTINSTALLER) { theActivity.installAPK2((String)message.obj); } else if (appConfigs.getSetupMode() == AppConfigs.SetupMode.NEWAPKINFONEWAPKINFO) { diff --git a/autoinstaller/src/main/res/drawable/ic_cloud.xml b/autoinstaller/src/main/res/drawable/ic_cloud.xml new file mode 100644 index 0000000..c116648 --- /dev/null +++ b/autoinstaller/src/main/res/drawable/ic_cloud.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/autoinstaller/src/main/res/drawable/ic_cloud_outline.xml b/autoinstaller/src/main/res/drawable/ic_cloud_outline.xml new file mode 100644 index 0000000..a8ed00c --- /dev/null +++ b/autoinstaller/src/main/res/drawable/ic_cloud_outline.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/autoinstaller/src/main/res/values/strings.xml b/autoinstaller/src/main/res/values/strings.xml index e1ebb98..2786107 100644 --- a/autoinstaller/src/main/res/values/strings.xml +++ b/autoinstaller/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ AutoInstaller + AutoInstaller From f1669f9e4184278aa62d2892729d762d9b29a466 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 16:00:42 +0800 Subject: [PATCH 10/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E5=8F=82=E6=95=B0=E4=B8=8A=E4=B8=8B=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 ++-- .../autoinstaller/models/AppConfigs.java | 21 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 1bda88a..4b2c98f 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 15 02:52:13 GMT 2025 +#Tue Apr 15 07:58:36 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=12 +buildCount=17 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java index ccacfd1..6d65adb 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java @@ -11,12 +11,11 @@ import android.util.JsonWriter; import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.utils.FileUtil; import cc.winboll.studio.libappbase.LogUtils; +import com.hjq.toast.ToastUtils; import java.io.IOException; import java.io.Serializable; import java.io.StringReader; import java.io.StringWriter; -import android.drm.DrmConvertedStatus; -import com.hjq.toast.ToastUtils; public class AppConfigs implements Serializable { @@ -32,12 +31,13 @@ public class AppConfigs implements Serializable { Context mContext; AppConfigs(Context context) { - mContext = context; + mContext = context.getApplicationContext(); } public static synchronized AppConfigs getInstance(Context context) { if (_AppConfigs == null) { _AppConfigs = new AppConfigs(context); + _AppConfigs.loadAppConfigs(_AppConfigs.mContext); } return _AppConfigs; } @@ -137,11 +137,22 @@ public class AppConfigs implements Serializable { static String getDataPath(Context context) { return context.getExternalFilesDir(TAG) + "/" + TAG + ".json"; } + + public AppConfigs loadAppConfigs() { + AppConfigs appConfigs = null; + try { + String szJson = FileUtil.readFile(getDataPath(mContext)); + appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson); + } catch (IOException e) { + LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); + } + return appConfigs; + } public AppConfigs loadAppConfigs(Context context) { AppConfigs appConfigs = null; try { - String szJson = FileUtil.readFile(getDataPath(context)); + String szJson = FileUtil.readFile(getDataPath(context.getApplicationContext())); appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson); } catch (IOException e) { LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); @@ -159,7 +170,7 @@ public class AppConfigs implements Serializable { LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); } } - + public void saveAppConfigs() { saveAppConfigs(mContext, this); } From 7edc341f1562ba4baffd28653386644e15a1995f Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 16:03:45 +0800 Subject: [PATCH 11/30] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autoinstaller/AppBaseTileService.java | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java index a6eeb6c..27092e6 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java @@ -1,17 +1,18 @@ package cc.winboll.studio.autoinstaller; -import android.content.Context; -import android.service.quicksettings.Tile; -import android.service.quicksettings.TileService; -import cc.winboll.studio.autoinstaller.models.MainServiceBean; -import cc.winboll.studio.autoinstaller.services.MainService; -import cc.winboll.studio.autoinstaller.models.AppConfigs; /** * @Author ZhanGSKen@AliYun.Com * @Date 2025/04/15 09:24:46 * @Describe 磁贴工具服务类 */ +import android.content.Context; +import android.service.quicksettings.Tile; +import android.service.quicksettings.TileService; +import cc.winboll.studio.autoinstaller.models.AppConfigs; +import cc.winboll.studio.autoinstaller.models.MainServiceBean; + public class AppBaseTileService extends TileService { + public static final String TAG = "AppBaseTileService"; volatile static AppBaseTileService _AppBaseTileService; @@ -21,23 +22,15 @@ public class AppBaseTileService extends TileService { super.onStartListening(); _AppBaseTileService = this; Tile tile = getQsTile(); - //MainServiceBean bean = MainServiceBean.loadBean(this, MainServiceBean.class); - + if (AppConfigs.getInstance(AppBaseTileService.this).isEnableService()) { - //MainService.startMainService(context); tile.setState(Tile.STATE_ACTIVE); tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud)); } else { - //MainService.stopMainService(context); tile.setState(Tile.STATE_INACTIVE); tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud_outline)); } tile.updateTile(); -// Tile tile = getQsTile(); -// tile.setState(Tile.STATE_INACTIVE); -// tile.setLabel(getString(R.string.tileservice_name)); -// tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud_outline)); -// tile.updateTile(); } @@ -45,14 +38,8 @@ public class AppBaseTileService extends TileService { public void onClick() { super.onClick(); Tile tile = getQsTile(); -// MainServiceBean bean = MainServiceBean.loadBean(this, MainServiceBean.class); -// if (bean == null) { -// bean = new MainServiceBean(); -// } if (tile.getState() == Tile.STATE_ACTIVE) { -// bean.setIsEnable(false); -// MainServiceBean.saveBean(this, bean); AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(false); AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); MainActivity.stopMainService(); From 1ae3fdf2b725e88b2c7e665bd2015618b8033a4e Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 16:07:49 +0800 Subject: [PATCH 12/30] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=A3=81=E8=B4=B4?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autoinstaller/AppBaseTileService.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java index 27092e6..c89234b 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java @@ -15,12 +15,12 @@ public class AppBaseTileService extends TileService { public static final String TAG = "AppBaseTileService"; - volatile static AppBaseTileService _AppBaseTileService; + //volatile static AppBaseTileService _AppBaseTileService; @Override public void onStartListening() { super.onStartListening(); - _AppBaseTileService = this; + //_AppBaseTileService = this; Tile tile = getQsTile(); if (AppConfigs.getInstance(AppBaseTileService.this).isEnableService()) { @@ -48,23 +48,25 @@ public class AppBaseTileService extends TileService { AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); MainActivity.startMainService(); } - updateServiceIconStatus(this); + + // 更新磁贴状态 + //updateServiceIconStatus(this); } - public static void updateServiceIconStatus(Context context) { - if (_AppBaseTileService == null) { - return; - } - - Tile tile = _AppBaseTileService.getQsTile(); - MainServiceBean bean = MainServiceBean.loadBean(context, MainServiceBean.class); - if (bean != null && bean.isEnable()) { - tile.setState(Tile.STATE_ACTIVE); - tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud)); - } else { - tile.setState(Tile.STATE_INACTIVE); - tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud_outline)); - } - tile.updateTile(); - } +// public static void updateServiceIconStatus(Context context) { +// if (_AppBaseTileService == null) { +// return; +// } +// +// Tile tile = _AppBaseTileService.getQsTile(); +// MainServiceBean bean = MainServiceBean.loadBean(context, MainServiceBean.class); +// if (bean != null && bean.isEnable()) { +// tile.setState(Tile.STATE_ACTIVE); +// tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud)); +// } else { +// tile.setState(Tile.STATE_INACTIVE); +// tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud_outline)); +// } +// tile.updateTile(); +// } } From df179242f01dbde6569e4a81c4ac969a11ec8d50 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 16:09:39 +0800 Subject: [PATCH 13/30] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=86=97=E4=BD=99?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studio/autoinstaller/AppBaseTileService.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java index c89234b..604264e 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java @@ -5,22 +5,17 @@ package cc.winboll.studio.autoinstaller; * @Date 2025/04/15 09:24:46 * @Describe 磁贴工具服务类 */ -import android.content.Context; import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; import cc.winboll.studio.autoinstaller.models.AppConfigs; -import cc.winboll.studio.autoinstaller.models.MainServiceBean; public class AppBaseTileService extends TileService { - - public static final String TAG = "AppBaseTileService"; - //volatile static AppBaseTileService _AppBaseTileService; + public static final String TAG = "AppBaseTileService"; @Override public void onStartListening() { super.onStartListening(); - //_AppBaseTileService = this; Tile tile = getQsTile(); if (AppConfigs.getInstance(AppBaseTileService.this).isEnableService()) { @@ -31,7 +26,6 @@ public class AppBaseTileService extends TileService { tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud_outline)); } tile.updateTile(); - } @Override @@ -48,11 +42,11 @@ public class AppBaseTileService extends TileService { AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); MainActivity.startMainService(); } - + // 更新磁贴状态 //updateServiceIconStatus(this); } - + // public static void updateServiceIconStatus(Context context) { // if (_AppBaseTileService == null) { // return; From f3198de00361d49358e7f8464d9de44e95ef4209 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 16:18:26 +0800 Subject: [PATCH 14/30] =?UTF-8?q?=E6=BA=90=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cc/winboll/studio/autoinstaller/AppBaseTileService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java index 604264e..ef33484 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java @@ -46,7 +46,10 @@ public class AppBaseTileService extends TileService { // 更新磁贴状态 //updateServiceIconStatus(this); } - + + // + // 更新磁贴状态 + // // public static void updateServiceIconStatus(Context context) { // if (_AppBaseTileService == null) { // return; From 0d3d691d8a1bb6442b1cfd93219b1ff9e1514ac8 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 17:10:01 +0800 Subject: [PATCH 15/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 ++-- .../studio/autoinstaller/AppBaseTileService.java | 4 ++-- autoinstaller/src/main/res/drawable/ic_android.xml | 11 +++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 autoinstaller/src/main/res/drawable/ic_android.xml diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 4b2c98f..6b74adb 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 15 07:58:36 GMT 2025 +#Tue Apr 15 09:08:44 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=17 +buildCount=40 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java index ef33484..285af8e 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java @@ -20,10 +20,10 @@ public class AppBaseTileService extends TileService { if (AppConfigs.getInstance(AppBaseTileService.this).isEnableService()) { tile.setState(Tile.STATE_ACTIVE); - tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud)); + tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android)); } else { tile.setState(Tile.STATE_INACTIVE); - tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_cloud_outline)); + tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android)); } tile.updateTile(); } diff --git a/autoinstaller/src/main/res/drawable/ic_android.xml b/autoinstaller/src/main/res/drawable/ic_android.xml new file mode 100644 index 0000000..6c69cd1 --- /dev/null +++ b/autoinstaller/src/main/res/drawable/ic_android.xml @@ -0,0 +1,11 @@ + + + + + From dabd1271fded34c572e87d7c50d7f1c61430ecf1 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 17:23:19 +0800 Subject: [PATCH 16/30] =?UTF-8?q?=E9=87=8D=E6=9E=84=E7=A3=81=E8=B4=B4?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 +- .../autoinstaller/AppBaseTileService.java | 54 +++++-------------- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 6b74adb..483ebd9 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 15 09:08:44 GMT 2025 +#Tue Apr 15 09:22:19 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=40 +buildCount=54 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java index 285af8e..5246601 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java @@ -17,53 +17,27 @@ public class AppBaseTileService extends TileService { public void onStartListening() { super.onStartListening(); Tile tile = getQsTile(); - - if (AppConfigs.getInstance(AppBaseTileService.this).isEnableService()) { - tile.setState(Tile.STATE_ACTIVE); - tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android)); - } else { - tile.setState(Tile.STATE_INACTIVE); - tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android)); - } + tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android)); + // 更新磁贴状态 + tile.setState(AppConfigs.getInstance(getApplicationContext()).isEnableService()?Tile.STATE_ACTIVE: Tile.STATE_INACTIVE); tile.updateTile(); } @Override public void onClick() { super.onClick(); - Tile tile = getQsTile(); - - if (tile.getState() == Tile.STATE_ACTIVE) { - AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(false); - AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); - MainActivity.stopMainService(); - } else if (tile.getState() == Tile.STATE_INACTIVE) { - AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(true); - AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); - MainActivity.startMainService(); - } - - // 更新磁贴状态 - //updateServiceIconStatus(this); - } - - // - // 更新磁贴状态 - // -// public static void updateServiceIconStatus(Context context) { -// if (_AppBaseTileService == null) { -// return; -// } +// Tile tile = getQsTile(); // -// Tile tile = _AppBaseTileService.getQsTile(); -// MainServiceBean bean = MainServiceBean.loadBean(context, MainServiceBean.class); -// if (bean != null && bean.isEnable()) { -// tile.setState(Tile.STATE_ACTIVE); -// tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud)); -// } else { +// if (tile.getState() == Tile.STATE_ACTIVE) { // tile.setState(Tile.STATE_INACTIVE); -// tile.setIcon(android.graphics.drawable.Icon.createWithResource(context, R.drawable.ic_cloud_outline)); +// AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(false); +// AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); +// MainActivity.stopMainService(); +// } else if (tile.getState() == Tile.STATE_INACTIVE) { +// tile.setState(Tile.STATE_ACTIVE); +// AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(true); +// AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); +// MainActivity.startMainService(); // } -// tile.updateTile(); -// } + } } From 1a7134711e208e90d9f808310d39ff6d70ca442c Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 15 Apr 2025 18:22:17 +0800 Subject: [PATCH 17/30] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=A3=81=E8=B4=B4?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=9D=99=E6=80=81=E6=8C=82=E8=BD=BD...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 +-- .../autoinstaller/AppBaseTileService.java | 31 ----------------- .../autoinstaller/services/MainService.java | 33 ++++++++++++++++--- 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 483ebd9..f6dc714 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 15 09:22:19 GMT 2025 +#Tue Apr 15 10:20:33 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=54 +buildCount=55 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java index 5246601..58f636c 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/AppBaseTileService.java @@ -9,35 +9,4 @@ import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; import cc.winboll.studio.autoinstaller.models.AppConfigs; -public class AppBaseTileService extends TileService { - public static final String TAG = "AppBaseTileService"; - - @Override - public void onStartListening() { - super.onStartListening(); - Tile tile = getQsTile(); - tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android)); - // 更新磁贴状态 - tile.setState(AppConfigs.getInstance(getApplicationContext()).isEnableService()?Tile.STATE_ACTIVE: Tile.STATE_INACTIVE); - tile.updateTile(); - } - - @Override - public void onClick() { - super.onClick(); -// Tile tile = getQsTile(); -// -// if (tile.getState() == Tile.STATE_ACTIVE) { -// tile.setState(Tile.STATE_INACTIVE); -// AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(false); -// AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); -// MainActivity.stopMainService(); -// } else if (tile.getState() == Tile.STATE_INACTIVE) { -// tile.setState(Tile.STATE_ACTIVE); -// AppConfigs.getInstance(AppBaseTileService.this).setIsEnableService(true); -// AppConfigs.getInstance(AppBaseTileService.this).saveAppConfigs(); -// MainActivity.startMainService(); -// } - } -} diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java index d7bfd3e..2a08f54 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/services/MainService.java @@ -10,10 +10,13 @@ import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.os.Message; +import android.service.quicksettings.Tile; +import android.service.quicksettings.TileService; import android.widget.Toast; import androidx.core.content.FileProvider; import cc.winboll.studio.autoinstaller.FileListener; import cc.winboll.studio.autoinstaller.MainActivity; +import cc.winboll.studio.autoinstaller.R; import cc.winboll.studio.autoinstaller.models.APKModel; import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.services.AssistantService; @@ -22,15 +25,15 @@ import cc.winboll.studio.autoinstaller.utils.NotificationUtil; import cc.winboll.studio.autoinstaller.utils.PackageUtil; import cc.winboll.studio.autoinstaller.utils.ServiceUtil; import cc.winboll.studio.libappbase.LogUtils; -import com.hjq.toast.ToastUtils; import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; -import cc.winboll.studio.autoinstaller.models.MainServiceBean; public class MainService extends Service { public static String TAG = "MainService"; + + Context mContext; ArrayList _APKModelList = new ArrayList(); private static boolean _mIsServiceAlive; @@ -51,6 +54,7 @@ public class MainService extends Service { @Override public void onCreate() { super.onCreate(); + mContext = this; LogUtils.d(TAG, "onCreate()"); _mIsServiceAlive = false; mHandler = new MyHandler(MainService.this); @@ -59,6 +63,9 @@ public class MainService extends Service { } run(); + + // 初始化磁贴工具服务 + MainTileService mainTileService = new MainTileService(this); } private void run() { @@ -99,6 +106,7 @@ public class MainService extends Service { } _mIsServiceAlive = false; LogUtils.d(TAG, "onDestroy()"); + mContext = null; } @Override @@ -183,7 +191,7 @@ public class MainService extends Service { private void installAPK(String szAPKFilePath) { String szAPKPackageName = PackageUtil.getPackageNameFromApk(this, szAPKFilePath); saveAPKInfo(szAPKPackageName); - + long nTimeNow = System.currentTimeMillis(); /*SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault()); @@ -220,7 +228,7 @@ public class MainService extends Service { LogUtils.d(TAG, "installAPK2()"); String szAPKPackageName = PackageUtil.getPackageNameFromApk(this, szAPKFilePath); saveAPKInfo(szAPKPackageName); - + Intent intent = new Intent(this, MainActivity.class); intent.setAction(MainActivity.ACTION_NEW_INSTALLTASK); intent.putExtra(MainActivity.EXTRA_INSTALLED_PACKAGENAME, szAPKPackageName); @@ -262,4 +270,21 @@ public class MainService extends Service { super.handleMessage(message); } } + + static class MainTileService extends TileService { + Context mContext; + MainTileService(Context context) { + mContext = context; + } + + @Override + public void onStartListening() { + super.onStartListening(); + Tile tile = getQsTile(); + tile.setIcon(android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_android)); + // 更新磁贴状态 + tile.setState((mContext == null || mContext.getApplicationContext() == null )?Tile.STATE_INACTIVE: Tile.STATE_ACTIVE); + tile.updateTile(); + } + } } From 55ce968053718d516bb6fc8231c3cc044fc91db9 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 29 Apr 2025 21:00:39 +0800 Subject: [PATCH 18/30] APK 15.3.0 release Publish. --- powerbell/build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powerbell/build.properties b/powerbell/build.properties index d85e3c3..c2cc27e 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 29 12:41:13 GMT 2025 -stageCount=0 +#Tue Apr 29 21:00:39 HKT 2025 +stageCount=1 libraryProject= baseVersion=15.3 publishVersion=15.3.0 -buildCount=4 +buildCount=0 baseBetaVersion=15.3.1 From cb486bb90ccb0e72064ddacd73fe3bcf29840a1f Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 11:52:00 +0800 Subject: [PATCH 19/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B1=BB=E5=BA=93?= =?UTF-8?q?=EF=BC=8CBugFix=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winboll/studio/aes/WinBoLLActivity.java | 60 --- .../studio/appbase/WinBoLLActivityBase.java | 81 --- .../appbase/models/WinBoLLNewsBean.java | 72 --- .../studio/apputils/WinBoLLActivityBase.java | 51 -- autoinstaller/build.gradle | 14 +- autoinstaller/build.properties | 4 +- .../cc/winboll/studio/autoinstaller/App.java | 6 +- .../autoinstaller/models/AppConfigs.java | 5 +- .../winboll/IWinBoLLClientServiceBinder.java | 17 - .../libaes/winboll/WinBoLLClientService.java | 192 ------- .../winboll/WinBoLLClientServiceBean.java | 78 --- .../studio/libaes/winboll/WinBoLLMail.java | 22 - .../WinBoLLServerConnectionThread.java | 106 ---- .../winboll/WinBoLLServiceStatusView.java | 473 ------------------ .../studio/libappbase/sos/WinBoLL.java | 39 -- .../libappbase/winboll/IWinBoLLActivity.java | 18 - .../winboll/WinBoLLActivityManager.java | 356 ------------- 17 files changed, 16 insertions(+), 1578 deletions(-) delete mode 100644 aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java delete mode 100644 appbase/src/main/java/cc/winboll/studio/appbase/WinBoLLActivityBase.java delete mode 100644 appbase/src/main/java/cc/winboll/studio/appbase/models/WinBoLLNewsBean.java delete mode 100644 apputils/src/main/java/cc/winboll/studio/apputils/WinBoLLActivityBase.java delete mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/IWinBoLLClientServiceBinder.java delete mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java delete mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientServiceBean.java delete mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLMail.java delete mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServerConnectionThread.java delete mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java delete mode 100644 libappbase/src/main/java/cc/winboll/studio/libappbase/sos/WinBoLL.java delete mode 100644 libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/IWinBoLLActivity.java delete mode 100644 libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/WinBoLLActivityManager.java diff --git a/aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java b/aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java deleted file mode 100644 index af25247..0000000 --- a/aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java +++ /dev/null @@ -1,60 +0,0 @@ -package cc.winboll.studio.aes; - -import android.app.Activity; -import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; -import cc.winboll.studio.libaes.beans.AESThemeBean; -import cc.winboll.studio.libaes.utils.AESThemeUtil; -import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; -import android.view.MenuItem; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/30 00:34:02 - * @Describe WinBoLL 活动窗口通用基类 - */ -public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity { - - public static final String TAG = "WinBoLLActivity"; - - protected volatile AESThemeBean.ThemeType mThemeType; - - @Override - public Activity getActivity() { - return this; - } - - @Override - public String getTag() { - return TAG; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - mThemeType = getThemeType(); - setThemeStyle(); - super.onCreate(savedInstanceState); - } - - AESThemeBean.ThemeType getThemeType() { - /*SharedPreferences sharedPreferences = getSharedPreferences( - SHAREDPREFERENCES_NAME, MODE_PRIVATE); - return AESThemeBean.ThemeType.values()[((sharedPreferences.getInt(DRAWER_THEME_TYPE, AESThemeBean.ThemeType.DEFAULT.ordinal())))]; - */ - return AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext())); - } - - void setThemeStyle() { - //setTheme(AESThemeBean.getThemeStyle(getThemeType())); - setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext())); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if(item.getItemId() == android.R.id.home) { - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } -} diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/WinBoLLActivityBase.java b/appbase/src/main/java/cc/winboll/studio/appbase/WinBoLLActivityBase.java deleted file mode 100644 index 71b4e40..0000000 --- a/appbase/src/main/java/cc/winboll/studio/appbase/WinBoLLActivityBase.java +++ /dev/null @@ -1,81 +0,0 @@ -package cc.winboll.studio.appbase; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/28 15:34:16 - * @Describe 应用活动窗口基类 - */ -import android.app.Activity; -import android.os.Bundle; -import android.os.PersistableBundle; -import android.view.MenuItem; -import cc.winboll.studio.appbase.App; -import cc.winboll.studio.appbase.R; -import cc.winboll.studio.libappbase.GlobalApplication; -import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog; -import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; -import cc.winboll.studio.libappbase.winboll.WinBoLLActivityManager; - -public class WinBoLLActivityBase extends Activity implements IWinBoLLActivity { - - public static final String TAG = "WinBoLLActivityBase"; - - @Override - public Activity getActivity() { - return this; - } - - @Override - public String getTag() { - return TAG; - } - - WinBoLLActivityManager getWinBoLLActivityManager() { - return WinBoLLActivityManager.getInstance(GlobalApplication.getInstance()); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getWinBoLLActivityManager().add(this); - } - - @Override - public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) { - super.onPostCreate(savedInstanceState, persistentState); - } - - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) { - GlobalApplication.getWinBoLLActivityManager().startLogActivity(this); - return true; - } else if(item.getItemId() == cc.winboll.studio.appbase.R.id.item_minimal) { - //moveTaskToBack(true); - exit(); - } - // 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。 - return super.onOptionsItemSelected(item); - } - - void exit() { - YesNoAlertDialog.show(this, "Exit " + getString(R.string.app_name), "Close all activity and exit?", new YesNoAlertDialog.OnDialogResultListener(){ - - @Override - public void onYes() { - App.getWinBoLLActivityManager().finishAll(); - } - - @Override - public void onNo() { - } - }); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - getWinBoLLActivityManager().registeRemove(this); - } -} diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/models/WinBoLLNewsBean.java b/appbase/src/main/java/cc/winboll/studio/appbase/models/WinBoLLNewsBean.java deleted file mode 100644 index 8d70a3a..0000000 --- a/appbase/src/main/java/cc/winboll/studio/appbase/models/WinBoLLNewsBean.java +++ /dev/null @@ -1,72 +0,0 @@ -package cc.winboll.studio.appbase.models; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/02/17 10:05:09 - * @Describe APPSOSReportBean - */ -import android.util.JsonReader; -import android.util.JsonWriter; -import cc.winboll.studio.libappbase.BaseBean; -import java.io.IOException; - -public class WinBoLLNewsBean extends BaseBean { - - public static final String TAG = "WinBoLLNewsBean"; - - protected String message; - - public WinBoLLNewsBean() { - this.message = ""; - } - - public WinBoLLNewsBean(String message) { - this.message = message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - - @Override - public String getName() { - return WinBoLLNewsBean.class.getName(); - } - - @Override - public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException { - super.writeThisToJsonWriter(jsonWriter); - jsonWriter.name("message").value(getMessage()); - - } - - @Override - public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException { - if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else { - if (name.equals("message")) { - setMessage(jsonReader.nextString()); - } else { - return false; - } - } - return true; - } - - @Override - public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException { - jsonReader.beginObject(); - while (jsonReader.hasNext()) { - String name = jsonReader.nextName(); - if (!initObjectsFromJsonReader(jsonReader, name)) { - jsonReader.skipValue(); - } - } - // 结束 JSON 对象 - jsonReader.endObject(); - return this; - } -} diff --git a/apputils/src/main/java/cc/winboll/studio/apputils/WinBoLLActivityBase.java b/apputils/src/main/java/cc/winboll/studio/apputils/WinBoLLActivityBase.java deleted file mode 100644 index 91c285e..0000000 --- a/apputils/src/main/java/cc/winboll/studio/apputils/WinBoLLActivityBase.java +++ /dev/null @@ -1,51 +0,0 @@ -package cc.winboll.studio.apputils; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/28 17:11:37 - * @Describe 应用活动窗口基类 - */ -import android.app.Activity; -import android.os.Bundle; -import android.os.PersistableBundle; -import cc.winboll.studio.libappbase.GlobalApplication; -import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; -import cc.winboll.studio.libappbase.winboll.WinBoLLActivityManager; - -public class WinBoLLActivityBase extends Activity implements IWinBoLLActivity { - - public static final String TAG = "WinBoLLActivityBase"; - - @Override - public Activity getActivity() { - return this; - } - - @Override - public String getTag() { - return TAG; - } - - WinBoLLActivityManager getWinBoLLActivityManager() { - return WinBoLLActivityManager.getInstance(GlobalApplication.getInstance()); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getWinBoLLActivityManager().add(this); - } - - @Override - public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) { - super.onPostCreate(savedInstanceState, persistentState); - } - - - - @Override - protected void onDestroy() { - super.onDestroy(); - getWinBoLLActivityManager().registeRemove(this); - } -} diff --git a/autoinstaller/build.gradle b/autoinstaller/build.gradle index 75ba7ae..d91dba5 100644 --- a/autoinstaller/build.gradle +++ b/autoinstaller/build.gradle @@ -18,13 +18,13 @@ def genVersionName(def versionName){ } android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" + compileSdkVersion 32 + buildToolsVersion "32.0.0" defaultConfig { applicationId "cc.winboll.studio.autoinstaller" - minSdkVersion 26 - targetSdkVersion 29 + minSdkVersion 24 + targetSdkVersion 30 versionCode 2 // versionName 更新后需要手动设置 // .winboll/winbollBuildProps.properties 文件的 stageCount=0 @@ -45,6 +45,9 @@ android { dependencies { api fileTree(dir: 'libs', include: ['*.jar']) + api 'cc.winboll.studio:libaes:15.6.0' + api 'cc.winboll.studio:libapputils:15.3.4' + api 'cc.winboll.studio:libappbase:15.7.6' // SSH api 'com.jcraft:jsch:0.1.55' @@ -67,7 +70,4 @@ dependencies { //api 'androidx.vectordrawable:vectordrawable-animated:1.1.0' //api 'androidx.fragment:fragment:1.1.0' - api 'cc.winboll.studio:libaes:15.2.5' - api 'cc.winboll.studio:libapputils:15.2.1' - api 'cc.winboll.studio:libappbase:15.2.2' } diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index f6dc714..2db361a 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 15 10:20:33 GMT 2025 +#Sat May 03 03:51:17 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=55 +buildCount=59 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java index 515d633..9d37f76 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/App.java @@ -6,9 +6,9 @@ package cc.winboll.studio.autoinstaller; * @Describe 全局应用类 */ import android.view.Gravity; -import cc.winboll.studio.autoinstaller.R; import cc.winboll.studio.libappbase.GlobalApplication; import com.hjq.toast.ToastUtils; +import com.hjq.toast.style.WhiteToastStyle; public class App extends GlobalApplication { @@ -21,8 +21,8 @@ public class App extends GlobalApplication { // 初始化 Toast 框架 ToastUtils.init(this); // 设置 Toast 布局样式 - ToastUtils.setView(R.layout.view_toast); - //ToastUtils.setStyle(new WhiteToastStyle()); + //ToastUtils.setView(R.layout.view_toast); + ToastUtils.setStyle(new WhiteToastStyle()); ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); } } diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java index 6d65adb..4924860 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/models/AppConfigs.java @@ -154,10 +154,13 @@ public class AppConfigs implements Serializable { try { String szJson = FileUtil.readFile(getDataPath(context.getApplicationContext())); appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson); + if(appConfigs != null) { + _AppConfigs = appConfigs; + } } catch (IOException e) { LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); } - return appConfigs; + return _AppConfigs; } public void saveAppConfigs(Context context, AppConfigs appConfigs) { diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/IWinBoLLClientServiceBinder.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/IWinBoLLClientServiceBinder.java deleted file mode 100644 index 65087ad..0000000 --- a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/IWinBoLLClientServiceBinder.java +++ /dev/null @@ -1,17 +0,0 @@ -package cc.winboll.studio.libaes.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/28 19:08:45 - * @Describe WinBoLLService 服务 Binder。 - */ -import android.graphics.drawable.Drawable; - -public interface IWinBoLLClientServiceBinder { - - public static final String TAG = "IWinBoLLClientServiceBinder"; - - public WinBoLLClientService getService(); - - public Drawable getCurrentStatusIconDrawable(); -} diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java deleted file mode 100644 index 12fcd43..0000000 --- a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java +++ /dev/null @@ -1,192 +0,0 @@ -package cc.winboll.studio.libaes.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/28 19:06:54 - * @Describe WinBoLL 客户端服务 - */ -import android.app.Service; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.graphics.drawable.Drawable; -import android.os.IBinder; -import cc.winboll.studio.libaes.winboll.AssistantService; -import cc.winboll.studio.libappbase.GlobalApplication; -import cc.winboll.studio.libappbase.LogUtils; -import cc.winboll.studio.libappbase.utils.ServiceUtils; -import cc.winboll.studio.libapputils.utils.PrefUtils; -import com.hjq.toast.ToastUtils; - -public class WinBoLLClientService extends Service implements IWinBoLLClientServiceBinder { - - public static final String TAG = "WinBoLLClientService"; - - WinBoLLClientServiceBean mWinBoLLClientServiceBean; - MyServiceConnection mMyServiceConnection; - volatile boolean mIsWinBoLLClientThreadRunning; - volatile boolean mIsEnableService; - volatile WinBoLLClientThread mWinBoLLClientThread; - - public boolean isWinBoLLClientThreadRunning() { - return mIsWinBoLLClientThreadRunning; - } - - @Override - public WinBoLLClientService getService() { - return WinBoLLClientService.this; - } - - @Override - public Drawable getCurrentStatusIconDrawable() { - return mIsWinBoLLClientThreadRunning ? - getDrawable(EWUIStatusIconDrawable.getIconDrawableId(EWUIStatusIconDrawable.NORMAL)) - : getDrawable(EWUIStatusIconDrawable.getIconDrawableId(EWUIStatusIconDrawable.NEWS)); - } - - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public void onCreate() { - //ToastUtils.show("onCreate"); - super.onCreate(); - mWinBoLLClientThread = null; - mWinBoLLClientServiceBean = WinBoLLClientServiceBean.loadWinBoLLClientServiceBean(this); - mIsEnableService = mWinBoLLClientServiceBean.isEnable(); - - if (mMyServiceConnection == null) { - mMyServiceConnection = new MyServiceConnection(); - } - - // 由系统启动时,应用可以通过下面函数实例化实际服务进程。 - runMainThread(); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - //ToastUtils.show("onStartCommand"); - // 由应用 Intent 启动时,应用可以通过下面函数实例化实际服务进程。 - runMainThread(); - - // 返回运行参数持久化存储后,服务状态控制参数 - // 无论 Intent 传入如何,服务状态一直以持久化存储后的参数控制, - // PS: 另外当然可以通过 Intent 传入的指标来修改 mWinBoLLServiceBean, - // 不过本服务的应用方向会变得繁琐, - // 现阶段只要满足手机端启动与停止本服务,WinBoLL 客户端实例运行在手机端就可以了。 - return mIsEnableService ? Service.START_STICKY: super.onStartCommand(intent, flags, startId); - } - - synchronized void runMainThread() { - if (mWinBoLLClientThread == null) { - //ToastUtils.show("runMainThread()"); - mWinBoLLClientThread = new WinBoLLClientThread(); - mWinBoLLClientThread.start(); - } - } - - void syncWinBoLLClientThreadStatus() { - mWinBoLLClientServiceBean = WinBoLLClientServiceBean.loadWinBoLLClientServiceBean(this); - mIsEnableService = mWinBoLLClientServiceBean.isEnable(); - LogUtils.d(TAG, String.format("mIsEnableService %s", mIsEnableService)); - } - - - // 唤醒和绑定守护进程 - // - void wakeupAndBindAssistant() { - if (ServiceUtils.isServiceRunning(getApplicationContext(), AssistantService.class.getName()) == false) { - startService(new Intent(WinBoLLClientService.this, AssistantService.class)); - //LogUtils.d(TAG, "call wakeupAndBindAssistant() : Binding... AssistantService"); - bindService(new Intent(WinBoLLClientService.this, AssistantService.class), mMyServiceConnection, Context.BIND_IMPORTANT); - } - } - - // 主进程与守护进程连接时需要用到此类 - // - private class MyServiceConnection implements ServiceConnection { - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - - } - - @Override - public void onServiceDisconnected(ComponentName name) { - mWinBoLLClientServiceBean = WinBoLLClientServiceBean.loadWinBoLLClientServiceBean(WinBoLLClientService.this); - if (mWinBoLLClientServiceBean.isEnable()) { - // 唤醒守护进程 - wakeupAndBindAssistant(); - } - } - } - - @Override - public void onDestroy() { - super.onDestroy(); - //ToastUtils.show("onDestroy"); - } - - @Override - public void onStart(Intent intent, int startId) { - super.onStart(intent, startId); - } - - void setWinBoLLServiceEnableStatus(boolean isEnable) { - WinBoLLClientServiceBean bean = WinBoLLClientServiceBean.loadWinBoLLClientServiceBean(this); - bean.setIsEnable(isEnable); - WinBoLLClientServiceBean.saveWinBoLLServiceBean(this, bean); - } - - boolean getWinBoLLServiceEnableStatus(Context context) { - mWinBoLLClientServiceBean = WinBoLLClientServiceBean.loadWinBoLLClientServiceBean(context); - return mWinBoLLClientServiceBean.isEnable(); - } - - /*public interface OnServiceStatusChangeListener { - void onServerStatusChange(boolean isServiceAlive); - } - - public void setOnServerStatusChangeListener(OnServiceStatusChangeListener l) { - mOnServerStatusChangeListener = l; - }*/ - - class WinBoLLClientThread extends Thread { - @Override - public void run() { - super.run(); - LogUtils.d(TAG, "run syncWinBoLLClientThreadStatus"); - syncWinBoLLClientThreadStatus(); - if (mIsEnableService) { - if (mIsWinBoLLClientThreadRunning == false) { - // 设置运行状态 - mIsWinBoLLClientThreadRunning = true; - LogUtils.d(TAG, "WinBoLLClientThread run()"); - - // 唤醒守护进程 - //wakeupAndBindAssistant(); - - while (mIsEnableService) { - // 显示运行状态 - WinBoLLServiceStatusView.startConnection(); - LogUtils.d(TAG, String.format("while mIsEnableService is %s", mIsEnableService)); - - try { - Thread.sleep(10 * 1000); - } catch (InterruptedException e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - syncWinBoLLClientThreadStatus(); - } - - // 服务进程退出, 重置进程运行状态 - WinBoLLServiceStatusView.stopConnection(); - mIsWinBoLLClientThreadRunning = false; - mWinBoLLClientThread = null; - } - } - } - } -} diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientServiceBean.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientServiceBean.java deleted file mode 100644 index 000b5db..0000000 --- a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientServiceBean.java +++ /dev/null @@ -1,78 +0,0 @@ -package cc.winboll.studio.libaes.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/28 19:05:15 - * @Describe WinBoLLService 运行参数配置 - */ -import android.content.Context; -import android.util.JsonReader; -import android.util.JsonWriter; -import cc.winboll.studio.libappbase.BaseBean; -import java.io.IOException; - -public class WinBoLLClientServiceBean extends BaseBean { - - public static final String TAG = "WinBoLLClientServiceBean"; - - volatile boolean isEnable; - - public WinBoLLClientServiceBean() { - isEnable = false; - } - - public void setIsEnable(boolean isEnable) { - this.isEnable = isEnable; - } - - public boolean isEnable() { - return isEnable; - } - - @Override - public String getName() { - return WinBoLLClientServiceBean.class.getName(); - } - - @Override - public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException { - super.writeThisToJsonWriter(jsonWriter); - WinBoLLClientServiceBean bean = this; - jsonWriter.name("isEnable").value(bean.isEnable()); - } - - @Override - public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException { - if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else { - if (name.equals("isEnable")) { - setIsEnable(jsonReader.nextBoolean()); - } else { - return false; - } - } - return true; - } - - @Override - public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException { - jsonReader.beginObject(); - while (jsonReader.hasNext()) { - String name = jsonReader.nextName(); - if (!initObjectsFromJsonReader(jsonReader, name)) { - jsonReader.skipValue(); - } - } - // 结束 JSON 对象 - jsonReader.endObject(); - return this; - } - - public static WinBoLLClientServiceBean loadWinBoLLClientServiceBean(Context context) { - WinBoLLClientServiceBean bean = WinBoLLClientServiceBean.loadBean(context, WinBoLLClientServiceBean.class); - return bean == null ? new WinBoLLClientServiceBean() : bean; - } - - public static boolean saveWinBoLLServiceBean(WinBoLLClientService service, WinBoLLClientServiceBean bean) { - return WinBoLLClientServiceBean.saveBean(service, bean); - } -} diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLMail.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLMail.java deleted file mode 100644 index 6f49c90..0000000 --- a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLMail.java +++ /dev/null @@ -1,22 +0,0 @@ -package cc.winboll.studio.libaes.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/28 19:13:20 - * @Describe WinBoLL 邮件服务 - */ -import android.app.Service; -import android.content.Intent; -import android.os.IBinder; - -public class WinBoLLMail extends Service { - - public static final String TAG = "WinBoLLMail"; - - @Override - public IBinder onBind(Intent intent) { - - return null; - } - -} diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServerConnectionThread.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServerConnectionThread.java deleted file mode 100644 index 5e3e833..0000000 --- a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServerConnectionThread.java +++ /dev/null @@ -1,106 +0,0 @@ -package cc.winboll.studio.libaes.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/29 15:57:28 - * @Describe WinBoLL 服务器服务情况测试访问进程。 - */ -import cc.winboll.studio.libappbase.LogUtils; -import java.io.IOException; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Credentials; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; - -// 新增自定义回调接口 -interface TextCallback { - void onSuccess(String text); - void onFailure(Exception e); -} - -public class WinBoLLServerConnectionThread extends Thread { - - public static final String TAG = "WinBoLLClientService"; - - private final String url; - private final String username; - private final String password; - private final int connectTimeout; - private final int readTimeout; - private final int maxRetries; - private final TextCallback callback; // 新增回调成员变量 - - // 新增带回调的构造函数 - public WinBoLLServerConnectionThread(String url, String username, String password, TextCallback callback) { - this(url, username, password, 10000, 10000, 5, callback); - } - - // 修改原有构造函数,添加回调参数 - public WinBoLLServerConnectionThread(String url, String username, String password, - int connectTimeout, int readTimeout, int maxRetries, TextCallback callback) { - this.url = url; - this.username = username; - this.password = password; - this.connectTimeout = connectTimeout; - this.readTimeout = readTimeout; - this.maxRetries = maxRetries; - this.callback = callback; - } - - @Override - public void run() { - LogUtils.d(TAG, String.format("run() url %s\nusername %s\npassword %s", url, username, password)); - String credential = Credentials.basic(username, password); - LogUtils.d(TAG, String.format("credential %s", credential)); - - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder() - .url(url) - .header("Accept", "text/plain") - .header("Authorization", credential) - .build(); - - Call call = client.newCall(request); - call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - // 优先调用自定义回调 - if (callback != null) { - callback.onFailure(e); - } else { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - - @Override - public void onResponse(Call call, Response response) throws IOException { - if (!response.isSuccessful()) { - if (callback != null) { - callback.onFailure(new Exception("Unexpected code " + response)); - } else { - LogUtils.d(TAG, "Unexpected code " + response, Thread.currentThread().getStackTrace()); - } - return; - } - - try { - String text = response.body().string(); - // 优先调用自定义回调 - if (callback != null) { - callback.onSuccess(text); - } else { - LogUtils.d(TAG, text); - } - } catch (Exception e) { - if (callback != null) { - callback.onFailure(e); - } else { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - } - }); - } -} diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java deleted file mode 100644 index f91acc9..0000000 --- a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java +++ /dev/null @@ -1,473 +0,0 @@ -package cc.winboll.studio.libaes.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/28 17:41:55 - * @Describe WinBoLL 服务主机连接状态视图 - */ -import cc.winboll.studio.libaes.R; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.graphics.drawable.Drawable; -import android.os.Handler; -import android.os.IBinder; -import android.os.Message; -import android.util.AttributeSet; -import android.view.View; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; -import cc.winboll.studio.libaes.winboll.WinBoLLClientService; -import cc.winboll.studio.libappbase.GlobalApplication; -import cc.winboll.studio.libappbase.LogUtils; -import cc.winboll.studio.libapputils.utils.PrefUtils; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -//import okhttp3.Authenticator; -//import okhttp3.Credentials; -//import okhttp3.OkHttpClient; -//import okhttp3.Request; -//import okhttp3.Response; -//import okhttp3.Route; - -public class WinBoLLServiceStatusView extends LinearLayout { - - public static final String TAG = "WinBoLLServiceStatusView"; - - public static final int MSG_CONNECTION_INFO = 0; - public static final int MSG_UPDATE_CONNECTION_STATUS = 1; - - static WinBoLLServiceStatusView _WinBoLLServiceStatusView; - Context mContext; - //boolean mIsConnected; - volatile ConnectionThread mConnectionThread; - - String mszServerHost; - WinBoLLClientService mWinBoLLService; - ImageView mImageView; - TextView mTextView; - WinBoLLServiceViewHandler mWinBoLLServiceViewHandler; - //WebView mWebView; - static volatile ConnectionStatus mConnectionStatus; - View.OnClickListener mViewOnClickListener; - static String _mUserName; - static String _mPassword; - - static enum ConnectionStatus { - DISCONNECTED, - START_CONNECT, - CONNECTING, - CONNECTED; - }; - - boolean isBound = false; - ServiceConnection connection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - IWinBoLLClientServiceBinder binder = (IWinBoLLClientServiceBinder) service; - mWinBoLLService = binder.getService(); - isBound = true; - // 可以在这里调用Service的方法进行通信,比如获取数据 - mImageView.setBackgroundDrawable(mWinBoLLService.getCurrentStatusIconDrawable()); - } - - @Override - public void onServiceDisconnected(ComponentName name) { - isBound = false; - } - }; - - public WinBoLLServiceStatusView(Context context) { - super(context); - mContext = context; - initView(); - } - - public WinBoLLServiceStatusView(Context context, AttributeSet attrs) { - super(context, attrs); - mContext = context; - initView(); - } - - public WinBoLLServiceStatusView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - mContext = context; - initView(); - } - - public WinBoLLServiceStatusView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - mContext = context; - initView(); - } - - ConnectionStatus getConnectionStatus() { - return false ? - ConnectionStatus.CONNECTED - : ConnectionStatus.DISCONNECTED; - } - - void initView() { - _WinBoLLServiceStatusView = this; - - mImageView = new ImageView(mContext); - setImageViewByConnection(mImageView, false); - mConnectionStatus = getConnectionStatus(); - //mIsConnected = false; - //mWinBoLLServerHostConnectionStatus = WinBoLLServerHostConnectionStatus.DISCONNECTED; - //ToastUtils.show("initView()"); - - mViewOnClickListener = new View.OnClickListener(){ - @Override - public void onClick(View v) { - LogUtils.d(TAG, "onClick()"); - if (mConnectionStatus == ConnectionStatus.CONNECTED) { - LogUtils.d(TAG, "Click to stop service."); - WinBoLLClientServiceBean bean = WinBoLLClientServiceBean.loadWinBoLLClientServiceBean(mContext); - bean.setIsEnable(false); - WinBoLLClientServiceBean.saveBean(mContext, bean); - Intent intent = new Intent(mContext, WinBoLLClientService.class); - mContext.stopService(intent); - //stopConnectionThread(); - mTextView.setText(""); - setImageViewByConnection(mImageView, false); - mConnectionStatus = ConnectionStatus.DISCONNECTED; - } else if (mConnectionStatus == ConnectionStatus.DISCONNECTED) { - LogUtils.d(TAG, "Click to start service."); - WinBoLLClientServiceBean bean = WinBoLLClientServiceBean.loadWinBoLLClientServiceBean(mContext); - bean.setIsEnable(true); - WinBoLLClientServiceBean.saveBean(mContext, bean); - Intent intent = new Intent(mContext, WinBoLLClientService.class); - mContext.startService(intent); - //startConnectionThread(); - } - } - }; - setOnClickListener(mViewOnClickListener); - addView(mImageView); - mTextView = new TextView(mContext); - mWinBoLLServiceViewHandler = new WinBoLLServiceViewHandler(this); - addView(mTextView); - /*mWebView = new WebView(mContext); - mWebView.setWebViewClient(new WebViewClient() { - @Override - public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { - // 弹出系统基本HTTP验证窗口 - handler.proceed("username", "password"); - } - }); - addView(mWebView);*/ - } - - void checkWinBoLLServerStatusAndUpdateCurrentView() { - LogUtils.d(TAG, "checkWinBoLLServerStatusAndUpdateCurrentView()"); - /*if (getConnectionStatus() == ConnectionStatus.CONNECTED) { - mConnectionStatus = ConnectionStatus.CONNECTED; - } else { - mConnectionStatus = ConnectionStatus.DISCONNECTED; - }*/ - } - - public void setServerHost(String szWinBoLLServerHost) { - mszServerHost = szWinBoLLServerHost; - } - - public void setAuthInfo(String username, String password) { - _mUserName = username; - _mPassword = password; - } - - void setImageViewByConnection(ImageView imageView, boolean isConnected) { - //mIsConnected = isConnected; - // 获取vector drawable - Drawable drawable = mContext.getDrawable(isConnected ? R.drawable.ic_dev_connected : R.drawable.ic_dev_disconnected); - if (drawable != null) { - imageView.setImageDrawable(drawable); - } - } - - TextCallback apiTextCallback = new TextCallback() { - @Override - public void onSuccess(String text) { - // 处理成功响应 - LogUtils.d(TAG, text); - } - - @Override - public void onFailure(Exception e) { - // 处理失败情况 - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - }; - - TextCallback cipTextCallback = new TextCallback() { - @Override - public void onSuccess(String text) { - // 处理成功响应 - LogUtils.d(TAG, text); - LogUtils.d(TAG, "Develop Host Connection IP is : " + text); - mConnectionStatus = ConnectionStatus.CONNECTED; - // 获取当前时间 - LocalDateTime now = LocalDateTime.now(); - // 定义时间格式 - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - // 按照指定格式格式化时间并输出 - String formattedDateTime = now.format(formatter); - String msg = "ClientIP<" + formattedDateTime + ">: " + text; - mWinBoLLServiceViewHandler.postMessageText(msg); - mWinBoLLServiceViewHandler.postMessageConnectionStatus(true); - - } - - @Override - public void onFailure(Exception e) { - // 处理失败情况 - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - // 处理网络请求失败 - setImageViewByConnection(mImageView, false); - mWinBoLLServiceViewHandler.postMessageText(e.getMessage()); - mWinBoLLServiceViewHandler.postMessageConnectionStatus(false); - } - }; - - public void requestAPIWithBasicAuth() { - String targetUrl = "https://" + (GlobalApplication.isDebuging() ?"dev.winboll": "winboll") + ".cc/api/"; // 替换为实际测试的URL - requestWithBasicAuth(targetUrl, apiTextCallback); - } - - public void requestCIPWithBasicAuth() { - String targetUrl = mszServerHost + "/cip/?simple=true"; - requestWithBasicAuth(targetUrl, cipTextCallback); - } - - public void requestWithBasicAuth(String targetUrl, TextCallback callback) { - String username = ""; - String password = ""; - if (GlobalApplication.isDebuging()) { - username = PrefUtils.getString(mContext, "metDevUserName", ""); - password = PrefUtils.getString(mContext, "metDevUserPassword", ""); - } else { - username = "WinBoLL"; - password = "WinBoLLPowerByZhanGSKen"; - } - - LogUtils.d(TAG, String.format("Connection Start. targetUrl %s", targetUrl)); - WinBoLLServerConnectionThread thread = new WinBoLLServerConnectionThread( - targetUrl, - username, - password, - cipTextCallback - ); - thread.start(); - } - - /*void requestWithBasicAuth(final WinBoLLServiceViewHandler textViewHandler, String targetUrl, final String username, final String password) { - // 用户名和密码,替换为实际的认证信息 - //String username = "your_username"; - //String password = "your_password"; - LogUtils.d(TAG, "requestWithBasicAuth(...)"); - LogUtils.d(TAG, String.format("targetUrl %s", targetUrl)); - - // 构建包含认证信息的请求 - String credential = Credentials.basic(username, password); - LogUtils.d(TAG, String.format("credential %s", credential)); - - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder() - .url(targetUrl) - .header("Accept", "text/plain") // 设置正确的Content-Type头 - .header("Authorization", credential) - .build(); - - Call call = client.newCall(request); - call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - // 处理网络请求失败 - setImageViewByConnection(mImageView, false); - textViewHandler.postMessageText(e.getMessage()); - textViewHandler.postMessageConnectionStatus(false); - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - //String sz = "请求失败,状态码: " + response.code(); - //setImageViewByConnection(mImageView, false); - //LogUtils.d(TAG, sz); - } - - @Override - public void onResponse(Call call, Response response) throws IOException { - if (!response.isSuccessful()) { - setImageViewByConnection(mImageView, false); - textViewHandler.postMessageText("Unexpected code " + response); - textViewHandler.postMessageConnectionStatus(false); - LogUtils.d(TAG, "Unexpected code " + response, Thread.currentThread().getStackTrace()); - return; - } - - try { - // 读取响应体作为字符串,注意这里可能需要解码 - String text = response.body().string(); - LogUtils.d(TAG, "Develop Host Connection IP is : " + text); - mConnectionStatus = ConnectionStatus.CONNECTED; - // 获取当前时间 - LocalDateTime now = LocalDateTime.now(); - // 定义时间格式 - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - // 按照指定格式格式化时间并输出 - String formattedDateTime = now.format(formatter); - textViewHandler.postMessageText("ClientIP<" + formattedDateTime + ">: " + text); - textViewHandler.postMessageConnectionStatus(true); - - //org.jsoup.nodes.Document doc = org.jsoup.Jsoup.parse(text); - //LogUtils.d(TAG, doc.text()); - - // 使用id选择器找到具有特定id的元素 - //org.jsoup.nodes.Element elementWithId = doc.select("#LastRelease").first(); // 获取第一个匹配的元素 - - // 提取并打印元素的文本内容 - //mszNewestAppPackageName = elementWithId.text(); - //ToastUtils.delayedShow(text + "\n" + mszNewestAppPackageName, 5000); - - //mHandler.sendMessage(mHandler.obtainMessage(MSG_APPUPDATE_CHECKED)); - //System.out.println(response.body().string()); - // mConnectionStatus = ConnectionStatus.CONNECTED; - // // 获取当前时间 - // LocalDateTime now = LocalDateTime.now(); - // - // // 定义时间格式 - // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - // // 按照指定格式格式化时间并输出 - // String formattedDateTime = now.format(formatter); - // //System.out.println(formattedDateTime); - // textViewHandler.postMessageText("ClientIP<" + formattedDateTime + ">: " + response.body().string()); - // textViewHandler.postMessageConnectionStatus(true); - } catch (Exception e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - }); - - }*/ - - class WinBoLLServiceViewHandler extends Handler { - WinBoLLServiceStatusView mDevelopHostConnectionStatusView; - - public WinBoLLServiceViewHandler(WinBoLLServiceStatusView view) { - mDevelopHostConnectionStatusView = view; - } - - @Override - public void handleMessage(Message msg) { - if (msg.what == MSG_CONNECTION_INFO) { - mDevelopHostConnectionStatusView.mTextView.setText((String)msg.obj); - } else if (msg.what == MSG_UPDATE_CONNECTION_STATUS) { - mDevelopHostConnectionStatusView.setImageViewByConnection(mImageView, (boolean)msg.obj); - mDevelopHostConnectionStatusView.mConnectionStatus = ((boolean)msg.obj) ? ConnectionStatus.CONNECTED : ConnectionStatus.DISCONNECTED; - } - super.handleMessage(msg); - } - - void postMessageText(String szMSG) { - Message msg = new Message(); - msg.what = MSG_CONNECTION_INFO; - msg.obj = szMSG; - sendMessage(msg); - } - - void postMessageConnectionStatus(boolean isConnected) { - Message msg = new Message(); - msg.what = MSG_UPDATE_CONNECTION_STATUS; - msg.obj = isConnected; - sendMessage(msg); - } - } - - public static void startConnection() { - if (_WinBoLLServiceStatusView != null) { - _WinBoLLServiceStatusView.startConnectionThread(); - } - } - - public static void stopConnection() { - if (_WinBoLLServiceStatusView != null) { - _WinBoLLServiceStatusView.stopConnectionThread(); - } - } - - void startConnectionThread() { - if (mConnectionStatus == ConnectionStatus.DISCONNECTED) { - mConnectionStatus = ConnectionStatus.START_CONNECT; - LogUtils.d(TAG, "startConnectionThread"); - if (mConnectionThread != null) { - LogUtils.d(TAG, "mConnectionThread != null"); - mConnectionThread.mIsExist = true; - } - mConnectionThread = new ConnectionThread(); - mConnectionThread.start(); - } else if (mConnectionStatus == ConnectionStatus.CONNECTING) { - //LogUtils.d(TAG, "mConnectionStatus == ConnectionStatus.CONNECTING"); - } else if (mConnectionStatus == ConnectionStatus.CONNECTED) { - //LogUtils.d(TAG, "mConnectionStatus == ConnectionStatus.CONNECTED"); - } else { - LogUtils.d(TAG, String.format("Unknow mConnectionStatus %s, can not start ConnectionThread.", mConnectionStatus)); - } - } - - void stopConnectionThread() { - LogUtils.d(TAG, "stopConnectionThread"); - if (mConnectionThread != null) { - LogUtils.d(TAG, "mConnectionThread != null"); - mConnectionThread.mIsExist = true; - mConnectionThread = null; - } - } - - - - class ConnectionThread extends Thread { - - public volatile boolean mIsExist; - - //DevelopHostConnectionStatusViewHandler mDevelopHostConnectionStatusViewHandler; - - //public ConnectionThread(DevelopHostConnectionStatusViewHandler developHostConnectionStatusViewHandler) { - //mDevelopHostConnectionStatusViewHandler = developHostConnectionStatusViewHandler; - //} - public ConnectionThread() { - mIsExist = false; - } - - @Override - public void run() { - super.run(); - while (mIsExist == false) { - if (mConnectionStatus == ConnectionStatus.START_CONNECT) { - mConnectionStatus = ConnectionStatus.CONNECTING; - //requestAPIWithBasicAuth(); - requestCIPWithBasicAuth(); - } else if (mConnectionStatus == ConnectionStatus.CONNECTED - || mConnectionStatus == ConnectionStatus.DISCONNECTED) { - //ToastUtils.show("mWinBoLLServerHostConnectionStatus " + mConnectionStatus); - LogUtils.d(TAG, String.format("mConnectionStatus done %s", mConnectionStatus)); - } else { - LogUtils.d(TAG, String.format("mConnectionStatus unknow %s", mConnectionStatus)); - } - - try { - Thread.sleep(5 * 1000); - } catch (InterruptedException e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - //ToastUtils.show("ConnectionThread exit."); - LogUtils.d(TAG, "ConnectionThread exit."); - } - } - - /*WinBoLLService.OnServiceStatusChangeListener mOnServerStatusChangeListener = new WinBoLLService.OnServiceStatusChangeListener(){ - @Override - public void onServerStatusChange(boolean isServiceAlive) { - } - };*/ -} diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/sos/WinBoLL.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/sos/WinBoLL.java deleted file mode 100644 index 080c7e0..0000000 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/sos/WinBoLL.java +++ /dev/null @@ -1,39 +0,0 @@ -package cc.winboll.studio.libappbase.sos; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/02 09:54:28 - * @Describe WinBoLL 系列应用通用管理类 - */ -import android.content.Context; -import android.content.Intent; -import cc.winboll.studio.libappbase.LogUtils; - -public class WinBoLL { - - public static final String TAG = "WinBoLL"; - - public static final String ACTION_BIND = WinBoLL.class.getName() + ".ACTION_BIND"; - public static final String EXTRA_APPMODEL = "EXTRA_APPMODEL"; - - public static void bindToAPPBase(Context context, String appMainService) { - LogUtils.d(TAG, "bindToAPPBase(...)"); - String toPackage = "cc.winboll.studio.appbase"; - startBind(context, toPackage, appMainService); - } - - public static void bindToAPPBaseBeta(Context context, String appMainService) { - LogUtils.d(TAG, "bindToAPPBaseBeta(...)"); - String toPackage = "cc.winboll.studio.appbase.beta"; - startBind(context, toPackage, appMainService); - } - - static void startBind(Context context, String toPackage, String appMainService) { - Intent intent = new Intent(ACTION_BIND); - intent.putExtra(EXTRA_APPMODEL, (new APPModel(toPackage, appMainService)).toString()); - intent.setPackage(toPackage); - LogUtils.d(TAG, String.format("ACTION_BIND :\nTo Package : %s\nAPP Main Service : %s", toPackage, appMainService)); - context.sendBroadcast(intent); - } - -} diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/IWinBoLLActivity.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/IWinBoLLActivity.java deleted file mode 100644 index 4bed92a..0000000 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/IWinBoLLActivity.java +++ /dev/null @@ -1,18 +0,0 @@ -package cc.winboll.studio.libappbase.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/24 08:23:40 - * @Describe WinBoLL 活动窗口通用接口 - */ -import android.app.Activity; -import android.widget.Toolbar; - -public interface IWinBoLLActivity { - - public static final String TAG = "IWinBoLLActivity"; - - // 获取活动窗口 - abstract public Activity getActivity(); - abstract public String getTag(); -} diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/WinBoLLActivityManager.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/WinBoLLActivityManager.java deleted file mode 100644 index 013ee8f..0000000 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/winboll/WinBoLLActivityManager.java +++ /dev/null @@ -1,356 +0,0 @@ -package cc.winboll.studio.libappbase.winboll; - -/** - * @Author ZhanGSKen@AliYun.Com - * @Date 2025/03/24 08:25:43 - * @Describe 应用活动窗口管理器 - * 参考 : - * android 类似微信小程序多任务窗口 及 设置 TaskDescription 修改 icon 和 label - * https://blog.csdn.net/qq_29364417/article/details/109379915?app_version=6.4.2&code=app_1562916241&csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22109379915%22%2C%22source%22%3A%22weixin_38986226%22%7D&uLinkId=usr1mkqgl919blen&utm_source=app - */ -import android.app.ActivityManager; -import android.app.TaskStackBuilder; -import android.content.Context; -import android.content.Intent; -import cc.winboll.studio.libappbase.GlobalApplication; -import cc.winboll.studio.libappbase.LogUtils; -import cc.winboll.studio.libappbase.utils.ToastUtils; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -public class WinBoLLActivityManager { - - public static final String TAG = "WinBoLLActivityManager"; - public static final String EXTRA_TAG = "EXTRA_TAG"; - - public static enum WinBoLLUI_TYPE { - Aplication, // 退出应用后,保持最近任务栏任务记录主窗口 - Service // 退出应用后,清理所有最近任务栏任务记录窗口 - }; - - // 应用类型标志 - static volatile WinBoLLUI_TYPE _mWinBoLLUI_TYPE = WinBoLLUI_TYPE.Service; - - GlobalApplication mGlobalApplication; - static volatile WinBoLLActivityManager _Instance; - static volatile Map _mapIWinBoLLList; - volatile IWinBoLLActivity mFirstIWinBoLLActivity; - - WinBoLLActivityManager(GlobalApplication application) { - mGlobalApplication = application; - _mapIWinBoLLList = new HashMap(); - } - - public static synchronized WinBoLLActivityManager getInstance(GlobalApplication application) { - LogUtils.d(TAG, "getInstance"); - if (_Instance == null) { - LogUtils.d(TAG, "_Instance == null"); - _Instance = new WinBoLLActivityManager(application); - } - return _Instance; - } - - // - // 设置 WinBoLL 应用 UI 类型 - // - public synchronized static void setWinBoLLUI_TYPE(WinBoLLUI_TYPE mWinBoLLUI_TYPE) { - _mWinBoLLUI_TYPE = mWinBoLLUI_TYPE; - } - - // - // 获取 WinBoLL 应用 UI 类型 - // - public synchronized static WinBoLLUI_TYPE getWinBoLLUI_TYPE() { - return _mWinBoLLUI_TYPE; - } - - // - // 把Activity添加到管理中 - // - public void add(T iWinBoLL) { - String tag = ((IWinBoLLActivity)iWinBoLL).getTag(); - LogUtils.d(TAG, String.format("add(T iWinBoLL) tag is %s", tag)); - if (isActive(tag)) { - LogUtils.d(TAG, String.format("isActive(tag) is true, tag : %s.", tag)); - } else { - // 设置起始活动窗口,以便最后退出时提问 - if (mFirstIWinBoLLActivity == null && _mapIWinBoLLList.size() == 0) { - LogUtils.d(TAG, "Set firstIWinBoLLActivity, iWinBoLL.getTag() is %s" + iWinBoLL.getTag()); - mFirstIWinBoLLActivity = iWinBoLL; - } - - // 添加到活动窗口列表 - _mapIWinBoLLList.put(iWinBoLL.getTag(), iWinBoLL); - LogUtils.d(TAG, String.format("Add activity : %s\n_mapActivityList.size() : %d", iWinBoLL.getTag(), _mapIWinBoLLList.size())); - } - } - - - // - // activity: 为 null 时, - // intent.putExtra 函数 EXTRA_TAG 参数为 tag - // activity: 不为 null 时, - // intent.putExtra 函数 "tag" 参数为 activity.getTag() - // - public void startWinBoLLActivity(Context context, Class clazz) { - try { - // 如果窗口已存在就重启窗口 - String tag = ((IWinBoLLActivity)clazz.newInstance()).getTag(); - LogUtils.d(TAG, String.format("startWinBoLLActivity(Context context, Class clazz) tag is %s", tag)); - if (isActive(tag)) { - resumeActivity(context, tag); - return; - } - //ToastUtils.show("startWinBoLLActivity(Context context, Class clazz)"); - - // 新建一个任务窗口 - Intent intent = new Intent(context, clazz); - //打开多任务窗口 flags - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); - intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra(EXTRA_TAG, tag); - context.startActivity(intent); - } catch (InstantiationException | IllegalAccessException e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - - public void startWinBoLLActivity(Context context, Intent intent, Class clazz) { - try { - // 如果窗口已存在就重启窗口 - String tag = ((IWinBoLLActivity)clazz.newInstance()).getTag(); - LogUtils.d(TAG, String.format("startWinBoLLActivity(Context context, Intent intent, Class clazz) tag is %s", tag)); - if (isActive(tag)) { - resumeActivity(context, tag); - return; - } - - // 新建一个任务窗口 - //Intent intent = new Intent(context, clazz); - //打开多任务窗口 flags - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); - intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra(EXTRA_TAG, tag); - context.startActivity(intent); - } catch (InstantiationException | IllegalAccessException e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - - public void startLogActivity(Context context) { - // 如果窗口已存在就重启窗口 - String tag = LogActivity.TAG; - if (isActive(tag)) { - resumeActivity(context, tag); - return; - } - - // 新建一个任务窗口 - Intent intent = new Intent(context, LogActivity.class); - //打开多任务窗口 flags - // Define the bounds. -// Rect bounds = new Rect(0, 0, 800, 200); -// // Set the bounds as an activity option. -// ActivityOptions options = ActivityOptions.makeBasic(); -// options.setLaunchBounds(bounds); - intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); - intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); - - intent.putExtra(EXTRA_TAG, tag); - - //context.startActivity(intent, options.toBundle()); - context.startActivity(intent); - } - - public boolean isFirstIWinBoLLActivity(IWinBoLLActivity iWinBoLLActivity) { - return mFirstIWinBoLLActivity != null && mFirstIWinBoLLActivity == iWinBoLLActivity; - } - - // - // 判断 tag绑定的 MyActivity是否存在 - // - public boolean isActive(String tag) { - LogUtils.d(TAG, String.format("isActive(String tag) tag is %s", tag)); - //printIWinBoLLListInfo(); - IWinBoLLActivity iWinBoLL = getIWinBoLL(tag); - if (iWinBoLL != null) { - //LogUtils.d(TAG, "isActive(...) activity != null tag " + tag); - //ToastUtils.show("activity != null tag " + tag); - //判断是否为 BaseActivity,如果已经销毁,则移除 - if (iWinBoLL.getActivity().isFinishing() || iWinBoLL.getActivity().isDestroyed()) { - _mapIWinBoLLList.remove(iWinBoLL.getTag()); - //_mWinBoLLActivityList.remove(activity); - LogUtils.d(TAG, String.format("isActive(...) remove activity.\ntag : %s", tag)); - return false; - } else { - LogUtils.d(TAG, String.format("isActive(...) activity is exist.\ntag : %s", tag)); - return true; - } - } else { - LogUtils.d(TAG, String.format("isActive(...) iWinBoLL is null tag by %s", tag)); - return false; - } - } - - static IWinBoLLActivity getIWinBoLL(String tag) { - LogUtils.d(TAG, String.format("getIWinBoLL(String tag) %s", tag)); - return _mapIWinBoLLList.get(tag); - } - - // - // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台 - // - public void resumeActivity(Context context, String tag) { - LogUtils.d(TAG, "resumeActivity(Context context, String tag)"); - T iWinBoLL = (T)getIWinBoLL(tag); - LogUtils.d(TAG, String.format("iWinBoLL.getTag() %s", iWinBoLL.getTag())); - //LogUtils.d(TAG, "activity " + activity.getTag()); - if (iWinBoLL != null && !iWinBoLL.getActivity().isFinishing() && !iWinBoLL.getActivity().isDestroyed()) { - resumeActivity(context, iWinBoLL); - } - } - - // - // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台 - // - public void resumeActivity(Context context, T iWinBoLL) { - LogUtils.d(TAG, "resumeActivity(Context context, T iWinBoLL)"); - ActivityManager am = (ActivityManager) mGlobalApplication.getSystemService(Context.ACTIVITY_SERVICE); - //返回启动它的根任务(home 或者 MainActivity) - Intent intent = new Intent(mGlobalApplication, iWinBoLL.getClass()); - TaskStackBuilder stackBuilder = TaskStackBuilder.create(mGlobalApplication); - stackBuilder.addNextIntentWithParentStack(intent); - stackBuilder.startActivities(); - //moveTaskToFront(YourTaskId, 0); - //ToastUtils.show("resumeActivity am.moveTaskToFront"); - LogUtils.d(TAG, String.format("iWinBoLL.getActivity().getTaskId() %d", iWinBoLL.getActivity().getTaskId())); - am.moveTaskToFront(iWinBoLL.getActivity().getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION); - LogUtils.d(TAG, "am.moveTaskToFront"); - } - - - // - // 结束所有 Activity - // - public void finishAll() { - try { - for (String key : _mapIWinBoLLList.keySet()) { - //System.out.println("Key: " + key + ", Value: " + _mapActivityList.get(key)); - IWinBoLLActivity iWinBoLL = _mapIWinBoLLList.get(key); - //ToastUtils.show("finishAll() activity"); - if (iWinBoLL != null && !iWinBoLL.getActivity().isFinishing() && !iWinBoLL.getActivity().isDestroyed()) { - //ToastUtils.show("activity != null ..."); - if (getWinBoLLUI_TYPE() == WinBoLLUI_TYPE.Service) { - // 结束窗口和最近任务栏, 建议前台服务类应用使用,可以方便用户再次调用 UI 操作。 - iWinBoLL.getActivity().finishAndRemoveTask(); - //ToastUtils.show("finishAll() activity.finishAndRemoveTask();"); - } else if (getWinBoLLUI_TYPE() == WinBoLLUI_TYPE.Aplication) { - // 结束窗口保留最近任务栏,建议前台服务类应用使用,可以保持应用的系统自觉性。 - iWinBoLL.getActivity().finish(); - //ToastUtils.show("finishAll() activity.finish();"); - } else { - LogUtils.d(TAG, "WinBoLLApplication.WinBoLLUI_TYPE error."); - //ToastUtils.show("WinBoLLApplication.WinBoLLUI_TYPE error."); - } - } - } - } catch (Exception e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - - // - // 结束指定Activity - // - public void finish(T iWinBoLL) { - try { - if (iWinBoLL != null && !iWinBoLL.getActivity().isFinishing() && !iWinBoLL.getActivity().isDestroyed()) { - //根据tag 移除 MyActivity - //String tag= activity.getTag(); - //_mWinBoLLActivityList.remove(tag); - //ToastUtils.show("remove"); - //ToastUtils.show("_mWinBoLLActivityArrayMap.size() " + Integer.toString(_mWinBoLLActivityArrayMap.size())); - - // 窗口回调规则: - // [] 当前窗口位置 >> 调度出的窗口位置 - // ★:[0] 1 2 3 4 >> 1 - // ★:0 1 [2] 3 4 >> 1 - // ★:0 1 2 [3] 4 >> 2 - // ★:0 1 2 3 [4] >> 3 - // ★:[0] >> 直接关闭当前窗口 - //LogUtils.d(TAG, "finish no yet."); - IWinBoLLActivity preIWinBoLL = getPreIWinBoLL(iWinBoLL); - iWinBoLL.getActivity().finish(); - if (preIWinBoLL != null) { - resumeActivity(mGlobalApplication, preIWinBoLL); - } - } - - } catch (Exception e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - } - - // - // 获取窗口队列中的前一个窗口 - // - IWinBoLLActivity getPreIWinBoLL(IWinBoLLActivity iWinBoLL) { - try { - boolean bingo = false; - IWinBoLLActivity preIWinBoLL = null; - for (Map.Entry entity : _mapIWinBoLLList.entrySet()) { - if (entity.getKey().equals(iWinBoLL.getTag())) { - bingo = true; - //LogUtils.d(TAG, "bingo"); - break; - } - preIWinBoLL = entity.getValue(); - } - - if (bingo) { - return preIWinBoLL; - } - } catch (Exception e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - - return null; - } - - // - // 从管理列表中移除管理项 - // - public boolean registeRemove(T activity) { - IWinBoLLActivity iWinBoLLTest = _mapIWinBoLLList.get(activity.getTag()); - if (iWinBoLLTest != null) { - _mapIWinBoLLList.remove(activity.getTag()); - return true; - } - return false; - } - - // - // 打印管理列表项列表里的信息 - // - public static void printIWinBoLLListInfo() { - //LogUtils.d(TAG, "printAvtivityListInfo"); - if (!_mapIWinBoLLList.isEmpty()) { - StringBuilder sb = new StringBuilder("Map entries : " + Integer.toString(_mapIWinBoLLList.size())); - Iterator> iterator = _mapIWinBoLLList.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - sb.append("\nKey: " + entry.getKey() + ", \nValue: " + entry.getValue().getTag()); - //ToastUtils.show("\nKey: " + entry.getKey() + ", Value: " + entry.getValue().getTag()); - } - sb.append("\nMap entries end."); - LogUtils.d(TAG, sb.toString()); - } else { - LogUtils.d(TAG, "The map is empty."); - } - } -} From d06023d023b12d5c103a8fb2a4cf5758cfd6bb9e Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 13:21:04 +0800 Subject: [PATCH 20/30] =?UTF-8?q?(=E6=89=93=E5=BC=80=E5=BA=94=E7=94=A8)?= =?UTF-8?q?=E7=9A=84=E6=8C=89=E9=92=AE=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 +-- .../studio/autoinstaller/MainActivity.java | 33 ++++++++++++------- .../autoinstaller/utils/PackageUtil.java | 16 +++++++++ 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 2db361a..a79dfe3 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 03:51:17 GMT 2025 +#Sat May 03 05:20:15 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=59 +buildCount=65 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java index 51763e9..b63de0c 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java @@ -20,6 +20,7 @@ import cc.winboll.studio.autoinstaller.models.APKModel; import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.services.MainService; import cc.winboll.studio.autoinstaller.utils.NotificationUtil; +import cc.winboll.studio.autoinstaller.utils.PackageUtil; import cc.winboll.studio.autoinstaller.views.ListViewForScrollView; import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogView; @@ -142,7 +143,7 @@ public class MainActivity extends Activity { } return ""; } - + public void onOpenAPP(View view) { String szInstalledPackageName = getLastApkPackageName(); if (szInstalledPackageName.trim().equals("")) { @@ -150,18 +151,28 @@ public class MainActivity extends Activity { return; } - Intent intent = getPackageManager().getLaunchIntentForPackage(mszInstalledPackageName); - if (intent != null) { - //ToastUtils.show("startActivity"); - startActivity(intent); - } else { - // 若没能获取到启动意图,可进行相应提示等操作,比如跳转到应用商店让用户下载该应用(示例) - Intent marketIntent = new Intent(Intent.ACTION_VIEW); - marketIntent.setData(Uri.parse("market://details?id=" + mszInstalledPackageName)); - startActivity(marketIntent); - } + PackageUtil.openAPP(this, szInstalledPackageName); } +// public void onOpenAPP(View view) { +// String szInstalledPackageName = getLastApkPackageName(); +// if (szInstalledPackageName.trim().equals("")) { +// ToastUtils.show("Installed APP package name is null."); +// return; +// } +// +// Intent intent = getPackageManager().getLaunchIntentForPackage(mszInstalledPackageName); +// if (intent != null) { +// //ToastUtils.show("startActivity"); +// startActivity(intent); +// } else { +// // 若没能获取到启动意图,可进行相应提示等操作,比如跳转到应用商店让用户下载该应用(示例) +// Intent marketIntent = new Intent(Intent.ACTION_VIEW); +// marketIntent.setData(Uri.parse("market://details?id=" + mszInstalledPackageName)); +// startActivity(marketIntent); +// } +// } + public void onInstallAPK(View view) { installAPK(); } diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/PackageUtil.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/PackageUtil.java index e4eb5d2..5e9303b 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/PackageUtil.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/PackageUtil.java @@ -6,8 +6,10 @@ package cc.winboll.studio.autoinstaller.utils; * @Describe 一个获取安卓APK安装文件的应用包名的函数 */ import android.content.Context; +import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import cc.winboll.studio.libappbase.LogUtils; public class PackageUtil { @@ -27,4 +29,18 @@ public class PackageUtil { } return ""; } + + public static void openAPP(Context context, String packageName) { + // 这里假设要打开微信,微信的包名是com.tencent.mm + //String packageName = "com.tencent.mm"; + PackageManager packageManager = context.getPackageManager(); + Intent intent = packageManager.getLaunchIntentForPackage(packageName); + if (intent != null) { + ResolveInfo resolveInfo = packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); + if (resolveInfo != null) { + context.startActivity(intent); + } + } + + } } From 38e4deb4252d2898654a6541cebd317812a6577a Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 13:46:46 +0800 Subject: [PATCH 21/30] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=89=93=E5=BC=80=E7=9A=84Bug.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 ++-- autoinstaller/src/main/AndroidManifest.xml | 2 ++ .../java/cc/winboll/studio/autoinstaller/MainActivity.java | 1 + .../cc/winboll/studio/autoinstaller/utils/PackageUtil.java | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index a79dfe3..0d0ddd9 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 05:20:15 GMT 2025 +#Sat May 03 05:44:59 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=65 +buildCount=72 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/AndroidManifest.xml b/autoinstaller/src/main/AndroidManifest.xml index 89a2c07..c496adb 100644 --- a/autoinstaller/src/main/AndroidManifest.xml +++ b/autoinstaller/src/main/AndroidManifest.xml @@ -23,6 +23,8 @@ + + Date: Sat, 3 May 2025 13:53:32 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=B1=BB=E5=BA=93?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libaes/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libaes/build.gradle b/libaes/build.gradle index 84124b2..6e72c8e 100644 --- a/libaes/build.gradle +++ b/libaes/build.gradle @@ -21,6 +21,9 @@ android { dependencies { api fileTree(dir: 'libs', include: ['*.jar']) + //api 'cc.winboll.studio:libaes:15.6.0' + api 'cc.winboll.studio:libapputils:15.3.4' + api 'cc.winboll.studio:libappbase:15.7.6' // 吐司类库 api 'com.github.getActivity:ToastUtils:10.5' @@ -50,7 +53,4 @@ dependencies { //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:libapputils:15.3.4' - api 'cc.winboll.studio:libappbase:15.7.6' } From 609182f909b14b1c085c0a0e9e21adae580410de Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 13:53:48 +0800 Subject: [PATCH 23/30] =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aes/build.properties | 4 ++-- libaes/build.properties | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aes/build.properties b/aes/build.properties index ec4f107..2c84118 100644 --- a/aes/build.properties +++ b/aes/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 29 15:14:41 HKT 2025 +#Sat May 03 05:48:06 GMT 2025 stageCount=1 libraryProject=libaes baseVersion=15.6 publishVersion=15.6.0 -buildCount=0 +buildCount=8 baseBetaVersion=15.6.1 diff --git a/libaes/build.properties b/libaes/build.properties index 83303dd..2c84118 100644 --- a/libaes/build.properties +++ b/libaes/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 29 15:14:21 HKT 2025 +#Sat May 03 05:48:06 GMT 2025 stageCount=1 libraryProject=libaes baseVersion=15.6 publishVersion=15.6.0 -buildCount=0 +buildCount=8 baseBetaVersion=15.6.1 From 482c0074813ffb48f4f8aff83be4bc1f75e49632 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 14:01:56 +0800 Subject: [PATCH 24/30] =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=90=8E=E5=BB=B6=E8=BF=9F2=E7=A7=92?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=8F=90=E9=86=92=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- powerbell/build.properties | 4 ++-- .../powerbell/services/ControlCenterService.java | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/powerbell/build.properties b/powerbell/build.properties index c2cc27e..81fcd6e 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 29 21:00:39 HKT 2025 +#Sat May 03 05:59:40 GMT 2025 stageCount=1 libraryProject= baseVersion=15.3 publishVersion=15.3.0 -buildCount=0 +buildCount=3 baseBetaVersion=15.3.1 diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/services/ControlCenterService.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/services/ControlCenterService.java index 926fb71..d073071 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/services/ControlCenterService.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/services/ControlCenterService.java @@ -32,6 +32,8 @@ import cc.winboll.studio.powerbell.utils.AppConfigUtils; import cc.winboll.studio.powerbell.utils.NotificationHelper; import cc.winboll.studio.powerbell.utils.ServiceUtils; import cc.winboll.studio.powerbell.utils.StringUtils; +import android.os.Handler; +import android.os.Looper; public class ControlCenterService extends Service { @@ -114,9 +116,17 @@ public class ControlCenterService extends Service { mControlCenterServiceReceiver = new ControlCenterServiceReceiver(this); mControlCenterServiceReceiver.registerAction(this); } - startRemindThread(mAppConfigUtils.mAppConfigBean); - ToastUtils.show("Service Is Start."); - LogUtils.i(TAG, "Service Is Start."); + + new Handler(Looper.getMainLooper()).postDelayed(new Runnable(){ + + @Override + public void run() { + startRemindThread(mAppConfigUtils.mAppConfigBean); + ToastUtils.show("Service Is Start."); + LogUtils.i(TAG, "Service Is Start."); + } + }, 2000); + } } From 512c321b763e969aef2db72b7897d12376063744 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 14:19:32 +0800 Subject: [PATCH 25/30] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=B8=E9=A9=BB?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=A0=8F=E6=98=BE=E7=A4=BAUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- powerbell/build.properties | 4 ++-- .../cc/winboll/studio/powerbell/utils/NotificationHelper.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/powerbell/build.properties b/powerbell/build.properties index 81fcd6e..14f5cdd 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 05:59:40 GMT 2025 +#Sat May 03 06:18:02 GMT 2025 stageCount=1 libraryProject= baseVersion=15.3 publishVersion=15.3.0 -buildCount=3 +buildCount=4 baseBetaVersion=15.3.1 diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java index cc62c37..98f25e5 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java @@ -83,8 +83,8 @@ public class NotificationHelper { 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) + .setContentTitle(title + "\n" + content) + //.setContentText(content) .setContentIntent(pendingIntent) .setPriority(NotificationCompat.PRIORITY_LOW) .setOngoing(true) From 9816167e877d1a63ca24dcacb6a83be3beeac8fb Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 14:22:27 +0800 Subject: [PATCH 26/30] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=A0=8F=E6=98=BE=E7=A4=BA=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- powerbell/build.properties | 4 ++-- .../cc/winboll/studio/powerbell/utils/NotificationHelper.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/powerbell/build.properties b/powerbell/build.properties index 14f5cdd..c6ca083 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 06:18:02 GMT 2025 +#Sat May 03 06:21:11 GMT 2025 stageCount=1 libraryProject= baseVersion=15.3 publishVersion=15.3.0 -buildCount=4 +buildCount=5 baseBetaVersion=15.3.1 diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java index 98f25e5..48b3816 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/NotificationHelper.java @@ -83,7 +83,8 @@ public class NotificationHelper { 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 + "\n" + content) + //.setContentTitle(title + "\n" + content) + .setContentTitle(content) //.setContentText(content) .setContentIntent(pendingIntent) .setPriority(NotificationCompat.PRIORITY_LOW) From 640f0c39e9001c021a9e9707f3fb610e18b31bbb Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 16:44:32 +0800 Subject: [PATCH 27/30] =?UTF-8?q?=E5=B8=B8=E9=A9=BB=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=A0=8FUI=E4=BC=98=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 ++-- .../winboll/studio/autoinstaller/utils/NotificationUtil.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index 0d0ddd9..ae43a96 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 05:44:59 GMT 2025 +#Sat May 03 08:40:10 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=72 +buildCount=73 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/NotificationUtil.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/NotificationUtil.java index 310d648..151648f 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/NotificationUtil.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/utils/NotificationUtil.java @@ -55,8 +55,9 @@ public class NotificationUtil { Notification mForegroundNotification = new Notification.Builder(service, szServiceChannelID) .setAutoCancel(true) - .setContentTitle(service.getString(R.string.app_name)) - .setContentText(service.TAG + " is started.") + //.setContentTitle(service.getString(R.string.app_name)) + .setContentTitle(service.TAG + " is started.") + //.setContentText(service.TAG + " is started.") .setWhen(System.currentTimeMillis()) .setSmallIcon(R.drawable.ic_launcher) //设置红色 From 027dc23060ffe52e3a44c16c3f93ca93f0436026 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 18:33:41 +0800 Subject: [PATCH 28/30] =?UTF-8?q?=E6=9B=B4=E6=96=B0Maven=E5=BA=93=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appbase/build.properties | 4 ++-- build.gradle | 5 +++++ libappbase/build.properties | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/appbase/build.properties b/appbase/build.properties index 3cb59e8..18395f7 100644 --- a/appbase/build.properties +++ b/appbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 29 14:47:34 HKT 2025 +#Sat May 03 10:32:21 GMT 2025 stageCount=7 libraryProject=libappbase baseVersion=15.7 publishVersion=15.7.6 -buildCount=0 +buildCount=4 baseBetaVersion=15.7.7 diff --git a/build.gradle b/build.gradle index ab63fe7..6e7cc62 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,11 @@ buildscript { allprojects { repositories { + // 本地 Maven 仓库(默认路径为 ~/.m2/repository) + mavenLocal() + // 或自定义本地仓库路径 + maven { url "file:///sdcard/.m2/repository" } + // Nexus Maven 库地址 // "WinBoLL Release" maven { url "https://nexus.winboll.cc/repository/maven-public/" } diff --git a/libappbase/build.properties b/libappbase/build.properties index faa715a..18395f7 100644 --- a/libappbase/build.properties +++ b/libappbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 29 14:47:16 HKT 2025 +#Sat May 03 10:32:21 GMT 2025 stageCount=7 libraryProject=libappbase baseVersion=15.7 publishVersion=15.7.6 -buildCount=0 +buildCount=4 baseBetaVersion=15.7.7 From 7ff2cab6151380c74341e372e7e0864ef060cad0 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sat, 3 May 2025 19:36:03 +0800 Subject: [PATCH 29/30] =?UTF-8?q?=E6=BA=90=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aes/build.properties | 4 +- .../cc/winboll/studio/aes/AboutActivity.java | 3 +- build.gradle | 4 +- libaes/build.properties | 4 +- libaes/src/main/AndroidManifest.xml | 23 ++++-- .../beans/WinBoLLClientServiceBean.java | 78 +++++++++++++++++++ .../libaes/winboll/AssistantService.java | 3 +- .../libaes/winboll/WinBoLLClientService.java | 21 +++++ .../winboll/WinBoLLServiceStatusView.java | 38 +++++++++ 9 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/beans/WinBoLLClientServiceBean.java create mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java create mode 100644 libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java diff --git a/aes/build.properties b/aes/build.properties index 2c84118..597a06b 100644 --- a/aes/build.properties +++ b/aes/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 05:48:06 GMT 2025 +#Sat May 03 11:34:58 GMT 2025 stageCount=1 libraryProject=libaes baseVersion=15.6 publishVersion=15.6.0 -buildCount=8 +buildCount=9 baseBetaVersion=15.6.1 diff --git a/aes/src/main/java/cc/winboll/studio/aes/AboutActivity.java b/aes/src/main/java/cc/winboll/studio/aes/AboutActivity.java index 228cd19..d720549 100644 --- a/aes/src/main/java/cc/winboll/studio/aes/AboutActivity.java +++ b/aes/src/main/java/cc/winboll/studio/aes/AboutActivity.java @@ -10,13 +10,14 @@ import android.content.Context; import android.os.Bundle; import android.view.ViewGroup; import android.widget.LinearLayout; +import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import cc.winboll.studio.libaes.winboll.APPInfo; import cc.winboll.studio.libaes.winboll.AboutView; import cc.winboll.studio.libappbase.GlobalApplication; import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; -public class AboutActivity extends WinBoLLActivity implements IWinBoLLActivity { +public class AboutActivity extends AppCompatActivity implements IWinBoLLActivity { public static final String TAG = "AboutActivity"; diff --git a/build.gradle b/build.gradle index 6e7cc62..c73b4af 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { repositories { // 本地 Maven 仓库(默认路径为 ~/.m2/repository) - mavenLocal() + //mavenLocal() // 或自定义本地仓库路径 maven { url "file:///sdcard/.m2/repository" } @@ -32,7 +32,7 @@ buildscript { allprojects { repositories { // 本地 Maven 仓库(默认路径为 ~/.m2/repository) - mavenLocal() + //mavenLocal() // 或自定义本地仓库路径 maven { url "file:///sdcard/.m2/repository" } diff --git a/libaes/build.properties b/libaes/build.properties index 2c84118..597a06b 100644 --- a/libaes/build.properties +++ b/libaes/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 05:48:06 GMT 2025 +#Sat May 03 11:34:58 GMT 2025 stageCount=1 libraryProject=libaes baseVersion=15.6 publishVersion=15.6.0 -buildCount=8 +buildCount=9 baseBetaVersion=15.6.1 diff --git a/libaes/src/main/AndroidManifest.xml b/libaes/src/main/AndroidManifest.xml index d8cbd79..7c90bad 100644 --- a/libaes/src/main/AndroidManifest.xml +++ b/libaes/src/main/AndroidManifest.xml @@ -5,27 +5,34 @@ - - - - - - - - + \ No newline at end of file diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/beans/WinBoLLClientServiceBean.java b/libaes/src/main/java/cc/winboll/studio/libaes/beans/WinBoLLClientServiceBean.java new file mode 100644 index 0000000..32bb757 --- /dev/null +++ b/libaes/src/main/java/cc/winboll/studio/libaes/beans/WinBoLLClientServiceBean.java @@ -0,0 +1,78 @@ +package cc.winboll.studio.libaes.beans; + +/** + * @Author ZhanGSKen + * @Date 2025/05/03 19:16 + */ +import android.content.Context; +import android.util.JsonReader; +import android.util.JsonWriter; +import cc.winboll.studio.libappbase.BaseBean; +import java.io.IOException; + +public class WinBoLLClientServiceBean extends BaseBean { + + public static final String TAG = "WinBoLLClientServiceBean"; + + // 服务是否正在使用中 + boolean isEnable; + + public WinBoLLClientServiceBean() { + this.isEnable = false; + } + + public WinBoLLClientServiceBean(boolean isEnable) { + this.isEnable = isEnable; + } + + public void setIsEnable(boolean isEnable) { + this.isEnable = isEnable; + } + + public boolean isEnable() { + return isEnable; + } + + + @Override + public String getName() { + return WinBoLLClientServiceBean.class.getName(); + } + + @Override + public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException { + super.writeThisToJsonWriter(jsonWriter); + WinBoLLClientServiceBean bean = this; + //jsonWriter.name("logLevel").value(bean.getLogLevel().ordinal()); + } + + @Override + public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException { + if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else { +// if (name.equals("logLevel")) { +// setLogLevel(LogUtils.LOG_LEVEL.values()[jsonReader.nextInt()]); +// } else { +// return false; +// } + } + return true; + } + + @Override + public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException { + jsonReader.beginObject(); + while (jsonReader.hasNext()) { + String name = jsonReader.nextName(); + if (!initObjectsFromJsonReader(jsonReader, name)) { + jsonReader.skipValue(); + } + } + // 结束 JSON 对象 + jsonReader.endObject(); + return this; + } + + public static WinBoLLClientServiceBean loadWinBoLLClientServiceBean(Context context) { + return new WinBoLLClientServiceBean(); + } +} diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/AssistantService.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/AssistantService.java index f2f8028..572a4aa 100644 --- a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/AssistantService.java +++ b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/AssistantService.java @@ -11,7 +11,8 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; -import cc.winboll.studio.libaes.winboll.WinBoLLClientService; +import cc.winboll.studio.libaes.beans.WinBoLLClientServiceBean; +import cc.winboll.studio.libaes.winboll.AssistantService; import cc.winboll.studio.libappbase.utils.ServiceUtils; public class AssistantService extends Service { diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java new file mode 100644 index 0000000..d4e93a6 --- /dev/null +++ b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLClientService.java @@ -0,0 +1,21 @@ +package cc.winboll.studio.libaes.winboll; + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; + +/** + * @Author ZhanGSKen + * @Date 2025/05/03 19:28 + */ +public class WinBoLLClientService extends Service { + + public static final String TAG = "WinBoLLClientService"; + + @Override + public IBinder onBind(Intent intent) { + + return null; + } + +} \ No newline at end of file diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java new file mode 100644 index 0000000..14a56e2 --- /dev/null +++ b/libaes/src/main/java/cc/winboll/studio/libaes/winboll/WinBoLLServiceStatusView.java @@ -0,0 +1,38 @@ +package cc.winboll.studio.libaes.winboll; +import android.content.Context; +import android.util.AttributeSet; +import android.widget.LinearLayout; + +/** + * @Author ZhanGSKen + * @Date 2025/05/03 19:14 + */ +public class WinBoLLServiceStatusView extends LinearLayout { + + public static final String TAG = "WinBoLLServiceStatusView"; + + public WinBoLLServiceStatusView(Context context) { + super(context); + } + + public WinBoLLServiceStatusView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public WinBoLLServiceStatusView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public WinBoLLServiceStatusView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + + void setServerHost(String szWinBoLLServerHost) { + + } + + void setAuthInfo(String szDevUserName, String szDevUserPassword) { + + } +} From 4a4e20a6bd5fae0b1629ad9cc47ffbc0c74fe40b Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sun, 4 May 2025 13:33:15 +0800 Subject: [PATCH 30/30] =?UTF-8?q?=E5=B8=B8=E9=A9=BB=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=A0=8F=E7=82=B9=E5=87=BBBugFix.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoinstaller/build.properties | 4 ++-- .../cc/winboll/studio/autoinstaller/MainActivity.java | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/autoinstaller/build.properties b/autoinstaller/build.properties index ae43a96..d987d28 100644 --- a/autoinstaller/build.properties +++ b/autoinstaller/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat May 03 08:40:10 GMT 2025 +#Sun May 04 05:32:00 GMT 2025 stageCount=1 libraryProject= baseVersion=15.2 publishVersion=15.2.0 -buildCount=73 +buildCount=74 baseBetaVersion=15.2.1 diff --git a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java index bda3d41..ce0c0f4 100644 --- a/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java +++ b/autoinstaller/src/main/java/cc/winboll/studio/autoinstaller/MainActivity.java @@ -71,7 +71,8 @@ public class MainActivity extends Activity { _MainActivity = this; initView(); - if (getIntent().getAction().equals(ACTION_NEW_INSTALLTASK)) { + String action = getIntent().getAction(); + if ((action != null) && action.equals(ACTION_NEW_INSTALLTASK)) { mszInstalledPackageName = getIntent().getStringExtra(EXTRA_INSTALLED_PACKAGENAME); mszInstalledAPKFilePath = getIntent().getStringExtra(EXTRA_INSTALLED_APKFILEPATH); installAPK(); @@ -143,7 +144,7 @@ public class MainActivity extends Activity { } return ""; } - + public void onOpenAPP(View view) { String szInstalledPackageName = getLastApkPackageName(); LogUtils.d(TAG, "szInstalledPackageName : " + szInstalledPackageName); @@ -353,7 +354,7 @@ public class MainActivity extends Activity { } } }; - + static void updateMainServiceStatus(boolean isEnable) { if (_Handler != null) { Message msg = new Message(); @@ -362,13 +363,13 @@ public class MainActivity extends Activity { _Handler.sendMessage(msg); } } - + public static void stopMainService() { if (_MainActivity != null && _Handler != null) { updateMainServiceStatus(false); } } - + public static void startMainService() { if (_MainActivity != null && _Handler != null) { updateMainServiceStatus(true);