Compare commits

...

123 Commits

Author SHA1 Message Date
ZhanGSKen
fe7ba6d38d <apputils>APK 15.0.5 release Publish. 2025-03-18 10:56:08 +08:00
ZhanGSKen
b3548bf1df 类库主题属性继承名称尝试 2025-03-18 10:55:13 +08:00
ZhanGSKen
d4b8b3bb35 <libapputils>Library Release 15.0.4 2025-03-18 10:46:52 +08:00
ZhanGSKen
d6a0d86e24 <apputils>APK 15.0.4 release Publish. 2025-03-18 10:46:39 +08:00
ZhanGSKen
20f1c29055 简化类库主题设置,避免attr属性增多。 2025-03-18 10:46:08 +08:00
ZhanGSKen
d8e7b35ec3 <libapputils>Library Release 15.0.3 2025-03-18 10:38:34 +08:00
ZhanGSKen
ccc5a995af <apputils>APK 15.0.3 release Publish. 2025-03-18 10:38:22 +08:00
ZhanGSKen
b46ee47e06 简化类库主题设置 2025-03-18 10:37:54 +08:00
ZhanGSKen
b11b06fad5 <libapputils>Library Release 15.0.2 2025-03-18 10:22:46 +08:00
ZhanGSKen
20af88fdd2 <apputils>APK 15.0.2 release Publish. 2025-03-18 10:22:27 +08:00
ZhanGSKen
9a70fe7c0f 更新类库,分开应用与类库主题设置。 2025-03-18 10:21:32 +08:00
ZhanGSKen
c62f3f1bea <libapputils>Library Release 15.0.1 2025-03-18 09:52:51 +08:00
ZhanGSKen
0e339c0f51 <apputils>APK 15.0.1 release Publish. 2025-03-18 09:52:37 +08:00
ZhanGSKen
c20975cfca 设置主题配置为模块化独立风格,添加应用异常测试。 2025-03-18 09:52:06 +08:00
ZhanGSKen
ed5f91f299 <libapputils>Library Release 15.0.0 2025-03-18 08:45:52 +08:00
ZhanGSKen
0031100219 <apputils>APK 15.0.0 release Publish. 2025-03-18 08:44:48 +08:00
ZhanGSKen
f9e7d362b7 调整测试窗口日志 2025-03-18 08:42:14 +08:00
ZhanGSKen
8d9d308c68 去除support依赖 2025-03-18 08:32:17 +08:00
ZhanGSKen
d3b12207e0 Merge branch 'appbase' into apputils 2025-03-15 19:38:11 +08:00
ZhanGSKen
befea40f61 <libappbase>Library Release 15.0.2 2025-03-15 15:30:08 +08:00
ZhanGSKen
cc1ca5b092 <appbase>APK 15.0.2 release Publish. 2025-03-15 15:29:07 +08:00
ZhanGSKen
af77c09415 <libappbase>Library Release 15.0.1 2025-03-15 15:27:57 +08:00
ZhanGSKen
2968d1dbfa <appbase>APK 15.0.1 release Publish. 2025-03-15 15:27:43 +08:00
ZhanGSKen
db96ece15f 修复吐司模块不显示字幕的BUG 2025-03-15 15:26:59 +08:00
ZhanGSKen
c0347ed706 <libappbase>Library Release 15.0.0 2025-03-15 14:46:58 +08:00
ZhanGSKen
ad408dfb53 <appbase>APK 15.0.0 release Publish. 2025-03-15 14:46:32 +08:00
ZhanGSKen
a2e963b53e Merge branch 'appbase' into apputils 2025-03-15 12:57:46 +08:00
ZhanGSKen
953da400be 设置APP主板本号对应Android版本 2025-03-15 12:34:22 +08:00
ZhanGSKen
165765e0eb APPBase去除 Support 依赖 2025-03-12 14:32:48 +08:00
ZhanGSKen
f5f88a61b0 AndroidX Demo 调试完成 2025-03-12 02:27:08 +08:00
ZhanGSKen
2f33574d5c Android Demo 调试完成 2025-03-12 02:03:29 +08:00
ZhanGSKen
afd93d6871 添加两个示例项目 2025-03-11 20:52:40 +08:00
ZhanGSKen
b7affa477f 忽略项目编译类型配置文件 2025-03-11 20:19:33 +08:00
ZhanGSKen
4f317322fc 根项目Gradle配置文件设置两种编译类型 2025-03-11 20:18:07 +08:00
ZhanGSKen
41c0394c4a <libapputils>Library Release 9.4.4 2025-03-09 09:34:30 +08:00
ZhanGSKen
d2a84f554b <apputils>APK 9.4.4 release Publish. 2025-03-09 09:34:16 +08:00
ZhanGSKen
d1e3e27f20 更新类库 2025-03-09 09:33:15 +08:00
ZhanGSKen
f9242bfc9a 编译参数修复 2025-03-09 09:29:39 +08:00
ZhanGSKen
bf37eb61bb Merge branch 'apputils' of https://gitea.winboll.cc/Studio/APP.git into apputils 2025-03-09 09:26:28 +08:00
ZhanGSKen
6fd1513d6b <libapputils>Library Release 9.4.3 2025-03-09 09:21:00 +08:00
ZhanGSKen
394d75e5a2 <apputils>APK 9.4.3 release Publish. 2025-03-09 09:20:34 +08:00
ZhanGSKen
378e9168b6 更新类库 2025-03-09 09:19:23 +08:00
ZhanGSKen
a3fa570b50 Merge branch 'appbase' into apputils 2025-03-09 09:16:39 +08:00
ZhanGSKen
5623d2d341 <libappbase>Library Release 2.1.5 2025-03-09 09:15:47 +08:00
ZhanGSKen
3d9b203760 <appbase>APK 2.1.5 release Publish. 2025-03-09 09:15:24 +08:00
ZhanGSKen
498a8ae458 更新Gradle配置 2025-03-09 09:13:51 +08:00
ZhanGSKen
9b8d6ad46b <libappbase>Library Release 2.1.4 2025-03-08 04:46:49 +08:00
ZhanGSKen
7662d1c153 <libapputils>Library Release 9.4.2 2025-03-08 03:59:18 +08:00
ZhanGSKen
ac7b5bb1a2 <apputils>APK 9.4.2 release Publish. 2025-03-08 03:59:02 +08:00
ZhanGSKen
eeae184e7e 更改类库引用方式,更新类库。 2025-03-08 03:58:06 +08:00
ZhanGSKen
d5f34ad618 <libapputils>Library Release 9.4.1 2025-03-08 03:43:49 +08:00
ZhanGSKen
3ad1863a5f <apputils>APK 9.4.1 release Publish. 2025-03-08 03:43:19 +08:00
ZhanGSKen
291080aa15 更改类库引用方式,更新类库。 2025-03-08 03:42:12 +08:00
ZhanGSKen
973a0ff94f <libapputils>Library Release 9.4.0 2025-03-08 03:14:44 +08:00
ZhanGSKen
e04ea7f035 <apputils>APK 9.4.0 release Publish. 2025-03-08 03:14:21 +08:00
ZhanGSKen
ecbaf639a0 更新类库 2025-03-08 03:12:28 +08:00
ZhanGSKen
050fd46d81 <libapputils>Library Release 9.3.2 2025-02-12 19:50:26 +08:00
ZhanGSKen
d4ea79b950 <apputils>APK 9.3.2 release Publish. 2025-02-12 19:50:03 +08:00
ZhanGSKen
06a40a4298 更新类库,精简代码。 2025-02-12 19:48:45 +08:00
ZhanGSKen
35835d746e 更新类库,应用崩溃报告风格化设置。 2025-02-12 15:21:27 +08:00
ZhanGSKen
5f3d03ba7d 更新类库 2025-02-09 15:14:33 +08:00
ZhanGSKen
1d372ff9ae 更新类库 2025-02-09 13:13:35 +08:00
ZhanGSKen
4a1e398755 更新类库 2025-02-09 11:43:53 +08:00
ZhanGSKen
107be6d6ad <libapputils>Library Release 9.3.1 2025-02-06 11:03:07 +08:00
ZhanGSKen
19db567a7d <apputils>APK 9.3.1 release Publish. 2025-02-06 11:02:45 +08:00
ZhanGSKen
b14add854e 应用介绍模块更新 2025-02-06 11:00:51 +08:00
ZhanGSKen
104d9fa283 更新类库,重构基础活动窗口类为实际活动窗口类。 2025-02-06 07:37:15 +08:00
ZhanGSKen
dd041e5d78 WinBollActivity 类型重构 2025-02-05 10:37:54 +08:00
ZhanGSKen
2f019ae176 重构 WinBollActivity 2025-02-04 12:21:09 +08:00
ZhanGSKen
b5b4fbd3f5 <libapputils>Library Release 9.3.0 2025-02-04 08:54:24 +08:00
ZhanGSKen
548dcf74ed <apputils>APK 9.3.0 release Publish. 2025-02-04 08:54:03 +08:00
ZhanGSKen
547bf894c6 更新类库 2025-02-04 08:53:03 +08:00
ZhanGSKen
09e6429726 <libapputils>Library Release 9.2.17 2025-01-23 14:51:10 +08:00
ZhanGSKen
3ad9bb262e <apputils>APK 9.2.17 release Publish. 2025-01-23 14:50:49 +08:00
ZhanGSKen
15992da22f 添加Application返回函数 2025-01-23 14:49:56 +08:00
ZhanGSKen
7fb4e665f9 <libapputils>Library Release 9.2.16 2025-01-23 14:30:38 +08:00
ZhanGSKen
6a82889926 <apputils>APK 9.2.16 release Publish. 2025-01-23 14:30:15 +08:00
ZhanGSKen
7272cc4e5b 更新类库,添加应用上下文函数 2025-01-23 14:28:54 +08:00
ZhanGSKen
1f7d112a8a <libapputils>Library Release 9.2.15 2025-01-23 14:03:05 +08:00
ZhanGSKen
936e214015 <apputils>APK 9.2.15 release Publish. 2025-01-23 14:02:45 +08:00
ZhanGSKen
46e95d1b1f 增加容错调试能力 2025-01-23 14:01:42 +08:00
ZhanGSKen
15173f7af3 <libapputils>Library Release 9.2.14 2025-01-23 04:27:34 +08:00
ZhanGSKen
6f3b6c40af <apputils>APK 9.2.14 release Publish. 2025-01-23 04:27:21 +08:00
ZhanGSKen
42ffba69e5 更新联系邮件 2025-01-23 04:26:52 +08:00
ZhanGSKen
f021e8a1a3 <libapputils>Library Release 9.2.13 2025-01-23 04:05:47 +08:00
ZhanGSKen
02ce7dedb0 <apputils>APK 9.2.13 release Publish. 2025-01-23 04:05:32 +08:00
ZhanGSKen
8e290cd5e6 应用介绍添加 Gitea 拥有者属性 2025-01-23 04:04:45 +08:00
ZhanGSKen
37f2aa5f1b <libapputils>Library Release 9.2.12 2025-01-23 03:47:38 +08:00
ZhanGSKen
10cc69940b <apputils>APK 9.2.12 release Publish. 2025-01-23 03:47:26 +08:00
ZhanGSKen
bfdff9ff2f 日志类BugFix 2025-01-23 03:46:57 +08:00
ZhanGSKen
12c6129a61 <libapputils>Library Release 9.2.11 2025-01-23 03:34:10 +08:00
ZhanGSKen
ea10d1b540 <apputils>APK 9.2.11 release Publish. 2025-01-23 03:33:58 +08:00
ZhanGSKen
81f6ff592e 应用类调整 2025-01-23 03:33:26 +08:00
ZhanGSKen
e6f22e9212 <libapputils>Library Release 9.2.10 2025-01-23 03:05:52 +08:00
ZhanGSKen
8ce8f383fa <apputils>APK 9.2.10 release Publish. 2025-01-23 03:05:41 +08:00
ZhanGSKen
35d32b384f 应用类重构 2025-01-23 03:05:08 +08:00
ZhanGSKen
85e86ddf05 <libapputils>Library Release 9.2.9 2025-01-23 02:44:03 +08:00
ZhanGSKen
99bf804625 <apputils>APK 9.2.9 release Publish. 2025-01-23 02:43:51 +08:00
ZhanGSKen
261259e61e 应用类重构 2025-01-23 02:43:15 +08:00
ZhanGSKen
9aaf3433bd <libapputils>Library Release 9.2.8 2025-01-23 02:30:30 +08:00
ZhanGSKen
b739510951 <apputils>APK 9.2.8 release Publish. 2025-01-23 02:30:17 +08:00
ZhanGSKen
903359d9a2 <libapputils>Library Release 9.2.7 2025-01-23 02:17:45 +08:00
ZhanGSKen
69e7e72ed8 <apputils>APK 9.2.7 release Publish. 2025-01-23 02:17:32 +08:00
ZhanGSKen
a96ba362b4 应用类重构 2025-01-23 02:16:53 +08:00
ZhanGSKen
6447bcf924 <libapputils>Library Release 9.2.6 2025-01-23 01:54:40 +08:00
ZhanGSKen
18ed325731 <apputils>APK 9.2.6 release Publish. 2025-01-23 01:54:23 +08:00
ZhanGSKen
16e3d10b63 吐司框架分离初始化步骤 2025-01-23 01:53:06 +08:00
ZhanGSKen
8b0e8b00ae <libapputils>Library Release 9.2.5 2025-01-23 01:34:24 +08:00
ZhanGSKen
7f61ff1470 <apputils>APK 9.2.5 release Publish. 2025-01-23 01:34:03 +08:00
ZhanGSKen
c4e0c23a0c 应用介绍页添加 Gitea APP 子项目文件夹直接链接方式 2025-01-23 01:33:10 +08:00
ZhanGSKen
c7d26bbc3d 清理应用提示信息 2025-01-23 01:14:06 +08:00
ZhanGSKen
4968bbaeae <apputils>APK 9.2.4 release Publish. 2025-01-22 21:22:05 +08:00
ZhanGSKen
8e6b06e366 <apputils>APK 9.2.3 release Publish. 2025-01-22 21:17:58 +08:00
ZhanGSKen
ae7fb2984a 介绍页调试中 2025-01-22 21:16:35 +08:00
ZhanGSKen
a4d009f8fb 重构 WinBoll 框架应用类 2025-01-22 19:36:11 +08:00
ZhanGSKen
5a549e9652 <libapputils>Library Release 9.2.2 2025-01-22 17:20:01 +08:00
ZhanGSKen
e2d71ae088 <apputils>APK 9.2.2 release Publish. 2025-01-22 17:19:38 +08:00
ZhanGSKen
506d2619f2 应用介绍页测试完成 2025-01-20 14:51:10 +08:00
ZhanGSKen
17fa805a7f 源码整理 2025-01-20 13:17:58 +08:00
ZhanGSKen
1dcf8cd007 代码整理 2025-01-20 13:00:52 +08:00
ZhanGSKen
d86d50212e 优化Log UI 2025-01-20 12:57:59 +08:00
ZhanGSKen
af2e09c02a 应用退出按钮调试完成,添加日志窗口调动响应。 2025-01-20 12:50:22 +08:00
ZhanGSKen
de6361b19b APPUtils编译调试 2025-01-20 11:07:17 +08:00
133 changed files with 3129 additions and 3208 deletions

1
.gitignore vendored
View File

@@ -96,6 +96,7 @@ local.properties
## 忽略模块应用编译配置
/settings.gradle
/gradle.properties
## 忽略 srv 纠结问题
/srv/

1
androiddemo/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

74
androiddemo/build.gradle Normal file
View File

@@ -0,0 +1,74 @@
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 {
productFlavors {
beta {
}
stage {
}
}
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "cc.winboll.studio.androiddemo"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
// versionName 更新后需要手动设置
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
versionName "1.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'])
// 吐司类库
implementation 'com.github.getActivity:ToastUtils:10.5'
// Android 类库
// https://mvnrepository.com/artifact/com.android.support/support-v4
implementation 'com.android.support:support-v4:28.0.0'
// https://mvnrepository.com/artifact/com.android.support/support-compat
implementation 'com.android.support:support-compat:28.0.0'
// https://mvnrepository.com/artifact/com.android.support/support-media-compat
implementation 'com.android.support:support-media-compat:28.0.0'
// https://mvnrepository.com/artifact/com.android.support/support-core-utils
implementation 'com.android.support:support-core-utils:28.0.0'
// https://mvnrepository.com/artifact/com.android.support/support-core-ui
implementation 'com.android.support:support-core-ui:28.0.0'
// https://mvnrepository.com/artifact/com.android.support/support-fragment
implementation 'com.android.support:support-fragment:28.0.0'
// https://mvnrepository.com/artifact/com.android.support/recyclerview-v7
implementation 'com.android.support:recyclerview-v7:28.0.0'
}

View File

@@ -0,0 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Mar 11 18:02:14 GMT 2025
stageCount=0
libraryProject=
baseVersion=1.0
publishVersion=1.0.0
buildCount=1
baseBetaVersion=1.0.1

21
androiddemo/proguard-rules.pro vendored Normal file
View File

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

View File

@@ -0,0 +1,12 @@
<?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>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Android Demo +</string>
</resources>

View File

@@ -0,0 +1,39 @@
<?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=".GlobalApplication">
<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>

View File

@@ -0,0 +1,334 @@
package cc.winboll.studio.androiddemo;
import android.app.Activity;
import android.app.Application;
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 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 GlobalApplication extends Application {
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 GlobalApplication.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();
}
}
}

View File

@@ -0,0 +1,15 @@
package cc.winboll.studio.androiddemo;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@@ -0,0 +1,16 @@
<?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:gravity="center_vertical|center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android Demo"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</LinearLayout>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorAccent">@color/colorAccent</item>
<item name="android:navigationBarColor">?android:colorPrimary</item>
</style>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#009688</color>
<color name="colorPrimaryDark">#00796B</color>
<color name="colorAccent">#FF9800</color>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Android Demo</string>
</resources>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
</style>
</resources>

View File

@@ -0,0 +1,12 @@
<?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>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Put flavor specific strings here -->
</resources>

1
androidxdemo/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

76
androidxdemo/build.gradle Normal file
View File

@@ -0,0 +1,76 @@
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 {
productFlavors {
beta {
}
stage {
}
}
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "cc.winboll.studio.androidxdemo"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
// versionName 更新后需要手动设置
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
versionName "1.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
implementation 'com.jcraft:jsch:0.1.55'
// Html 解析
implementation 'org.jsoup:jsoup:1.13.1'
// 二维码类库
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
// 应用介绍页类库
implementation 'io.github.medyo:android-about-page:2.0.0'
// 吐司类库
implementation 'com.github.getActivity:ToastUtils:10.5'
// 网络连接类库
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
// Android 类库
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
}

View File

@@ -0,0 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Mar 11 18:25:43 GMT 2025
stageCount=0
libraryProject=
baseVersion=1.0
publishVersion=1.0.0
buildCount=4
baseBetaVersion=1.0.1

21
androidxdemo/proguard-rules.pro vendored Normal file
View File

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

View File

@@ -0,0 +1,12 @@
<?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>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AndroidX Demo +</string>
</resources>

View File

@@ -0,0 +1,37 @@
<?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/AppTheme"
android:resizeableActivity="true"
android:name=".GlobalApplication">
<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>

View File

@@ -0,0 +1,334 @@
package cc.winboll.studio.androidxdemo;
import android.app.Activity;
import android.app.Application;
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 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 GlobalApplication extends Application {
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 GlobalApplication.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();
}
}
}

View File

@@ -0,0 +1,19 @@
package cc.winboll.studio.androidxdemo;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
}

View File

@@ -0,0 +1,34 @@
<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>

View File

@@ -0,0 +1,170 @@
<?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>

View File

@@ -0,0 +1,38 @@
<?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>

View File

@@ -0,0 +1,5 @@
<?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>

View File

@@ -0,0 +1,5 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#009688</color>
<color name="colorPrimaryDark">#00796B</color>
<color name="colorAccent">#FF9800</color>
</resources>

View File

@@ -0,0 +1,4 @@
<resources>
<string name="app_name">AndroidX Demo</string>
</resources>

View File

@@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" 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>

View File

@@ -0,0 +1,12 @@
<?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>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Put flavor specific strings here -->
</resources>

View File

@@ -29,7 +29,7 @@ android {
// versionName 更新后需要手动设置
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
versionName "2.1"
versionName "15.0"
if(true) {
versionName = genVersionName("${versionName}")
}
@@ -46,25 +46,4 @@ android {
dependencies {
api project(':libappbase')
api fileTree(dir: 'libs', include: ['*.jar'])
// SSH
implementation 'com.jcraft:jsch:0.1.55'
// Html 解析
implementation 'org.jsoup:jsoup:1.13.1'
// 二维码类库
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
// 应用介绍页类库
implementation 'io.github.medyo:android-about-page:2.0.0'
// 吐司类库
implementation 'com.github.getActivity:ToastUtils:10.5'
// 网络连接类库
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
// Android 类库
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
}

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Mar 08 04:46:23 HKT 2025
stageCount=5
#Sat Mar 15 15:30:02 HKT 2025
stageCount=3
libraryProject=libappbase
baseVersion=2.1
publishVersion=2.1.4
baseVersion=15.0
publishVersion=15.0.2
buildCount=0
baseBetaVersion=2.1.5
baseBetaVersion=15.0.3

View File

@@ -7,7 +7,7 @@
android:name=".App"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:theme="@style/MyAppTheme"
android:resizeableActivity="true">
<activity

View File

@@ -1,11 +1,12 @@
package cc.winboll.studio.appbase;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.widget.Toolbar;
import cc.winboll.studio.appbase.R;
import cc.winboll.studio.appbase.services.MainService;
import cc.winboll.studio.appbase.services.TestDemoBindService;
@@ -13,13 +14,11 @@ import cc.winboll.studio.appbase.services.TestDemoService;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.widgets.StatusWidget;
import com.hjq.toast.ToastUtils;
import android.content.ComponentName;
import cc.winboll.studio.libappbase.sos.SOS;
import cc.winboll.studio.libappbase.sos.SOSObject;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.libappbase.widgets.StatusWidget;
public class MainActivity extends AppCompatActivity {
public class MainActivity extends Activity {
public static final String TAG = "MainActivity";
@@ -32,13 +31,16 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.activitymainToolbar1);
setSupportActionBar(toolbar);
setActionBar(toolbar);
CheckBox cbIsDebugMode = findViewById(R.id.activitymainCheckBox1);
cbIsDebugMode.setChecked(GlobalApplication.isDebuging());
mLogView = findViewById(R.id.activitymainLogView1);
if (GlobalApplication.isDebuging()) { mLogView.start(); }
if (GlobalApplication.isDebuging()) {
mLogView.start();
ToastUtils.show("LogView start.");
}
}
@Override
@@ -90,7 +92,7 @@ public class MainActivity extends AppCompatActivity {
public void onTestSOS(View view) {
Intent intent = new Intent(this, TestDemoService.class);
stopService(intent);
if(App.isDebuging()) {
if (App.isDebuging()) {
SOS.sosToAppBaseBeta(this, TestDemoService.class.getName());
} else {
SOS.sosToAppBase(this, TestDemoService.class.getName());
@@ -108,7 +110,7 @@ public class MainActivity extends AppCompatActivity {
Intent intent = new Intent(this, TestDemoService.class);
intent.setAction(TestDemoService.ACTION_DISABLE);
startService(intent);
Intent intentStop = new Intent(this, TestDemoService.class);
stopService(intentStop);
}
@@ -117,7 +119,7 @@ public class MainActivity extends AppCompatActivity {
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);

View File

@@ -5,7 +5,6 @@ package cc.winboll.studio.appbase.receivers;
* @Date 2025/02/13 06:58:04
* @Describe 主要广播接收器
*/
import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -16,15 +15,15 @@ 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 com.hjq.toast.ToastUtils;
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;
import cc.winboll.studio.libappbase.sos.WinBoll;
import cc.winboll.studio.libappbase.sos.APPModel;
import cc.winboll.studio.libappbase.sos.SOS;
import cc.winboll.studio.libappbase.sos.SOSObject;
public class MainReceiver extends BroadcastReceiver {

View File

@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activitymainToolbar1"/>

View File

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

View File

@@ -18,18 +18,18 @@ def genVersionName(def versionName){
}
android {
compileSdkVersion 32
buildToolsVersion "33.0.3"
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "cc.winboll.studio.apputils"
minSdkVersion 21
targetSdkVersion 30
minSdkVersion 26
targetSdkVersion 29
versionCode 1
// versionName 更新后需要手动设置
// 项目模块目录的 build.gradle 文件的 stageCount=0
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
versionName "9.2"
versionName "15.0"
if(true) {
versionName = genVersionName("${versionName}")
}
@@ -41,15 +41,26 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
dependencies {
api project(':libapputils')
api 'cc.winboll.studio:libappbase:1.0.3'
api fileTree(dir: 'libs', include: ['*.jar'])
implementation 'cc.winboll.studio:libappbase:15.0.5'
// 二维码类库
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
// 网络连接类库
//implementation 'com.squareup.okhttp3:okhttp:4.4.1'
// Html 解析
//implementation 'org.jsoup:jsoup:1.13.1'
// SSH
//implementation 'com.jcraft:jsch:0.1.55'
// 应用介绍页类库
//implementation 'io.github.medyo:android-about-page:2.0.0'
}

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Jan 18 13:03:10 HKT 2025
stageCount=2
#Tue Mar 18 10:56:08 HKT 2025
stageCount=6
libraryProject=libapputils
baseVersion=9.2
publishVersion=9.2.1
baseVersion=15.0
publishVersion=15.0.5
buildCount=0
baseBetaVersion=9.2.2
baseBetaVersion=15.0.6

View File

@@ -8,7 +8,7 @@
android:allowBackup="true"
android:icon="@drawable/ic_winboll"
android:label="@string/app_name"
android:theme="@style/WinBoll.SupportThemeNoActionBar"
android:theme="@style/MyUtilsTheme"
android:supportsRtl="true">
<activity
@@ -27,10 +27,8 @@
</activity>
<activity android:name=".TestWinBollActivity"/>
<activity android:name=".TestStringToQrCodeViewActivity"/>
</application>
</manifest>
</manifest>

View File

@@ -5,27 +5,83 @@ package cc.winboll.studio.apputils;
* @Date 2024/12/08 15:10:51
* @Describe 全局应用类
*/
import android.view.Gravity;
import cc.winboll.studio.libapputils.app.WinBollApplication;
import com.hjq.toast.ToastUtils;
import com.hjq.toast.style.WhiteToastStyle;
import android.app.Application;
import android.content.Context;
import android.widget.Toast;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libapputils.app.MyActivityLifecycleCallbacks;
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
import cc.winboll.studio.libapputils.bean.DebugBean;
public class App extends WinBollApplication {
public class App extends GlobalApplication {
public static final String TAG = "App";
public static final String _ACTION_DEBUGVIEW = WinBollApplication.class.getName() + "_ACTION_DEBUGVIEW";
public static final String _ACTION_DEBUGVIEW = App.class.getName() + "_ACTION_DEBUGVIEW";
//static volatile WinBollApplication _WinBollApplication = null;
MyActivityLifecycleCallbacks mMyActivityLifecycleCallbacks;
// 标记当前应用是否处于调试状态
static volatile boolean isDebug = false;
public synchronized static void setIsDebug(boolean isDebug) {
App.isDebug = isDebug;
}
public static boolean isDebug() {
return isDebug;
}
MyActivityLifecycleCallbacks getMyActivityLifecycleCallbacks() {
return mMyActivityLifecycleCallbacks;
}
@Override
public Context getApplicationContext() {
return super.getApplicationContext();
}
@Override
public Application getApplication() {
return this;
}
@Override
public void onCreate() {
super.onCreate();
// 初始化 Toast 框架
// 应用环境初始化, 基本调试环境
//
ToastUtils.init(this);
// 设置 Toast 布局样式
//ToastUtils.setView(R.layout.view_toast);
ToastUtils.setStyle(new WhiteToastStyle());
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
}
// 初始化日志模块
//LogUtils.init(this);
try {
// 初始化 Toast 框架
// ToastUtils.init(this);
// // 设置 Toast 布局样式
// //ToastUtils.setView(R.layout.view_toast);
// ToastUtils.setStyle(new WhiteToastStyle());
// ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
// 设置应用调试标志
DebugBean debugBean = DebugBean.loadBean(this, DebugBean.class);
if (debugBean == null) {
//ToastUtils.show("debugBean == null");
setIsDebug(false);
} else {
//ToastUtils.show("saveDebugStatus(" + String.valueOf(debugBean.isDebuging()) + ")");
setIsDebug(debugBean.isDebuging());
}
// 应用窗口管理模块参数设置
//
mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks();
registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
// 设置默认 WinBoll 应用 UI 类型
WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Service);
//ToastUtils.show("WinBollUI_TYPE " + getWinBollUI_TYPE());
} catch (Exception e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}

View File

@@ -1,28 +1,83 @@
package cc.winboll.studio.apputils;
import cc.winboll.studio.apputils.R;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import android.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.libapputils.activities.AssetsHtmlActivity;
import cc.winboll.studio.libapputils.activities.LogActivity;
import cc.winboll.studio.libapputils.activities.QRCodeDecodeActivity;
import cc.winboll.studio.libapputils.app.WinBollActivity;
import cc.winboll.studio.libapputils.app.AboutActivityFactory;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
import cc.winboll.studio.libapputils.log.LogActivity;
import cc.winboll.studio.libapputils.log.LogUtils;
import com.hjq.toast.ToastUtils;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.AboutView;
import cc.winboll.studio.libapputils.view.YesNoAlertDialog;
import java.util.List;
import java.util.Set;
final public class MainActivity extends WinBollActivity {
final public class MainActivity extends Activity implements IWinBollActivity {
public static final String TAG = "MainActivity";
public static final int REQUEST_QRCODEDECODE_ACTIVITY = 0;
Toolbar mToolbar;
LogView mLogView;
@Override
protected boolean isEnableDisplayHomeAsUp() {
public Activity getActivity() {
return this;
}
@Override
public APPInfo getAppInfo() {
String szBranchName = "apputils";
APPInfo appInfo = AboutActivityFactory.buildDefaultAPPInfo();
appInfo.setAppName("APPUtils");
appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll);
appInfo.setAppDescription("APPUtils Description");
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("APPUtils");
appInfo.setAppAPKFolderName("APPUtils");
return appInfo;
//return null;
}
@Override
public String getTag() {
return TAG;
}
@Override
public boolean isAddWinBollToolBar() {
return true;
}
@Override
public Toolbar initToolBar() {
return findViewById(R.id.activitymainToolbar1);
}
@Override
public boolean isEnableDisplayHomeAsUp() {
return false;
}
@@ -31,8 +86,22 @@ final public class MainActivity extends WinBollActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Toolbar toolbar = findViewById(R.id.activitymainToolbar1);
//setActionBar(toolbar);
mLogView = findViewById(R.id.logview);
mLogView.start();
// 初始化工具栏
mToolbar = findViewById(R.id.activitymainToolbar1);
setActionBar(mToolbar);
if (isEnableDisplayHomeAsUp()) {
// 显示后退按钮
getActionBar().setDisplayHomeAsUpEnabled(true);
}
getActionBar().setSubtitle(getTag());
checkResolveActivity();
archiveInstance();
// 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回
//if (prosessIntents(getIntent())) return;
@@ -44,44 +113,94 @@ final public class MainActivity extends WinBollActivity {
// LogUtils.d(TAG, "BuildConfig.DEBUG : " + Boolean.toString(BuildConfig.DEBUG));
}
boolean checkResolveActivity() {
PackageManager packageManager = getPackageManager();
//Intent intent = new Intent("your_action_here");
Intent intent = getIntent();
if (intent != null) {
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (resolveInfoList.size() > 0) {
// 传入的Intent action在Activity清单的intent-filter的action节点里有定义
if (intent.getAction() != null) {
if (intent.getAction().equals(cc.winboll.studio.libapputils.intent.action.DEBUGVIEW)) {
App.setIsDebug(true);
//ToastUtils.show!("WinBollApplication.setIsDebug(true) by action : " + intent.getAction());
}
}
return true;
} else {
// 传入的Intent action在Activity清单的intent-filter的action节点里没有定义
//ToastUtils.show("false : " + intent.getAction());
return false;
}
}
// action在清单文件中没有声明
ToastUtils.show("false");
return false;
}
void archiveInstance() {
Intent intent = getIntent();
StringBuilder sb = new StringBuilder("\n### Archive Instance ###\n");
if (intent != null) {
ComponentName componentName = intent.getComponent();
if (componentName != null) {
String packageName = componentName.getPackageName();
//Log.d("AppStarter", "启动本应用的应用包名: " + packageName);
sb.append("启动本应用的应用包名: \n" + packageName);
}
sb.append("\nImplicit Intent Tracker \n接收到的 Intent 动作: \n" + intent.getAction());
Set<String> categories = intent.getCategories();
if (categories != null) {
for (String category : categories) {
sb.append("\n接收到的 Intent 类别 :\n" + category);
}
}
Uri data = intent.getData();
if (data != null) {
sb.append("\n接收到的 Intent 数据 :\n" + data.toString());
}
} else {
sb.append("Intent is null.");
}
sb.append("\n\n");
LogUtils.d(TAG, sb.toString());
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// 缓存当前 activity
WinBollActivityManager.getInstance(this).add(this);
}
@Override
public void onDestroy() {
WinBollActivityManager.getInstance(this).registeRemove(this);
super.onDestroy();
}
public void onTestLogClick(View view) {
LogUtils.d(TAG, "onTestLogClick");
Toast.makeText(getApplication(), "onTestLogClick", Toast.LENGTH_SHORT).show();
}
public void onLogUtilsClick(View view) {
Intent intent = new Intent(this, LogActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
startActivity(intent);
}
// Intent intent = new Intent(this, LogActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
// intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
// startActivity(intent);
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// setSubTitle("");
//WinBollActivityManager.getInstance().printAvtivityListInfo();
WinBollActivityManager.getInstance(this).startWinBollActivity(this, LogActivity.class);
}
@Override
public void onBackPressed() {
// exit();
}
// void exit() {
// YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
//
// @Override
// public void onYes() {
// WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
// }
//
// @Override
// public void onNo() {
// }
// };
// YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
// }
//
// 处理传入的 Intent 数据
//
@@ -125,40 +244,88 @@ final public class MainActivity extends WinBollActivity {
return true;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected boolean isAddWinBollToolBar() {
return true;
}
@Override
protected Toolbar initToolBar() {
return findViewById(R.id.activitymainToolbar1);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//ToastUtils.show("onCreateOptionsMenu");
getMenuInflater().inflate(R.menu.toolbar_main, menu);
if (isAddWinBollToolBar()) {
//ToastUtils.show("mIWinBoll.isAddWinBollToolBar()");
getMenuInflater().inflate(R.menu.toolbar_winboll_shared_main, menu);
}
if (App.isDebug()) {
getMenuInflater().inflate(R.menu.toolbar_studio_debug, menu);
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.item_testwinboll) {
WinBollActivityManager.getInstance(this).startWinBollActivity(this, TestWinBollActivity.class);
if (item.getItemId() == R.id.item_exit) {
exit();
return true;
} else if (item.getItemId() == R.id.item_about) {
AboutActivityFactory.showAboutActivity(this, getAppInfo());
return true;
} else if (item.getItemId() == R.id.item_teststringtoqrcodeview) {
WinBollActivityManager.getInstance(this).startWinBollActivity(this, TestStringToQrCodeViewActivity.class);
} else if (item.getItemId() == R.id.item_testqrcodedecodeactivity) {
Intent intent = new Intent(this, QRCodeDecodeActivity.class);
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
} else if (item.getItemId() == R.id.item_testcrashreport) {
for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; i++) {
getString(i);
}
return true;
} else if (item.getItemId() == R.id.item_log) {
WinBollActivityManager.getInstance(this).startWinBollActivity(this, LogActivity.class);
return true;
} else if (item.getItemId() == R.id.item_exitdebug) {
//AboutView.setApp2NormalMode(this);
return true;
} else if (item.getItemId() == android.R.id.home) {
WinBollActivityManager.getInstance(this).finish(this);
return true;
}
return super.onOptionsItemSelected(item);
}
void about() {
// Intent intent = new Intent(this, AboutActivity.class);
// intent.putExtra(AboutActivity.EXTRA_APPINFO, AboutActivityFactory.buildAPPBranchInfo(this));
// WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AboutActivity.class);
}
void exit() {
YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
@Override
public void onYes() {
WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
}
@Override
public void onNo() {
}
};
YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
}
@Override
public void onBackPressed() {
if (WinBollActivityManager.getInstance(getApplicationContext()).isFirstIWinBollActivity(this)) {
exit();
} else {
WinBollActivityManager.getInstance(this).finish(this);
super.onBackPressed();
}
}
public void onTestAboutActivity(View view) {
about();
}
public void onTestJavascriptHtmlActivity(View view) {
Intent intent = new Intent(this, AssetsHtmlActivity.class);
intent.putExtra(AssetsHtmlActivity.EXTRA_HTMLFILENAME, "javascript_test.html");
@@ -166,17 +333,25 @@ final public class MainActivity extends WinBollActivity {
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_QRCODEDECODE_ACTIVITY : {
String text = data.getStringExtra(QRCodeDecodeActivity.EXTRA_RESULT);
ToastUtils.show(text);
break;
}
default : {
ToastUtils.show(String.format("%d, %d", requestCode, resultCode));
super.onActivityResult(requestCode, resultCode, data);
}
}
protected void onResume() {
super.onResume();
mLogView.start();
}
/*@Override
protected void onActivithyResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_QRCODEDECODE_ACTIVITY : {
if (data != null) {
String text = data.getStringExtra(QRCodeDecodeActivity.EXTRA_RESULT);
ToastUtils.show(text);
}
break;
}
default : {
//ToastUtils.show(String.format("%d, %d", requestCode, resultCode));
super.prosessActivityResult(requestCode, resultCode, data);
}
}
}*/
}

View File

@@ -1,37 +1,50 @@
package cc.winboll.studio.apputils;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libapputils.app.WinBollActivity;
import cc.winboll.studio.libapputils.view.StringToQrCodeView;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2025/01/17 19:50:46
*/
public class TestStringToQrCodeViewActivity extends WinBollActivity {
import cc.winboll.studio.apputils.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.StringToQrCodeView;
public class TestStringToQrCodeViewActivity extends Activity implements IWinBollActivity {
public static final String TAG = "TestStringToQrCodeViewActivity";
StringToQrCodeView mStringToQrCodeView;
@Override
public Activity getActivity() {
return this;
}
@Override
public APPInfo getAppInfo() {
return null;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected Toolbar initToolBar() {
public Toolbar initToolBar() {
return findViewById(R.id.activityteststringtoqrcodeviewToolbar1);
}
@Override
protected boolean isEnableDisplayHomeAsUp() {
public boolean isEnableDisplayHomeAsUp() {
return true;
}
@Override
protected boolean isAddWinBollToolBar() {
public boolean isAddWinBollToolBar() {
return true;
}
@@ -41,10 +54,4 @@ public class TestStringToQrCodeViewActivity extends WinBollActivity {
setContentView(R.layout.activity_teststringtoqrcodeview);
mStringToQrCodeView = findViewById(R.id.activityteststringtoqrcodeviewStringToQrCodeView1);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
setSubTitle(TAG);
}
}

View File

@@ -1,52 +0,0 @@
package cc.winboll.studio.apputils;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libapputils.activities.AssetsHtmlActivity;
import cc.winboll.studio.libapputils.app.WinBollActivity;
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2025/01/13 15:09:46
*/
public class TestWinBollActivity extends WinBollActivity {
public static final String TAG = "TestWinBollActivity";
@Override
public String getTag() {
return TAG;
}
@Override
protected Toolbar initToolBar() {
return findViewById(R.id.activitytestwinbollToolbar1);
}
@Override
protected boolean isEnableDisplayHomeAsUp() {
return true;
}
@Override
protected boolean isAddWinBollToolBar() {
return true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_testwinboll);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
setSubTitle(TAG);
}
}

View File

@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activitymainToolbar1"/>
@@ -27,7 +27,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TestLog"
android:textAllCaps="false"
android:textAllCaps="false"
android:onClick="onTestLogClick"/>
<Button
@@ -39,20 +39,27 @@
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="false"
android:text="Test Javascript Html Activity"
android:onClick="onTestJavascriptHtmlActivity"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="false"
android:text="Test Javascript Html Activity"
android:onClick="onTestJavascriptHtmlActivity"/>
</LinearLayout>
</LinearLayout>
<cc.winboll.studio.libappbase.LogView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Button"
android:id="@+id/logview"
android:layout_weight="1.0"/>
</LinearLayout>

View File

@@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityteststringtoqrcodeviewToolbar1"/>

View File

@@ -7,7 +7,7 @@
android:layout_height="match_parent"
android:background="#FF36B5B3">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activitytestwinbollToolbar1"/>

View File

@@ -1,32 +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="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_gradient"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_launcher"/>
<TextView
android:id="@android:id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textColor="#FF000000"
android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>

View File

@@ -3,14 +3,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/item_testwinboll"
android:title="TestWinBollActivity"
app:showAsAction="ifRoom"/>
android:title="TestWinBollActivity"/>
<item
android:id="@+id/item_teststringtoqrcodeview"
android:title="TestStringToQrCodeViewActivity"
app:showAsAction="ifRoom"/>
android:title="TestStringToQrCodeViewActivity"/>
<item
android:id="@+id/item_testqrcodedecodeactivity"
android:title="TestQRCodeDecodeActivity"
app:showAsAction="ifRoom"/>
android:title="TestQRCodeDecodeActivity"/>
<item
android:id="@+id/item_testcrashreport"
android:title="TestCrashReportActivity"/>
</menu>

View File

@@ -4,7 +4,4 @@
<color name="colorPrimary">#FF196ABC</color>
<color name="colorPrimaryDark">#FF002B57</color>
<color name="colorAccent">#FF80BFFF</color>
<color name="colorToastFrame">#FFA9A9A9</color>
<color name="colorToastShadow">#FF000000</color>
<color name="colorToastBackgroung">#FFFFFFFF</color>
</resources>

View File

@@ -1,3 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyUtilsTheme" parent="UtilsTheme">
<item name="attrColorPrimary">@color/colorPrimary</item>
<item name="themeGlobalCrashActivity">@style/GlobalCrashActivityTheme</item>
</style>
</resources>

View File

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

View File

@@ -0,0 +1,19 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=false
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false

View File

@@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4096m
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
@@ -17,10 +17,3 @@ org.gradle.jvmargs=-Xmx4096m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
org.gradle.caching=true
android.disableAutomaticComponentCreation=true
android.injected.testOnly=false

View File

@@ -21,26 +21,4 @@ android {
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
// SSH
implementation 'com.jcraft:jsch:0.1.55'
// Html 解析
implementation 'org.jsoup:jsoup:1.13.1'
// 二维码类库
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
// 应用介绍页类库
implementation 'io.github.medyo:android-about-page:2.0.0'
// 吐司类库
implementation 'com.github.getActivity:ToastUtils:10.5'
// 网络连接类库
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
// Android 类库
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
}

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Mar 08 04:46:23 HKT 2025
stageCount=5
#Sat Mar 15 15:29:07 HKT 2025
stageCount=3
libraryProject=libappbase
baseVersion=2.1
publishVersion=2.1.4
baseVersion=15.0
publishVersion=15.0.2
buildCount=0
baseBetaVersion=2.1.5
baseBetaVersion=15.0.3

View File

@@ -6,17 +6,13 @@ package cc.winboll.studio.libappbase;
* @Describe 全局应用类
*/
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Looper;
import android.view.Gravity;
import com.hjq.toast.ToastUtils;
import com.hjq.toast.style.WhiteToastStyle;
import cc.winboll.studio.libappbase.utils.ToastUtils;
public class GlobalApplication extends Application {
@@ -78,8 +74,8 @@ public class GlobalApplication extends Application {
ToastUtils.init(this);
// 设置 Toast 布局样式
//ToastUtils.setView(R.layout.toast_custom_view);
ToastUtils.setStyle(new WhiteToastStyle());
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
//ToastUtils.setStyle(new WhiteToastStyle());
//ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
}
public static String getAppName(Context context) {

View File

@@ -21,11 +21,9 @@ import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libappbase.R;
import androidx.appcompat.app.AppCompatActivity;
public final class GlobalCrashActivity extends AppCompatActivity implements MenuItem.OnMenuItemClickListener {
public final class GlobalCrashActivity extends Activity implements MenuItem.OnMenuItemClickListener {
private static final int MENUITEM_COPY = 0;
private static final int MENUITEM_RESTART = 1;
@@ -47,10 +45,10 @@ public final class GlobalCrashActivity extends AppCompatActivity implements Menu
setContentView(R.layout.activity_globalcrash);
mGlobalCrashReportView = findViewById(R.id.activityglobalcrashGlobalCrashReportView1);
mGlobalCrashReportView.setReport(mLog);
setSupportActionBar(mGlobalCrashReportView.getToolbar());
setActionBar(mGlobalCrashReportView.getToolbar());
getSupportActionBar().setTitle(CrashHandler.TITTLE);
getSupportActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext()));
getActionBar().setTitle(CrashHandler.TITTLE);
getActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext()));
}
@Override

View File

@@ -15,8 +15,8 @@ import android.view.Menu;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libappbase.R;
import android.widget.Toolbar;
public class GlobalCrashReportView extends LinearLayout {

View File

@@ -16,16 +16,15 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.R;
import cc.winboll.studio.libappbase.views.HorizontalListView;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
@@ -51,7 +50,7 @@ public class LogView extends RelativeLayout {
Spinner mLogLevelSpinner;
ArrayAdapter<CharSequence> mLogLevelSpinnerAdapter;
// 标签列表
RecyclerView recyclerView;
HorizontalListView mListViewTags;
public LogView(Context context) {
super(context);
@@ -190,11 +189,9 @@ public class LogView extends RelativeLayout {
cbALLTAG.setChecked(isAllSelect);
// 加载标签表
recyclerView = findViewById(cc.winboll.studio.libappbase.R.id.viewlogRecyclerView1);
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);
recyclerView.setLayoutManager(layoutManager);
mTAGListAdapter = new TAGListAdapter(mapTAGList);
recyclerView.setAdapter(mTAGListAdapter);
mListViewTags = findViewById(cc.winboll.studio.libappbase.R.id.tags_listview);
mTAGListAdapter = new TAGListAdapter(mContext, mapTAGList);
mListViewTags.setAdapter(mTAGListAdapter);
// 可以添加点击监听器来处理勾选框状态变化后的逻辑,比如获取当前勾选情况等
mTAGListAdapter.notifyDataSetChanged();
@@ -305,15 +302,32 @@ public class LogView extends RelativeLayout {
}
public class TAGListAdapter extends RecyclerView.Adapter<TAGListAdapter.ViewHolder> {
public class TAGListAdapter extends BaseAdapter {
private Context context;
private Map<String, Boolean> mapOrigin;
private List<TAGItemModel> itemList;
public TAGListAdapter(Map<String, Boolean> map) {
public TAGListAdapter(Context context, Map<String, Boolean> map) {
this.context = context;
mapOrigin = map;
loadMap(mapOrigin);
}
@Override
public int getCount() {
return itemList.size();
}
@Override
public Object getItem(int p) {
return itemList.get(p);
}
@Override
public long getItemId(int p) {
return p;
}
void loadMap(Map<String, Boolean> map) {
itemList = new ArrayList<TAGItemModel>();
@@ -329,16 +343,20 @@ public class LogView extends RelativeLayout {
loadMap(mapOrigin);
super.notifyDataSetChanged();
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_logtag, parent, false);
return new ViewHolder(view);
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.item_logtag, parent, false);
holder = new ViewHolder();
holder.tvText = convertView.findViewById(R.id.viewlogtagTextView1);
holder.cbChecked = convertView.findViewById(R.id.viewlogtagCheckBox1);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
final TAGItemModel item = itemList.get(position);
holder.tvText.setText(item.getTag());
holder.cbChecked.setChecked(item.isChecked());
@@ -349,22 +367,13 @@ public class LogView extends RelativeLayout {
LogUtils.setTAGListEnable(item.getTag(), ((CheckBox)v).isChecked());
}
});
return convertView;
}
@Override
public int getItemCount() {
return itemList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public class ViewHolder {
TextView tvText;
CheckBox cbChecked;
public ViewHolder(@NonNull View itemView) {
super(itemView);
tvText = itemView.findViewById(R.id.viewlogtagTextView1);
cbChecked = itemView.findViewById(R.id.viewlogtagCheckBox1);
}
}
}

View File

@@ -0,0 +1,33 @@
package cc.winboll.studio.libappbase.utils;
import android.content.Context;
import android.widget.Toast;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/12 12:02:31
*/
public class ToastUtils {
public static final String TAG = "ToastUtils";
volatile static ToastUtils _ToastUtils;
Context mContext;
ToastUtils() {
}
synchronized static ToastUtils getInstance() {
if (_ToastUtils == null) {
_ToastUtils = new ToastUtils();
}
return _ToastUtils;
}
public static void init(Context context) {
getInstance().mContext = context;
}
public static void show(String message) {
Toast.makeText(getInstance().mContext, message, Toast.LENGTH_SHORT).show();
}
}

View File

@@ -0,0 +1,82 @@
package cc.winboll.studio.libappbase.views;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/12 12:29:01
* @Describe 水平布局的 ListView
*/
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ListView;
import cc.winboll.studio.libappbase.LogUtils;
public class HorizontalListView extends ListView {
public static final String TAG = "HorizontalListView";
public HorizontalListView(Context context) {
super(context);
}
public HorizontalListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public HorizontalListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
// @Override
// protected void onLayout(boolean changed, int l, int t, int r, int b) {
// super.onLayout(changed, l, t, r, b);
// int childCount = getChildCount();
// int left = getPaddingLeft();
// // 获取HorizontalListView的高度
// int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
// for (int i = 0; i < childCount; i++) {
// View child = getChildAt(i);
// int width = child.getMeasuredWidth();
// int height = child.getMeasuredHeight();
// // 计算子项在垂直方向上的居中偏移量
// int verticalOffset = (viewHeight - height) / 2;
// // 设置子视图的位置,实现水平布局并垂直居中
// child.layout(left, getPaddingTop() + verticalOffset, left + width, getPaddingTop() + verticalOffset + height);
// left += width;
// }
// }
//
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
int childCount = getChildCount();
int left = getPaddingLeft();
int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
LogUtils.d(TAG, String.format("HorizontalListView的高度 %d", viewHeight));
int verticalOffset = 20;
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
// 计算每个子视图的宽度和高度
int width = child.getMeasuredWidth();
int height = child.getMeasuredHeight();
//LogUtils.d(TAG, String.format("child : width %d , height %d", width, height));
// 设置子视图的位置,实现水平布局
child.layout(left, verticalOffset, left + width, verticalOffset + height);
left += width;
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int newHeightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
//super.onMeasure(widthMeasureSpec, newHeightMeasureSpec);
int newWidthMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
//LogUtils.d(TAG, String.format("newWidthMeasureSpec %d, newHeightMeasureSpec %d", newWidthMeasureSpec, newHeightMeasureSpec));
super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec);
// ViewGroup.LayoutParams params = getLayoutParams();
// params.width = getMeasuredWidth();
}
}

View File

@@ -14,9 +14,9 @@ import android.widget.RemoteViews;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.R;
import cc.winboll.studio.libappbase.utils.ServiceUtils;
import com.hjq.toast.ToastUtils;
import android.content.ServiceConnection;
import android.os.IBinder;
import cc.winboll.studio.libappbase.utils.ToastUtils;
public class StatusWidget extends AppWidgetProvider {
@@ -35,6 +35,7 @@ public class StatusWidget extends AppWidgetProvider {
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
if (intent.getAction().equals(ACTION_STATUS_UPDATE)) {
ToastUtils.show("Test");
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, StatusWidget.class));
for (int appWidgetId : appWidgetIds) {

View File

@@ -9,7 +9,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import cc.winboll.studio.libappbase.LogUtils;
import com.hjq.toast.ToastUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
public class StatusWidgetClickListener extends BroadcastReceiver {

View File

@@ -0,0 +1,22 @@
<?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="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#FFEEEEEE">
<TextView
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_marginLeft="5dp"
android:id="@+id/viewlogtagTextView1"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="24dp"
android:id="@+id/viewlogtagCheckBox1"/>
</LinearLayout>

View File

@@ -7,7 +7,7 @@
android:layout_height="match_parent"
android:id="@+id/viewglobalcrashreportLinearLayout1">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/viewglobalcrashreportToolbar1"/>

View File

@@ -1,121 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000">
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000">
<RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:background="@drawable/bg_shadow"
android:id="@+id/viewlogRelativeLayoutToolbar">
<RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:background="@drawable/bg_shadow"
android:id="@+id/viewlogRelativeLayoutToolbar">
<Button
android:layout_width="wrap_content"
android:layout_height="36dp"
android:text="Clean"
android:textSize="14dp"
android:layout_centerVertical="true"
android:id="@+id/viewlogButtonClean"
android:layout_marginLeft="5dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="36dp"
android:text="Clean"
android:textSize="14dp"
android:layout_centerVertical="true"
android:id="@+id/viewlogButtonClean"
android:layout_marginLeft="5dp"/>
<TextView
android:background="#FF000000"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="LV:"
android:layout_toRightOf="@+id/viewlogButtonClean"
android:layout_centerVertical="true"
android:id="@+id/viewlogTextView1"
android:textColor="#FFFFFFFF"/>
<TextView
android:background="#FF000000"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="LV:"
android:layout_toRightOf="@+id/viewlogButtonClean"
android:layout_centerVertical="true"
android:id="@+id/viewlogTextView1"
android:textColor="#FFFFFFFF"/>
<Spinner
android:background="#FFFFFFFF"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_toRightOf="@+id/viewlogTextView1"
android:layout_centerVertical="true"
android:id="@+id/viewlogSpinner1"/>
<Spinner
android:background="#FFFFFFFF"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_toRightOf="@+id/viewlogTextView1"
android:layout_centerVertical="true"
android:id="@+id/viewlogSpinner1"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_toLeftOf="@+id/viewlogButtonCopy"
android:layout_centerVertical="true"
android:text="Selectable"
android:background="#FFFFFFFF"
android:paddingRight="10dp"
android:textSize="16dp"
android:id="@+id/viewlogCheckBoxSelectable"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_toLeftOf="@+id/viewlogButtonCopy"
android:layout_centerVertical="true"
android:text="Selectable"
android:background="#FFFFFFFF"
android:paddingRight="10dp"
android:textSize="16dp"
android:id="@+id/viewlogCheckBoxSelectable"/>
<Button
android:layout_width="wrap_content"
android:layout_height="36dp"
android:text="Copy"
android:layout_alignParentRight="true"
android:textSize="14dp"
android:layout_centerVertical="true"
android:id="@+id/viewlogButtonCopy"
android:layout_marginRight="5dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="36dp"
android:text="Copy"
android:layout_alignParentRight="true"
android:textSize="14dp"
android:layout_centerVertical="true"
android:id="@+id/viewlogButtonCopy"
android:layout_marginRight="5dp"/>
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/bg_shadow"
android:layout_below="@+id/viewlogRelativeLayoutToolbar"
android:id="@+id/viewlogLinearLayout1"
android:gravity="center_vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@+id/viewlogRelativeLayoutToolbar"
android:id="@+id/viewlogLinearLayout1"
android:gravity="center_vertical"
android:background="#FFC0F4C2">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ALL"
android:id="@+id/viewlogCheckBox1"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ALL"
android:id="@+id/viewlogCheckBox1"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/view_border"
android:id="@+id/viewlogRecyclerView1"
android:layout_weight="1.0"
android:layout_marginRight="5dp"
android:padding="2dp"/>
<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:scrollbars="none"
android:layout_weight="1.0"
android:background="#FF97F2E3">
</LinearLayout>
<cc.winboll.studio.libappbase.views.HorizontalListView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/view_border"
android:id="@+id/tags_listview"
android:paddingLeft="10dp"/>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:layout_alignParentBottom="true"
android:layout_below="@+id/viewlogLinearLayout1">
</HorizontalScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000"
android:id="@+id/viewlogScrollViewLog">
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Text"
android:textColor="#FF00FF00"
android:textIsSelectable="true"
android:id="@+id/viewlogTextViewLog"/>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:layout_alignParentBottom="true"
android:layout_below="@+id/viewlogLinearLayout1">
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000"
android:id="@+id/viewlogScrollViewLog">
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Text"
android:textColor="#FF00FF00"
android:textIsSelectable="true"
android:id="@+id/viewlogTextViewLog"/>
</ScrollView>
</RelativeLayout>
</RelativeLayout>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="#F5F5F5"
app:cardElevation="4dp"
app:cardCornerRadius="4dp"
android:id="@+id/listviewauthinfoCardView1"
android:layout_marginLeft="0dp"
android:layout_marginRight="5dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_marginLeft="5dp"
android:id="@+id/viewlogtagTextView1"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="24dp"
android:id="@+id/viewlogtagCheckBox1"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="APPBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="APPBaseTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
<item name="themeGlobalCrashActivity">@style/GlobalCrashActivityTheme</item>
</style>

View File

@@ -4,12 +4,12 @@ apply from: '../.winboll/winboll_lib_build.gradle'
apply from: '../.winboll/winboll_lint_build.gradle'
android {
compileSdkVersion 32
buildToolsVersion "33.0.3"
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
minSdkVersion 26
targetSdkVersion 29
}
buildTypes {
release {
@@ -17,28 +17,22 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
dependencies {
// 二维码使用的类库
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.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:libappbase:1.0.3'
api fileTree(dir: 'libs', include: ['*.jar'])
implementation 'cc.winboll.studio:libappbase:15.0.5'
// 二维码类库
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
// 网络连接类库
//implementation 'com.squareup.okhttp3:okhttp:4.4.1'
// Html 解析
//implementation 'org.jsoup:jsoup:1.13.1'
// SSH
//implementation 'com.jcraft:jsch:0.1.55'
}

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Jan 18 13:02:39 HKT 2025
stageCount=2
#Tue Mar 18 10:56:08 HKT 2025
stageCount=6
libraryProject=libapputils
baseVersion=9.2
publishVersion=9.2.1
baseVersion=15.0
publishVersion=15.0.5
buildCount=0
baseBetaVersion=9.2.2
baseBetaVersion=15.0.6

View File

@@ -18,6 +18,9 @@
<!-- 拍摄照片和视频 -->
<uses-permission android:name="android.permission.CAMERA"/>
<!-- 拥有完全的网络访问权限 -->
<uses-permission android:name="android.permission.INTERNET"/>
<application android:networkSecurityConfig="@xml/network_security_config">
<activity
@@ -26,7 +29,7 @@
android:launchMode="standard"/>
<activity
android:name=".log.LogActivity"
android:name=".activities.LogActivity"
android:label="LogActivity"
android:launchMode="standard"/>
@@ -45,4 +48,4 @@
</application>
</manifest>
</manifest>

View File

@@ -1,70 +1,79 @@
package cc.winboll.studio.libapputils.activities;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libapputils.app.WinBollActivity;
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
import cc.winboll.studio.libapputils.log.LogUtils;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2024/07/14 13:20:33
* @Describe AboutFragment Test
* @Describe 应用介绍页
*/
final public class AboutActivity extends WinBollActivity {
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.AboutView;
final public class AboutActivity extends Activity implements IWinBollActivity {
public static final String TAG = "AboutActivity";
public static final String EXTRA_APPINFO = "EXTRA_APPINFO";
APPInfo mAPPInfo;
@Override
public Activity getActivity() {
return this;
}
@Override
public APPInfo getAppInfo() {
return null;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected boolean isEnableDisplayHomeAsUp() {
public boolean isEnableDisplayHomeAsUp() {
return true;
}
@Override
public boolean isAddWinBollToolBar() {
return false;
}
@Override
public Toolbar initToolBar() {
return findViewById(R.id.activityaboutToolbar1);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
Intent intent = getIntent();
if (intent != null) {
mAPPInfo = (APPInfo)intent.getSerializableExtra(EXTRA_APPINFO);
}
if (mAPPInfo == null) {
mAPPInfo = new APPInfo();
}
/*AboutView aboutView = findViewById(R.id.activityaboutAboutView1);
aboutView.setOnRequestDevUserInfoAutofillListener(new AboutView.OnRequestDevUserInfoAutofillListener(){
AboutView aboutView = new AboutView(this, mAPPInfo);
LinearLayout llMain = findViewById(R.id.activityaboutLinearLayout1);
llMain.addView(aboutView);
@Override
public void requestAutofill(EditText etDevUserName, EditText etDevUserPassword) {
AutofillManager autofillManager = (AutofillManager) getSystemService(AutofillManager.class);
if (autofillManager!= null) {
//ToastUtils.show("0");
autofillManager.requestAutofill(findViewById(R.id.usernameEditText));
autofillManager.requestAutofill(findViewById(R.id.passwordEditText));
}
}
});*/
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
setSubTitle(TAG);
}
@Override
protected boolean isAddWinBollToolBar() {
return false;
}
@Override
protected Toolbar initToolBar() {
return findViewById(R.id.activityaboutToolbar1);
//ToastUtils.show(TAG);
}
@Override
@@ -73,15 +82,11 @@ final public class AboutActivity extends WinBollActivity {
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.item_help) {
WinBollActivityManager.getInstance(this).startWinBollActivity(this, AssetsHtmlActivity.class);
}
// else if (item.getItemId() == android.R.id.home) {
// WinBollActivityManager.getInstance(this).finish(this);
// }
return super.onOptionsItemSelected(item);
}
}

View File

@@ -5,28 +5,28 @@ package cc.winboll.studio.libapputils.activities;
* @Date 2025/01/03 11:02:49
* @Describe 一个可以浏览随 APP 附带的 Html 文档的窗口
*/
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libapputils.app.WinBollActivity;
import cc.winboll.studio.libapputils.log.LogUtils;
import android.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.SimpleWebView;
import com.hjq.toast.ToastUtils;
import java.io.IOException;
import java.io.InputStream;
import android.os.PersistableBundle;
public class AssetsHtmlActivity extends WinBollActivity {
public class AssetsHtmlActivity extends Activity implements IWinBollActivity {
public static final String TAG = "AssetsHtmlActivity";
public static final String EXTRA_HTMLFILENAME = "EXTRA_HTMLFILENAME";
String mszHelpIndexFilePath = "";
Uri mszHelpIndexFileUri;
Context mContext;
@@ -34,24 +34,34 @@ public class AssetsHtmlActivity extends WinBollActivity {
// Assets 文件夹里的 Html 文件的名称
String mszHtmlFileName;
@Override
public Activity getActivity() {
return this;
}
@Override
public APPInfo getAppInfo() {
return null;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected boolean isEnableDisplayHomeAsUp() {
public boolean isEnableDisplayHomeAsUp() {
return true;
}
@Override
protected boolean isAddWinBollToolBar() {
public boolean isAddWinBollToolBar() {
return false;
}
@Override
protected Toolbar initToolBar() {
public Toolbar initToolBar() {
return findViewById(R.id.activityassetshtmlToolbar1);
}
@@ -81,7 +91,7 @@ public class AssetsHtmlActivity extends WinBollActivity {
if (szTemp != null && !szTemp.trim().equals("")) {
mszHtmlFileName = szTemp.trim();
}
ToastUtils.show(mszHtmlFileName);
//ToastUtils.show(mszHtmlFileName);
}
// 与其他应用分享 html 帮助
@@ -107,13 +117,6 @@ public class AssetsHtmlActivity extends WinBollActivity {
// myWebView.loadUrl(mszHelpIndexFileUri.toString());
}
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onPostCreate(savedInstanceState, persistentState);
setSubTitle(mszHtmlFileName);
//setSubTitle(TAG);
}
//
void initWebViewFromAssets(String szHtmlFileName) {
try {

View File

@@ -0,0 +1,68 @@
package cc.winboll.studio.libapputils.activities;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/08 00:19:39
* @Describe LogActivity
*/
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
public class LogActivity extends Activity implements IWinBollActivity {
public static final String TAG = "LogActivity";
LogView mLogView;
@Override
public Activity getActivity() {
return this;
}
@Override
public APPInfo getAppInfo() {
return null;
}
@Override
public String getTag() {
return TAG;
}
@Override
public Toolbar initToolBar() {
return null;
}
@Override
public boolean isEnableDisplayHomeAsUp() {
return false;
}
@Override
public boolean isAddWinBollToolBar() {
return false;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
LogUtils.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log);
mLogView = findViewById(R.id.logview);
mLogView.start();
}
@Override
protected void onResume() {
LogUtils.d(TAG, "onResume");
super.onResume();
}
}

View File

@@ -5,29 +5,40 @@ package cc.winboll.studio.libapputils.activities;
* @Date 2025/01/18 10:32:21
* @Describe 二维码扫码解码窗口
*/
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libapputils.app.WinBollActivity;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
import com.google.zxing.ResultPoint;
import com.journeyapps.barcodescanner.BarcodeCallback;
import com.journeyapps.barcodescanner.BarcodeResult;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
import java.util.List;
public class QRCodeDecodeActivity extends WinBollActivity {
public class QRCodeDecodeActivity extends Activity implements IWinBollActivity {
public static final String TAG = "QRCodeDecodeActivity";
public static final String EXTRA_RESULT = "EXTRA_RESULT";
public static final String EXTRA_RESULT = "EXTRA_RESULT";
private static final int REQUEST_CAMERA_PERMISSION = 1;
TextView resultTextView;
DecoratedBarcodeView barcodeView;
@Override
public Activity getActivity() {
return this;
}
@Override
public APPInfo getAppInfo() {
return null;
}
@Override
public String getTag() {
@@ -35,18 +46,18 @@ public class QRCodeDecodeActivity extends WinBollActivity {
}
@Override
protected boolean isEnableDisplayHomeAsUp() {
public boolean isEnableDisplayHomeAsUp() {
return true;
}
@Override
protected boolean isAddWinBollToolBar() {
public boolean isAddWinBollToolBar() {
return false;
}
@Override
protected Toolbar initToolBar() {
public Toolbar initToolBar() {
return findViewById(R.id.activityqrcodedecodeToolbar1);
}
@@ -57,16 +68,17 @@ public class QRCodeDecodeActivity extends WinBollActivity {
resultTextView = findViewById(R.id.activityqrcodedecodeTextView1);
barcodeView = findViewById(R.id.activityqrcodedecodeDecoratedBarcodeView1);
// 请求相机权限
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{android.Manifest.permission.CAMERA},
REQUEST_CAMERA_PERMISSION);
} else {
startScanning();
}
// if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
// != PackageManager.PERMISSION_GRANTED) {
// ActivityCompat.requestPermissions(this,
// new String[]{android.Manifest.permission.CAMERA},
// REQUEST_CAMERA_PERMISSION);
// } else {
// startScanning();
// }
startScanning();
}
private void startScanning() {

View File

@@ -1,240 +0,0 @@
package cc.winboll.studio.libapputils.ads;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2024/12/09 15:37:35
* @Describe WinBoll 应用推广视图
*/
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import com.hjq.toast.ToastUtils;
public class ADsView extends RelativeLayout {
public static final String TAG = "ADsView";
public volatile boolean mIsHandling;
public volatile boolean mIsAddNewLog;
Context mContext;
WebView mWebView;
//ScrollView mScrollView;
//TextView mTextView;
//CheckBox mSelectableCheckBox;
//LogViewThread mLogViewThread;
//LogViewHandler mLogViewHandler;
//Spinner mLogLevelSpinner;
//ArrayAdapter<CharSequence> mLogLevelSpinnerAdapter;
public ADsView(Context context) {
super(context);
initView(context);
}
public ADsView(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public ADsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
public ADsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initView(context);
}
// public void start() {
// mLogViewThread = new LogViewThread(LogView.this);
// mLogViewThread.start();
// // 显示日志
// showAndScrollLogView();
// }
//
// public void scrollLogUp() {
// mScrollView.post(new Runnable() {
// @Override
// public void run() {
// mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
// // 日志显示结束
// mLogViewHandler.setIsHandling(false);
// // 检查是否添加了新日志
// if (mLogViewHandler.isAddNewLog()) {
// // 有新日志添加,先更改新日志标志
// mLogViewHandler.setIsAddNewLog(false);
// // 再次发送显示日志的显示
// Message message = mLogViewHandler.obtainMessage(LogViewHandler.MSG_LOGVIEW_UPDATE);
// mLogViewHandler.sendMessage(message);
// }
// }
// });
// }
void initView(Context context) {
mContext = context;
// mLogViewHandler = new LogViewHandler();
// 加载视图布局
View viewMain = inflate(mContext, cc.winboll.studio.libapputils.R.layout.view_ads, null);
mWebView = viewMain.findViewById(cc.winboll.studio.libapputils.R.id.viewadsWebView1);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
ToastUtils.show(url);
return true;
}
});
// // 初始化日志子控件视图
// //
// mScrollView = findViewById(cc.winboll.studio.libapputils.R.id.viewlogScrollViewLog);
// mTextView = findViewById(cc.winboll.studio.libapputils.R.id.viewlogTextViewLog);
// // 获取Log Level spinner实例
// mLogLevelSpinner = findViewById(cc.winboll.studio.libapputils.R.id.viewlogSpinner1);
//
// (findViewById(cc.winboll.studio.libapputils.R.id.viewlogButtonClean)).setOnClickListener(new View.OnClickListener(){
//
// @Override
// public void onClick(View v) {
// LogUtils.cleanLog();
// LogUtils.d(TAG, "Log is cleaned.");
// }
// });
// (findViewById(cc.winboll.studio.libapputils.R.id.viewlogButtonCopy)).setOnClickListener(new View.OnClickListener(){
//
// @Override
// public void onClick(View v) {
//
// ClipboardManager cm = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
// cm.setPrimaryClip(ClipData.newPlainText(mContext.getPackageName(), LogUtils.loadLog()));
// LogUtils.d(TAG, "Log is copied.");
// }
// });
// mSelectableCheckBox = findViewById(cc.winboll.studio.libapputils.R.id.viewlogCheckBoxSelectable);
// mSelectableCheckBox.setOnClickListener(new View.OnClickListener(){
// @Override
// public void onClick(View v) {
// if (mSelectableCheckBox.isChecked()) {
// setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
// } else {
// setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
// }
// }
// });
//
// // 设置日志级别列表
// ArrayList<String> adapterItems = new ArrayList<>();
// for (LogUtils.LOG_LEVEL e : LogUtils.LOG_LEVEL.values()) {
// adapterItems.add(e.name());
// }
// // 假设你有一个字符串数组作为选项列表
// //String[] options = {"Option 1", "Option 2", "Option 3"};
// // 创建一个ArrayAdapter来绑定数据到spinner
// mLogLevelSpinnerAdapter = ArrayAdapter.createFromResource(
// context, cc.winboll.studio.libapputils.R.array.enum_loglevel_array, android.R.layout.simple_spinner_item);
// mLogLevelSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//
// // 设置适配器并将它应用到spinner上
// mLogLevelSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // 设置下拉视图样式
// mLogLevelSpinner.setAdapter(mLogLevelSpinnerAdapter);
// // 为Spinner添加监听器
// mLogLevelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
// @Override
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// //String selectedOption = mLogLevelSpinnerAdapter.getItem(position);
// // 处理选中的选项...
// LogUtils.setLogLevel(LogUtils.LOG_LEVEL.values()[position]);
// }
// @Override
// public void onNothingSelected(AdapterView<?> parent) {
// // 如果没有选择,则执行此操作...
// }
// });
// // 获取默认值的索引
// int defaultValueIndex = LogUtils.getLogLevel().ordinal();
//
// if (defaultValueIndex != -1) {
// // 如果找到了默认值,设置默认选项
// mLogLevelSpinner.setSelection(defaultValueIndex);
// }
//
// // 设置滚动时不聚焦日志
// setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
}
public void loadUrl(String url) {
mWebView.loadUrl(url);
//webView.loadUrl("https://www.winboll.cc");
//webView.loadUrl("https://ads.winboll.cc");
}
// public void updateLogView() {
// if (mLogViewHandler.isHandling() == true) {
// // 正在处理日志显示,
// // 就先设置一个新日志标志位
// // 以便日志显示完后,再次显示新日志内容
// mLogViewHandler.setIsAddNewLog(true);
// } else {
// //LogUtils.d(TAG, "LogListener showLog(String path)");
// Message message = mLogViewHandler.obtainMessage(LogViewHandler.MSG_LOGVIEW_UPDATE);
// mLogViewHandler.sendMessage(message);
// mLogViewHandler.setIsAddNewLog(false);
// }
// }
//
// void showAndScrollLogView() {
// mTextView.setText(LogUtils.loadLog());
// scrollLogUp();
// }
//
// class LogViewHandler extends Handler {
//
// final static int MSG_LOGVIEW_UPDATE = 0;
// volatile boolean isHandling;
// volatile boolean isAddNewLog;
//
// public LogViewHandler() {
// setIsHandling(false);
// setIsAddNewLog(false);
// }
//
// public void setIsHandling(boolean isHandling) {
// this.isHandling = isHandling;
// }
//
// public boolean isHandling() {
// return isHandling;
// }
//
// public void setIsAddNewLog(boolean isAddNewLog) {
// this.isAddNewLog = isAddNewLog;
// }
//
// public boolean isAddNewLog() {
// return isAddNewLog;
// }
//
// public void handleMessage(Message msg) {
// switch (msg.what) {
// case MSG_LOGVIEW_UPDATE:{
// if (isHandling() == false) {
// setIsHandling(true);
// showAndScrollLogView();
// }
// break;
// }
// default:
// break;
// }
// super.handleMessage(msg);
// }
// }
}

View File

@@ -0,0 +1,54 @@
package cc.winboll.studio.libapputils.app;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2025/02/06 08:45:23
* @Describe 关于活动窗口的介绍窗口工厂
*/
import android.content.Context;
import android.content.Intent;
import cc.winboll.studio.libapputils.activities.AboutActivity;
import cc.winboll.studio.libapputils.app.AboutActivityFactory;
import cc.winboll.studio.libapputils.bean.APPInfo;
public class AboutActivityFactory {
public static final String TAG = "AboutActivityFactory";
public static APPInfo buildDefaultAPPInfo() {
String szBranchName = "";
APPInfo appInfo = new APPInfo();
appInfo.setAppName("APP");
appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll);
appInfo.setAppDescription("APP Description");
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 appInfo;
}
public static void showAboutActivity(Context context, APPInfo appInfo) {
/*String szPN = ((IWinBollActivity)context).getActivityPackageName();
//String szPN = context.getPackageName();
String szBranchName = "";
if (szPN != null) {
//String szPN = "cc.winboll.studio.apputils.beta";
String regex = "cc\\.winboll\\.studio\\.([^.]+)\\.*";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(szPN);
if (matcher.find()) {
szBranchName = matcher.group(1);
}
}*/
//ToastUtils.show(szPN);
Intent intent = new Intent(context, AboutActivity.class);
intent.putExtra(AboutActivity.EXTRA_APPINFO, (appInfo == null) ? AboutActivityFactory.buildDefaultAPPInfo():appInfo);
WinBollActivityManager.getInstance(context).startWinBollActivity(context, intent, AboutActivity.class);
}
}

View File

@@ -5,7 +5,7 @@ package cc.winboll.studio.libapputils.app;
* @Date 2024/08/12 14:45:35
* @Describe 应用版本工具集
*/
import com.hjq.toast.ToastUtils;
import cc.winboll.studio.libappbase.LogUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -23,6 +23,7 @@ public class AppVersionUtils {
// true 新版本 == 当前版本
//
public static boolean isHasNewVersion2(String szCurrentName, String szNextName) {
LogUtils.d(TAG, String.format("isHasNewVersion2\nszCurrentName : %s\nszNextName : %s", szCurrentName, szNextName));
//szCurrentName = "AES_6.2.0-beta0_3234.apk";
//szNextName = "AES_6.1.12.apk";
//szCurrentName = "AES_6.2.0-beta0_3234.apk";
@@ -77,8 +78,9 @@ public class AppVersionUtils {
//LogUtils.d(TAG, "App version is the newest. ");
return false;
}
public static boolean isHasNewStageReleaseVersion(String szCurrentName, String szNextName) {
LogUtils.d(TAG, String.format("isHasNewStageReleaseVersion\nszCurrentName : %s\nszNextName : %s", szCurrentName, szNextName));
//szCurrentName = "AES_6.2.12.apk";
//szNextName = "AES_6.3.12.apk";
if (checkNewVersion(getCodeInPackageName(szCurrentName), getCodeInPackageName(szNextName))) {
@@ -96,6 +98,10 @@ public class AppVersionUtils {
// 返回 true 新版本 > 当前版本
//
public static Boolean checkNewVersion(String szCurrentCode, String szNextCode) {
if (szCurrentCode == null || szCurrentCode.equals("") || szNextCode == null || szNextCode.equals("")) {
LogUtils.d(TAG, String.format("checkNewVersion unexpected parameters:\nszCurrentCode : %s\nszNextCode : %s", szCurrentCode, szNextCode));
return false;
}
boolean isNew = false;
String[] appVersionCurrent = szCurrentCode.split("\\.");
String[] appVersionNext = szNextCode.split("\\.");
@@ -106,7 +112,7 @@ public class AppVersionUtils {
if (Integer.parseInt(appVersionNext[i]) > Integer.parseInt(appVersionCurrent[i])) {
isNew = true;
return isNew;
} else if(Integer.parseInt(appVersionNext[i]) == Integer.parseInt(appVersionCurrent[i])) {
} else if (Integer.parseInt(appVersionNext[i]) == Integer.parseInt(appVersionCurrent[i])) {
continue ;
} else {
isNew = false;
@@ -122,14 +128,17 @@ public class AppVersionUtils {
// 如 AppUtils_7.0.4.apk 版本号为 7.0.4
//
public static String getCodeInPackageName(String apkName) {
LogUtils.d(TAG, String.format("getCodeInPackageName apkName : %s", apkName));
//String apkName = "AppUtils_7.0.0.apk";
Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
Matcher matcher = pattern.matcher(apkName);
if (matcher.find()) {
String version = matcher.group();
LogUtils.d(TAG, String.format("version is %s", version));
return version;
//System.out.println("Version number: " + version); // 输出7.0.0
}
LogUtils.d(TAG, String.format("No result."));
return "";
}
@@ -149,5 +158,4 @@ public class AppVersionUtils {
}
return "";
}
}

View File

@@ -0,0 +1,23 @@
package cc.winboll.studio.libapputils.app;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/08 00:15:36
* @Describe WinBoll 活动窗口通用接口
*/
import android.app.Activity;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.bean.APPInfo;
public interface IWinBollActivity {
public static final String TAG = "IWinBollActivity";
// 获取当前具有 IWinBoll 特征的 AppCompatActivity 活动窗口
abstract public Activity getActivity();
abstract public APPInfo getAppInfo();
abstract public String getTag();
abstract public Toolbar initToolBar();
abstract public boolean isEnableDisplayHomeAsUp();
abstract public boolean isAddWinBollToolBar();
}

View File

@@ -6,22 +6,19 @@ package cc.winboll.studio.libapputils.app;
*/
import android.app.Activity;
import android.app.Application;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import cc.winboll.studio.libapputils.log.LogUtils;
import com.hjq.toast.ToastUtils;
import java.util.Set;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
public class MyActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
public static final String TAG = "MyActivityLifecycleCallbacks";
public String mInfo = "";
public MyActivityLifecycleCallbacks(WinBollApplication application) {
public MyActivityLifecycleCallbacks() {
}
void createActivityeInfo(Activity activity) {

Some files were not shown because too many files have changed in this diff Show More