Compare commits

..

No commits in common. "7c7554133bb537e89717e5c5d046047ff421244a" and "e045bbb71cf81f01cb4f798027638504a3f1c1e9" have entirely different histories.

53 changed files with 810 additions and 699 deletions

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sat May 03 11:34:58 GMT 2025 #Tue Apr 29 15:14:41 HKT 2025
stageCount=1 stageCount=1
libraryProject=libaes libraryProject=libaes
baseVersion=15.6 baseVersion=15.6
publishVersion=15.6.0 publishVersion=15.6.0
buildCount=9 buildCount=0
baseBetaVersion=15.6.1 baseBetaVersion=15.6.1

View File

@ -10,14 +10,13 @@ import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libaes.winboll.APPInfo; import cc.winboll.studio.libaes.winboll.APPInfo;
import cc.winboll.studio.libaes.winboll.AboutView; import cc.winboll.studio.libaes.winboll.AboutView;
import cc.winboll.studio.libappbase.GlobalApplication; import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
public class AboutActivity extends AppCompatActivity implements IWinBoLLActivity { public class AboutActivity extends WinBoLLActivity implements IWinBoLLActivity {
public static final String TAG = "AboutActivity"; public static final String TAG = "AboutActivity";

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sat May 03 10:32:21 GMT 2025 #Tue Apr 29 14:47:34 HKT 2025
stageCount=7 stageCount=7
libraryProject=libappbase libraryProject=libappbase
baseVersion=15.7 baseVersion=15.7
publishVersion=15.7.6 publishVersion=15.7.6
buildCount=4 buildCount=0
baseBetaVersion=15.7.7 baseBetaVersion=15.7.7

View File

@ -0,0 +1,81 @@
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);
}
}

View File

@ -1,49 +1,54 @@
package cc.winboll.studio.autoinstaller.models; 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.JsonReader;
import android.util.JsonWriter; import android.util.JsonWriter;
import cc.winboll.studio.libappbase.BaseBean; import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException; import java.io.IOException;
/** public class WinBoLLNewsBean extends BaseBean {
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/04/15 09:27:39 public static final String TAG = "WinBoLLNewsBean";
* @Describe MainServiceBean
*/ protected String message;
public class MainServiceBean extends BaseBean {
public WinBoLLNewsBean() {
public static final String TAG = "MainServiceBean"; this.message = "";
boolean isEnable;
public MainServiceBean() {
this.isEnable = false;
} }
public void setIsEnable(boolean isEnable) { public WinBoLLNewsBean(String message) {
this.isEnable = isEnable; this.message = message;
} }
public boolean isEnable() { public void setMessage(String message) {
return isEnable; this.message = message;
}
public String getMessage() {
return message;
} }
@Override @Override
public String getName() { public String getName() {
return MainServiceBean.class.getName(); return WinBoLLNewsBean.class.getName();
} }
@Override @Override
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException { public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
super.writeThisToJsonWriter(jsonWriter); super.writeThisToJsonWriter(jsonWriter);
jsonWriter.name("isEnable").value(isEnable()); jsonWriter.name("message").value(getMessage());
} }
@Override @Override
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException { public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else { if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
if (name.equals("isEnable")) { if (name.equals("message")) {
setIsEnable(jsonReader.nextBoolean()); setMessage(jsonReader.nextString());
} else { } else {
return false; return false;
} }

View File

@ -0,0 +1,36 @@
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);
}
}

View File

@ -19,7 +19,7 @@ def genVersionName(def versionName){
android { android {
compileSdkVersion 32 compileSdkVersion 32
buildToolsVersion "32.0.0" buildToolsVersion "33.0.3"
defaultConfig { defaultConfig {
applicationId "cc.winboll.studio.autoinstaller" applicationId "cc.winboll.studio.autoinstaller"
@ -29,7 +29,7 @@ android {
// versionName // versionName
// .winboll/winbollBuildProps.properties stageCount=0 // .winboll/winbollBuildProps.properties stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0" // Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "15.2" versionName "5.0"
if(true) { if(true) {
versionName = genVersionName("${versionName}") versionName = genVersionName("${versionName}")
} }
@ -41,33 +41,30 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
} }
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) api 'cc.winboll.studio:winboll-shared:1.1.0'
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'
// 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 'io.github.medyo:android-about-page:2.0.0'
//
api 'com.github.getActivity:ToastUtils:10.5' api 'com.github.getActivity:ToastUtils:10.5'
// api 'com.jcraft:jsch:0.1.55'
api 'org.jsoup:jsoup:1.13.1'
api 'com.squareup.okhttp3:okhttp:4.4.1' 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 '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'])
} }

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sun May 04 05:32:00 GMT 2025 #Thu Jan 02 02:39:56 HKT 2025
stageCount=1 stageCount=4
libraryProject= libraryProject=
baseVersion=15.2 baseVersion=5.0
publishVersion=15.2.0 publishVersion=5.0.3
buildCount=74 buildCount=0
baseBetaVersion=15.2.1 baseBetaVersion=5.0.4

View File

@ -23,8 +23,6 @@
<!-- MANAGE_EXTERNAL_STORAGE --> <!-- MANAGE_EXTERNAL_STORAGE -->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<application <application
android:name=".App" android:name=".App"
@ -35,7 +33,7 @@
android:persistent="true" android:persistent="true"
android:supportsRtl="true" android:supportsRtl="true"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:theme="@style/MyAppTheme"> android:theme="@style/Theme.Application">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
@ -56,21 +54,6 @@
<service android:name=".services.AssistantService"/> <service android:name=".services.AssistantService"/>
<service
android:name=".AppBaseTileService"
android:exported="true"
android:label="@string/tileservice_name"
android:icon="@drawable/ic_launcher"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<receiver <receiver
android:name=".receivers.MainReceiver" android:name=".receivers.MainReceiver"
android:enabled="true" android:enabled="true"

View File

@ -6,23 +6,22 @@ package cc.winboll.studio.autoinstaller;
* @Describe 全局应用类 * @Describe 全局应用类
*/ */
import android.view.Gravity; import android.view.Gravity;
import cc.winboll.studio.libappbase.GlobalApplication;
import com.hjq.toast.ToastUtils; import com.hjq.toast.ToastUtils;
import com.hjq.toast.style.WhiteToastStyle; import cc.winboll.studio.shared.app.WinBollApplication;
public class App extends GlobalApplication { public class App extends WinBollApplication {
public static final String TAG = "App"; public static final String TAG = "App";
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
setIsDebug(BuildConfig.DEBUG);
// 初始化 Toast 框架 // 初始化 Toast 框架
ToastUtils.init(this); ToastUtils.init(this);
// 设置 Toast 布局样式 // 设置 Toast 布局样式
//ToastUtils.setView(R.layout.view_toast); ToastUtils.setView(R.layout.toast_custom_view);
ToastUtils.setStyle(new WhiteToastStyle()); //ToastUtils.setStyle(new WhiteToastStyle());
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
} }
} }

View File

@ -1,12 +0,0 @@
package cc.winboll.studio.autoinstaller;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/04/15 09:24:46
* @Describe 磁贴工具服务类
*/
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import cc.winboll.studio.autoinstaller.models.AppConfigs;

View File

@ -1,7 +1,7 @@
package cc.winboll.studio.autoinstaller; package cc.winboll.studio.autoinstaller;
import android.os.FileObserver; import android.os.FileObserver;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.shared.log.LogUtils;
public class FileListener extends FileObserver { public class FileListener extends FileObserver {
public final static String TAG = "FileListener"; public final static String TAG = "FileListener";

View File

@ -6,24 +6,21 @@ import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.SimpleAdapter; import android.widget.SimpleAdapter;
import android.widget.Switch; import android.widget.Switch;
import android.widget.TextClock; import android.widget.TextClock;
import android.widget.Toast;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import cc.winboll.studio.shared.log.LogUtils;
import cc.winboll.studio.shared.log.LogView;
import cc.winboll.studio.autoinstaller.MainActivity; import cc.winboll.studio.autoinstaller.MainActivity;
import cc.winboll.studio.autoinstaller.models.APKModel; 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.services.MainService;
import cc.winboll.studio.autoinstaller.utils.NotificationUtil; 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.autoinstaller.views.ListViewForScrollView;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import com.hjq.toast.ToastUtils; import com.hjq.toast.ToastUtils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -33,13 +30,8 @@ import java.util.Map;
public class MainActivity extends Activity { public class MainActivity extends Activity {
public static final String TAG = "MainActivity"; public static final String TAG = "MainActivity";
public static final int MSG_UPDATE_STATUS = 0;
private static final int INSTALL_PERMISSION_CODE = 1; private static final int INSTALL_PERMISSION_CODE = 1;
static MainActivity _MainActivity;
ArrayList<APKModel> _APKModelList = new ArrayList<APKModel>();
LogView mLogView; LogView mLogView;
TextClock mTextClock; TextClock mTextClock;
EditText mEditText; EditText mEditText;
@ -68,11 +60,9 @@ public class MainActivity extends Activity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
_MainActivity = this;
initView(); initView();
String action = getIntent().getAction(); if (getIntent().getAction().equals(ACTION_NEW_INSTALLTASK)) {
if ((action != null) && action.equals(ACTION_NEW_INSTALLTASK)) {
mszInstalledPackageName = getIntent().getStringExtra(EXTRA_INSTALLED_PACKAGENAME); mszInstalledPackageName = getIntent().getStringExtra(EXTRA_INSTALLED_PACKAGENAME);
mszInstalledAPKFilePath = getIntent().getStringExtra(EXTRA_INSTALLED_APKFILEPATH); mszInstalledAPKFilePath = getIntent().getStringExtra(EXTRA_INSTALLED_APKFILEPATH);
installAPK(); installAPK();
@ -86,7 +76,11 @@ public class MainActivity extends Activity {
mLogView = findViewById(R.id.logview); mLogView = findViewById(R.id.logview);
mLogView.start(); mLogView.start();
AppConfigs appConfigs = AppConfigs.getInstance(this).loadAppConfigs(this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(this);
if (appConfigs == null) {
appConfigs = new AppConfigs();
AppConfigs.saveAppConfigs(this, appConfigs);
}
if (appConfigs.getSetupMode() == AppConfigs.SetupMode.WATCHOUTPUTINSTALLER) { if (appConfigs.getSetupMode() == AppConfigs.SetupMode.WATCHOUTPUTINSTALLER) {
((RadioButton)findViewById(R.id.activitymainRadioButton1)).setChecked(true); ((RadioButton)findViewById(R.id.activitymainRadioButton1)).setChecked(true);
@ -137,44 +131,23 @@ 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) { public void onOpenAPP(View view) {
String szInstalledPackageName = getLastApkPackageName(); if (mszInstalledPackageName.trim().equals("")) {
LogUtils.d(TAG, "szInstalledPackageName : " + szInstalledPackageName);
if (szInstalledPackageName.trim().equals("")) {
ToastUtils.show("Installed APP package name is null."); ToastUtils.show("Installed APP package name is null.");
return; return;
} }
PackageUtil.openAPP(this, szInstalledPackageName); Intent intent = getPackageManager().getLaunchIntentForPackage(mszInstalledPackageName);
if (intent != null) {
startActivity(intent);
} else {
// 若没能获取到启动意图可进行相应提示等操作比如跳转到应用商店让用户下载该应用示例
Intent marketIntent = new Intent(Intent.ACTION_VIEW);
marketIntent.setData(Uri.parse("market://details?id=" + mszInstalledPackageName));
startActivity(marketIntent);
}
} }
// 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) { public void onInstallAPK(View view) {
installAPK(); installAPK();
} }
@ -212,22 +185,17 @@ public class MainActivity extends Activity {
} }
public void onLockPath(View view) { public void onLockPath(View view) {
AppConfigs appConfigs = AppConfigs.loadAppConfigs(this);
Switch sw = (Switch)view; Switch sw = (Switch)view;
setMainServiceStatus(sw.isChecked()); if (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(); String szFilePath = mEditText.getText().toString();
// 设置空路径时退出 // 设置空路径时退出
// //
if (szFilePath.trim().equals("")) { if (szFilePath.trim().equals("")) {
sw.setChecked(false); sw.setChecked(false);
ToastUtils.show("监控路径为空。"); Toast.makeText(getApplication(), "监控路径为空。", Toast.LENGTH_SHORT).show();
return; return;
} }
@ -268,7 +236,7 @@ public class MainActivity extends Activity {
stopWatchingFile(); stopWatchingFile();
} }
AppConfigs.getInstance(this).saveAppConfigs(this, appConfigs); AppConfigs.saveAppConfigs(this, appConfigs);
} }
void stopWatchingFile() { void stopWatchingFile() {
@ -283,6 +251,8 @@ public class MainActivity extends Activity {
Intent intentService = new Intent(MainActivity.this, MainService.class); Intent intentService = new Intent(MainActivity.this, MainService.class);
//intentService.putExtra(MainService.EXTRA_APKFILEPATH, szAPKFilePath); //intentService.putExtra(MainService.EXTRA_APKFILEPATH, szAPKFilePath);
startService(intentService); startService(intentService);
} }
/* /*
@ -328,7 +298,7 @@ public class MainActivity extends Activity {
}*/ }*/
public void onChangeSetupMode(View view) { public void onChangeSetupMode(View view) {
AppConfigs appConfigs = AppConfigs.getInstance(this).loadAppConfigs(this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(this);
if (view.getId() == R.id.activitymainRadioButton1) { if (view.getId() == R.id.activitymainRadioButton1) {
appConfigs.setSetupMode(AppConfigs.SetupMode.WATCHOUTPUTINSTALLER); appConfigs.setSetupMode(AppConfigs.SetupMode.WATCHOUTPUTINSTALLER);
@ -337,42 +307,6 @@ public class MainActivity extends Activity {
appConfigs.setSetupMode(AppConfigs.SetupMode.NEWAPKINFONEWAPKINFO); appConfigs.setSetupMode(AppConfigs.SetupMode.NEWAPKINFONEWAPKINFO);
((RadioButton)findViewById(R.id.activitymainRadioButton1)).setChecked(false); ((RadioButton)findViewById(R.id.activitymainRadioButton1)).setChecked(false);
} }
AppConfigs.getInstance(this).saveAppConfigs(this, appConfigs); AppConfigs.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);
}
} }
} }

View File

@ -1,4 +1,4 @@
package cc.winboll.studio.autoinstaller.models; package cc.winboll.studio.autoinstaller.beans;
/** /**
* @Author ZhanGSKen@QQ.COM * @Author ZhanGSKen@QQ.COM
@ -8,14 +8,13 @@ package cc.winboll.studio.autoinstaller.models;
import android.content.Context; import android.content.Context;
import android.util.JsonReader; import android.util.JsonReader;
import android.util.JsonWriter; import android.util.JsonWriter;
import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.beans.AppConfigs;
import cc.winboll.studio.autoinstaller.utils.FileUtil; 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.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import cc.winboll.studio.shared.log.LogUtils;
public class AppConfigs implements Serializable { public class AppConfigs implements Serializable {
@ -27,21 +26,6 @@ public class AppConfigs implements Serializable {
NEWAPKINFONEWAPKINFO // 调用[应用信息查看器]打开应用包 NEWAPKINFONEWAPKINFO // 调用[应用信息查看器]打开应用包
}; };
static volatile AppConfigs _AppConfigs;
Context mContext;
AppConfigs(Context context) {
mContext = context.getApplicationContext();
}
public static synchronized AppConfigs getInstance(Context context) {
if (_AppConfigs == null) {
_AppConfigs = new AppConfigs(context);
_AppConfigs.loadAppConfigs(_AppConfigs.mContext);
}
return _AppConfigs;
}
// 监控文件路径 // 监控文件路径
private String watchingFilePath = ""; private String watchingFilePath = "";
@ -101,8 +85,8 @@ public class AppConfigs implements Serializable {
return ""; return "";
} }
public AppConfigs parseAppConfigs(String szAppConfigs) { public static AppConfigs parseAppConfigs(String szAppConfigs) {
AppConfigs appConfigs = new AppConfigs(mContext); AppConfigs appConfigs = new AppConfigs();
// 创建 JsonWriter 对象 // 创建 JsonWriter 对象
StringReader stringReader = new StringReader(szAppConfigs); StringReader stringReader = new StringReader(szAppConfigs);
JsonReader jsonReader = new JsonReader jsonReader = new
@ -137,35 +121,20 @@ public class AppConfigs implements Serializable {
static String getDataPath(Context context) { static String getDataPath(Context context) {
return context.getExternalFilesDir(TAG) + "/" + TAG + ".json"; return context.getExternalFilesDir(TAG) + "/" + TAG + ".json";
} }
public AppConfigs loadAppConfigs() { public static AppConfigs loadAppConfigs(Context context) {
AppConfigs appConfigs = null; AppConfigs appConfigs = null;
try { try {
String szJson = FileUtil.readFile(getDataPath(mContext)); String szJson = FileUtil.readFile(getDataPath(context));
appConfigs = AppConfigs.getInstance(mContext).parseAppConfigs(szJson); appConfigs = AppConfigs.parseAppConfigs(szJson);
} catch (IOException e) { } catch (IOException e) {
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
} }
return appConfigs; return appConfigs;
} }
public AppConfigs loadAppConfigs(Context context) { public static void saveAppConfigs(Context context, AppConfigs appConfigs) {
AppConfigs appConfigs = null;
try { 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;
}
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()); //LogUtils.d(TAG, "appConfigs is : " + appConfigs.toString());
String szJson = appConfigs.toString(); String szJson = appConfigs.toString();
FileUtil.writeFile(getDataPath(context), szJson); FileUtil.writeFile(getDataPath(context), szJson);
@ -173,8 +142,4 @@ public class AppConfigs implements Serializable {
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace()); LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
} }
} }
public void saveAppConfigs() {
saveAppConfigs(mContext, this);
}
} }

View File

@ -1,75 +0,0 @@
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;
}
}

View File

@ -4,9 +4,9 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.beans.AppConfigs;
import cc.winboll.studio.autoinstaller.services.MainService; import cc.winboll.studio.autoinstaller.services.MainService;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.shared.log.LogUtils;
/** /**
* @Author ZhanGSKen@QQ.COM * @Author ZhanGSKen@QQ.COM
@ -23,7 +23,7 @@ public class MainReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String szAction = intent.getAction(); String szAction = intent.getAction();
if (szAction.equals(ACTION_BOOT_COMPLETED)) { if (szAction.equals(ACTION_BOOT_COMPLETED)) {
AppConfigs appConfigs = AppConfigs.getInstance(context).loadAppConfigs(context); AppConfigs appConfigs = AppConfigs.loadAppConfigs(context);
if (appConfigs.isEnableService()) { if (appConfigs.isEnableService()) {
Intent intentService = new Intent(context, MainService.class); Intent intentService = new Intent(context, MainService.class);
//intentService.putExtra(MainService.EXTRA_APKFILEPATH, appConfigs.getWatchingFilePath()); //intentService.putExtra(MainService.EXTRA_APKFILEPATH, appConfigs.getWatchingFilePath());

View File

@ -6,7 +6,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.autoinstaller.models.AppConfigs; import cc.winboll.studio.autoinstaller.beans.AppConfigs;
import cc.winboll.studio.autoinstaller.utils.ServiceUtil; import cc.winboll.studio.autoinstaller.utils.ServiceUtil;
/** /**
@ -46,7 +46,7 @@ public class AssistantService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
//LogUtils.d(TAG, "call onStartCommand(...)"); //LogUtils.d(TAG, "call onStartCommand(...)");
run(); run();
AppConfigs appConfigs = AppConfigs.getInstance(AssistantService.this).loadAppConfigs(AssistantService.this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(AssistantService.this);
return appConfigs.isEnableService() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId); return appConfigs.isEnableService() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId);
} }
@ -68,7 +68,7 @@ public class AssistantService extends Service {
// //
void run() { void run() {
//LogUtils.d(TAG, "call run()"); //LogUtils.d(TAG, "call run()");
AppConfigs appConfigs = AppConfigs.getInstance(AssistantService.this).loadAppConfigs(AssistantService.this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(AssistantService.this);
if (appConfigs.isEnableService()) { if (appConfigs.isEnableService()) {
if (mIsThreadAlive == false) { if (mIsThreadAlive == false) {
// 设置运行状态 // 设置运行状态
@ -101,7 +101,7 @@ public class AssistantService extends Service {
@Override @Override
public void onServiceDisconnected(ComponentName name) { public void onServiceDisconnected(ComponentName name) {
//LogUtils.d(TAG, "call onServiceDisconnected(...)"); //LogUtils.d(TAG, "call onServiceDisconnected(...)");
AppConfigs appConfigs = AppConfigs.getInstance(AssistantService.this).loadAppConfigs(AssistantService.this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(AssistantService.this);
if (appConfigs.isEnableService()) { if (appConfigs.isEnableService()) {
wakeupAndBindMain(); wakeupAndBindMain();
} }

View File

@ -10,32 +10,25 @@ import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Message; import android.os.Message;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import android.widget.Toast; import android.widget.Toast;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import cc.winboll.studio.shared.log.LogUtils;
import cc.winboll.studio.autoinstaller.FileListener; import cc.winboll.studio.autoinstaller.FileListener;
import cc.winboll.studio.autoinstaller.MainActivity; import cc.winboll.studio.autoinstaller.MainActivity;
import cc.winboll.studio.autoinstaller.R; import cc.winboll.studio.autoinstaller.beans.AppConfigs;
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.AssistantService;
import cc.winboll.studio.autoinstaller.services.MainService; import cc.winboll.studio.autoinstaller.services.MainService;
import cc.winboll.studio.autoinstaller.utils.NotificationUtil; import cc.winboll.studio.autoinstaller.utils.NotificationUtil;
import cc.winboll.studio.autoinstaller.utils.PackageUtil; import cc.winboll.studio.autoinstaller.utils.PackageUtil;
import cc.winboll.studio.autoinstaller.utils.ServiceUtil; import cc.winboll.studio.autoinstaller.utils.ServiceUtil;
import cc.winboll.studio.libappbase.LogUtils; import com.hjq.toast.ToastUtils;
import java.io.File; import java.io.File;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList;
public class MainService extends Service { public class MainService extends Service {
public static String TAG = "MainService"; public static String TAG = "MainService";
Context mContext;
ArrayList<APKModel> _APKModelList = new ArrayList<APKModel>();
private static boolean _mIsServiceAlive; private static boolean _mIsServiceAlive;
//String mszAPKFilePath; //String mszAPKFilePath;
//String mszAPKFileName; //String mszAPKFileName;
@ -54,7 +47,6 @@ public class MainService extends Service {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
mContext = this;
LogUtils.d(TAG, "onCreate()"); LogUtils.d(TAG, "onCreate()");
_mIsServiceAlive = false; _mIsServiceAlive = false;
mHandler = new MyHandler(MainService.this); mHandler = new MyHandler(MainService.this);
@ -63,14 +55,11 @@ public class MainService extends Service {
} }
run(); run();
// 初始化磁贴工具服务
MainTileService mainTileService = new MainTileService(this);
} }
private void run() { private void run() {
AppConfigs appConfigs = AppConfigs.getInstance(MainService.this).loadAppConfigs(MainService.this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(MainService.this);
if (appConfigs.isEnableService()) { if (appConfigs.isEnableService()) {
if (_mIsServiceAlive == false) { if (_mIsServiceAlive == false) {
// 设置运行状态 // 设置运行状态
@ -85,8 +74,7 @@ public class MainService extends Service {
startWatchingFile(appConfigs.getWatchingFilePath()); startWatchingFile(appConfigs.getWatchingFilePath());
//LogUtils.d(TAG, "running..."); LogUtils.d(TAG, "running...");
//ToastUtils.show("running...");
} else { } else {
LogUtils.d(TAG, "_mIsServiceAlive is " + Boolean.toString(_mIsServiceAlive)); LogUtils.d(TAG, "_mIsServiceAlive is " + Boolean.toString(_mIsServiceAlive));
@ -106,7 +94,6 @@ public class MainService extends Service {
} }
_mIsServiceAlive = false; _mIsServiceAlive = false;
LogUtils.d(TAG, "onDestroy()"); LogUtils.d(TAG, "onDestroy()");
mContext = null;
} }
@Override @Override
@ -114,7 +101,7 @@ public class MainService extends Service {
LogUtils.d(TAG, "onStartCommand"); LogUtils.d(TAG, "onStartCommand");
run(); run();
AppConfigs appConfigs = AppConfigs.getInstance(MainService.this).loadAppConfigs(MainService.this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(MainService.this);
return appConfigs.isEnableService() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId); return appConfigs.isEnableService() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId);
} }
@ -131,7 +118,7 @@ public class MainService extends Service {
@Override @Override
public void onServiceDisconnected(ComponentName name) { public void onServiceDisconnected(ComponentName name) {
//LogUtils.d(TAG, "call onServiceConnected(...)"); //LogUtils.d(TAG, "call onServiceConnected(...)");
AppConfigs appConfigs = AppConfigs.getInstance(MainService.this).loadAppConfigs(MainService.this); AppConfigs appConfigs = AppConfigs.loadAppConfigs(MainService.this);
if (appConfigs.isEnableService()) { if (appConfigs.isEnableService()) {
// 唤醒守护进程 // 唤醒守护进程
wakeupAndBindAssistant(); wakeupAndBindAssistant();
@ -173,7 +160,7 @@ public class MainService extends Service {
}); });
mFileListener.startWatching(); mFileListener.startWatching();
//ToastUtils.show("Start watching."); ToastUtils.show("Start watching.");
} else { } else {
// 父级文件夹不存在就提示用户 // 父级文件夹不存在就提示用户
Toast.makeText(getApplication(), fParentDir.toString() + " no exist.", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplication(), fParentDir.toString() + " no exist.", Toast.LENGTH_SHORT).show();
@ -189,9 +176,6 @@ public class MainService extends Service {
// 调用[应用信息查看器]打开应用包 // 调用[应用信息查看器]打开应用包
// //
private void installAPK(String szAPKFilePath) { private void installAPK(String szAPKFilePath) {
String szAPKPackageName = PackageUtil.getPackageNameFromApk(this, szAPKFilePath);
saveAPKInfo(szAPKPackageName);
long nTimeNow = System.currentTimeMillis(); long nTimeNow = System.currentTimeMillis();
/*SimpleDateFormat dateFormat = new SimpleDateFormat( /*SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()); "yyyy-MM-dd HH:mm:ss", Locale.getDefault());
@ -226,24 +210,15 @@ public class MainService extends Service {
// //
void installAPK2(String szAPKFilePath) { void installAPK2(String szAPKFilePath) {
LogUtils.d(TAG, "installAPK2()"); LogUtils.d(TAG, "installAPK2()");
String szAPKPackageName = PackageUtil.getPackageNameFromApk(this, szAPKFilePath);
saveAPKInfo(szAPKPackageName);
Intent intent = new Intent(this, MainActivity.class); Intent intent = new Intent(this, MainActivity.class);
intent.setAction(MainActivity.ACTION_NEW_INSTALLTASK); intent.setAction(MainActivity.ACTION_NEW_INSTALLTASK);
intent.putExtra(MainActivity.EXTRA_INSTALLED_PACKAGENAME, szAPKPackageName); intent.putExtra(MainActivity.EXTRA_INSTALLED_PACKAGENAME, PackageUtil.getPackageNameFromApk(this, szAPKFilePath));
intent.putExtra(MainActivity.EXTRA_INSTALLED_APKFILEPATH, szAPKFilePath); intent.putExtra(MainActivity.EXTRA_INSTALLED_APKFILEPATH, szAPKFilePath);
// Intent.ACTION_VIEW); // Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent); 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 { static class MyHandler extends Handler {
@ -256,7 +231,7 @@ public class MainService extends Service {
switch (message.what) { switch (message.what) {
case MSG_INSTALL_APK: case MSG_INSTALL_APK:
{ {
AppConfigs appConfigs = AppConfigs.getInstance(theActivity).loadAppConfigs(theActivity); AppConfigs appConfigs = AppConfigs.loadAppConfigs(theActivity);
if (appConfigs.getSetupMode() == AppConfigs.SetupMode.WATCHOUTPUTINSTALLER) { if (appConfigs.getSetupMode() == AppConfigs.SetupMode.WATCHOUTPUTINSTALLER) {
theActivity.installAPK2((String)message.obj); theActivity.installAPK2((String)message.obj);
} else if (appConfigs.getSetupMode() == AppConfigs.SetupMode.NEWAPKINFONEWAPKINFO) { } else if (appConfigs.getSetupMode() == AppConfigs.SetupMode.NEWAPKINFONEWAPKINFO) {
@ -270,21 +245,4 @@ public class MainService extends Service {
super.handleMessage(message); 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();
}
}
} }

View File

@ -55,9 +55,8 @@ public class NotificationUtil {
Notification mForegroundNotification = new Notification.Builder(service, szServiceChannelID) Notification mForegroundNotification = new Notification.Builder(service, szServiceChannelID)
.setAutoCancel(true) .setAutoCancel(true)
//.setContentTitle(service.getString(R.string.app_name)) .setContentTitle(service.getString(R.string.app_name))
.setContentTitle(service.TAG + " is started.") .setContentText(service.TAG + " is started.")
//.setContentText(service.TAG + " is started.")
.setWhen(System.currentTimeMillis()) .setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_launcher) .setSmallIcon(R.drawable.ic_launcher)
//设置红色 //设置红色

View File

@ -6,11 +6,9 @@ package cc.winboll.studio.autoinstaller.utils;
* @Describe 一个获取安卓APK安装文件的应用包名的函数 * @Describe 一个获取安卓APK安装文件的应用包名的函数
*/ */
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import cc.winboll.studio.shared.log.LogUtils;
import cc.winboll.studio.libappbase.LogUtils;
public class PackageUtil { public class PackageUtil {
@ -29,20 +27,4 @@ public class PackageUtil {
} }
return ""; return "";
} }
public static void openAPP(Context context, String packageName) {
// 这里假设要打开微信微信的包名是com.tencent.mm
//String packageName = "com.tencent.mm";
LogUtils.d(TAG, "packageName : " + packageName);
PackageManager packageManager = context.getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage(packageName);
if (intent != null) {
ResolveInfo resolveInfo = packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (resolveInfo != null) {
LogUtils.d(TAG, "startActivity...");
context.startActivity(intent);
}
}
}
} }

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#FF000000"
android:pathData="M16.61,15.15C16.15,15.15 15.77,14.78 15.77,14.32S16.15,13.5 16.61,13.5H16.61C17.07,13.5 17.45,13.86 17.45,14.32C17.45,14.78 17.07,15.15 16.61,15.15M7.41,15.15C6.95,15.15 6.57,14.78 6.57,14.32C6.57,13.86 6.95,13.5 7.41,13.5H7.41C7.87,13.5 8.24,13.86 8.24,14.32C8.24,14.78 7.87,15.15 7.41,15.15M16.91,10.14L18.58,7.26C18.67,7.09 18.61,6.88 18.45,6.79C18.28,6.69 18.07,6.75 18,6.92L16.29,9.83C14.95,9.22 13.5,8.9 12,8.91C10.47,8.91 9,9.24 7.73,9.82L6.04,6.91C5.95,6.74 5.74,6.68 5.57,6.78C5.4,6.87 5.35,7.08 5.44,7.25L7.1,10.13C4.25,11.69 2.29,14.58 2,18H22C21.72,14.59 19.77,11.7 16.91,10.14H16.91Z"/>
</vector>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ff000000"
android:pathData="M6.5,20Q4.22,20 2.61,18.43 1,16.85 1,14.58 1,12.63 2.17,11.1 3.35,9.57 5.25,9.15 5.88,6.85 7.75,5.43 9.63,4 12,4 14.93,4 16.96,6.04 19,8.07 19,11 20.73,11.2 21.86,12.5 23,13.78 23,15.5 23,17.38 21.69,18.69 20.38,20 18.5,20Z"/>
</vector>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ff000000"
android:pathData="M6.5,20Q4.22,20 2.61,18.43 1,16.85 1,14.58 1,12.63 2.17,11.1 3.35,9.57 5.25,9.15 5.88,6.85 7.75,5.43 9.63,4 12,4 14.93,4 16.96,6.04 19,8.07 19,11 20.73,11.2 21.86,12.5 23,13.78 23,15.5 23,17.38 21.69,18.69 20.38,20 18.5,20M6.5,18H18.5Q19.55,18 20.27,17.27 21,16.55 21,15.5 21,14.45 20.27,13.73 19.55,13 18.5,13H17V11Q17,8.93 15.54,7.46 14.08,6 12,6 9.93,6 8.46,7.46 7,8.93 7,11H6.5Q5.05,11 4.03,12.03 3,13.05 3,14.5 3,15.95 4.03,17 5.05,18 6.5,18M12,12Z"/>
</vector>

View File

@ -132,7 +132,7 @@
</LinearLayout> </LinearLayout>
<cc.winboll.studio.libappbase.LogView <cc.winboll.studio.shared.log.LogView
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" android:layout_height="200dp"

View File

@ -1,4 +1,3 @@
<resources> <resources>
<string name="app_name">AutoInstaller</string> <string name="app_name">AutoInstaller</string>
<string name="tileservice_name">AutoInstaller</string>
</resources> </resources>

View File

@ -1,13 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="MyAppTheme" parent="APPBaseTheme">
<item name="attrColorPrimary">@color/colorPrimary</item>
<item name="themeGlobalCrashActivity">@style/MyGlobalCrashActivityTheme</item>
</style>
<style name="MyGlobalCrashActivityTheme" parent="GlobalCrashActivityTheme">
<item name="colorTittle">#FFFFFFFF</item>
<item name="colorTittleBackgound">#FF00A4B3</item>
<item name="colorText">#FFFFFFFF</item>
<item name="colorTextBackgound">#FF000000</item>
</style>
</resources>

View File

@ -0,0 +1,14 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Application" parent="android:Theme.Material.Light.DarkActionBar">
<!-- Primary brand color. -->
<item name="android:colorPrimary">@color/purple_500</item>
<!-- Secondary brand color. -->
<item name="android:colorSecondary">@color/teal_200</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">@color/purple_700</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -2,7 +2,7 @@
buildscript { buildscript {
repositories { repositories {
// Maven ~/.m2/repository // Maven ~/.m2/repository
//mavenLocal() mavenLocal()
// //
maven { url "file:///sdcard/.m2/repository" } maven { url "file:///sdcard/.m2/repository" }
@ -31,11 +31,6 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
// Maven ~/.m2/repository
//mavenLocal()
//
maven { url "file:///sdcard/.m2/repository" }
// Nexus Maven // Nexus Maven
// "WinBoLL Release" // "WinBoLL Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" } maven { url "https://nexus.winboll.cc/repository/maven-public/" }

View File

@ -29,7 +29,7 @@ android {
// versionName // versionName
// build.gradle stageCount=0 // build.gradle stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0" // Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "15.3" versionName "15.2"
if(true) { if(true) {
versionName = genVersionName("${versionName}") versionName = genVersionName("${versionName}")
} }
@ -45,9 +45,6 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) 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'
// https://github.com/getActivity/XXPermissions // https://github.com/getActivity/XXPermissions
api 'com.github.getActivity:XXPermissions:18.63' api 'com.github.getActivity:XXPermissions:18.63'
@ -84,4 +81,8 @@ dependencies {
//api 'androidx.vectordrawable:vectordrawable:1.1.0' //api 'androidx.vectordrawable:vectordrawable:1.1.0'
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0' //api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
//api 'androidx.fragment:fragment:1.1.0' //api 'androidx.fragment:fragment:1.1.0'
api 'cc.winboll.studio:libaes:15.2.4'
api 'cc.winboll.studio:libapputils:15.2.1'
api 'cc.winboll.studio:libappbase:15.2.2'
} }

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Mon May 05 03:56:16 HKT 2025 #Mon Apr 14 12:09:37 GMT 2025
stageCount=2 stageCount=8
libraryProject= libraryProject=
baseVersion=15.3 baseVersion=15.2
publishVersion=15.3.1 publishVersion=15.2.7
buildCount=0 buildCount=14
baseBetaVersion=15.3.2 baseBetaVersion=15.2.8

View File

@ -7,7 +7,7 @@ package cc.winboll.studio.contacts;
*/ */
import android.view.Gravity; import android.view.Gravity;
import cc.winboll.studio.libappbase.GlobalApplication; import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.winboll.WinBoLLActivityManager; import cc.winboll.studio.libappbase.winboll.WinBollActivityManager;
import com.hjq.toast.ToastUtils; import com.hjq.toast.ToastUtils;
public class App extends GlobalApplication { public class App extends GlobalApplication {
@ -20,8 +20,8 @@ public class App extends GlobalApplication {
// 这样可以预先设置日志与数据的存储根目录 // 这样可以预先设置日志与数据的存储根目录
//setIsDebuging(BuildConfig.DEBUG); //setIsDebuging(BuildConfig.DEBUG);
super.onCreate(); super.onCreate();
// 设置 WinBoLL 应用 UI 类型 // 设置 WinBoll 应用 UI 类型
getWinBoLLActivityManager().setWinBoLLUI_TYPE(WinBoLLActivityManager.WinBoLLUI_TYPE.Aplication); WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Aplication);
//LogUtils.d(TAG, "onCreate"); //LogUtils.d(TAG, "onCreate");

View File

@ -32,21 +32,22 @@ import cc.winboll.studio.contacts.fragments.CallLogFragment;
import cc.winboll.studio.contacts.fragments.ContactsFragment; import cc.winboll.studio.contacts.fragments.ContactsFragment;
import cc.winboll.studio.contacts.fragments.LogFragment; import cc.winboll.studio.contacts.fragments.LogFragment;
import cc.winboll.studio.contacts.services.MainService; import cc.winboll.studio.contacts.services.MainService;
import cc.winboll.studio.libaes.winboll.APPInfo;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView; import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
final public class MainActivity extends AppCompatActivity implements IWinBoLLActivity, ViewPager.OnPageChangeListener, View.OnClickListener { final public class MainActivity extends AppCompatActivity implements IWinBollActivity, ViewPager.OnPageChangeListener, View.OnClickListener {
public static final String TAG = "MainActivity"; public static final String TAG = "MainActivity";
public static final int REQUEST_HOME_ACTIVITY = 0; public static final int REQUEST_HOME_ACTIVITY = 0;
public static final int REQUEST_ABOUT_ACTIVITY = 1; public static final int REQUEST_ABOUT_ACTIVITY = 1;
public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoLL.ACTION_SOS"; public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoll.ACTION_SOS";
static MainActivity _MainActivity; static MainActivity _MainActivity;
LogView mLogView; LogView mLogView;
@ -70,10 +71,10 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
private static final int DIALER_REQUEST_CODE = 1; private static final int DIALER_REQUEST_CODE = 1;
// @Override @Override
// public Activity getActivity() { public Activity getActivity() {
// return this; return this;
// } }
// @Override // @Override
// public APPInfo getAppInfo() { // public APPInfo getAppInfo() {
@ -94,17 +95,6 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
// return null; // return null;
// } // }
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
// 接收并处理 Intent 数据函数 Intent 处理接收就直接返回 // 接收并处理 Intent 数据函数 Intent 处理接收就直接返回
@ -121,7 +111,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
// // 显示后退按钮 // // 显示后退按钮
// getSupportActionBar().setDisplayHomeAsUpEnabled(true); // getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// } // }
getSupportActionBar().setSubtitle(TAG); getSupportActionBar().setSubtitle(getTag());
tabLayout = findViewById(R.id.tabLayout); tabLayout = findViewById(R.id.tabLayout);
viewPager = findViewById(R.id.viewPager); viewPager = findViewById(R.id.viewPager);
@ -349,7 +339,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
// //
// if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) { // if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) {
// try { // try {
// WinBoLLActivity clazzActivity = UnitTestActivity.class.newInstance(); // WinBollActivity clazzActivity = UnitTestActivity.class.newInstance();
// String tag = clazzActivity.getTag(); // String tag = clazzActivity.getTag();
// LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag); // LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag);
// Intent subIntent = new Intent(this, UnitTestActivity.class); // Intent subIntent = new Intent(this, UnitTestActivity.class);
@ -367,8 +357,8 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
// } // }
// //
// Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath())); // Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath()));
// //startWinBoLLActivity(subIntent, tag); // //startWinBollActivity(subIntent, tag);
// WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, subIntent, UnitTestActivity.class); // WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class);
// } catch (IllegalAccessException | InstantiationException | IOException e) { // } catch (IllegalAccessException | InstantiationException | IOException e) {
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); // LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// // 函数处理异常返回失败 // // 函数处理异常返回失败
@ -381,10 +371,10 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
// return true; // return true;
// } // }
// @Override @Override
// public String getTag() { public String getTag() {
// return TAG; return TAG;
// } }
// @Override // @Override
// public void onBackPressed() { // public void onBackPressed() {
@ -396,7 +386,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
// //
// @Override // @Override
// public void onYes() { // public void onYes() {
// WinBoLLActivityManager.getInstance(getApplicationContext()).finishAll(); // WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
// } // }
// //
// @Override // @Override
@ -418,7 +408,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBoLLAct
if (item.getItemId() == R.id.item_settings) { if (item.getItemId() == R.id.item_settings) {
Intent intent = new Intent(this, SettingsActivity.class); Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent); startActivity(intent);
//WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, CallActivity.class); //WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
} }
// } else // } else
// if (item.getItemId() == R.id.item_exit) { // if (item.getItemId() == R.id.item_exit) {

View File

@ -10,15 +10,14 @@ import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.contacts.R; import cc.winboll.studio.contacts.R;
import cc.winboll.studio.libaes.winboll.APPInfo; import cc.winboll.studio.libaes.winboll.APPInfo;
import cc.winboll.studio.libaes.winboll.AboutView; import cc.winboll.studio.libaes.winboll.AboutView;
import cc.winboll.studio.libappbase.GlobalApplication; import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
public class AboutActivity extends AppCompatActivity implements IWinBoLLActivity { public class AboutActivity extends WinBollActivity implements IWinBollActivity {
public static final String TAG = "AboutActivity"; public static final String TAG = "AboutActivity";
@ -65,13 +64,13 @@ public class AboutActivity extends AppCompatActivity implements IWinBoLLActivity
); );
layout.addView(aboutView, params); layout.addView(aboutView, params);
GlobalApplication.getWinBoLLActivityManager().add(this); GlobalApplication.getWinBollActivityManager().add(this);
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
GlobalApplication.getWinBoLLActivityManager().registeRemove(this); GlobalApplication.getWinBollActivityManager().registeRemove(this);
} }
public AboutView CreateAboutView() { public AboutView CreateAboutView() {

View File

@ -36,12 +36,12 @@ import cc.winboll.studio.contacts.dun.Rules;
import cc.winboll.studio.contacts.services.MainService; import cc.winboll.studio.contacts.services.MainService;
import cc.winboll.studio.contacts.views.DuInfoTextView; import cc.winboll.studio.contacts.views.DuInfoTextView;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
import com.hjq.toast.ToastUtils; import com.hjq.toast.ToastUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.List; import java.util.List;
public class SettingsActivity extends AppCompatActivity implements IWinBoLLActivity { public class SettingsActivity extends AppCompatActivity implements IWinBollActivity {
public static final String TAG = "SettingsActivity"; public static final String TAG = "SettingsActivity";
@ -202,11 +202,6 @@ public class SettingsActivity extends AppCompatActivity implements IWinBoLLActiv
settingsModel.setIsEnableDun(isEnableDun); settingsModel.setIsEnableDun(isEnableDun);
Rules.getInstance(this).saveDun(); Rules.getInstance(this).saveDun();
Rules.getInstance(this).reload(); Rules.getInstance(this).reload();
// 重新加载盾牌参数
etDunTotalCount.setText(Integer.toString(settingsModel.getDunTotalCount()));
etDunResumeSecondCount.setText(Integer.toString(settingsModel.getDunResumeSecondCount()));
etDunResumeCount.setText(Integer.toString(settingsModel.getDunResumeCount()));
} }
void updateStreamVolumeTextView() { void updateStreamVolumeTextView() {
@ -328,6 +323,6 @@ public class SettingsActivity extends AppCompatActivity implements IWinBoLLActiv
} }
public void onAbout(View view) { public void onAbout(View view) {
App.getWinBoLLActivityManager().startWinBoLLActivity(this, AboutActivity.class); App.getWinBollActivityManager().startWinBollActivity(this, AboutActivity.class);
} }
} }

View File

@ -0,0 +1,60 @@
package cc.winboll.studio.contacts.activities;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/31 15:16:45
* @Describe 应用窗口基类
*/
import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
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;
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);
}
}

View File

@ -84,7 +84,7 @@ public class Rules {
LogUtils.d(TAG, String.format("saveRules()")); LogUtils.d(TAG, String.format("saveRules()"));
PhoneConnectRuleModel.saveBeanList(mContext, _PhoneConnectRuleModelList, PhoneConnectRuleModel.class); PhoneConnectRuleModel.saveBeanList(mContext, _PhoneConnectRuleModelList, PhoneConnectRuleModel.class);
} }
public void resetDefaultBoBullToonURL() { public void resetDefaultBoBullToonURL() {
mSettingsModel.setBoBullToon_URL(TomCat.getInstance(mContext).getDefaultBobulltoonUrl()); mSettingsModel.setBoBullToon_URL(TomCat.getInstance(mContext).getDefaultBobulltoonUrl());
saveDun(); saveDun();
@ -124,12 +124,8 @@ public class Rules {
boolean isDefend = false; // 盾牌是否生效 boolean isDefend = false; // 盾牌是否生效
boolean isConnect = true; // 防御结果是否连接 boolean isConnect = true; // 防御结果是否连接
// 进行盾牌层数预计缩减计算
int nDunCurrentCount = mSettingsModel.getDunCurrentCount() - 1;
LogUtils.d(TAG, String.format("nDunCurrentCount : %d", nDunCurrentCount));
// 如果盾值小于1则解除防御 // 如果盾值小于1则解除防御
if (!isDefend && nDunCurrentCount < 1) { if (!isDefend && mSettingsModel.getDunCurrentCount() < 1) {
// 盾层为1以下防御解除 // 盾层为1以下防御解除
LogUtils.d(TAG, "盾层为1以下防御解除"); LogUtils.d(TAG, "盾层为1以下防御解除");
isDefend = true; isDefend = true;
@ -193,17 +189,17 @@ public class Rules {
// 就减少防御盾牌层数 // 就减少防御盾牌层数
// 每校验一次规则云盾防御层数减1 // 每校验一次规则云盾防御层数减1
// 当云盾防御层数为0时再次进行以下程序段则恢复满值防御 // 当云盾防御层数为0时再次进行以下程序段则恢复满值防御
int newDunCount = nDunCurrentCount; int newDunCount = mSettingsModel.getDunCurrentCount() - 1;
LogUtils.d(TAG, String.format("新的防御层数预计为 %d", newDunCount)); LogUtils.d(TAG, String.format("新的防御层数预计为 %d", newDunCount));
// 保证盾值在[1DunTotalCount]之内其他值一律重置为 DunTotalCount // 保证盾值在[0DunTotalCount]之内其他值一律重置为 DunTotalCount
if (newDunCount > 0 && newDunCount < mSettingsModel.getDunTotalCount()) { if (newDunCount < 0 || newDunCount > mSettingsModel.getDunTotalCount()) {
mSettingsModel.setDunCurrentCount(newDunCount);
LogUtils.d(TAG, String.format("设置防御层数为 %d", newDunCount));
} else {
mSettingsModel.setDunCurrentCount(mSettingsModel.getDunTotalCount()); mSettingsModel.setDunCurrentCount(mSettingsModel.getDunTotalCount());
LogUtils.d(TAG, String.format("盾值不在[0%d]区间,恢复防御最大值%d", mSettingsModel.getDunTotalCount(), mSettingsModel.getDunTotalCount())); LogUtils.d(TAG, String.format("盾值不在[0%d]区间,恢复防御最大值%d", mSettingsModel.getDunTotalCount(), mSettingsModel.getDunTotalCount()));
} } else {
mSettingsModel.setDunCurrentCount(newDunCount);
LogUtils.d(TAG, String.format("设置防御层数为 %d", newDunCount));
}
saveDun(); saveDun();
SettingsActivity.notifyDunInfoUpdate(); SettingsActivity.notifyDunInfoUpdate();

View File

@ -31,7 +31,7 @@ import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.sos.SOS; import cc.winboll.studio.libappbase.sos.SOS;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import cc.winboll.studio.libappbase.sos.WinBoLL; import cc.winboll.studio.libappbase.sos.WinBoll;
import cc.winboll.studio.contacts.App; import cc.winboll.studio.contacts.App;
import cc.winboll.studio.libappbase.sos.APPModel; import cc.winboll.studio.libappbase.sos.APPModel;
@ -129,11 +129,11 @@ public class MainService extends Service {
isServiceRunning = true; isServiceRunning = true;
// 唤醒守护进程 // 唤醒守护进程
wakeupAndBindAssistant(); wakeupAndBindAssistant();
// 召唤 WinBoLL APP 绑定本服务 // 召唤 WinBoll APP 绑定本服务
if (App.isDebuging()) { if (App.isDebuging()) {
WinBoLL.bindToAPPBaseBeta(this, MainService.class.getName()); WinBoll.bindToAPPBaseBeta(this, MainService.class.getName());
} else { } else {
WinBoLL.bindToAPPBase(this, MainService.class.getName()); WinBoll.bindToAPPBase(this, MainService.class.getName());
} }
// 初始化服务运行参数 // 初始化服务运行参数

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- WinBoLL 默认方案 --> <!-- WinBoll 默认方案 -->
<color name="colorPrimary">#FF196ABC</color> <color name="colorPrimary">#FF196ABC</color>
<color name="colorPrimaryDark">#FF002B57</color> <color name="colorPrimaryDark">#FF002B57</color>
<color name="colorAccent">#FF80BFFF</color> <color name="colorAccent">#FF80BFFF</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="MyAppTheme" parent="AESTheme"> <style name="MyAppTheme" parent="APPBaseTheme">
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
@ -8,7 +8,7 @@
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
</style> </style>
<style name="GlobalCrashActivityTheme" parent="AESTheme"> <style name="GlobalCrashActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="colorTittle">@color/colorAccent</item> <item name="colorTittle">@color/colorAccent</item>
<item name="colorTittleBackgound">@color/colorPrimary</item> <item name="colorTittleBackgound">@color/colorPrimary</item>
<item name="colorText">@color/colorAccent</item> <item name="colorText">@color/colorAccent</item>

View File

@ -21,9 +21,6 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) 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' api 'com.github.getActivity:ToastUtils:10.5'
@ -53,4 +50,7 @@ dependencies {
//api 'androidx.vectordrawable:vectordrawable:1.1.0' //api 'androidx.vectordrawable:vectordrawable:1.1.0'
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0' //api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
//api 'androidx.fragment:fragment: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'
} }

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sat May 03 11:34:58 GMT 2025 #Tue Apr 29 15:14:21 HKT 2025
stageCount=1 stageCount=1
libraryProject=libaes libraryProject=libaes
baseVersion=15.6 baseVersion=15.6
publishVersion=15.6.0 publishVersion=15.6.0
buildCount=9 buildCount=0
baseBetaVersion=15.6.1 baseBetaVersion=15.6.1

View File

@ -5,34 +5,27 @@
<application> <application>
<activity <activity android:name="cc.winboll.studio.libaes.unittests.SecondaryLibraryActivity"
android:name="cc.winboll.studio.libaes.unittests.SecondaryLibraryActivity"
android:exported="true"/> android:exported="true"/>
<activity <activity android:name="cc.winboll.studio.libaes.unittests.TestDrawerFragmentActivity"
android:name="cc.winboll.studio.libaes.unittests.TestDrawerFragmentActivity"
android:exported="true"/> android:exported="true"/>
<activity <activity android:name="cc.winboll.studio.libaes.unittests.TestAToolbarActivity"
android:name="cc.winboll.studio.libaes.unittests.TestAToolbarActivity"
android:exported="true"/> android:exported="true"/>
<activity <activity android:name="cc.winboll.studio.libaes.unittests.TestASupportToolbarActivity"
android:name="cc.winboll.studio.libaes.unittests.TestASupportToolbarActivity"
android:exported="true"/> android:exported="true"/>
<service <service android:name="cc.winboll.studio.libaes.winboll.WinBoLLClientService"
android:name="cc.winboll.studio.libaes.winboll.WinBoLLClientService"
android:exported="true"/> android:exported="true"/>
<service <service android:name="cc.winboll.studio.libaes.winboll.AssistantService"
android:name="cc.winboll.studio.libaes.winboll.AssistantService"
android:exported="true"/> android:exported="true"/>
<service <service android:name="cc.winboll.studio.libaes.winboll.WinBoLLMail"
android:name="cc.winboll.studio.libaes.winboll.WinBoLLMail"
android:exported="true"/> android:exported="true"/>
</application> </application>
</manifest> </manifest>

View File

@ -1,78 +0,0 @@
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();
}
}

View File

@ -11,8 +11,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import cc.winboll.studio.libaes.beans.WinBoLLClientServiceBean; import cc.winboll.studio.libaes.winboll.WinBoLLClientService;
import cc.winboll.studio.libaes.winboll.AssistantService;
import cc.winboll.studio.libappbase.utils.ServiceUtils; import cc.winboll.studio.libappbase.utils.ServiceUtils;
public class AssistantService extends Service { public class AssistantService extends Service {

View File

@ -1,21 +0,0 @@
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;
}
}

View File

@ -1,38 +0,0 @@
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) {
}
}

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sat May 03 10:32:21 GMT 2025 #Tue Apr 29 14:47:16 HKT 2025
stageCount=7 stageCount=7
libraryProject=libappbase libraryProject=libappbase
baseVersion=15.7 baseVersion=15.7
publishVersion=15.7.6 publishVersion=15.7.6
buildCount=4 buildCount=0
baseBetaVersion=15.7.7 baseBetaVersion=15.7.7

View File

@ -0,0 +1,39 @@
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);
}
}

View File

@ -0,0 +1,18 @@
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();
}

View File

@ -0,0 +1,356 @@
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<String, IWinBoLLActivity> _mapIWinBoLLList;
volatile IWinBoLLActivity mFirstIWinBoLLActivity;
WinBoLLActivityManager(GlobalApplication application) {
mGlobalApplication = application;
_mapIWinBoLLList = new HashMap<String, IWinBoLLActivity>();
}
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 <T extends IWinBoLLActivity> 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 <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Class<T> clazz) {
try {
// 如果窗口已存在就重启窗口
String tag = ((IWinBoLLActivity)clazz.newInstance()).getTag();
LogUtils.d(TAG, String.format("startWinBoLLActivity(Context context, Class<T> clazz) tag is %s", tag));
if (isActive(tag)) {
resumeActivity(context, tag);
return;
}
//ToastUtils.show("startWinBoLLActivity(Context context, Class<T> 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 <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Intent intent, Class<T> clazz) {
try {
// 如果窗口已存在就重启窗口
String tag = ((IWinBoLLActivity)clazz.newInstance()).getTag();
LogUtils.d(TAG, String.format("startWinBoLLActivity(Context context, Intent intent, Class<T> 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 <T extends IWinBoLLActivity> 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 <T extends IWinBoLLActivity> 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 <T extends IWinBoLLActivity> 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 <T extends IWinBoLLActivity> 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<String, IWinBoLLActivity> 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 <T extends IWinBoLLActivity> 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<Map.Entry<String, IWinBoLLActivity>> iterator = _mapIWinBoLLList.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, IWinBoLLActivity> 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.");
}
}
}

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sat May 03 06:21:11 GMT 2025 #Tue Apr 29 12:41:13 GMT 2025
stageCount=1 stageCount=0
libraryProject= libraryProject=
baseVersion=15.3 baseVersion=15.3
publishVersion=15.3.0 publishVersion=15.3.0
buildCount=5 buildCount=4
baseBetaVersion=15.3.1 baseBetaVersion=15.3.1

View File

@ -32,8 +32,6 @@ import cc.winboll.studio.powerbell.utils.AppConfigUtils;
import cc.winboll.studio.powerbell.utils.NotificationHelper; import cc.winboll.studio.powerbell.utils.NotificationHelper;
import cc.winboll.studio.powerbell.utils.ServiceUtils; import cc.winboll.studio.powerbell.utils.ServiceUtils;
import cc.winboll.studio.powerbell.utils.StringUtils; import cc.winboll.studio.powerbell.utils.StringUtils;
import android.os.Handler;
import android.os.Looper;
public class ControlCenterService extends Service { public class ControlCenterService extends Service {
@ -116,17 +114,9 @@ public class ControlCenterService extends Service {
mControlCenterServiceReceiver = new ControlCenterServiceReceiver(this); mControlCenterServiceReceiver = new ControlCenterServiceReceiver(this);
mControlCenterServiceReceiver.registerAction(this); mControlCenterServiceReceiver.registerAction(this);
} }
startRemindThread(mAppConfigUtils.mAppConfigBean);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable(){ ToastUtils.show("Service Is Start.");
LogUtils.i(TAG, "Service Is Start.");
@Override
public void run() {
startRemindThread(mAppConfigUtils.mAppConfigBean);
ToastUtils.show("Service Is Start.");
LogUtils.i(TAG, "Service Is Start.");
}
}, 2000);
} }
} }

View File

@ -83,9 +83,8 @@ public class NotificationHelper {
Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_FOREGROUND) Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_FOREGROUND)
.setSmallIcon(R.drawable.ic_launcher) .setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher)) .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher))
//.setContentTitle(title + "\n" + content) .setContentTitle(title)
.setContentTitle(content) .setContentText(content)
//.setContentText(content)
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW)
.setOngoing(true) .setOngoing(true)