Compare commits
66 Commits
app-v15.0.
...
apputils-v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4ea79b950 | ||
|
|
06a40a4298 | ||
|
|
35835d746e | ||
|
|
5f3d03ba7d | ||
|
|
1d372ff9ae | ||
|
|
4a1e398755 | ||
|
|
107be6d6ad | ||
|
|
19db567a7d | ||
|
|
b14add854e | ||
|
|
104d9fa283 | ||
|
|
dd041e5d78 | ||
|
|
2f019ae176 | ||
|
|
b5b4fbd3f5 | ||
|
|
548dcf74ed | ||
|
|
547bf894c6 | ||
|
|
09e6429726 | ||
|
|
3ad9bb262e | ||
|
|
15992da22f | ||
|
|
7fb4e665f9 | ||
|
|
6a82889926 | ||
|
|
7272cc4e5b | ||
|
|
1f7d112a8a | ||
|
|
936e214015 | ||
|
|
46e95d1b1f | ||
|
|
15173f7af3 | ||
|
|
6f3b6c40af | ||
|
|
42ffba69e5 | ||
|
|
f021e8a1a3 | ||
|
|
02ce7dedb0 | ||
|
|
8e290cd5e6 | ||
|
|
37f2aa5f1b | ||
|
|
10cc69940b | ||
|
|
bfdff9ff2f | ||
|
|
12c6129a61 | ||
|
|
ea10d1b540 | ||
|
|
81f6ff592e | ||
|
|
e6f22e9212 | ||
|
|
8ce8f383fa | ||
|
|
35d32b384f | ||
|
|
85e86ddf05 | ||
|
|
99bf804625 | ||
|
|
261259e61e | ||
|
|
9aaf3433bd | ||
|
|
b739510951 | ||
|
|
903359d9a2 | ||
|
|
69e7e72ed8 | ||
|
|
a96ba362b4 | ||
|
|
6447bcf924 | ||
|
|
18ed325731 | ||
|
|
16e3d10b63 | ||
|
|
8b0e8b00ae | ||
|
|
7f61ff1470 | ||
|
|
c4e0c23a0c | ||
|
|
c7d26bbc3d | ||
|
|
4968bbaeae | ||
|
|
8e6b06e366 | ||
|
|
ae7fb2984a | ||
|
|
a4d009f8fb | ||
|
|
5a549e9652 | ||
|
|
e2d71ae088 | ||
|
|
506d2619f2 | ||
|
|
17fa805a7f | ||
|
|
1dcf8cd007 | ||
|
|
d86d50212e | ||
|
|
af2e09c02a | ||
|
|
de6361b19b |
1
.gitignore
vendored
@@ -96,7 +96,6 @@ local.properties
|
|||||||
|
|
||||||
## 忽略模块应用编译配置
|
## 忽略模块应用编译配置
|
||||||
/settings.gradle
|
/settings.gradle
|
||||||
/gradle.properties
|
|
||||||
|
|
||||||
## 忽略 srv 纠结问题
|
## 忽略 srv 纠结问题
|
||||||
/srv/
|
/srv/
|
||||||
|
|||||||
3
.idea/.gitignore
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
1
.idea/.name
generated
@@ -1 +0,0 @@
|
|||||||
appbase
|
|
||||||
6
.idea/compiler.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<bytecodeTargetLevel target="17" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
10
.idea/deploymentTargetDropDown.xml
generated
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="deploymentTargetDropDown">
|
|
||||||
<value>
|
|
||||||
<entry key="appbase">
|
|
||||||
<State />
|
|
||||||
</entry>
|
|
||||||
</value>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
10
.idea/migrations.xml
generated
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectMigrations">
|
|
||||||
<option name="MigrateToGradleLocalJavaHome">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
10
.idea/misc.xml
generated
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
20
README.md
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
## WinBoll 项目组研发计划
|
## WinBoll 项目组研发计划
|
||||||
致力于把 WinBoll-APP 应用在手机端 Android 项目开发。
|
致力于把 WinBoll-APP 应用在手机端 Android 项目开发。
|
||||||
也在探索 https://gitea.winboll.cc/<WinBoll 项目组>/APP.git 应用于 WinBoll-APP APK 分发。
|
也在探索 https://gitea.winboll.cc/<WinBoll 项目组>/WinBoll-APP.git 应用于 WinBoll-APP APK 分发。
|
||||||
更想进阶 https://github.com/<WinBoll 项目组>/APP.git 应用于 WinBoll-APP Beta APK 分发。
|
更想进阶 https://github.com/<WinBoll 项目组>/WinBoll-APP.git 应用于 WinBoll-APP Beta APK 分发。
|
||||||
|
|
||||||
## WinBoll-APP 汗下...
|
## WinBoll-APP 汗下...
|
||||||
#### ☁应用何置如此呢。且观用户云云。
|
#### ☁应用何置如此呢。且观用户云云。
|
||||||
@@ -55,10 +55,10 @@
|
|||||||
☁ WinBoll 主机建立 1Panel Gitea 应用。
|
☁ WinBoll 主机建立 1Panel Gitea 应用。
|
||||||
☁ WinBoll 主机设置 WinBoll 应用为非登录状态。
|
☁ WinBoll 主机设置 WinBoll 应用为非登录状态。
|
||||||
☁ WinBoll 主机建立 WinBoll 账户与 WinBoll 用户组。
|
☁ WinBoll 主机建立 WinBoll 账户与 WinBoll 用户组。
|
||||||
☁ WinBoll 账户 User ID 为: J。
|
☁ WinBoll 账户 User ID 为: winboll。
|
||||||
☁ WinBoll 用户组 Group ID 为: Studio。
|
☁ WinBoll 用户组 Group ID 为: winboll。
|
||||||
☁ WinBoll 主机 WinBoll 1Panel Gitea 建立 WinBoll 工作组。
|
☁ WinBoll 主机 WinBoll 1Panel Gitea 建立 WinBoll 工作组。
|
||||||
☁ WinBoll 主机 WinBoll 1Panel Gitea 用户项目 APK 编译输出目录为 /sdcard/WinBollStudio/<用户名>/APKs/
|
☁ WinBoll 主机 WinBoll 1Panel Gitea 用户项目 APK 编译输出目录为 /sdcard/<用户名>/WinBoll/app/
|
||||||
☁ WinBoll 项目配置文件示例为 "<WinBoll 项目根目录>/.winboll/winboll.properties-demo"(WinBoll 项目已设置)
|
☁ WinBoll 项目配置文件示例为 "<WinBoll 项目根目录>/.winboll/winboll.properties-demo"(WinBoll 项目已设置)
|
||||||
☁ WinBoll 项目配置文件为 "<WinBoll 项目根目录>/.winboll/winboll.properties"
|
☁ WinBoll 项目配置文件为 "<WinBoll 项目根目录>/.winboll/winboll.properties"
|
||||||
☁ WinBoll 项目配置文件设定为源码提交时忽略。(WinBoll 项目已设置)
|
☁ WinBoll 项目配置文件设定为源码提交时忽略。(WinBoll 项目已设置)
|
||||||
@@ -72,17 +72,17 @@
|
|||||||
☁ MySQL winbollclient 数据库中
|
☁ MySQL winbollclient 数据库中
|
||||||
WinBoll 客户端用户信息设定为:
|
WinBoll 客户端用户信息设定为:
|
||||||
<用户名, 验证密码, 验证邮箱, 验证手机, 唯一存储令牌Token, 备用验证邮箱>。
|
<用户名, 验证密码, 验证邮箱, 验证手机, 唯一存储令牌Token, 备用验证邮箱>。
|
||||||
☁ WinBoll 项目源码仓库托管在 WinBoll 1Panel Gitea 目录 /opt/1panel/apps/gitea/gitea/data/git/repositories/studio/app.git中。
|
☁ WinBoll 项目源码仓库托管在 WinBoll 1Panel Gitea 目录 /opt/1panel/apps/gitea/gitea/data/git/repositories/winboll/winboll.git中。
|
||||||
☁ WinBoll 主机提供 WinBoll 1Panel Gitea 应用的 WinBoll 项目源码仓库存取功能。(Gitea 应用已提供)
|
☁ WinBoll 主机提供 WinBoll 1Panel Gitea 应用的 WinBoll 项目源码仓库存取功能。(Gitea 应用已提供)
|
||||||
☁ WinBoll 主机提供 WinBoll Gitea 项目仓库存档功能。(Gitea 应用已提供)
|
☁ WinBoll 主机提供 WinBoll Gitea 项目仓库存档功能。(Gitea 应用已提供)
|
||||||
☁ 提供 WinBoll 客户端用户登录功能。(Gitea 应用已提供)
|
☁ 提供 WinBoll 客户端用户登录功能。(Gitea 应用已提供)
|
||||||
|
|
||||||
### ☁ 看远方 ☁ ###
|
### ☁ 看远方 ☁ ###
|
||||||
### ☁ 心忧虑 ☁ WinBoll-APP 应用前置需求
|
### ☁ 心忧虑 ☁ WinBoll-APP 应用前置需求
|
||||||
☁ WinBoll-APP WinBoll 项目根目录设定为手机的 /sdcard/WinBollStudio/Sources 目录。(需要用户手动建立文件夹)
|
☁ WinBoll-APP WinBoll 项目根目录设定为手机的 /sdcard/WinBoll 目录。(需要用户手动建立文件夹)
|
||||||
☁ WinBoll-APP 具有手机 /sdcard/WinBoll 目录的存储权限。(需要手机操作系统授权)
|
☁ WinBoll-APP 具有手机 /sdcard/WinBoll 目录的存储权限。(需要手机操作系统授权)
|
||||||
☁ WinBoll-APP WinBoll 项目仓库源码存储路径为 /sdcard/WinBollStudio/Sources/APP.git(需要用户手动建立文件夹)
|
☁ WinBoll-APP WinBoll 项目仓库源码存储路径为 /sdcard/WinBoll/repositories/winboll.git(需要用户手动建立文件夹)
|
||||||
☁ WinBoll-APP 项目 APK 编译输出目录为 /sdcard/WinBollStudio/APKs/
|
☁ WinBoll-APP 项目 APK 编译输出目录为 /sdcard/WinBoll/app/
|
||||||
☁ WinBoll-APP 应用签名验证可定制化。(WinBoll 项目已提供)
|
☁ WinBoll-APP 应用签名验证可定制化。(WinBoll 项目已提供)
|
||||||
☁ WinBoll-APP 与系列衍生 APP 应用共享 cc.winboll.studio 命名空间资源。(WinBoll 项目已提供)
|
☁ WinBoll-APP 与系列衍生 APP 应用共享 cc.winboll.studio 命名空间资源。(WinBoll 项目已提供)
|
||||||
☁ WinBoll-APP 用户客户端信息存储在命名空间为 WinBoll APP MySQLLite 应用的 winbollappclient 数据库中。
|
☁ WinBoll-APP 用户客户端信息存储在命名空间为 WinBoll APP MySQLLite 应用的 winbollappclient 数据库中。
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
### ☁ 云游四方 ☁ ###
|
### ☁ 云游四方 ☁ ###
|
||||||
### ☁ 呔! ☁ WinBoll-APP 应用需求规划
|
### ☁ 呔! ☁ WinBoll-APP 应用需求规划
|
||||||
☁ WinBoll-APP 提供手机目录 /sdcard/WinBollStudio/Sources 的 WinBoll 项目源码管理功能。
|
☁ WinBoll-APP 提供手机目录 /sdcard/WinBoll 的 WinBoll 项目源码管理功能。
|
||||||
|
|
||||||
### ☁ 吁! ☁ WinBoll-APP 共享计划前景
|
### ☁ 吁! ☁ WinBoll-APP 共享计划前景
|
||||||
☁ WinBoll-APP 将会实现 https://winboll.cc/api 访问功能。
|
☁ WinBoll-APP 将会实现 https://winboll.cc/api 访问功能。
|
||||||
|
|||||||
@@ -19,17 +19,17 @@ def genVersionName(def versionName){
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 32
|
compileSdkVersion 32
|
||||||
buildToolsVersion "32.0.0"
|
buildToolsVersion "33.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.aes"
|
applicationId "cc.winboll.studio.aes"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.2"
|
versionName "7.6"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@@ -41,9 +41,29 @@ 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 project(':libaes')
|
api project(':libaes')
|
||||||
|
|
||||||
|
//api 'cc.winboll.studio:winboll-shared:1.6.5'
|
||||||
|
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 'cc.winboll.studio:libapputils:9.2.1'
|
||||||
|
api 'cc.winboll.studio:libappbase:1.0.3'
|
||||||
|
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Mon Mar 31 19:41:19 HKT 2025
|
#Sun Jan 19 04:58:59 GMT 2025
|
||||||
stageCount=5
|
stageCount=3
|
||||||
libraryProject=libaes
|
libraryProject=libaes
|
||||||
baseVersion=15.2
|
baseVersion=7.6
|
||||||
publishVersion=15.2.4
|
publishVersion=7.6.2
|
||||||
buildCount=0
|
buildCount=4
|
||||||
baseBetaVersion=15.2.5
|
baseBetaVersion=7.6.3
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/MyAESTheme"
|
android:theme="@style/WinBoll.SupportThemeNoActionBar"
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true">
|
||||||
android:networkSecurityConfig="@xml/network_security_config">
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
@@ -31,8 +30,6 @@
|
|||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="4.0"/>
|
android:value="4.0"/>
|
||||||
|
|
||||||
<activity android:name=".AboutActivity"/>
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -1,91 +0,0 @@
|
|||||||
package cc.winboll.studio.aes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/24 23:52:29
|
|
||||||
* @Describe AES应用介绍窗口
|
|
||||||
*/
|
|
||||||
import android.app.Activity;
|
|
||||||
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 static final String TAG = "AboutActivity";
|
|
||||||
|
|
||||||
Context mContext;
|
|
||||||
Toolbar mToolbar;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
mContext = this;
|
|
||||||
setContentView(R.layout.activity_about);
|
|
||||||
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(mToolbar);
|
|
||||||
mToolbar.setSubtitle(TAG);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
AboutView aboutView = CreateAboutView();
|
|
||||||
// 在 Activity 的 onCreate 或其他生命周期方法中调用
|
|
||||||
// LinearLayout layout = new LinearLayout(this);
|
|
||||||
// layout.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
// // 创建布局参数(宽度和高度)
|
|
||||||
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
|
||||||
// ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
// ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
// );
|
|
||||||
// addContentView(aboutView, params);
|
|
||||||
|
|
||||||
LinearLayout layout = findViewById(R.id.aboutviewroot_ll);
|
|
||||||
// 创建布局参数(宽度和高度)
|
|
||||||
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
);
|
|
||||||
layout.addView(aboutView, params);
|
|
||||||
|
|
||||||
GlobalApplication.getWinBollActivityManager().add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
GlobalApplication.getWinBollActivityManager().registeRemove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AboutView CreateAboutView() {
|
|
||||||
String szBranchName = "aes";
|
|
||||||
APPInfo appInfo = new APPInfo();
|
|
||||||
appInfo.setAppName("AES");
|
|
||||||
appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll);
|
|
||||||
appInfo.setAppDescription("AES Description");
|
|
||||||
appInfo.setAppGitName("APP");
|
|
||||||
appInfo.setAppGitOwner("Studio");
|
|
||||||
appInfo.setAppGitAPPBranch(szBranchName);
|
|
||||||
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
|
|
||||||
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=AES");
|
|
||||||
appInfo.setAppAPKName("AES");
|
|
||||||
appInfo.setAppAPKFolderName("AES");
|
|
||||||
return new AboutView(mContext, appInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,8 +6,6 @@ package cc.winboll.studio.aes;
|
|||||||
* @Describe AES应用类
|
* @Describe AES应用类
|
||||||
*/
|
*/
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
|
|
||||||
|
|
||||||
public class App extends GlobalApplication {
|
public class App extends GlobalApplication {
|
||||||
|
|
||||||
@@ -16,8 +14,7 @@ public class App extends GlobalApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
ToastUtils.init(this);
|
//setIsDebug(BuildConfig.DEBUG);
|
||||||
//ToastUtils.show("App onCreate");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,193 +5,12 @@ package cc.winboll.studio.aes;
|
|||||||
* @Date 2024/06/13 19:05:52
|
* @Date 2024/06/13 19:05:52
|
||||||
* @Describe 应用主窗口
|
* @Describe 应用主窗口
|
||||||
*/
|
*/
|
||||||
import android.app.Activity;
|
import cc.winboll.studio.libaes.unittests.LibraryActivity;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import cc.winboll.studio.aes.R;
|
|
||||||
import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity;
|
|
||||||
import cc.winboll.studio.libaes.beans.DrawerMenuBean;
|
|
||||||
import cc.winboll.studio.libaes.dialogs.LocalFileSelectDialog;
|
|
||||||
import cc.winboll.studio.libaes.dialogs.StoragePathDialog;
|
|
||||||
import cc.winboll.studio.libaes.unittests.SecondaryLibraryActivity;
|
|
||||||
import cc.winboll.studio.libaes.unittests.TestAButtonFragment;
|
|
||||||
import cc.winboll.studio.libaes.unittests.TestASupportToolbarActivity;
|
|
||||||
import cc.winboll.studio.libaes.unittests.TestAToolbarActivity;
|
|
||||||
import cc.winboll.studio.libaes.unittests.TestDrawerFragmentActivity;
|
|
||||||
import cc.winboll.studio.libaes.unittests.TestViewPageFragment;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
|
||||||
import com.a4455jkjh.colorpicker.ColorPickerDialog;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class MainActivity extends DrawerFragmentActivity implements IWinBollActivity {
|
public class MainActivity extends LibraryActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "MainActivity";
|
||||||
public static final String TAG = "MainActivity";
|
|
||||||
|
|
||||||
TestAButtonFragment mTestAButtonFragment;
|
|
||||||
TestViewPageFragment mTestViewPageFragment;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
if (mTestAButtonFragment == null) {
|
|
||||||
mTestAButtonFragment = new TestAButtonFragment();
|
|
||||||
addFragment(mTestAButtonFragment);
|
|
||||||
}
|
|
||||||
showFragment(mTestAButtonFragment);
|
|
||||||
//setSubtitle(TAG);
|
|
||||||
//ToastUtils.show("onCreate");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initDrawerMenuItemList(ArrayList<DrawerMenuBean> listDrawerMenu) {
|
|
||||||
super.initDrawerMenuItemList(listDrawerMenu);
|
|
||||||
LogUtils.d(TAG, "initDrawerMenuItemList");
|
|
||||||
//listDrawerMenu.clear();
|
|
||||||
// 添加抽屉菜单项
|
|
||||||
listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestAButtonFragment.TAG));
|
|
||||||
listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestViewPageFragment.TAG));
|
|
||||||
notifyDrawerMenuDataChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reinitDrawerMenuItemList(ArrayList<DrawerMenuBean> listDrawerMenu) {
|
|
||||||
super.reinitDrawerMenuItemList(listDrawerMenu);
|
|
||||||
LogUtils.d(TAG, "reinitDrawerMenuItemList");
|
|
||||||
//listDrawerMenu.clear();
|
|
||||||
// 添加抽屉菜单项
|
|
||||||
listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestAButtonFragment.TAG));
|
|
||||||
listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestViewPageFragment.TAG));
|
|
||||||
notifyDrawerMenuDataChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DrawerFragmentActivity.ActivityType initActivityType() {
|
|
||||||
return DrawerFragmentActivity.ActivityType.Main;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_library, menu);
|
|
||||||
if(App.isDebuging()) {
|
|
||||||
getMenuInflater().inflate(cc.winboll.studio.libapputils.R.menu.toolbar_studio_debug, menu);
|
|
||||||
}
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
super.onItemClick(parent, view, position, id);
|
|
||||||
switch (position) {
|
|
||||||
case 0 : {
|
|
||||||
if (mTestAButtonFragment == null) {
|
|
||||||
mTestAButtonFragment = new TestAButtonFragment();
|
|
||||||
addFragment(mTestAButtonFragment);
|
|
||||||
}
|
|
||||||
showFragment(mTestAButtonFragment);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1 : {
|
|
||||||
if (mTestViewPageFragment == null) {
|
|
||||||
mTestViewPageFragment = new TestViewPageFragment();
|
|
||||||
addFragment(mTestViewPageFragment);
|
|
||||||
}
|
|
||||||
showFragment(mTestViewPageFragment);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
int nItemId = item.getItemId();
|
|
||||||
// if (item.getItemId() == R.id.item_log) {
|
|
||||||
// WinBollActivityManager.getInstance(this).startWinBollActivity(getApplicationContext(), LogActivity.class);
|
|
||||||
// } else
|
|
||||||
if (nItemId == R.id.item_atoast) {
|
|
||||||
Toast.makeText(getApplication(), "item_testatoast", Toast.LENGTH_SHORT).show();
|
|
||||||
} else if (nItemId == R.id.item_atoolbar) {
|
|
||||||
Intent intent = new Intent(this, TestAToolbarActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
|
|
||||||
} else if (nItemId == R.id.item_asupporttoolbar) {
|
|
||||||
Intent intent = new Intent(this, TestASupportToolbarActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
|
|
||||||
} else if (nItemId == R.id.item_colordialog) {
|
|
||||||
ColorPickerDialog dlg = new ColorPickerDialog(this, getResources().getColor(R.color.colorPrimary));
|
|
||||||
dlg.setOnColorChangedListener(new com.a4455jkjh.colorpicker.view.OnColorChangedListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeColorChanged() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onColorChanged(int color) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterColorChanged() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
dlg.show();
|
|
||||||
|
|
||||||
} else if (nItemId == R.id.item_dialogstoragepath) {
|
|
||||||
final StoragePathDialog dialog = new StoragePathDialog(this, 0);
|
|
||||||
dialog.setOnOKClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialog.show();
|
|
||||||
|
|
||||||
} else if (nItemId == R.id.item_localfileselectdialog) {
|
|
||||||
final LocalFileSelectDialog dialog = new LocalFileSelectDialog(this);
|
|
||||||
dialog.setOnOKClickListener(new LocalFileSelectDialog.OKClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onOKClick(String sz) {
|
|
||||||
Toast.makeText(getApplication(), sz, Toast.LENGTH_SHORT).show();
|
|
||||||
//dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
} else if (nItemId == R.id.item_secondarylibraryactivity) {
|
|
||||||
Intent intent = new Intent(this, SecondaryLibraryActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
} else if (nItemId == R.id.item_drawerfragmentactivity) {
|
|
||||||
Intent intent = new Intent(this, TestDrawerFragmentActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
else if (nItemId == R.id.item_about) {
|
|
||||||
Intent intent = new Intent(this, AboutActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/toolbar"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/aboutviewroot_ll"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="colorPrimary">#FF00B322</color>
|
|
||||||
<color name="colorPrimaryDark">#FF005C12</color>
|
|
||||||
<color name="colorAccent">#FF8DFFA2</color>
|
|
||||||
<color name="colorText">#FFFFFB8D</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="MyAESTheme" parent="AESTheme">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<network-security-config>
|
|
||||||
<domain-config cleartextTrafficPermitted="true">
|
|
||||||
<domain includeSubdomains="true">winboll.cc</domain>
|
|
||||||
</domain-config>
|
|
||||||
</network-security-config>
|
|
||||||
1
androiddemo/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
apply from: '../.winboll/winboll_app_build.gradle'
|
|
||||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
|
||||||
|
|
||||||
def genVersionName(def versionName){
|
|
||||||
// 检查编译标志位配置
|
|
||||||
assert (winbollBuildProps['stageCount'] != null)
|
|
||||||
assert (winbollBuildProps['baseVersion'] != null)
|
|
||||||
// 保存基础版本号
|
|
||||||
winbollBuildProps.setProperty("baseVersion", "${versionName}");
|
|
||||||
//保存编译标志配置
|
|
||||||
FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile)
|
|
||||||
winbollBuildProps.store(fos, "${winbollBuildPropsDesc}");
|
|
||||||
fos.close();
|
|
||||||
|
|
||||||
// 返回编译版本号
|
|
||||||
return "${versionName}." + winbollBuildProps['stageCount']
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 32
|
|
||||||
buildToolsVersion "32.0.0"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "cc.winboll.studio.androiddemo"
|
|
||||||
minSdkVersion 24
|
|
||||||
targetSdkVersion 29
|
|
||||||
versionCode 1
|
|
||||||
// versionName 更新后需要手动设置
|
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
|
||||||
versionName "15.0"
|
|
||||||
if(true) {
|
|
||||||
versionName = genVersionName("${versionName}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
|
|
||||||
// Android 类库
|
|
||||||
//api 'com.android.support:appcompat-v7:28.0.0'
|
|
||||||
api('com.android.support:appcompat-v7:28.0.0'){
|
|
||||||
exclude group: "com.android.support", module: "support-vector-drawable"
|
|
||||||
}
|
|
||||||
// https://mvnrepository.com/artifact/com.android.support/support-compat
|
|
||||||
api 'com.android.support:support-compat:28.0.0' // 保留原有依赖(可选)
|
|
||||||
// https://mvnrepository.com/artifact/com.android.support/support-v4
|
|
||||||
api 'com.android.support:support-v4:28.0.0'
|
|
||||||
// https://mvnrepository.com/artifact/com.android.support/support-media-compat
|
|
||||||
api 'com.android.support:support-media-compat:28.0.0'
|
|
||||||
// https://mvnrepository.com/artifact/com.android.support/support-core-utils
|
|
||||||
api 'com.android.support:support-core-utils:28.0.0'
|
|
||||||
// https://mvnrepository.com/artifact/com.android.support/support-core-ui
|
|
||||||
api 'com.android.support:support-core-ui:28.0.0'
|
|
||||||
// https://mvnrepository.com/artifact/com.android.support/support-fragment
|
|
||||||
api 'com.android.support:support-fragment:28.0.0'
|
|
||||||
// https://mvnrepository.com/artifact/com.android.support/recyclerview-v7
|
|
||||||
api 'com.android.support:recyclerview-v7:28.0.0'
|
|
||||||
|
|
||||||
api 'cc.winboll.studio:libapputils:15.2.1'
|
|
||||||
api 'cc.winboll.studio:libappbase:15.2.2'
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
|
||||||
#Sat Mar 29 04:34:14 GMT 2025
|
|
||||||
stageCount=0
|
|
||||||
libraryProject=
|
|
||||||
baseVersion=15.0
|
|
||||||
publishVersion=15.0.0
|
|
||||||
buildCount=15
|
|
||||||
baseBetaVersion=15.0.1
|
|
||||||
21
androiddemo/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools" >
|
|
||||||
|
|
||||||
<application>
|
|
||||||
|
|
||||||
<!-- Put flavor specific code here -->
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
|
|
||||||
<string name="app_name">Android Demo +</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
package="cc.winboll.studio.androiddemo">
|
|
||||||
|
|
||||||
<application
|
|
||||||
tools:replace="android:appComponentFactory"
|
|
||||||
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
|
|
||||||
android:icon="@drawable/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/AppTheme"
|
|
||||||
android:resizeableActivity="true"
|
|
||||||
android:name=".App">
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.max_aspect"
|
|
||||||
android:value="4.0"/>
|
|
||||||
|
|
||||||
<activity android:name=".GlobalApplication$CrashActivity"/>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,334 +0,0 @@
|
|||||||
package cc.winboll.studio.androiddemo;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.ClipData;
|
|
||||||
import android.content.ClipboardManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.HorizontalScrollView;
|
|
||||||
import android.widget.ScrollView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.lang.Thread.UncaughtExceptionHandler;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class App extends GlobalApplication {
|
|
||||||
|
|
||||||
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
//CrashHandler.getInstance().registerGlobal(this);
|
|
||||||
//CrashHandler.getInstance().registerPart(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(InputStream input, OutputStream output) throws IOException {
|
|
||||||
byte[] buf = new byte[1024 * 8];
|
|
||||||
int len;
|
|
||||||
while ((len = input.read(buf)) != -1) {
|
|
||||||
output.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(File file, byte[] data) throws IOException {
|
|
||||||
File parent = file.getParentFile();
|
|
||||||
if (parent != null && !parent.exists()) parent.mkdirs();
|
|
||||||
|
|
||||||
ByteArrayInputStream input = new ByteArrayInputStream(data);
|
|
||||||
FileOutputStream output = new FileOutputStream(file);
|
|
||||||
try {
|
|
||||||
write(input, output);
|
|
||||||
} finally {
|
|
||||||
closeIO(input, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toString(InputStream input) throws IOException {
|
|
||||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
||||||
write(input, output);
|
|
||||||
try {
|
|
||||||
return output.toString("UTF-8");
|
|
||||||
} finally {
|
|
||||||
closeIO(input, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void closeIO(Closeable... closeables) {
|
|
||||||
for (Closeable closeable : closeables) {
|
|
||||||
try {
|
|
||||||
if (closeable != null) closeable.close();
|
|
||||||
} catch (IOException ignored) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CrashHandler {
|
|
||||||
|
|
||||||
public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler();
|
|
||||||
|
|
||||||
private static CrashHandler sInstance;
|
|
||||||
|
|
||||||
private PartCrashHandler mPartCrashHandler;
|
|
||||||
|
|
||||||
public static CrashHandler getInstance() {
|
|
||||||
if (sInstance == null) {
|
|
||||||
sInstance = new CrashHandler();
|
|
||||||
}
|
|
||||||
return sInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerGlobal(Context context) {
|
|
||||||
registerGlobal(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerGlobal(Context context, String crashDir) {
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregister() {
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerPart(Context context) {
|
|
||||||
unregisterPart(context);
|
|
||||||
mPartCrashHandler = new PartCrashHandler(context.getApplicationContext());
|
|
||||||
MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregisterPart(Context context) {
|
|
||||||
if (mPartCrashHandler != null) {
|
|
||||||
mPartCrashHandler.isRunning.set(false);
|
|
||||||
mPartCrashHandler = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class PartCrashHandler implements Runnable {
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
public AtomicBoolean isRunning = new AtomicBoolean(true);
|
|
||||||
|
|
||||||
public PartCrashHandler(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
while (isRunning.get()) {
|
|
||||||
try {
|
|
||||||
Looper.loop();
|
|
||||||
} catch (final Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
if (isRunning.get()) {
|
|
||||||
MAIN_HANDLER.post(new Runnable(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (e instanceof RuntimeException) {
|
|
||||||
throw (RuntimeException)e;
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler {
|
|
||||||
|
|
||||||
private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss");
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
private final File mCrashDir;
|
|
||||||
|
|
||||||
public UncaughtExceptionHandlerImpl(Context context, String crashDir) {
|
|
||||||
this.mContext = context;
|
|
||||||
this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void uncaughtException(Thread thread, Throwable throwable) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
String log = buildLog(throwable);
|
|
||||||
writeLog(log);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent(mContext, CrashActivity.class);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, log);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
writeLog(e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
throwable.printStackTrace();
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
System.exit(0);
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildLog(Throwable throwable) {
|
|
||||||
String time = DATE_FORMAT.format(new Date());
|
|
||||||
|
|
||||||
String versionName = "unknown";
|
|
||||||
long versionCode = 0;
|
|
||||||
try {
|
|
||||||
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
|
|
||||||
versionName = packageInfo.versionName;
|
|
||||||
versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode;
|
|
||||||
} catch (Throwable ignored) {}
|
|
||||||
|
|
||||||
LinkedHashMap<String, String> head = new LinkedHashMap<String, String>();
|
|
||||||
head.put("Time Of Crash", time);
|
|
||||||
head.put("Device", String.format("%s, %s", Build.MANUFACTURER, Build.MODEL));
|
|
||||||
head.put("Android Version", String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
|
|
||||||
head.put("App Version", String.format("%s (%d)", versionName, versionCode));
|
|
||||||
head.put("Kernel", getKernel());
|
|
||||||
head.put("Support Abis", Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_ABIS != null ? Arrays.toString(Build.SUPPORTED_ABIS): "unknown");
|
|
||||||
head.put("Fingerprint", Build.FINGERPRINT);
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
for (String key : head.keySet()) {
|
|
||||||
if (builder.length() != 0) builder.append("\n");
|
|
||||||
builder.append(key);
|
|
||||||
builder.append(" : ");
|
|
||||||
builder.append(head.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append("\n\n");
|
|
||||||
builder.append(Log.getStackTraceString(throwable));
|
|
||||||
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeLog(String log) {
|
|
||||||
String time = DATE_FORMAT.format(new Date());
|
|
||||||
File file = new File(mCrashDir, "crash_" + time + ".txt");
|
|
||||||
try {
|
|
||||||
write(file, log.getBytes("UTF-8"));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getKernel() {
|
|
||||||
try {
|
|
||||||
return App.toString(new FileInputStream("/proc/version")).trim();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
return e.getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class CrashActivity extends Activity {
|
|
||||||
|
|
||||||
private String mLog;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
setTheme(android.R.style.Theme_DeviceDefault);
|
|
||||||
setTitle("App Crash");
|
|
||||||
|
|
||||||
mLog = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
|
||||||
|
|
||||||
ScrollView contentView = new ScrollView(this);
|
|
||||||
contentView.setFillViewport(true);
|
|
||||||
|
|
||||||
HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
|
|
||||||
|
|
||||||
TextView textView = new TextView(this);
|
|
||||||
int padding = dp2px(16);
|
|
||||||
textView.setPadding(padding, padding, padding, padding);
|
|
||||||
textView.setText(mLog);
|
|
||||||
textView.setTextIsSelectable(true);
|
|
||||||
textView.setTypeface(Typeface.DEFAULT);
|
|
||||||
textView.setLinksClickable(true);
|
|
||||||
|
|
||||||
horizontalScrollView.addView(textView);
|
|
||||||
contentView.addView(horizontalScrollView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
|
||||||
|
|
||||||
setContentView(contentView);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void restart() {
|
|
||||||
Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
|
||||||
if (intent != null) {
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
finish();
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int dp2px(float dpValue) {
|
|
||||||
final float scale = Resources.getSystem().getDisplayMetrics().density;
|
|
||||||
return (int) (dpValue * scale + 0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
menu.add(0, android.R.id.copy, 0, android.R.string.copy)
|
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case android.R.id.copy:
|
|
||||||
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
|
||||||
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package cc.winboll.studio.androiddemo;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import cc.winboll.studio.libappbase.LogView;
|
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
|
||||||
|
|
||||||
LogView mLogView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
mLogView = findViewById(R.id.logview);
|
|
||||||
mLogView.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
mLogView.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:gravity="center_vertical|center_horizontal"
|
|
||||||
android:layout_weight="1.0">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Android Demo"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1.0">
|
|
||||||
|
|
||||||
<cc.winboll.studio.libappbase.LogView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Text"
|
|
||||||
android:id="@+id/logview"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="colorPrimary">#009688</color>
|
|
||||||
<color name="colorPrimaryDark">#00796B</color>
|
|
||||||
<color name="colorAccent">#FF9800</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">Android Demo</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools" >
|
|
||||||
|
|
||||||
<application>
|
|
||||||
|
|
||||||
<!-- Put flavor specific code here -->
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Put flavor specific strings here -->
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
1
androidxdemo/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
apply from: '../.winboll/winboll_app_build.gradle'
|
|
||||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
|
||||||
|
|
||||||
def genVersionName(def versionName){
|
|
||||||
// 检查编译标志位配置
|
|
||||||
assert (winbollBuildProps['stageCount'] != null)
|
|
||||||
assert (winbollBuildProps['baseVersion'] != null)
|
|
||||||
// 保存基础版本号
|
|
||||||
winbollBuildProps.setProperty("baseVersion", "${versionName}");
|
|
||||||
//保存编译标志配置
|
|
||||||
FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile)
|
|
||||||
winbollBuildProps.store(fos, "${winbollBuildPropsDesc}");
|
|
||||||
fos.close();
|
|
||||||
|
|
||||||
// 返回编译版本号
|
|
||||||
return "${versionName}." + winbollBuildProps['stageCount']
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 32
|
|
||||||
buildToolsVersion "32.0.0"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "cc.winboll.studio.androidxdemo"
|
|
||||||
minSdkVersion 24
|
|
||||||
targetSdkVersion 29
|
|
||||||
versionCode 1
|
|
||||||
// versionName 更新后需要手动设置
|
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
|
||||||
versionName "15.0"
|
|
||||||
if(true) {
|
|
||||||
versionName = genVersionName("${versionName}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
|
|
||||||
// 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.4'
|
|
||||||
api 'cc.winboll.studio:libapputils:15.2.1'
|
|
||||||
api 'cc.winboll.studio:libappbase:15.2.2'
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
|
||||||
#Mon Mar 31 11:42:18 GMT 2025
|
|
||||||
stageCount=0
|
|
||||||
libraryProject=
|
|
||||||
baseVersion=15.0
|
|
||||||
publishVersion=15.0.0
|
|
||||||
buildCount=13
|
|
||||||
baseBetaVersion=15.0.1
|
|
||||||
21
androidxdemo/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools" >
|
|
||||||
|
|
||||||
<application>
|
|
||||||
|
|
||||||
<!-- Put flavor specific code here -->
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">AndroidX Demo +</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="cc.winboll.studio.androidxdemo">
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/MyAppTheme"
|
|
||||||
android:resizeableActivity="true"
|
|
||||||
android:name=".App">
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:label="@string/app_name">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.max_aspect"
|
|
||||||
android:value="4.0"/>
|
|
||||||
|
|
||||||
<activity android:name=".GlobalApplication$CrashActivity"/>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,334 +0,0 @@
|
|||||||
package cc.winboll.studio.androidxdemo;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.ClipData;
|
|
||||||
import android.content.ClipboardManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.HorizontalScrollView;
|
|
||||||
import android.widget.ScrollView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.lang.Thread.UncaughtExceptionHandler;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class App extends GlobalApplication {
|
|
||||||
|
|
||||||
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
//CrashHandler.getInstance().registerGlobal(this);
|
|
||||||
//CrashHandler.getInstance().registerPart(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(InputStream input, OutputStream output) throws IOException {
|
|
||||||
byte[] buf = new byte[1024 * 8];
|
|
||||||
int len;
|
|
||||||
while ((len = input.read(buf)) != -1) {
|
|
||||||
output.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(File file, byte[] data) throws IOException {
|
|
||||||
File parent = file.getParentFile();
|
|
||||||
if (parent != null && !parent.exists()) parent.mkdirs();
|
|
||||||
|
|
||||||
ByteArrayInputStream input = new ByteArrayInputStream(data);
|
|
||||||
FileOutputStream output = new FileOutputStream(file);
|
|
||||||
try {
|
|
||||||
write(input, output);
|
|
||||||
} finally {
|
|
||||||
closeIO(input, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toString(InputStream input) throws IOException {
|
|
||||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
||||||
write(input, output);
|
|
||||||
try {
|
|
||||||
return output.toString("UTF-8");
|
|
||||||
} finally {
|
|
||||||
closeIO(input, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void closeIO(Closeable... closeables) {
|
|
||||||
for (Closeable closeable : closeables) {
|
|
||||||
try {
|
|
||||||
if (closeable != null) closeable.close();
|
|
||||||
} catch (IOException ignored) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CrashHandler {
|
|
||||||
|
|
||||||
public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler();
|
|
||||||
|
|
||||||
private static CrashHandler sInstance;
|
|
||||||
|
|
||||||
private PartCrashHandler mPartCrashHandler;
|
|
||||||
|
|
||||||
public static CrashHandler getInstance() {
|
|
||||||
if (sInstance == null) {
|
|
||||||
sInstance = new CrashHandler();
|
|
||||||
}
|
|
||||||
return sInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerGlobal(Context context) {
|
|
||||||
registerGlobal(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerGlobal(Context context, String crashDir) {
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregister() {
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerPart(Context context) {
|
|
||||||
unregisterPart(context);
|
|
||||||
mPartCrashHandler = new PartCrashHandler(context.getApplicationContext());
|
|
||||||
MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregisterPart(Context context) {
|
|
||||||
if (mPartCrashHandler != null) {
|
|
||||||
mPartCrashHandler.isRunning.set(false);
|
|
||||||
mPartCrashHandler = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class PartCrashHandler implements Runnable {
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
public AtomicBoolean isRunning = new AtomicBoolean(true);
|
|
||||||
|
|
||||||
public PartCrashHandler(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
while (isRunning.get()) {
|
|
||||||
try {
|
|
||||||
Looper.loop();
|
|
||||||
} catch (final Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
if (isRunning.get()) {
|
|
||||||
MAIN_HANDLER.post(new Runnable(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (e instanceof RuntimeException) {
|
|
||||||
throw (RuntimeException)e;
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler {
|
|
||||||
|
|
||||||
private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss");
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
private final File mCrashDir;
|
|
||||||
|
|
||||||
public UncaughtExceptionHandlerImpl(Context context, String crashDir) {
|
|
||||||
this.mContext = context;
|
|
||||||
this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void uncaughtException(Thread thread, Throwable throwable) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
String log = buildLog(throwable);
|
|
||||||
writeLog(log);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent(mContext, CrashActivity.class);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, log);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
writeLog(e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
throwable.printStackTrace();
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
System.exit(0);
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildLog(Throwable throwable) {
|
|
||||||
String time = DATE_FORMAT.format(new Date());
|
|
||||||
|
|
||||||
String versionName = "unknown";
|
|
||||||
long versionCode = 0;
|
|
||||||
try {
|
|
||||||
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
|
|
||||||
versionName = packageInfo.versionName;
|
|
||||||
versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode;
|
|
||||||
} catch (Throwable ignored) {}
|
|
||||||
|
|
||||||
LinkedHashMap<String, String> head = new LinkedHashMap<String, String>();
|
|
||||||
head.put("Time Of Crash", time);
|
|
||||||
head.put("Device", String.format("%s, %s", Build.MANUFACTURER, Build.MODEL));
|
|
||||||
head.put("Android Version", String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
|
|
||||||
head.put("App Version", String.format("%s (%d)", versionName, versionCode));
|
|
||||||
head.put("Kernel", getKernel());
|
|
||||||
head.put("Support Abis", Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_ABIS != null ? Arrays.toString(Build.SUPPORTED_ABIS): "unknown");
|
|
||||||
head.put("Fingerprint", Build.FINGERPRINT);
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
for (String key : head.keySet()) {
|
|
||||||
if (builder.length() != 0) builder.append("\n");
|
|
||||||
builder.append(key);
|
|
||||||
builder.append(" : ");
|
|
||||||
builder.append(head.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append("\n\n");
|
|
||||||
builder.append(Log.getStackTraceString(throwable));
|
|
||||||
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeLog(String log) {
|
|
||||||
String time = DATE_FORMAT.format(new Date());
|
|
||||||
File file = new File(mCrashDir, "crash_" + time + ".txt");
|
|
||||||
try {
|
|
||||||
write(file, log.getBytes("UTF-8"));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getKernel() {
|
|
||||||
try {
|
|
||||||
return App.toString(new FileInputStream("/proc/version")).trim();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
return e.getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class CrashActivity extends Activity {
|
|
||||||
|
|
||||||
private String mLog;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
setTheme(android.R.style.Theme_DeviceDefault);
|
|
||||||
setTitle("App Crash");
|
|
||||||
|
|
||||||
mLog = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
|
||||||
|
|
||||||
ScrollView contentView = new ScrollView(this);
|
|
||||||
contentView.setFillViewport(true);
|
|
||||||
|
|
||||||
HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
|
|
||||||
|
|
||||||
TextView textView = new TextView(this);
|
|
||||||
int padding = dp2px(16);
|
|
||||||
textView.setPadding(padding, padding, padding, padding);
|
|
||||||
textView.setText(mLog);
|
|
||||||
textView.setTextIsSelectable(true);
|
|
||||||
textView.setTypeface(Typeface.DEFAULT);
|
|
||||||
textView.setLinksClickable(true);
|
|
||||||
|
|
||||||
horizontalScrollView.addView(textView);
|
|
||||||
contentView.addView(horizontalScrollView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
|
||||||
|
|
||||||
setContentView(contentView);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void restart() {
|
|
||||||
Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
|
||||||
if (intent != null) {
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
finish();
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int dp2px(float dpValue) {
|
|
||||||
final float scale = Resources.getSystem().getDisplayMetrics().density;
|
|
||||||
return (int) (dpValue * scale + 0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
menu.add(0, android.R.id.copy, 0, android.R.string.copy)
|
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case android.R.id.copy:
|
|
||||||
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
|
||||||
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package cc.winboll.studio.androidxdemo;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import cc.winboll.studio.libappbase.LogView;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
LogView mLogView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
|
|
||||||
mLogView = findViewById(R.id.logview);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
mLogView.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportHeight="108"
|
|
||||||
android:viewportWidth="108">
|
|
||||||
<path
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
|
||||||
android:strokeColor="#00000000"
|
|
||||||
android:strokeWidth="1">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="78.5885"
|
|
||||||
android:endY="90.9159"
|
|
||||||
android:startX="48.7653"
|
|
||||||
android:startY="61.0927"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#44000000"
|
|
||||||
android:offset="0.0" />
|
|
||||||
<item
|
|
||||||
android:color="#00000000"
|
|
||||||
android:offset="1.0" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:fillType="nonZero"
|
|
||||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
|
||||||
android:strokeColor="#00000000"
|
|
||||||
android:strokeWidth="1" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportHeight="108"
|
|
||||||
android:viewportWidth="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="#26A69A"
|
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M9,0L9,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,0L19,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,0L29,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,0L39,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,0L49,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,0L59,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,0L69,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,0L79,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M89,0L89,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M99,0L99,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,9L108,9"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,19L108,19"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,29L108,29"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,39L108,39"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,49L108,49"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,59L108,59"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,69L108,69"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,79L108,79"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,89L108,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,99L108,99"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,29L89,29"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,39L89,39"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,49L89,49"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,59L89,59"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,69L89,69"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,79L89,79"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,19L29,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,19L39,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,19L49,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,19L59,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,19L69,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,19L79,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:gravity="center_vertical|center_horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="AndroidX Demo"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1.0">
|
|
||||||
|
|
||||||
<cc.winboll.studio.libappbase.LogView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:id="@+id/logview"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 15 KiB |
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="colorPrimary">#009688</color>
|
|
||||||
<color name="colorPrimaryDark">#00796B</color>
|
|
||||||
<color name="colorAccent">#FF9800</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<string name="app_name">AndroidX Demo</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools" >
|
|
||||||
|
|
||||||
<application>
|
|
||||||
|
|
||||||
<!-- Put flavor specific code here -->
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Put flavor specific strings here -->
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
0
app/app.py
Normal file
0
app/app.sh
Normal file
0
app/app.txt
Normal file
@@ -19,17 +19,17 @@ def genVersionName(def versionName){
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 32
|
compileSdkVersion 32
|
||||||
buildToolsVersion "32.0.0"
|
buildToolsVersion "33.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.app"
|
applicationId "cc.winboll.studio.app"
|
||||||
minSdkVersion 24
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.0"
|
versionName "1.8"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@@ -41,32 +41,14 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api project(':winboll-shared')
|
||||||
// SSH
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
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.4'
|
|
||||||
api 'cc.winboll.studio:libapputils:15.2.1'
|
|
||||||
api 'cc.winboll.studio:libappbase:15.2.2'
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Apr 01 13:50:28 HKT 2025
|
#Sun Jan 05 07:55:24 HKT 2025
|
||||||
stageCount=2
|
stageCount=17
|
||||||
libraryProject=
|
libraryProject=winboll-shared
|
||||||
baseVersion=15.0
|
baseVersion=1.8
|
||||||
publishVersion=15.0.1
|
publishVersion=1.8.16
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.0.2
|
baseBetaVersion=1.8.17
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">APP+</string>
|
<string name="app_name">WinBoll-APP+</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_winboll"
|
android:icon="@drawable/ic_winboll"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AESTheme"
|
android:theme="@style/WinBoll.SupportThemeNoActionBar"
|
||||||
android:supportsRtl="true">
|
android:supportsRtl="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -42,7 +42,6 @@
|
|||||||
|
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
<activity android:name=".AboutActivity"/>
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
package cc.winboll.studio.app;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/24 23:52:29
|
|
||||||
* @Describe 应用介绍窗口
|
|
||||||
*/
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import cc.winboll.studio.app.R;
|
|
||||||
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 static final String TAG = "AboutActivity";
|
|
||||||
|
|
||||||
Context mContext;
|
|
||||||
Toolbar mToolbar;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
mContext = this;
|
|
||||||
setContentView(R.layout.activity_about);
|
|
||||||
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(mToolbar);
|
|
||||||
mToolbar.setSubtitle(TAG);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
AboutView aboutView = CreateAboutView();
|
|
||||||
// 在 Activity 的 onCreate 或其他生命周期方法中调用
|
|
||||||
// LinearLayout layout = new LinearLayout(this);
|
|
||||||
// layout.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
// // 创建布局参数(宽度和高度)
|
|
||||||
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
|
||||||
// ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
// ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
// );
|
|
||||||
// addContentView(aboutView, params);
|
|
||||||
|
|
||||||
LinearLayout layout = findViewById(R.id.aboutviewroot_ll);
|
|
||||||
// 创建布局参数(宽度和高度)
|
|
||||||
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
);
|
|
||||||
layout.addView(aboutView, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AboutView CreateAboutView() {
|
|
||||||
String szBranchName = "app";
|
|
||||||
APPInfo appInfo = new APPInfo();
|
|
||||||
appInfo.setAppName("APP");
|
|
||||||
appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll);
|
|
||||||
appInfo.setAppDescription("WinBoll APP");
|
|
||||||
appInfo.setAppGitName("APP");
|
|
||||||
appInfo.setAppGitOwner("Studio");
|
|
||||||
appInfo.setAppGitAPPBranch(szBranchName);
|
|
||||||
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
|
|
||||||
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=APP");
|
|
||||||
appInfo.setAppAPKName("APP");
|
|
||||||
appInfo.setAppAPKFolderName("APP");
|
|
||||||
return new AboutView(mContext, appInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,26 +5,20 @@ package cc.winboll.studio.app;
|
|||||||
* @Date 2024/12/08 15:10:51
|
* @Date 2024/12/08 15:10:51
|
||||||
* @Describe 全局应用类
|
* @Describe 全局应用类
|
||||||
*/
|
*/
|
||||||
import android.view.Gravity;
|
import cc.winboll.studio.shared.app.WinBollApplication;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.shared.log.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.winboll.WinBollActivityManager;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
|
|
||||||
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() {
|
||||||
|
// 必须在调用基类前设置应用调试标志,
|
||||||
|
// 这样可以预先设置日志与数据的存储根目录。
|
||||||
|
//setIsDebug(BuildConfig.DEBUG);
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
LogUtils.d(TAG, "onCreate");
|
||||||
// 初始化 Toast 框架
|
|
||||||
ToastUtils.init(this);
|
|
||||||
// 设置 Toast 布局样式
|
|
||||||
//ToastUtils.setView(R.layout.toast_custom_view);
|
|
||||||
//ToastUtils.setStyle(new WhiteToastStyle());
|
|
||||||
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
|
|
||||||
|
|
||||||
getWinBollActivityManager().setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Service);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,98 @@
|
|||||||
package cc.winboll.studio.app;
|
package cc.winboll.studio.app;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import cc.winboll.studio.app.R;
|
import cc.winboll.studio.shared.app.WinBollActivity;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.shared.app.WinBollActivityManager;
|
||||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
import cc.winboll.studio.shared.app.WinBollApplication;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
import cc.winboll.studio.shared.log.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.winboll.WinBollActivityManager;
|
import cc.winboll.studio.shared.util.UriUtils;
|
||||||
|
import cc.winboll.studio.shared.view.StringToQrCodeView;
|
||||||
|
import cc.winboll.studio.shared.view.YesNoAlertDialog;
|
||||||
|
import cc.winboll.studio.unittest.UnitTestActivity;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
final public class MainActivity extends WinBollActivity implements IWinBollActivity {
|
final public class MainActivity extends WinBollActivity {
|
||||||
|
|
||||||
public static final String TAG = "MainActivity";
|
public static final String TAG = "MainActivity";
|
||||||
|
|
||||||
Toolbar mToolbar;
|
public static final int REQUEST_HOME_ACTIVITY = 0;
|
||||||
|
public static final int REQUEST_ABOUT_ACTIVITY = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Activity getActivity() {
|
protected boolean isEnableDisplayHomeAsUp() {
|
||||||
return this;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
// 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回
|
||||||
|
if (prosessIntents(getIntent())) return;
|
||||||
|
// 以下正常创建主窗口
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
// 设置 WinBoll 应用 UI 类型
|
||||||
|
WinBollApplication.setWinBollUI_TYPE(WinBollApplication.WinBollUI_TYPE.Aplication);
|
||||||
|
//ToastUtils.show("WinBollUI_TYPE " + WinBollApplication.getWinBollUI_TYPE());
|
||||||
|
LogUtils.d(TAG, "BuildConfig.DEBUG : " + Boolean.toString(BuildConfig.DEBUG));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
super.onPostCreate(savedInstanceState);
|
||||||
|
setSubTitle("");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 处理传入的 Intent 数据
|
||||||
|
//
|
||||||
|
boolean prosessIntents(Intent intent) {
|
||||||
|
if (intent == null
|
||||||
|
|| intent.getAction() == null
|
||||||
|
|| intent.getAction().equals(""))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) {
|
||||||
|
try {
|
||||||
|
WinBollActivity clazzActivity = UnitTestActivity.class.newInstance();
|
||||||
|
String tag = clazzActivity.getTag();
|
||||||
|
LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag);
|
||||||
|
Intent subIntent = new Intent(this, UnitTestActivity.class);
|
||||||
|
subIntent.setAction(intent.getAction());
|
||||||
|
File file = new File(getCacheDir(), UUID.randomUUID().toString());
|
||||||
|
//取出文件uri
|
||||||
|
Uri uri = intent.getData();
|
||||||
|
if (uri == null) {
|
||||||
|
uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
|
}
|
||||||
|
//获取文件真实地址
|
||||||
|
String szSrcPath = UriUtils.getFileFromUri(getApplication(), uri);
|
||||||
|
if (TextUtils.isEmpty(szSrcPath)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath()));
|
||||||
|
//startWinBollActivity(subIntent, tag);
|
||||||
|
WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class);
|
||||||
|
} catch (IllegalAccessException | InstantiationException | IOException e) {
|
||||||
|
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
|
// 函数处理异常返回失败
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.d(TAG, "prosessIntents|" + intent.getAction() + "|yet");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -28,25 +100,10 @@ final public class MainActivity extends WinBollActivity implements IWinBollActiv
|
|||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
LogUtils.d(TAG, "onCreate(Bundle savedInstanceState)");
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(mToolbar);
|
|
||||||
mToolbar.setSubtitle(TAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected boolean isAddWinBollToolBar() {
|
||||||
super.onPostCreate(savedInstanceState);
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,7 +116,7 @@ final public class MainActivity extends WinBollActivity implements IWinBollActiv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onYes() {
|
public void onYes() {
|
||||||
App.getWinBollActivityManager().finishAll();
|
WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,23 +126,43 @@ final public class MainActivity extends WinBollActivity implements IWinBollActiv
|
|||||||
YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Toolbar initToolBar() {
|
||||||
|
return findViewById(R.id.activitymainToolbar1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
getMenuInflater().inflate(R.menu.toolbar_winboll_app_main, menu);
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.item_log) {
|
if (item.getItemId() == R.id.item_unittest) {
|
||||||
App.getWinBollActivityManager().startLogActivity(this);
|
WinBollActivityManager.getInstance(this).startWinBollActivity(this, UnitTestActivity.class);
|
||||||
} else if (item.getItemId() == R.id.item_about) {
|
|
||||||
App.getWinBollActivityManager().startWinBollActivity(this, AboutActivity.class);
|
|
||||||
} else if (item.getItemId() == R.id.item_exit) {
|
} else if (item.getItemId() == R.id.item_exit) {
|
||||||
exit();
|
exit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
switch (resultCode) {
|
||||||
|
case REQUEST_HOME_ACTIVITY : {
|
||||||
|
LogUtils.d(TAG, "REQUEST_HOME_ACTIVITY");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REQUEST_ABOUT_ACTIVITY : {
|
||||||
|
LogUtils.d(TAG, "REQUEST_ABOUT_ACTIVITY");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default : {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
package cc.winboll.studio.app;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/04/01 12:55:32
|
|
||||||
* @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();
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
App.getWinBollActivityManager().add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
App.getWinBollActivityManager().registeRemove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/toolbar"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/aboutviewroot_ll"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -5,10 +5,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/toolbar"/>
|
android:id="@+id/activitymainToolbar1"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_log"
|
|
||||||
android:title="Log"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_about"
|
|
||||||
android:title="About"/>
|
|
||||||
</menu>
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">APP</string>
|
<string name="app_name">WinBoll-APP</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -18,19 +18,18 @@ def genVersionName(def versionName){
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
compileSdkVersion 32
|
compileSdkVersion 32
|
||||||
buildToolsVersion "32.0.0"
|
buildToolsVersion "33.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.appbase"
|
applicationId "cc.winboll.studio.appbase"
|
||||||
minSdkVersion 24
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.2"
|
versionName "1.0"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@@ -42,9 +41,14 @@ 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 project(':libappbase')
|
api project(':libappbase')
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Mar 29 11:28:02 HKT 2025
|
#Sun Jan 05 02:30:11 GMT 2025
|
||||||
stageCount=3
|
stageCount=0
|
||||||
libraryProject=libappbase
|
libraryProject=
|
||||||
baseVersion=15.2
|
baseVersion=1.0
|
||||||
publishVersion=15.2.2
|
publishVersion=1.0.0
|
||||||
buildCount=0
|
buildCount=2
|
||||||
baseBetaVersion=15.2.3
|
baseBetaVersion=1.0.1
|
||||||
|
|||||||
@@ -7,16 +7,13 @@
|
|||||||
android:name=".App"
|
android:name=".App"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/MyAPPBaseTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true">
|
||||||
android:process=":App">
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:exported="true"
|
android:exported="true">
|
||||||
android:resizeableActivity="true"
|
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation">
|
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
||||||
@@ -24,104 +21,15 @@
|
|||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
|
||||||
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activities.NewActivity"
|
|
||||||
android:label="NewActivity"
|
|
||||||
android:exported="true"
|
|
||||||
android:resizeableActivity="true"
|
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"/>
|
|
||||||
|
|
||||||
<activity android:name=".activities.New2Activity"
|
|
||||||
android:label="New2Activity"
|
|
||||||
android:exported="true"
|
|
||||||
android:resizeableActivity="true"
|
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"/>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".MyTileService"
|
|
||||||
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>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".services.MainService"
|
|
||||||
android:exported="true"/>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name="cc.winboll.studio.appbase.services.TestDemoBindService"
|
|
||||||
android:exported="true"/>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name="cc.winboll.studio.appbase.services.TestDemoService"
|
|
||||||
android:exported="true"/>
|
|
||||||
|
|
||||||
<service android:name=".services.AssistantService"/>
|
|
||||||
|
|
||||||
<receiver android:name="cc.winboll.studio.appbase.receivers.MainReceiver"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.appbase.receivers.MainReceiver"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver
|
|
||||||
android:name=".widgets.APPNewsWidget"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.appbase.widgets.APPNewsWidget.ACTION_WAKEUP_SERVICE"/>
|
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.appbase.widgets.APPNewsWidget.ACTION_RELOAD_REPORT"/>
|
|
||||||
|
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.appwidget.provider"
|
|
||||||
android:resource="@xml/widget_provider_info_sos"/>
|
|
||||||
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".receivers.APPNewsWidgetClickListener"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener.ACTION_PRE"/>
|
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener.ACTION_NEXT"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="4.0"/>
|
android:value="4.0"/>
|
||||||
|
|
||||||
|
<activity android:name=".GlobalApplication$CrashActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
@@ -5,23 +5,12 @@ package cc.winboll.studio.appbase;
|
|||||||
* @Date 2025/01/05 09:54:42
|
* @Date 2025/01/05 09:54:42
|
||||||
* @Describe APPbase 应用类
|
* @Describe APPbase 应用类
|
||||||
*/
|
*/
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.GlobalApplication;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import cc.winboll.studio.libappbase.sos.SOSCenterServiceReceiver;
|
|
||||||
import cc.winboll.studio.libappbase.sos.SOS;
|
|
||||||
|
|
||||||
public class App extends GlobalApplication {
|
public class App extends GlobalApplication {
|
||||||
|
|
||||||
public static final String TAG = "App";
|
public static final String TAG = "App";
|
||||||
|
|
||||||
SOSCenterServiceReceiver mSOSCenterServiceReceiver;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
mSOSCenterServiceReceiver = new SOSCenterServiceReceiver();
|
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
|
||||||
intentFilter.addAction(SOS.ACTION_SOS);
|
|
||||||
registerReceiver(mSOSCenterServiceReceiver, intentFilter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,184 +1,15 @@
|
|||||||
package cc.winboll.studio.appbase;
|
package cc.winboll.studio.appbase;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ComponentName;
|
import android.os.Bundle;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
public class MainActivity extends Activity {
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
@Override
|
||||||
import android.view.MenuItem;
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
import android.view.View;
|
super.onCreate(savedInstanceState);
|
||||||
import android.widget.CheckBox;
|
setContentView(R.layout.activity_main);
|
||||||
import cc.winboll.studio.appbase.R;
|
|
||||||
import cc.winboll.studio.appbase.activities.NewActivity;
|
}
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
|
||||||
import cc.winboll.studio.appbase.services.TestDemoBindService;
|
}
|
||||||
import cc.winboll.studio.appbase.services.TestDemoService;
|
|
||||||
import cc.winboll.studio.libappbase.CrashHandler;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalCrashActivity;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.libappbase.sos.SOS;
|
|
||||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
|
||||||
import cc.winboll.studio.libappbase.widgets.StatusWidget;
|
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
|
||||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
|
||||||
|
|
||||||
public class MainActivity extends WinBollActivityBase implements IWinBollActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "MainActivity";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
Toolbar mToolbar;
|
|
||||||
//LogView mLogView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
ToastUtils.show("onCreate");
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(mToolbar);
|
|
||||||
|
|
||||||
CheckBox cbIsDebugMode = findViewById(R.id.activitymainCheckBox1);
|
|
||||||
cbIsDebugMode.setChecked(GlobalApplication.isDebuging());
|
|
||||||
//mLogView = findViewById(R.id.activitymainLogView1);
|
|
||||||
|
|
||||||
// if (GlobalApplication.isDebuging()) {
|
|
||||||
// mLogView.start();
|
|
||||||
// ToastUtils.show("LogView start.");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_appbase, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
Intent intentAPPWidget = new Intent(this, StatusWidget.class);
|
|
||||||
intentAPPWidget.setAction(StatusWidget.ACTION_STATUS_UPDATE);
|
|
||||||
sendBroadcast(intentAPPWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSwitchDebugMode(View view) {
|
|
||||||
boolean isDebuging = ((CheckBox)view).isChecked();
|
|
||||||
GlobalApplication.setIsDebuging(isDebuging);
|
|
||||||
GlobalApplication.saveDebugStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPreviewGlobalCrashActivity(View view) {
|
|
||||||
Intent intent = new Intent(this, GlobalCrashActivity.class);
|
|
||||||
intent.putExtra(CrashHandler.EXTRA_CRASH_INFO, "Demo log...");
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStartCenter(View view) {
|
|
||||||
MainService.startMainService(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStopCenter(View view) {
|
|
||||||
MainService.stopMainService(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTestStopMainServiceWithoutSettingEnable(View view) {
|
|
||||||
LogUtils.d(TAG, "onTestStopMainServiceWithoutSettingEnable");
|
|
||||||
stopService(new Intent(this, MainService.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTestUseComponentStartService(View view) {
|
|
||||||
LogUtils.d(TAG, "onTestUseComponentStartService");
|
|
||||||
|
|
||||||
// 目标服务的包名和类名
|
|
||||||
String packageName = this.getPackageName();
|
|
||||||
String serviceClassName = TestDemoService.class.getName();
|
|
||||||
|
|
||||||
// 构建Intent
|
|
||||||
Intent intentService = new Intent();
|
|
||||||
intentService.setComponent(new ComponentName(packageName, serviceClassName));
|
|
||||||
|
|
||||||
startService(intentService);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTestDemoServiceSOS(View view) {
|
|
||||||
Intent intent = new Intent(this, TestDemoService.class);
|
|
||||||
stopService(intent);
|
|
||||||
if (App.isDebuging()) {
|
|
||||||
SOS.sosToAppBaseBeta(this, TestDemoService.class.getName());
|
|
||||||
} else {
|
|
||||||
SOS.sosToAppBase(this, TestDemoService.class.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSartTestDemoService(View view) {
|
|
||||||
Intent intent = new Intent(this, TestDemoService.class);
|
|
||||||
intent.setAction(TestDemoService.ACTION_ENABLE);
|
|
||||||
startService(intent);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onStopTestDemoService(View view) {
|
|
||||||
Intent intent = new Intent(this, TestDemoService.class);
|
|
||||||
intent.setAction(TestDemoService.ACTION_DISABLE);
|
|
||||||
startService(intent);
|
|
||||||
|
|
||||||
Intent intentStop = new Intent(this, TestDemoService.class);
|
|
||||||
stopService(intentStop);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStopTestDemoServiceNoSettings(View view) {
|
|
||||||
Intent intent = new Intent(this, TestDemoService.class);
|
|
||||||
stopService(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSartTestDemoBindService(View view) {
|
|
||||||
Intent intent = new Intent(this, TestDemoBindService.class);
|
|
||||||
intent.setAction(TestDemoBindService.ACTION_ENABLE);
|
|
||||||
startService(intent);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStopTestDemoBindService(View view) {
|
|
||||||
Intent intent = new Intent(this, TestDemoBindService.class);
|
|
||||||
intent.setAction(TestDemoBindService.ACTION_DISABLE);
|
|
||||||
startService(intent);
|
|
||||||
|
|
||||||
Intent intentStop = new Intent(this, TestDemoBindService.class);
|
|
||||||
stopService(intentStop);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStopTestDemoBindServiceNoSettings(View view) {
|
|
||||||
Intent intent = new Intent(this, TestDemoBindService.class);
|
|
||||||
stopService(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTestOpenNewActivity(View view) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().startWinBollActivity(this, NewActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/13 19:30:10
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
import android.service.quicksettings.Tile;
|
|
||||||
import android.service.quicksettings.TileService;
|
|
||||||
import cc.winboll.studio.appbase.models.MainServiceBean;
|
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
|
||||||
|
|
||||||
public class MyTileService extends TileService {
|
|
||||||
public static final String TAG = "MyTileService";
|
|
||||||
|
|
||||||
volatile static MyTileService _MyTileService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStartListening() {
|
|
||||||
super.onStartListening();
|
|
||||||
_MyTileService = this;
|
|
||||||
Tile tile = getQsTile();
|
|
||||||
MainServiceBean bean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
|
||||||
if (bean != null && bean.isEnable()) {
|
|
||||||
//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();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
MainService.stopMainService(this);
|
|
||||||
} else if (tile.getState() == Tile.STATE_INACTIVE) {
|
|
||||||
bean.setIsEnable(true);
|
|
||||||
MainServiceBean.saveBean(this, bean);
|
|
||||||
MainService.startMainService(this);
|
|
||||||
}
|
|
||||||
updateServiceIconStatus(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateServiceIconStatus(Context context) {
|
|
||||||
if (_MyTileService == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tile tile = _MyTileService.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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,82 +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.support.v7.app.AppCompatActivity;
|
|
||||||
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 AppCompatActivity 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.activities;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/25 11:46:40
|
|
||||||
* @Describe 测试窗口2
|
|
||||||
*/
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import cc.winboll.studio.appbase.R;
|
|
||||||
import cc.winboll.studio.appbase.WinBollActivityBase;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
|
||||||
|
|
||||||
public class New2Activity extends WinBollActivityBase implements IWinBollActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "New2Activity";
|
|
||||||
|
|
||||||
Toolbar mToolbar;
|
|
||||||
//LogView mLogView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_new2);
|
|
||||||
|
|
||||||
// mLogView = findViewById(R.id.logview);
|
|
||||||
// mLogView.start();
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(mToolbar);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
//mLogView.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCloseThisActivity(View view) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().finish(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCloseAllActivity(View view) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().finishAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNewActivity(View view) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().startWinBollActivity(this, NewActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_appbase, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.activities;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/25 05:04:22
|
|
||||||
*/
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import cc.winboll.studio.appbase.R;
|
|
||||||
import cc.winboll.studio.appbase.WinBollActivityBase;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
|
||||||
|
|
||||||
public class NewActivity extends WinBollActivityBase implements IWinBollActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "NewActivity";
|
|
||||||
|
|
||||||
Toolbar mToolbar;
|
|
||||||
//LogView mLogView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_new);
|
|
||||||
// mLogView = findViewById(R.id.logview);
|
|
||||||
// mLogView.start();
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(mToolbar);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
//mLogView.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCloseThisActivity(View view) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().finish(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCloseAllActivity(View view) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().finishAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNew2Activity(View view) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().startWinBollActivity(this, New2Activity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_appbase, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
|
||||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.handlers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/14 03:51:40
|
|
||||||
*/
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
|
|
||||||
public class MainServiceHandler extends Handler {
|
|
||||||
public static final String TAG = "MainServiceHandler";
|
|
||||||
|
|
||||||
public static final int MSG_REMINDTHREAD = 0;
|
|
||||||
|
|
||||||
WeakReference<MainService> serviceWeakReference;
|
|
||||||
public MainServiceHandler(MainService service) {
|
|
||||||
serviceWeakReference = new WeakReference<MainService>(service);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
switch (msg.what) {
|
|
||||||
case MSG_REMINDTHREAD: // 处理下载完成消息,更新UI
|
|
||||||
{
|
|
||||||
// 显示提醒消息
|
|
||||||
//
|
|
||||||
//LogUtils.d(TAG, "显示提醒消息");
|
|
||||||
MainService mainService = serviceWeakReference.get();
|
|
||||||
if (mainService != null) {
|
|
||||||
mainService.appenMessage((String)msg.obj);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/13 07:06:13
|
|
||||||
*/
|
|
||||||
import android.util.JsonReader;
|
|
||||||
import android.util.JsonWriter;
|
|
||||||
import cc.winboll.studio.libappbase.BaseBean;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/07 12:47:22
|
|
||||||
* @Describe TestServiceBean
|
|
||||||
*/
|
|
||||||
import android.util.JsonReader;
|
|
||||||
import android.util.JsonWriter;
|
|
||||||
import cc.winboll.studio.libappbase.BaseBean;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class TestDemoBindServiceBean extends BaseBean {
|
|
||||||
|
|
||||||
public static final String TAG = "TestServiceBean";
|
|
||||||
|
|
||||||
boolean isEnable;
|
|
||||||
|
|
||||||
public TestDemoBindServiceBean() {
|
|
||||||
this.isEnable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsEnable(boolean isEnable) {
|
|
||||||
this.isEnable = isEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnable() {
|
|
||||||
return isEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return TestDemoBindServiceBean.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/07 12:49:21
|
|
||||||
* @Describe TestDemoServiceBean
|
|
||||||
*/
|
|
||||||
import android.util.JsonReader;
|
|
||||||
import android.util.JsonWriter;
|
|
||||||
import cc.winboll.studio.libappbase.BaseBean;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class TestDemoServiceBean extends BaseBean {
|
|
||||||
|
|
||||||
public static final String TAG = "TestDemoServiceBean";
|
|
||||||
|
|
||||||
boolean isEnable;
|
|
||||||
|
|
||||||
public TestDemoServiceBean() {
|
|
||||||
this.isEnable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsEnable(boolean isEnable) {
|
|
||||||
this.isEnable = isEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnable() {
|
|
||||||
return isEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return TestDemoServiceBean.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.receivers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/24 07:11:44
|
|
||||||
*/
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
|
|
||||||
public class APPNewsWidgetClickListener extends BroadcastReceiver {
|
|
||||||
|
|
||||||
public static final String TAG = "APPNewsWidgetClickListener";
|
|
||||||
public static final String ACTION_PRE = APPNewsWidgetClickListener.class.getName() + ".ACTION_PRE";
|
|
||||||
public static final String ACTION_NEXT = APPNewsWidgetClickListener.class.getName() + ".ACTION_NEXT";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (action == null) {
|
|
||||||
LogUtils.d(TAG, String.format("action %s", action));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (action.equals(ACTION_PRE)) {
|
|
||||||
LogUtils.d(TAG, "ACTION_PRE");
|
|
||||||
APPNewsWidget.prePage(context);
|
|
||||||
} else if (action.equals(ACTION_NEXT)) {
|
|
||||||
LogUtils.d(TAG, "ACTION_NEXT");
|
|
||||||
APPNewsWidget.nextPage(context);
|
|
||||||
} else {
|
|
||||||
LogUtils.d(TAG, String.format("action %s", action));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.receivers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/13 06:58:04
|
|
||||||
* @Describe 主要广播接收器
|
|
||||||
*/
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import cc.winboll.studio.appbase.models.WinBollNewsBean;
|
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
|
||||||
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
|
||||||
import cc.winboll.studio.libappbase.AppUtils;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.libappbase.sos.APPModel;
|
|
||||||
import cc.winboll.studio.libappbase.sos.SOS;
|
|
||||||
import cc.winboll.studio.libappbase.sos.SOSObject;
|
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
|
||||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class MainReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
public static final String TAG = "MainReceiver";
|
|
||||||
|
|
||||||
public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
|
|
||||||
|
|
||||||
WeakReference<MainService> mwrService;
|
|
||||||
|
|
||||||
public MainReceiver(MainService service) {
|
|
||||||
mwrService = new WeakReference<MainService>(service);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String szAction = intent.getAction();
|
|
||||||
if (szAction.equals(ACTION_BOOT_COMPLETED)) {
|
|
||||||
ToastUtils.show("ACTION_BOOT_COMPLETED");
|
|
||||||
} else if (szAction.equals(WinBoll.ACTION_BIND)) {
|
|
||||||
LogUtils.d(TAG, "ACTION_BIND");
|
|
||||||
LogUtils.d(TAG, String.format("context.getPackageName() %s", context.getPackageName()));
|
|
||||||
LogUtils.d(TAG, String.format("intent.getAction() %s", intent.getAction()));
|
|
||||||
String szAPPModel = intent.getStringExtra(WinBoll.EXTRA_APPMODEL);
|
|
||||||
LogUtils.d(TAG, String.format("szAPPModel %s", szAPPModel));
|
|
||||||
if (szAPPModel != null && !szAPPModel.equals("")) {
|
|
||||||
try {
|
|
||||||
APPModel bean = APPModel.parseStringToBean(szAPPModel, APPModel.class);
|
|
||||||
if (bean != null) {
|
|
||||||
String szAppPackageName = bean.getAppPackageName();
|
|
||||||
LogUtils.d(TAG, String.format("szAppPackageName %s", szAppPackageName));
|
|
||||||
String szAppMainServiveName = bean.getAppMainServiveName();
|
|
||||||
LogUtils.d(TAG, String.format("szAppMainServiveName %s", szAppMainServiveName));
|
|
||||||
mwrService.get().bindAPPModelConnection(bean);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (intent.getAction().equals(SOS.ACTION_SOS)) {
|
|
||||||
LogUtils.d(TAG, "ACTION_SOS");
|
|
||||||
String sos = intent.getStringExtra(SOS.EXTRA_OBJECT);
|
|
||||||
LogUtils.d(TAG, String.format("SOS %s", sos));
|
|
||||||
if (sos != null && !sos.equals("")) {
|
|
||||||
SOSObject bean = SOS.parseSOSObject(sos);
|
|
||||||
if (bean != null) {
|
|
||||||
String szObjectPackageName = bean.getObjectPackageName();
|
|
||||||
LogUtils.d(TAG, String.format("szObjectPackageName %s", szObjectPackageName));
|
|
||||||
String szObjectServiveName = bean.getObjectServiveName();
|
|
||||||
LogUtils.d(TAG, String.format("szObjectServiveName %s", szObjectServiveName));
|
|
||||||
|
|
||||||
Intent intentService = new Intent();
|
|
||||||
intentService.setComponent(new ComponentName(szObjectPackageName, szObjectServiveName));
|
|
||||||
context.startService(intentService);
|
|
||||||
|
|
||||||
String appName = AppUtils.getAppNameByPackageName(context, szObjectPackageName);
|
|
||||||
LogUtils.d(TAG, String.format("appName %s", appName));
|
|
||||||
WinBollNewsBean appWinBollNewsBean = new WinBollNewsBean(appName);
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
|
||||||
String currentTime = sdf.format(new Date());
|
|
||||||
StringBuilder sbLine = new StringBuilder();
|
|
||||||
sbLine.append("[");
|
|
||||||
sbLine.append(currentTime);
|
|
||||||
sbLine.append("] Power to ");
|
|
||||||
sbLine.append(appName);
|
|
||||||
appWinBollNewsBean.setMessage(sbLine.toString());
|
|
||||||
|
|
||||||
APPNewsWidget.addWinBollNewsBean(context, appWinBollNewsBean);
|
|
||||||
|
|
||||||
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
|
||||||
intentWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
|
||||||
context.sendBroadcast(intentWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ToastUtils.show(szAction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 注册 Receiver
|
|
||||||
//
|
|
||||||
public void registerAction(MainService service) {
|
|
||||||
IntentFilter filter=new IntentFilter();
|
|
||||||
filter.addAction(ACTION_BOOT_COMPLETED);
|
|
||||||
filter.addAction(SOS.ACTION_SOS);
|
|
||||||
filter.addAction(WinBoll.ACTION_BIND);
|
|
||||||
//filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
|
||||||
service.registerReceiver(this, filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.services;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/14 03:38:31
|
|
||||||
* @Describe 守护进程服务
|
|
||||||
*/
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import cc.winboll.studio.appbase.models.MainServiceBean;
|
|
||||||
import cc.winboll.studio.appbase.services.AssistantService;
|
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import android.os.Binder;
|
|
||||||
|
|
||||||
public class AssistantService extends Service {
|
|
||||||
|
|
||||||
public static final String TAG = "AssistantService";
|
|
||||||
|
|
||||||
MainServiceBean mMainServiceBean;
|
|
||||||
MyServiceConnection mMyServiceConnection;
|
|
||||||
MainService mMainService;
|
|
||||||
boolean isBound = false;
|
|
||||||
volatile boolean isThreadAlive = false;
|
|
||||||
|
|
||||||
public synchronized void setIsThreadAlive(boolean isThreadAlive) {
|
|
||||||
LogUtils.d(TAG, "setIsThreadAlive(...)");
|
|
||||||
LogUtils.d(TAG, String.format("isThreadAlive %s", isThreadAlive));
|
|
||||||
this.isThreadAlive = isThreadAlive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isThreadAlive() {
|
|
||||||
return isThreadAlive;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return new MyBinder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
LogUtils.d(TAG, "onCreate");
|
|
||||||
super.onCreate();
|
|
||||||
|
|
||||||
//mMyBinder = new MyBinder();
|
|
||||||
if (mMyServiceConnection == null) {
|
|
||||||
mMyServiceConnection = new MyServiceConnection();
|
|
||||||
}
|
|
||||||
// 设置运行参数
|
|
||||||
setIsThreadAlive(false);
|
|
||||||
assistantService();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
LogUtils.d(TAG, "call onStartCommand(...)");
|
|
||||||
assistantService();
|
|
||||||
return START_STICKY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
//LogUtils.d(TAG, "onDestroy");
|
|
||||||
setIsThreadAlive(false);
|
|
||||||
// 解除绑定
|
|
||||||
if (isBound) {
|
|
||||||
unbindService(mMyServiceConnection);
|
|
||||||
isBound = false;
|
|
||||||
}
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 运行服务内容
|
|
||||||
//
|
|
||||||
void assistantService() {
|
|
||||||
LogUtils.d(TAG, "assistantService()");
|
|
||||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
|
||||||
LogUtils.d(TAG, String.format("mMainServiceBean.isEnable() %s", mMainServiceBean.isEnable()));
|
|
||||||
if (mMainServiceBean.isEnable()) {
|
|
||||||
LogUtils.d(TAG, String.format("mIsThreadAlive %s", isThreadAlive()));
|
|
||||||
if (isThreadAlive() == false) {
|
|
||||||
// 设置运行状态
|
|
||||||
setIsThreadAlive(true);
|
|
||||||
// 唤醒和绑定主进程
|
|
||||||
wakeupAndBindMain();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 唤醒和绑定主进程
|
|
||||||
//
|
|
||||||
void wakeupAndBindMain() {
|
|
||||||
LogUtils.d(TAG, "wakeupAndBindMain()");
|
|
||||||
// 绑定服务的Intent
|
|
||||||
Intent intent = new Intent(this, MainService.class);
|
|
||||||
startService(new Intent(this, MainService.class));
|
|
||||||
bindService(intent, mMyServiceConnection, Context.BIND_IMPORTANT);
|
|
||||||
|
|
||||||
// startService(new Intent(this, MainService.class));
|
|
||||||
// bindService(new Intent(AssistantService.this, MainService.class), mMyServiceConnection, Context.BIND_IMPORTANT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 主进程与守护进程连接时需要用到此类
|
|
||||||
//
|
|
||||||
class MyServiceConnection implements ServiceConnection {
|
|
||||||
@Override
|
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
||||||
LogUtils.d(TAG, "onServiceConnected(...)");
|
|
||||||
MainService.MyBinder binder = (MainService.MyBinder) service;
|
|
||||||
mMainService = binder.getService();
|
|
||||||
isBound = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
|
||||||
LogUtils.d(TAG, "onServiceDisconnected(...)");
|
|
||||||
mMainServiceBean = MainServiceBean.loadBean(AssistantService.this, MainServiceBean.class);
|
|
||||||
if (mMainServiceBean.isEnable()) {
|
|
||||||
wakeupAndBindMain();
|
|
||||||
}
|
|
||||||
isBound = false;
|
|
||||||
mMainService = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用于返回服务实例的Binder
|
|
||||||
public class MyBinder extends Binder {
|
|
||||||
AssistantService getService() {
|
|
||||||
LogUtils.d(TAG, "AssistantService MyBinder getService()");
|
|
||||||
return AssistantService.this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.services;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/13 06:56:41
|
|
||||||
* @Describe 拨号主服务
|
|
||||||
* 参考:
|
|
||||||
* 进程保活-双进程守护的正确姿势
|
|
||||||
* https://blog.csdn.net/sinat_35159441/article/details/75267380
|
|
||||||
* Android Service之onStartCommand方法研究
|
|
||||||
* https://blog.csdn.net/cyp331203/article/details/38920491
|
|
||||||
*/
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.os.Binder;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import cc.winboll.studio.appbase.MyTileService;
|
|
||||||
import cc.winboll.studio.appbase.models.MainServiceBean;
|
|
||||||
import cc.winboll.studio.appbase.handlers.MainServiceHandler;
|
|
||||||
import cc.winboll.studio.appbase.receivers.MainReceiver;
|
|
||||||
import cc.winboll.studio.appbase.services.AssistantService;
|
|
||||||
import cc.winboll.studio.appbase.threads.MainServiceThread;
|
|
||||||
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import cc.winboll.studio.libappbase.sos.APPModel;
|
|
||||||
|
|
||||||
public class MainService extends Service {
|
|
||||||
|
|
||||||
public static final String TAG = "MainService";
|
|
||||||
|
|
||||||
public static final int MSG_UPDATE_STATUS = 0;
|
|
||||||
|
|
||||||
static MainService _mControlCenterService;
|
|
||||||
|
|
||||||
volatile boolean isServiceRunning;
|
|
||||||
|
|
||||||
MainServiceBean mMainServiceBean;
|
|
||||||
MainServiceThread mMainServiceThread;
|
|
||||||
MainServiceHandler mMainServiceHandler;
|
|
||||||
MyServiceConnection mMyServiceConnection;
|
|
||||||
AssistantService mAssistantService;
|
|
||||||
boolean isBound = false;
|
|
||||||
MainReceiver mMainReceiver;
|
|
||||||
ArrayList<APPConnection> mAPPModelConnectionList;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return new MyBinder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MainServiceThread getRemindThread() {
|
|
||||||
return mMainServiceThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
LogUtils.d(TAG, "onCreate()");
|
|
||||||
mAPPModelConnectionList = new ArrayList<APPConnection>();
|
|
||||||
|
|
||||||
_mControlCenterService = MainService.this;
|
|
||||||
isServiceRunning = false;
|
|
||||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
|
||||||
|
|
||||||
if (mMyServiceConnection == null) {
|
|
||||||
mMyServiceConnection = new MyServiceConnection();
|
|
||||||
}
|
|
||||||
mMainServiceHandler = new MainServiceHandler(this);
|
|
||||||
|
|
||||||
// 运行服务内容
|
|
||||||
mainService();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
LogUtils.d(TAG, "onStartCommand(...)");
|
|
||||||
// 运行服务内容
|
|
||||||
mainService();
|
|
||||||
return (mMainServiceBean.isEnable()) ? START_STICKY : super.onStartCommand(intent, flags, startId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 运行服务内容
|
|
||||||
//
|
|
||||||
void mainService() {
|
|
||||||
LogUtils.d(TAG, "mainService()");
|
|
||||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
|
||||||
if (mMainServiceBean.isEnable() && isServiceRunning == false) {
|
|
||||||
LogUtils.d(TAG, "mainService() start running");
|
|
||||||
isServiceRunning = true;
|
|
||||||
// 唤醒守护进程
|
|
||||||
wakeupAndBindAssistant();
|
|
||||||
|
|
||||||
if (mMainReceiver == null) {
|
|
||||||
// 注册广播接收器
|
|
||||||
mMainReceiver = new MainReceiver(this);
|
|
||||||
mMainReceiver.registerAction(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 启动小部件
|
|
||||||
Intent intentTimeWidget = new Intent(this, APPNewsWidget.class);
|
|
||||||
intentTimeWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
|
||||||
this.sendBroadcast(intentTimeWidget);
|
|
||||||
|
|
||||||
startMainServiceThread();
|
|
||||||
|
|
||||||
MyTileService.updateServiceIconStatus(this);
|
|
||||||
|
|
||||||
LogUtils.i(TAG, "Main Service Is Start.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 唤醒和绑定守护进程
|
|
||||||
//
|
|
||||||
void wakeupAndBindAssistant() {
|
|
||||||
LogUtils.d(TAG, "wakeupAndBindAssistant()");
|
|
||||||
|
|
||||||
Intent intent = new Intent(this, AssistantService.class);
|
|
||||||
startService(intent);
|
|
||||||
// 绑定服务的Intent
|
|
||||||
bindService(intent, mMyServiceConnection, Context.BIND_IMPORTANT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开启提醒铃声线程
|
|
||||||
//
|
|
||||||
public void startMainServiceThread() {
|
|
||||||
LogUtils.d(TAG, "startMainServiceThread");
|
|
||||||
if (mMainServiceThread == null) {
|
|
||||||
mMainServiceThread = new MainServiceThread(this, mMainServiceHandler);
|
|
||||||
LogUtils.d(TAG, "new MainServiceThread");
|
|
||||||
} else {
|
|
||||||
if (mMainServiceThread.isExist() == true) {
|
|
||||||
mMainServiceThread = new MainServiceThread(this, mMainServiceHandler);
|
|
||||||
LogUtils.d(TAG, "renew MainServiceThread");
|
|
||||||
} else {
|
|
||||||
// 提醒进程正在进行中就更新状态后退出
|
|
||||||
LogUtils.d(TAG, "A mMainServiceThread running.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mMainServiceThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopRemindThread() {
|
|
||||||
if (mMainServiceThread != null) {
|
|
||||||
mMainServiceThread.setIsExist(true);
|
|
||||||
mMainServiceThread = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
//LogUtils.d(TAG, "onDestroy");
|
|
||||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
|
||||||
if (mMainServiceBean.isEnable() == false) {
|
|
||||||
// 设置运行状态
|
|
||||||
isServiceRunning = false;// 解除绑定
|
|
||||||
if (isBound) {
|
|
||||||
unbindService(mMyServiceConnection);
|
|
||||||
isBound = false;
|
|
||||||
}
|
|
||||||
// 停止守护进程
|
|
||||||
Intent intent = new Intent(this, AssistantService.class);
|
|
||||||
stopService(intent);
|
|
||||||
// 停止Receiver
|
|
||||||
if (mMainReceiver != null) {
|
|
||||||
unregisterReceiver(mMainReceiver);
|
|
||||||
mMainReceiver = null;
|
|
||||||
}
|
|
||||||
// 停止前台通知栏
|
|
||||||
stopForeground(true);
|
|
||||||
// 停止消息提醒进程
|
|
||||||
stopRemindThread();
|
|
||||||
|
|
||||||
MyTileService.updateServiceIconStatus(this);
|
|
||||||
|
|
||||||
super.onDestroy();
|
|
||||||
//LogUtils.d(TAG, "onDestroy done");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bindAPPModelConnection(APPModel bean) {
|
|
||||||
LogUtils.d(TAG, "bindAPPModelConnection(...)");
|
|
||||||
// 清理旧的绑定链接
|
|
||||||
for (int i = mAPPModelConnectionList.size() - 1; i > -1; i--) {
|
|
||||||
APPConnection item = mAPPModelConnectionList.get(i);
|
|
||||||
if (item.isBindToAPP(bean)) {
|
|
||||||
LogUtils.d(TAG, "Bind Servive exist.");
|
|
||||||
unbindService(item);
|
|
||||||
mAPPModelConnectionList.remove(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 绑定服务
|
|
||||||
APPConnection appConnection = new APPConnection();
|
|
||||||
Intent intentService = new Intent();
|
|
||||||
intentService.setComponent(new ComponentName(bean.getAppPackageName(), bean.getAppMainServiveName()));
|
|
||||||
bindService(intentService, appConnection, Context.BIND_IMPORTANT);
|
|
||||||
mAPPModelConnectionList.add(appConnection);
|
|
||||||
|
|
||||||
Intent intentWidget = new Intent(this, APPNewsWidget.class);
|
|
||||||
intentWidget.setAction(APPNewsWidget.ACTION_WAKEUP_SERVICE);
|
|
||||||
APPModel appSOSBean = new APPModel(bean.getAppPackageName(), bean.getAppMainServiveName());
|
|
||||||
intentWidget.putExtra("APPSOSBean", appSOSBean.toString());
|
|
||||||
sendBroadcast(intentWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class APPConnection implements ServiceConnection {
|
|
||||||
|
|
||||||
ComponentName mComponentName;
|
|
||||||
|
|
||||||
boolean isBindToAPP(APPModel bean) {
|
|
||||||
return mComponentName != null
|
|
||||||
&& mComponentName.getClassName().equals(bean.getAppMainServiveName())
|
|
||||||
&& mComponentName.getPackageName().equals(bean.getAppPackageName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
||||||
LogUtils.d(TAG, "onServiceConnected(...)");
|
|
||||||
mComponentName = name;
|
|
||||||
LogUtils.d(TAG, String.format("onServiceConnected : \ngetClassName %s\ngetPackageName %s", name.getClassName(), name.getPackageName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
|
||||||
LogUtils.d(TAG, "onServiceDisconnected(...)");
|
|
||||||
LogUtils.d(TAG, String.format("onServiceDisconnected : \ngetClassName %s\ngetPackageName %s", name.getClassName(), name.getPackageName()));
|
|
||||||
|
|
||||||
// 尝试无参数启动一下服务
|
|
||||||
String appPackage = mComponentName.getPackageName();
|
|
||||||
LogUtils.d(TAG, String.format("appPackage %s", appPackage));
|
|
||||||
String appMainServiceClassName = mComponentName.getClassName();
|
|
||||||
LogUtils.d(TAG, String.format("appMainServiceClassName %s", appMainServiceClassName));
|
|
||||||
|
|
||||||
Intent intentService = new Intent();
|
|
||||||
intentService.setComponent(new ComponentName(appPackage, appMainServiceClassName));
|
|
||||||
startService(intentService);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 主进程与守护进程连接时需要用到此类
|
|
||||||
//
|
|
||||||
private class MyServiceConnection implements ServiceConnection {
|
|
||||||
@Override
|
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
||||||
LogUtils.d(TAG, "onServiceConnected(...)");
|
|
||||||
AssistantService.MyBinder binder = (AssistantService.MyBinder) service;
|
|
||||||
mAssistantService = binder.getService();
|
|
||||||
isBound = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
|
||||||
LogUtils.d(TAG, "onServiceDisconnected(...)");
|
|
||||||
|
|
||||||
if (mMainServiceBean.isEnable()) {
|
|
||||||
// 唤醒守护进程
|
|
||||||
wakeupAndBindAssistant();
|
|
||||||
}
|
|
||||||
isBound = false;
|
|
||||||
mAssistantService = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 用于返回服务实例的Binder
|
|
||||||
public class MyBinder extends Binder {
|
|
||||||
MainService getService() {
|
|
||||||
LogUtils.d(TAG, "MainService MyBinder getService()");
|
|
||||||
return MainService.this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // 启动服务
|
|
||||||
// //
|
|
||||||
// public static void startControlCenterService(Context context) {
|
|
||||||
// Intent intent = new Intent(context, MainService.class);
|
|
||||||
// context.startForegroundService(intent);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // 停止服务
|
|
||||||
// //
|
|
||||||
// public static void stopControlCenterService(Context context) {
|
|
||||||
// Intent intent = new Intent(context, MainService.class);
|
|
||||||
// context.stopService(intent);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void appenMessage(String message) {
|
|
||||||
LogUtils.d(TAG, String.format("Message : %s", message));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void stopMainService(Context context) {
|
|
||||||
LogUtils.d(TAG, "stopMainService");
|
|
||||||
MainServiceBean bean = new MainServiceBean();
|
|
||||||
bean.setIsEnable(false);
|
|
||||||
MainServiceBean.saveBean(context, bean);
|
|
||||||
context.stopService(new Intent(context, MainService.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void startMainService(Context context) {
|
|
||||||
LogUtils.d(TAG, "startMainService");
|
|
||||||
MainServiceBean bean = new MainServiceBean();
|
|
||||||
bean.setIsEnable(true);
|
|
||||||
MainServiceBean.saveBean(context, bean);
|
|
||||||
context.startService(new Intent(context, MainService.class));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||