Compare commits

..

30 Commits

Author SHA1 Message Date
ZhanGSKen f5dc87149e <positions>APK 15.12.23 release Publish. 2026-07-19 20:37:45 +08:00
ZhanGSKen e45619a352 更新源码地址 2026-07-19 20:36:37 +08:00
ZhanGSKen 8a992b2c66 <positions>APK 15.12.22 release Publish. 2026-07-19 20:29:15 +08:00
ZhanGSKen bdc76ea059 恢复原WinBoLL项目,projects_keeper_tag保持的Positions模块文件。 2026-07-18 21:27:06 +08:00
ZhanGSKen e136045d1f Merge remote-tracking branch 'winboll_https/projects_keeper_tag' into mywinboll 2026-07-11 20:21:13 +08:00
qinglong bd635425a1 合并模块AES 同步最新时间标签aes-v15.20.18 2026-07-11 20:17:35 +08:00
BigPickle 49414a3938 App/MainActivity: 修复主题切换 crash 及工具栏主题不刷新问题
- App.onCreate 添加 AESThemeUtil.init(null) 初始化 themeStyleIDList,
  修复点击主题菜单时 IndexOutOfBoundsException 崩溃
- MainActivity.onCreate 添加 AESThemeUtil.applyAppCompatTheme(this)
  置于 super.onCreate 之前,使 recreate() 后应用已保存的主题样式
2026-07-02 01:34:58 +08:00
BigPickle 08a47768a1 MainActivity: 接入 AESThemeUtil/DevelopUtils 工具类,替换 Toolbar 为 ASupportToolbar
- MainActivity 新增 onCreateOptionsMenu/onOptionsItemSelected,
  使用 AESThemeUtil.inflateCompatThemeMenu 加载主题菜单、
  DevelopUtils.inflateMenu 加载调试菜单
- 布局文件 Toolbar 替换为 cc.winboll.studio.libaes.views.ASupportToolbar,
  移除 AppBarLayout 包裹层
- MyAppTheme 日间/夜间主题增加 aSupportToolbar 属性引用 AESASupportToolbar 样式
2026-07-02 01:26:50 +08:00
ZhanGSKen 79f161b559 fix: 修复 MyAppTheme 主题继承链,适配 Android 16(SDK 36)
- 修复 view_log.xml 自定义属性解析失败崩溃(需要 APPBaseTheme 的属性集)
- 修复 AppCompatActivity 需要 Theme.AppCompat 子主题的 IllegalStateException
- 父主题改为 Theme.AppCompat.Light.NoActionBar / Theme.AppCompat.NoActionBar
- 新增 values-night/ 日夜模式自动切换支持
- 主色调从 Teal/Orange 更换为 Blue/Amber 专业配色方案
2026-07-01 17:06:20 +08:00
LaizyBoy b14538db47 20260701_163734_738 2026-07-01 16:37:41 +08:00
ZhanGSKen c9e16a9a1e 编译配置完成 2026-07-01 15:53:23 +08:00
ZhanGSKen 42dbfb4238 加入WinBoLL框架文件 2026-07-01 15:47:18 +08:00
ZhanGSKen b274503187 20260701_154438_390 2026-07-01 15:45:11 +08:00
ZhanGSKen b50e4e02ea 修复git管理脚本 2026-07-01 04:49:24 +08:00
ZhanGSKen 84f1c820cb 修复git管理脚本 2026-07-01 04:48:30 +08:00
ZhanGSKen 0e60d75ac6 修复git管理脚本 2026-07-01 04:44:47 +08:00
ZhanGSKen 773cc9f6c1 修复git管理脚本 2026-07-01 04:42:45 +08:00
ZhanGSKen ca33dab4da 修复git管理脚本 2026-07-01 04:33:36 +08:00
ZhanGSKen eee8809485 修复git管理脚本 2026-07-01 04:11:36 +08:00
ZhanGSKen 69f79549e9 合并模块WinBoLL 同步最新时间标签winboll-v15.20.8 2026-07-01 04:10:40 +08:00
ZhanGSKen f204cd2608 修复git管理脚本 2026-07-01 04:08:42 +08:00
ZhanGSKen 2d3592690a 更新新版winboll架构 2026-07-01 03:49:09 +08:00
ZhanGSKen 576f8bb5e5 更新新版winboll架构 2026-07-01 03:48:29 +08:00
qinglong e787697d6b 合并模块AES 同步最新时间标签aes-v15.20.17 2026-06-30 19:00:05 +08:00
qinglong 3db3edcf2c 合并模块APPBase 同步最新时间标签appbase-v15.20.34 2026-06-30 19:00:05 +08:00
qinglong 643d08bf22 合并模块AES 同步最新时间标签aes-v15.20.16 2026-06-26 02:00:28 +08:00
qinglong beefb16c32 合并模块APPBase 同步最新时间标签appbase-v15.20.33 2026-06-26 02:00:28 +08:00
qinglong 878009ec9f 合并模块WinBoLL 同步最新时间标签winboll-v15.20.8 2026-06-26 02:00:28 +08:00
qinglong 2d8b5d515b 合并模块AES 同步最新时间标签aes-v15.20.15 2026-06-03 20:30:22 +08:00
qinglong 1453287667 合并模块APPBase 同步最新时间标签appbase-v15.20.26 2026-06-03 20:30:22 +08:00
224 changed files with 9961 additions and 4385 deletions
+3 -45
View File
@@ -94,50 +94,8 @@ lint-results.html
## 忽略 AndroidIDE 临时文件夹
.androidide
## WinBoLL 基础应用(避免上传敏感配置)
## MyWinBoLL 基础应用(避免上传敏感配置)
/winboll.properties
/local.properties
/settings.gradle
/gradle.properties
## WinBoLL 项目配置
#.git
#.gitignore
#.gitmodules
#.gradle
#.winboll
#GenKeyStore
#LICENSE
#LICENSE-Private-Demo
#LICENSE-Private-Demo_docs
#README.md
#aes
#appbase
appkey.jks
appkey.keystore
autonfc
#build.gradle
contacts
debugtemp
gallery
gpsrelaysentinel
#gradle
gradle.properties
#gradle.properties-android-demo
#gradle.properties-androidx-demo
#gradlew
#libaes
#libappbase
libdebugtemp
libgpsrelaysentinel
#libwinboll
local.properties
#local.properties-demo
mymessagemanager
positions
powerbell
settings.gradle
#settings.gradle-demo
#winboll
winboll.properties
#winboll.properties-demo
#/settings.gradle
#/gradle.properties
@@ -1,5 +1,5 @@
#!/system/bin/sh
## 合并其他项目分支的模块源码到projects-keeper分支。
## 合并其他项目分支的模块源码到projects_keeper分支。
# ====================== 0. 进入目标目录 ======================
TARGET_DIR="/sdcard/AppProjects/Projects_Keeper"
@@ -36,7 +36,7 @@ fi
# ====================== 3. Git 分支检查 ======================
CUR_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
TARGET_BRANCH="projects-keeper"
TARGET_BRANCH="projects_keeper"
if [ "$CUR_BRANCH" != "$TARGET_BRANCH" ]; then
echo "错误:当前不在 $TARGET_BRANCH 分支!"
@@ -72,7 +72,6 @@ libaes
libappbase
libdebugtemp
libgpsrelaysentinel
libwinboll
local.properties-demo
mymessagemanager
positions
@@ -82,13 +81,14 @@ winboll
winboll.properties-demo
)
# ====================== 5. 获取当前目录真实文件列表 ======================
# ====================== 5. 获取当前目录真实文件列表(兼容过滤 . .. ======================
REAL_ITEMS=()
# 使用固定排序ls,自动过滤 . 和 ..,不会进入比对数组
while IFS= read -r line; do
if [[ "$line" != "." && "$line" != ".." ]]; then
REAL_ITEMS+=("$line")
fi
done < <(ls -a)
done < <(LC_COLLATE=C ls -a1 --color=none)
# ====================== 6. 差异比对函数 ======================
check_diff() {
@@ -158,7 +158,7 @@ echo -e "## 对象列表结束
## 合并 APP 项目
MERGE_APP_PROJECT_LIST=(
DemoAPP
WinBoLL
)
echo -e "#@@@ 开始合并应用型模块源码 @@@#
## 目标合并对象列表:"
@@ -166,14 +166,13 @@ echo -e "#@@@ 开始合并应用型模块源码 @@@#
for item in "${MERGE_APP_PROJECT_LIST[@]}"; do
echo "正在合并 $item 项目 ..."
item_lower=$(echo "$item" | tr 'A-Z' 'a-z')
git checkout origin/$item_lower $item_lower
git checkout origin/$item_lower $item_lower
git add .
git commit -m "合并 $item 项目"
done
## 合并 LIB 项目
MERGE_LIB_PROJECT_LIST=(
WinBoLL
APPBase
AES
)
@@ -183,10 +182,10 @@ echo -e "#@@@ 开始合并类库型模块源码 @@@#
for item in "${MERGE_LIB_PROJECT_LIST[@]}"; do
echo "正在合并 $item 项目 ..."
item_lower=$(echo "$item" | tr 'A-Z' 'a-z')
git checkout origin/$item_lower $item_lower lib$item_lower
git checkout origin/$item_lower $item_lower lib$item_lower
git add .
git commit -m "合并 $item 项目"
done
echo '正在推送 Projects_Keeper 项目'
git push
git push
@@ -38,7 +38,7 @@ if [ "${NOW_BRANCH}" != "${TARGET_BRANCH}" ];then
exit 1
fi
# 目录结构校验
# 目录结构校验白名单(不含 . ..
MERGE_OBJECTS_LIST=(
.git
.gitignore
@@ -65,7 +65,6 @@ libaes
libappbase
libdebugtemp
libgpsrelaysentinel
libwinboll
local.properties-demo
mymessagemanager
positions
@@ -76,9 +75,13 @@ winboll.properties-demo
)
REAL_ITEMS=()
# 标准排序ls输出,循环强制过滤 . 和 ..
while IFS= read -r line; do
[[ $line != "." && $line != ".." ]] && REAL_ITEMS+=("$line")
done < <(ls -a)
# 跳过虚拟目录 . 和 ..
if [[ "$line" != "." && "$line" != ".." ]]; then
REAL_ITEMS+=("$line")
fi
done < <(LC_COLLATE=C ls -a1 --color=none)
check_diff(){
local miss=() extra=()
@@ -89,7 +92,17 @@ check_diff(){
[[ ! " ${MERGE_OBJECTS_LIST[@]} " =~ " ${i} " ]] && extra+=("$i")
done
if [[ ${#miss[@]} -gt 0 || ${#extra[@]} -gt 0 ]];then
echo "========================================"
echo "本地目录结构不一致,终止运行"
if [[ ${#miss[@]} -gt 0 ]]; then
echo -e "\n缺失条目:"
for m in "${miss[@]}"; do echo " $m"; done
fi
if [[ ${#extra[@]} -gt 0 ]]; then
echo -e "\n多余条目:"
for e in "${extra[@]}"; do echo " $e"; done
fi
echo "========================================"
exit 1
fi
}
@@ -98,7 +111,7 @@ check_diff
echo -e "#@@@ 按时间获取最新标签合并模块源码 @@@#"
# 应用型模块
MERGE_APP_PROJECT_LIST=(DemoAPP)
MERGE_APP_PROJECT_LIST=(WinBoLL)
echo -e "---------- 应用型模块 ----------"
for name in "${MERGE_APP_PROJECT_LIST[@]}";do
low_name=$(echo "$name" | tr 'A-Z' 'a-z')
@@ -120,7 +133,7 @@ for name in "${MERGE_APP_PROJECT_LIST[@]}";do
done
# 类库模块
MERGE_LIB_PROJECT_LIST=(WinBoLL APPBase AES)
MERGE_LIB_PROJECT_LIST=(APPBase AES)
echo -e "---------- 类库模块 ----------"
for name in "${MERGE_LIB_PROJECT_LIST[@]}";do
low_name=$(echo "$name" | tr 'A-Z' 'a-z')
+228
View File
@@ -0,0 +1,228 @@
#!/usr/bin/bash
# ==============================================================================
# WinBoLL 应用发布脚本
# 功能:检查Git源码状态 → 编译Stage Release包 → 添加WinBoLL标签 → 提交并推送源码
# 依赖:build.properties、app_update_description.txt(项目根目录下)
# 使用:./script_name.sh <APP_NAME>
# 作者:豆包&ZhanGSKen<zhangsken@qq.com>
# ==============================================================================
# ==================== 常量定义 ====================
# 脚本退出码
EXIT_CODE_SUCCESS=0
EXIT_CODE_ERR_NO_APP_NAME=2
EXIT_CODE_ERR_WORK_DIR=1
EXIT_CODE_ERR_GIT_CHECK=1
EXIT_CODE_ERR_ADD_WINBOLL_TAG=1
# Gradle 任务(正式发布)
GRADLE_TASK_PUBLISH="assembleStageRelease"
# Gradle 任务(调试用,注释备用)
# GRADLE_TASK_DEBUG="assembleBetaDebug"
# aapt2本地覆盖参数
AAPT2_OVERRIDE_ARG="-Pandroid.aapt2FromMavenOverride=/data/data/com.termux/files/usr/bin/aapt2"
# 禁用Gradle守护进程
GRADLE_NO_DAEMON="--no-daemon"
# ==================== 函数定义 ====================
# 检查Git源码是否已完全提交(无未提交变更)
# 返回值:0=已完全提交,1=存在未提交变更
function checkGitSources() {
# 配置Git安全目录(解决权限问题)
git config --global --add safe.directory "$(pwd)"
# 检查是否有未提交的变更
if [[ -n $(git diff --stat) ]]; then
echo "[ERROR] Git源码存在未提交变更,请先提交所有修改!"
return 1
fi
echo "[INFO] Git源码检查通过:所有变更已提交。"
return 0
}
# 询问是否添加GitHub Workflows标签(当前逻辑注释,保留扩展能力)
# 返回值:1=用户选择是,0=用户选择否
function askAddWorkflowsTag() {
read -p "是否添加GitHub Workflows标签?(Y/n) " answer
if [[ $answer =~ ^[Yy]$ ]]; then
return 1
else
return 0
fi
}
# 添加WinBoLL正式标签
# 参数:$1=应用名称(项目根目录名)
# 返回值:0=标签添加成功,1=标签已存在/添加失败
function addWinBoLLTag() {
local app_name=$1
local build_prop_path="${app_name}/build.properties"
# 从build.properties中提取publishVersion
local publish_version=$(grep -o "publishVersion=.*" "${build_prop_path}" | awk -F '=' '{print $2}')
if [[ -z ${publish_version} ]]; then
echo "[ERROR] 未从${build_prop_path}中提取到publishVersion配置!"
return 1
fi
echo "[INFO] 从${build_prop_path}读取到publishVersion${publish_version}"
# 构造WinBoLL标签(格式:<APP_NAME>-v<publishVersion>
local tag="${app_name}-v${publish_version}"
echo "[INFO] 准备添加WinBoLL标签:${tag}"
# 检查标签是否已存在
if [[ "$(git tag -l ${tag})" == "${tag}" ]]; then
echo "[ERROR] WinBoLL标签${tag}已存在!"
return 1
fi
# 添加带注释的标签(注释来自app_update_description.txt
git tag -a "${tag}" -F "${app_name}/app_update_description.txt"
echo "[INFO] WinBoLL标签${tag}添加成功!"
return 0
}
# 添加GitHub Workflows Beta标签(当前逻辑注释,保留扩展能力)
# 参数:$1=应用名称(项目根目录名)
# 返回值:0=标签添加成功,1=标签已存在/添加失败
function addWorkflowsTag() {
local app_name=$1
local build_prop_path="${app_name}/build.properties"
# 从build.properties中提取baseBetaVersion
local base_beta_version=$(grep -o "baseBetaVersion=.*" "${build_prop_path}" | awk -F '=' '{print $2}')
if [[ -z ${base_beta_version} ]]; then
echo "[ERROR] 未从${build_prop_path}中提取到baseBetaVersion配置!"
return 1
fi
echo "[INFO] 从${build_prop_path}读取到baseBetaVersion${base_beta_version}"
# 构造Workflows标签(格式:<APP_NAME>-v<baseBetaVersion>-beta
local tag="${app_name}-v${base_beta_version}-beta"
echo "[INFO] 准备添加Workflows标签:${tag}"
# 检查标签是否已存在
if [[ "$(git tag -l ${tag})" == "${tag}" ]]; then
echo "[ERROR] Workflows标签${tag}已存在!"
return 1
fi
# 添加带注释的标签(注释来自app_update_description.txt
git tag -a "${tag}" -F "${app_name}/app_update_description.txt"
echo "[INFO] Workflows标签${tag}添加成功!"
return 0
}
# ==================== 主流程开始 ====================
echo "============================================="
echo " WinBoLL 应用发布脚本"
echo "============================================="
# 1. 检查应用名称参数是否指定
if [ -z "$1" ]; then
echo "[ERROR] 未指定应用名称!使用方式:${0} <APP_NAME>"
exit ${EXIT_CODE_ERR_NO_APP_NAME}
fi
APP_NAME=$1
echo "[INFO] 待发布应用名称:${APP_NAME}"
# 2. 检查并切换到项目根目录(确保build.properties存在)
echo "[INFO] 当前工作目录:$(pwd)"
if [[ ! -e "${APP_NAME}/build.properties" ]]; then
echo "[WARNING] 当前目录不存在${APP_NAME}/build.properties,尝试切换到上级目录..."
cd ..
echo "[INFO] 切换后工作目录:$(pwd)"
fi
# 验证最终工作目录是否正确
if [[ ! -e "${APP_NAME}/build.properties" ]]; then
echo "[ERROR] 工作目录错误!${APP_NAME}/build.properties 文件不存在。"
exit ${EXIT_CODE_ERR_WORK_DIR}
fi
echo "[INFO] 工作目录验证通过:${APP_NAME}/build.properties 存在。"
# 3. 检查Git源码状态
echo "---------------------------------------------"
echo " 步骤1:检查Git源码状态"
echo "---------------------------------------------"
checkGitSources
if [[ $? -ne ${EXIT_CODE_SUCCESS} ]]; then
echo "[ERROR] Git源码检查失败,脚本终止!"
exit ${EXIT_CODE_ERR_GIT_CHECK}
fi
# 4. 编译Stage Release版本APK(携带aapt2覆盖参数 + --no-daemon
echo "---------------------------------------------"
echo " 步骤2:编译Stage Release APK"
echo "---------------------------------------------"
echo "[INFO] 开始执行Gradle任务:${GRADLE_TASK_PUBLISH}"
# 调试用(注释正式任务,启用调试任务)
# bash gradlew ${AAPT2_OVERRIDE_ARG} ${GRADLE_NO_DAEMON} :${APP_NAME}:${GRADLE_TASK_DEBUG}
bash gradlew ${AAPT2_OVERRIDE_ARG} ${GRADLE_NO_DAEMON} :${APP_NAME}:${GRADLE_TASK_PUBLISH}
if [[ $? -ne ${EXIT_CODE_SUCCESS} ]]; then
echo "[ERROR] Gradle编译任务失败!"
exit 1
fi
echo "[INFO] Stage Release APK编译成功!"
# 5. 添加WinBoLL正式标签
echo "---------------------------------------------"
echo " 步骤3:添加WinBoLL标签"
echo "---------------------------------------------"
addWinBoLLTag ${APP_NAME}
if [[ $? -ne ${EXIT_CODE_SUCCESS} ]]; then
echo "[ERROR] WinBoLL标签添加失败,脚本终止!"
exit ${EXIT_CODE_ERR_ADD_WINBOLL_TAG}
fi
# 6. (可选)添加GitHub Workflows标签(当前逻辑注释,保留扩展能力)
# echo "---------------------------------------------"
# echo " 步骤4:添加Workflows标签(可选)"
# echo "---------------------------------------------"
# echo "是否添加GitHub Workflows Beta标签?(Y/n) "
# askAddWorkflowsTag
# nAskAddWorkflowsTag=$?
# if [[ ${nAskAddWorkflowsTag} -eq 1 ]]; then
# addWorkflowsTag ${APP_NAME}
# if [[ $? -ne ${EXIT_CODE_SUCCESS} ]]; then
# echo "[ERROR] Workflows标签添加失败,脚本终止!"
# exit 1
# fi
# fi
# 7. 清理更新描述文件
echo "---------------------------------------------"
echo " 步骤5:清理更新描述文件"
echo "---------------------------------------------"
echo "" > "${APP_NAME}/app_update_description.txt"
echo "[INFO] 已清空${APP_NAME}/app_update_description.txt"
# 8. 提交并推送源码与标签
echo "---------------------------------------------"
echo " 步骤6:提交并推送源码"
echo "---------------------------------------------"
git add .
git commit -m "<${APP_NAME}> 开始新的Stage版本开发。"
echo "[INFO] 源码提交成功,开始推送..."
# 推送源码到远程仓库
git push origin
# 推送标签到远程仓库
git push origin --tags
if [[ $? -eq ${EXIT_CODE_SUCCESS} ]]; then
echo "[INFO] 源码与标签推送成功!"
else
echo "[ERROR] 源码与标签推送失败!"
exit 1
fi
# ==================== 主流程结束 ====================
echo "============================================="
echo " WinBoLL 应用发布完成!"
echo "============================================="
exit ${EXIT_CODE_SUCCESS}
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/bash
# aapt2本地覆盖参数
AAPT2_OVERRIDE_ARG="-Pandroid.aapt2FromMavenOverride=/data/data/com.termux/files/usr/bin/aapt2"
# Gradle禁用守护进程参数
GRADLE_NO_DAEMON="--no-daemon"
# 检查是否指定了将要发布的类库名称
# 使用 `-z` 命令检查变量是否为空
if [ -z "$1" ]; then
echo "No Library name specified : $0"
exit 2
fi
## 正式发布使用
git pull && bash gradlew ${AAPT2_OVERRIDE_ARG} ${GRADLE_NO_DAEMON} :$1:publishReleasePublicationToWinBoLLReleaseRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1
## 调试使用
#bash gradlew ${AAPT2_OVERRIDE_ARG} ${GRADLE_NO_DAEMON} :$1:publishSnapshotWinBoLLPublicationToWinBoLLSnapshotRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1
+56 -27
View File
@@ -122,7 +122,6 @@ android {
// 如果正在调试,就拷贝到 WinBoLL 备份管理文件夹
//
if(variant.flavorName == "beta"&&variant.buildType.name == "debug"){
//File outBuildBckDir = new File(fWinBoLLStudioDir, "/${rootProject.name}/${variant.buildType.name}")
File outBuildBckDir = new File(fWinBoLLStudioDir, "/" + project.rootDir.name + "/${variant.buildType.name}")
// 创建目标路径目录
if(!outBuildBckDir.exists()) {
@@ -130,6 +129,7 @@ android {
println "Output Folder Created.(WinBoLLStudio) : " + outBuildBckDir.getAbsolutePath()
}
if(outBuildBckDir.exists()) {
def targetApkFile = new File(outBuildBckDir, outputFileName)
copy{
from file.outputFile
into outBuildBckDir
@@ -138,6 +138,14 @@ android {
}
println "Output APK (WinBoLLStudio): " + outBuildBckDir.getAbsolutePath() + "/${outputFileName}"
}
// ========== 设置文件权限为775 ==========
if(targetApkFile.exists()){
exec {
commandLine 'chmod', '775', targetApkFile.absolutePath
}
println "Set file permission to 775 : ${targetApkFile.absolutePath}"
}
// 检查编译标志位配置
assert (winbollBuildProps['buildCount'] != null)
assert (winbollBuildProps['libraryProject'] != null)
@@ -160,8 +168,7 @@ android {
assert(libraryProjectBuildPropsFile.exists())
java.nio.file.Path sourceFilePath = winbollBuildPropsFile.toPath();
java.nio.file.Path targetFilePath = libraryProjectBuildPropsFile.toPath();
// 使用copyTo()方法复制文件,如果目标文件存在会被覆盖,可选参数可以选择不覆盖
java.nio.file.Files.copy(sourceFilePath, targetFilePath, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
java.nio.file.Files.copy(sourceFilePath, targetFilePath, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
println "\n\n>>> Library Project build.properties saved.\n\n";
}
@@ -172,16 +179,12 @@ android {
//
if(variant.flavorName == "stage"&&variant.buildType.name == "release"){
// 发布 APK 文件
//
// 截取版本号的版本字段为短版本名
String szVersionName = "${versionName}"
String[] szlistTemp = szVersionName.split("-")
String szShortVersionName = szlistTemp[0]
//String szCommonTagAPKName = "${rootProject.name}_" + szShortVersionName + ".apk"
String szCommonTagAPKName = project.rootDir.name + "_" + szShortVersionName + ".apk"
println "CommonTagAPKName is : " + szCommonTagAPKName
//File outTagDir = new File(fWinBoLLStudioDir, "/${rootProject.name}/tag/")
File outTagDir = new File(fWinBoLLStudioDir, "/" + project.rootDir.name + "/tag/")
// 创建目标路径目录
if(!outTagDir.exists()) {
@@ -192,12 +195,10 @@ android {
if(outTagDir.exists()) {
File targetAPK = new File(outTagDir, "${szCommonTagAPKName}")
if(targetAPK.exists()) {
// 标签版本APK文件已经存在,构建拷贝任务停止
assert (!targetAPK.exists())
// 可选择删除并继续输出APK文件
//delete targetAPK
}
// 复制一个备份
// 复制完整版APK
def fullApkFile = new File(outTagDir, outputFileName)
copy{
from file.outputFile
into outTagDir
@@ -206,7 +207,16 @@ android {
}
println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${outputFileName}"
}
// 复制一个并重命名为短版本名
// 设置权限775。
if(fullApkFile.exists()){
exec {
commandLine 'chmod', '775', fullApkFile.absolutePath
}
println "Set file permission to 775 : ${fullApkFile.absolutePath}"
}
// 复制短版本名APK
def shortApkFile = new File(outTagDir, szCommonTagAPKName)
copy{
from file.outputFile
into outTagDir
@@ -215,6 +225,14 @@ android {
}
println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${szCommonTagAPKName}"
}
// 设置权限775。
if(shortApkFile.exists()){
exec {
commandLine 'chmod', '775', shortApkFile.absolutePath
}
println "Set file permission to 775 : ${shortApkFile.absolutePath}"
}
// 检查编译标志位配置
assert (winbollBuildProps['stageCount'] != null)
assert (winbollBuildProps['publishVersion'] != null)
@@ -239,14 +257,11 @@ android {
fos.close();
if(winbollBuildProps['libraryProject'] != "") {
// 如果应用 build.properties 文件设置了类库模块项目文件名
// 就拷贝一份新的编译标志配置到类库项目文件夹
File libraryProjectBuildPropsFile = new File("$RootProjectDir/" + winbollBuildProps['libraryProject'] + "/build.properties")
assert(winbollBuildPropsFile.exists())
assert(libraryProjectBuildPropsFile.exists())
java.nio.file.Path sourceFilePath = winbollBuildPropsFile.toPath();
java.nio.file.Path targetFilePath = libraryProjectBuildPropsFile.toPath();
// 使用copyTo()方法复制文件,如果目标文件存在会被覆盖,可选参数可以选择不覆盖
java.nio.file.Files.copy(sourceFilePath, targetFilePath, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
}
@@ -263,17 +278,12 @@ android {
// 如果正在调试发布版,就只生成和输出APK文件,不处理 Git 仓库提交与更新问题。
//
if(variant.flavorName == "stage"&&variant.buildType.name == "debug"){
// 发布 APK 文件
//
// 截取版本号的版本字段为短版本名
String szVersionName = "${versionName}"
String[] szlistTemp = szVersionName.split("-")
String szShortVersionName = szlistTemp[0]
//String szCommonTagAPKName = "${rootProject.name}_" + szShortVersionName + ".apk"
String szCommonTagAPKName = project.rootDir.name + "_" + szShortVersionName + ".apk"
println "CommonTagAPKName is : " + szCommonTagAPKName
//File outTagDir = new File(fWinBoLLStudioDir, "/${rootProject.name}/tag/")
File outTagDir = new File(fWinBoLLStudioDir, "/" + project.rootDir.name + "/${variant.buildType.name}/")
// 创建目标路径目录
if(!outTagDir.exists()) {
@@ -284,13 +294,11 @@ android {
if(outTagDir.exists()) {
File targetAPK = new File(outTagDir, "${szCommonTagAPKName}")
if(targetAPK.exists()) {
// 标签版本APK文件已经存在,构建拷贝任务停止
println '如果是在调试 Stage 版应用包构建,请删除(注:在debug目录)现有的 Stage 应用包('+targetAPK.getAbsolutePath()+')。再编译一次。'
assert (!targetAPK.exists())
// 可选择删除并继续输出APK文件
//delete targetAPK
}
// 复制一个备份
// 复制完整版APK
def debugFullApk = new File(outTagDir, outputFileName)
copy{
from file.outputFile
into outTagDir
@@ -299,7 +307,16 @@ android {
}
println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${outputFileName}"
}
// 复制一个并重命名为短版本名
// 权限设为775。
if(debugFullApk.exists()){
exec {
commandLine 'chmod', '775', debugFullApk.absolutePath
}
println "Set file permission to 775 : ${debugFullApk.absolutePath}"
}
// 复制短版本名APK
def debugShortApk = new File(outTagDir, szCommonTagAPKName)
copy{
from file.outputFile
into outTagDir
@@ -308,8 +325,13 @@ android {
}
println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${szCommonTagAPKName}"
}
//不保存编译标志配置
// 权限设为775
if(debugShortApk.exists()){
exec {
commandLine 'chmod', '775', debugShortApk.absolutePath
}
println "Set file permission to 775 : ${debugShortApk.absolutePath}"
}
}
}
@@ -328,6 +350,13 @@ android {
}
println "Output APK (Common): " + outCommonDir.getAbsolutePath() + "/${commandAPKName}"
}
// 额外输出文件设置775权限
if(apkFile.exists()){
exec {
commandLine 'chmod', '775', apkFile.absolutePath
}
println "Set file permission to 775 : ${apkFile.absolutePath}"
}
}
}
+97
View File
@@ -0,0 +1,97 @@
# WinBoLL 源码 LICENSE-Private-Demo 规范说明书
# LICENSE-Private-Demo
# WinBoLL 源码公共转私有继承开发规范守则
## 核心声明
本文档**唯一核心设计目的**:通过文件标识、分支隔离、操作规范、责任界定四重约束,**从根源规避私有开发分支代码被人为合并、推送、提交至公共开源主流分支的风险**,明确人为操作失误、违规合并的全部责任归属,同时保证私有分支可正常同步、拉取公共主流分支的上游更新。
## 一、文件宗旨与风险防控说明
本文件为 WinBoLL 项目公共开源分支转为私有独立分支开发的**强制标准化操作手册与责任界定文件**,核心风控目标:
1. 严格隔离公共开源分支与私有开发分支,通过授权文件标记实现分支属性一眼可辨,杜绝人为操作混淆
2. **重点防控人为操作导致的私有分支代码违规合并、回合、推送至公共 ****`winboll`**** 主流分支**,从流程上封堵合并风险
3. 明确所有开发提交者的操作责任,违规合并公共分支的行为由操作人承担全部代码泄露、合规风险
4. 规范私有分支初始化全流程,保证私有分支仅可单向同步公共分支更新,禁止任何反向代码流入公共分支
## 二、公私分支授权标识文件定义(风控核心依据)
### 1. 公共开源分支唯一标识
**文件名:LICENSE**
- 仅允许存在于公共主流分支 `winboll` 及官方公共衍生分支
- 标识当前分支为**开源公开可贡献分支**,遵循原开源授权协议
- **严禁私有分支内保留、恢复此文件**,出现即判定分支属性异常
### 2. 私有开发分支唯一标识
**文件名:LICENSE-Private**
- 仅允许存在于私有开发分支,**绝对禁止出现在公共 ****`winboll`**** 分支**
- 标识当前分支为**私有闭源分支**,代码仅限内部使用,禁止公开、禁止对外贡献
- 为本分支私有属性的法定判定依据,也是禁止合并至公共分支的核心标记
## 三、分支管理与合并风控规则(强制遵守)
1. **公共主流分支**:固定为 `winboll`,为项目唯一开源主线,仅保留 `LICENSE` 文件,**禁止接收任何私有分支的合并、提交、推送请求**。
2. **私有开发分支**:统一从 `winboll` 分支检出,命名固定格式为 `private-demo-*`,与公共分支物理隔离。
3. **核心合并风控铁则**
- 私有分支 → 公共分支:**永久禁止任何形式的合并、推送、PR 提交、代码回合,人为操作也绝不允许**
- 公共分支 → 私有分支:允许正常拉取、同步上游更新,不影响私有开发迭代
4. 所有仓库提交者、合并操作者,均视为已阅读并完全认可本规则,**人为执行私有分支向公共分支的合并操作,由操作人承担全部代码泄露、合规违约、项目安全风险**。
## 四、公共转私有标准化操作步骤(锁死合并风险)
请严格按顺序执行,每一步均为风控必要环节,不可跳过、不可修改顺序。
1. 基于公共主流分支 `winboll`,新建私有开发分支,严格使用 `private-demo-*` 命名,从名称上明确分支私有属性,避免人为混淆。
2. 本地仓库切换至新建私有分支,确认当前分支名称、检出来源无误。
3. **永久删除项目根目录公共授权文件 ****`LICENSE`**,彻底移除公共分支标识,断绝误合并的标识漏洞。
4. 将本规范文件 `LICENSE-Private-Demo` 复制并重命名为 `LICENSE-Private`,作为私有分支生效授权文件。
5. 将以上所有变更执行一次性 Git 提交,**提交信息必须固定使用以下内容,不可修改**:
> 初始化私有开发分支,已切换私有授权文件,本分支禁止任何人为合并、推送至 winboll 公共分支
>
>
6. 提交完成后,本分支正式转为私有开发状态,后续所有代码提交、分支合并、版本迭代,均严禁指向公共 `winboll` 分支。
## 五、人为操作责任界定(核心补充条款)
1. 本分支所有开发者、代码提交者、分支合并操作者,均视为**完全知晓本分支的私有属性与合并禁令**,自愿遵守本规范全部约束。
2. **无论故意或过失,凡是人为执行私有分支向公共 ****`winboll`**** 分支的合并、推送、PR 提交、代码回合操作,全部责任由执行操作的本人独立承担**,项目方不承担任何因人为违规操作导致的代码泄露、开源合规、版本污染风险。
3. 仓库管理员需严格校验合并请求的分支标识与授权文件,发现带有 `LICENSE-Private` 标记的分支申请合并至公共分支,一律直接拒绝,并记录操作人信息。
4. 分支属性校验以根目录授权文件为唯一标准:只要分支内存在 `LICENSE-Private` 文件,就绝对禁止向公共分支发起任何合并操作。
## 六、分支状态校验与异常处理
- 合规公共分支:仅存在 `LICENSE`,无 `LICENSE-Private`
- 合规私有分支:仅存在 `LICENSE-Private`,无 `LICENSE`
- 异常状态:两个文件同时存在 / 均不存在 → 立即停止开发与提交,按本规范重置分支状态,严禁执行任何合并操作
> (注:文档部分内容可能由 AI 生成)
+5 -5
View File
@@ -9,15 +9,15 @@ WinBoLL 手机源码计划,旨在通过核心项目 WinBoLL 构建手机端与
#### **仓库类型:功能说明**
☆ 基础项目分支 WinBoLL:手机端安卓应用开发基础模板。
☆ 应用项目分支 APPBase、AES、PowerBell、Positions**:安卓应用单一管理系列项目。
☆ 源码汇总管理 Projects_Keeper**:各类分支源码合并存档,不适宜作为开发库使用。
☆ 源码汇总管理 OriginMaster**:各类分支源码合并存档,不适宜作为开发库使用。
### 3. 源码合并管理推送路线图
⚠️ **注意**:仅仅展示不同应用模块源码的综合管理路线。分支合并操作时,必须具备 Git 管理经验。
★ WinBoLL → APPBase → Projects_Keeper
★ WinBoLL → AES → Projects_Keeper
★ WinBoLL → PowerBell → Projects_Keeper
★ WinBoLL → Positions → Projects_Keeper
★ WinBoLL → APPBase → OriginMaster
★ WinBoLL → AES → OriginMaster
★ WinBoLL → PowerBell → OriginMaster
★ WinBoLL → Positions → OriginMaster
## 二、WinBoLL 项目核心信息
-4
View File
@@ -39,10 +39,6 @@ android {
}
}
// 米盟 SDK
packagingOptions {
doNotStrip "*/*/libmimo_1011.so"
}
}
dependencies {
+4 -4
View File
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Jun 03 07:07:27 HKT 2026
stageCount=15
#Sat Jul 11 20:07:00 HKT 2026
stageCount=19
libraryProject=libaes
baseVersion=15.20
publishVersion=15.20.14
publishVersion=15.20.18
buildCount=0
baseBetaVersion=15.20.15
baseBetaVersion=15.20.19
@@ -65,7 +65,7 @@ public class AboutActivity extends BaseWinBoLLActivity {
appInfo.setAppName(getString(R.string.app_name));
appInfo.setAppIcon(R.drawable.ic_winboll);
appInfo.setAppDescription(getString(R.string.app_description));
appInfo.setAppGitName("AES");
appInfo.setAppGitName("WinBoLL");
appInfo.setAppGitOwner("Studio");
appInfo.setAppGitAPPBranch(branchName);
appInfo.setAppGitAPPSubProjectFolder(branchName);
@@ -7,7 +7,7 @@ package cc.winboll.studio.aes;
*/
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
import cc.winboll.studio.libappbase.CrashHandler;
import cc.winboll.studio.libappbase.CrashActivity;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
@@ -36,7 +36,7 @@ public class App extends GlobalApplication {
this,
getPackageName(),
stackTraceStr,
CrashHandler.CrashActivity.class
CrashActivity.class
);
}
@@ -1,11 +1,7 @@
package cc.winboll.studio.aes;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import cc.winboll.studio.libaes.views.ADsControlView;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
@@ -20,7 +16,7 @@ public class SettingsActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
ADsControlView adsControlView = (ADsControlView) findViewById(R.id.ads_control_view);
//ADsControlView adsControlView = (ADsControlView) findViewById(R.id.ads_control_view);
// adsControlView.setOnAdsModeSelectedListener(new ADsControlView.OnAdsModeSelectedListener() {
// @Override
@@ -6,12 +6,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<cc.winboll.studio.libaes.views.ADsControlView
android:id="@+id/ads_control_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_frame"
android:padding="10dp"/>
</LinearLayout>
+1 -1
View File
@@ -5,7 +5,7 @@
</style>
<style name="MyDebugActivityTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
<item name="colorTittle">@color/mainWindowTextColor</item>
<item name="colorTittleBackgound">@color/toolbarBackgroundColor</item>
<item name="colorText">@color/debugTextColor</item>
+1 -1
View File
@@ -5,7 +5,7 @@
</style>
<style name="MyDebugActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
<item name="colorTittle">@color/mainWindowTextColor</item>
<item name="colorTittleBackgound">@color/toolbarBackgroundColor</item>
<item name="colorText">@color/debugTextColor</item>
+4 -4
View File
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Jun 03 06:52:38 HKT 2026
stageCount=26
#Sun Jun 28 20:55:33 HKT 2026
stageCount=35
libraryProject=libappbase
baseVersion=15.20
publishVersion=15.20.25
publishVersion=15.20.34
buildCount=0
baseBetaVersion=15.20.26
baseBetaVersion=15.20.35
@@ -37,7 +37,7 @@ public class AboutActivity extends Activity {
appInfo.setAppName("APPBase");
appInfo.setAppIcon(R.drawable.ic_winboll);
appInfo.setAppDescription(getString(R.string.app_description));
appInfo.setAppGitName("APPBase");
appInfo.setAppGitName("WinBoLL");
appInfo.setAppGitOwner("Studio");
appInfo.setAppGitAPPBranch(branchName);
appInfo.setAppGitAPPSubProjectFolder(branchName);
@@ -1,6 +1,6 @@
package cc.winboll.studio.appbase;
import cc.winboll.studio.libappbase.CrashHandler;
import cc.winboll.studio.libappbase.CrashActivity;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
@@ -39,7 +39,7 @@ public class App extends GlobalApplication {
this,
getPackageName(),
stackTraceStr,
CrashHandler.CrashActivity.class
CrashActivity.class
);
}
}
+21
View File
@@ -0,0 +1,21 @@
# 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=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# 保持与旧版Gradle插件的兼容
android.disableAutomaticComponentCreation=true
+4 -8
View File
@@ -20,15 +20,11 @@ android {
}
}
// 米盟 SDK
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
doNotStrip "*/*/libmimo_1011.so"
}
}
dependencies {
@@ -57,7 +53,7 @@ dependencies {
//api 'androidx.fragment:fragment:1.1.0'
// 米盟
api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk
//api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk
//注意:以下5个库必须要引入
//implementation 'androidx.appcompat:appcompat:1.4.1'
api 'androidx.recyclerview:recyclerview:1.0.0'
@@ -66,9 +62,9 @@ dependencies {
//annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// WinBoLL库 nexus.winboll.cc 地址
api 'cc.winboll.studio:libappbase:15.20.25'
api 'cc.winboll.studio:libappbase:15.20.34'
// 备用库 jitpack.io 地址
//api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.25'
//api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.33'
api fileTree(dir: 'libs', include: ['*.jar'])
}
+4 -4
View File
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Jun 03 07:07:27 HKT 2026
stageCount=15
#Sat Jul 11 20:07:00 HKT 2026
stageCount=19
libraryProject=libaes
baseVersion=15.20
publishVersion=15.20.14
publishVersion=15.20.18
buildCount=0
baseBetaVersion=15.20.15
baseBetaVersion=15.20.19
@@ -15,7 +15,6 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
@@ -23,9 +22,9 @@ import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import cc.winboll.studio.libaes.DrawerMenuDataAdapter;
import cc.winboll.studio.libaes.R;
import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libaes.models.AESThemeBean;
import cc.winboll.studio.libaes.models.DrawerMenuBean;
@@ -33,11 +32,9 @@ import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.libaes.utils.DevelopUtils;
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
import cc.winboll.studio.libaes.views.ADrawerMenuListView;
import cc.winboll.studio.libaes.views.ADsBannerView;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import com.baoyz.widget.PullRefreshLayout;
import java.util.ArrayList;
public abstract class DrawerFragmentActivity extends AppCompatActivity implements IWinBoLLActivity, AdapterView.OnItemClickListener {
@@ -91,10 +88,10 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement
WinBoLLActivityManager.getInstance().registeRemove(this);
super.onDestroy();
// 修复:释放广告资源,避免内存泄漏
ADsBannerView adsBannerView = findViewById(R.id.adsbanner);
if (adsBannerView != null) {
adsBannerView.releaseAdResources();
}
// ADsBannerView adsBannerView = findViewById(R.id.adsbanner);
// if (adsBannerView != null) {
// adsBannerView.releaseAdResources();
// }
}
@Override
@@ -151,10 +148,10 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement
protected void onResume() {
super.onResume();
ADsBannerView adsBannerView = findViewById(R.id.adsbanner);
if (adsBannerView != null) {
adsBannerView.resumeADs(DrawerFragmentActivity.this);
}
// ADsBannerView adsBannerView = findViewById(R.id.adsbanner);
// if (adsBannerView != null) {
// adsBannerView.resumeADs(DrawerFragmentActivity.this);
// }
}
void initRootView() {
@@ -56,10 +56,5 @@
</LinearLayout>
<cc.winboll.studio.libaes.views.ADsBannerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/adsbanner"/>
</LinearLayout>
+1 -1
View File
@@ -25,7 +25,7 @@
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
<item name="aToolbar">@style/AESAToolbar</item>
<item name="aSupportToolbar">@style/AESASupportToolbar</item>
+1 -1
View File
@@ -25,7 +25,7 @@
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
<item name="aToolbar">@style/AESAToolbar</item>
<item name="aSupportToolbar">@style/AESASupportToolbar</item>
+4 -4
View File
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Jun 03 06:52:38 HKT 2026
stageCount=26
#Sun Jun 28 20:55:33 HKT 2026
stageCount=35
libraryProject=libappbase
baseVersion=15.20
publishVersion=15.20.25
publishVersion=15.20.34
buildCount=0
baseBetaVersion=15.20.26
baseBetaVersion=15.20.35
+1 -1
View File
@@ -8,7 +8,7 @@
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".CrashHandler$CrashActivity"
android:name=".CrashActivity"
android:label="CrashActivity"
android:launchMode="singleInstance"
android:process=":CrashActivity"/>
@@ -0,0 +1,109 @@
package cc.winboll.studio.libappbase;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
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;
public final class CrashActivity extends Activity implements MenuItem.OnMenuItemClickListener {
private static final int MENUITEM_COPY = 0;
private static final int MENUITEM_RESTART = 1;
private String mLog;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCrashSafetyWire.getInstance().postResumeCrashSafetyWireHandler(getApplicationContext());
mLog = getIntent().getStringExtra(CrashHandler.EXTRA_CRASH_LOG);
setTheme(android.R.style.Theme_DeviceDefault_Light_DarkActionBar);
initLayout();
}
private void initLayout() {
ScrollView contentView = new ScrollView(this);
contentView.setFillViewport(true);
HorizontalScrollView hw = new HorizontalScrollView(this);
hw.setBackgroundColor(0xFFF5F5F5);
TextView message = new TextView(this);
final int padding = dp2px(16);
message.setPadding(padding, padding, padding, padding);
message.setText(mLog);
message.setTextColor(0xFF000000);
message.setTextIsSelectable(true);
hw.addView(message);
contentView.addView(hw, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
setContentView(contentView);
getActionBar().setTitle(CrashHandler.TITTLE);
getActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext()) + " Error");
}
@Override
public void onBackPressed() {
restartApp();
}
private void restartApp() {
final Intent intent = getPackageManager()
.getLaunchIntentForPackage(getPackageName());
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
finish();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
private int dp2px(final float dpValue) {
final float scale = Resources.getSystem().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
menu.add(0, MENUITEM_COPY, 0, "Copy")
.setOnMenuItemClickListener(this)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
menu.add(0, MENUITEM_RESTART, 0, "Restart")
.setOnMenuItemClickListener(this)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
return true;
}
@Override
public boolean onMenuItemClick(final MenuItem item) {
switch (item.getItemId()) {
case MENUITEM_COPY:
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
Toast.makeText(getApplication(), "The text is copied.", Toast.LENGTH_SHORT).show();
break;
case MENUITEM_RESTART:
AppCrashSafetyWire.getInstance().resumeToMaximumImmediately();
restartApp();
break;
default:
break;
}
return false;
}
}
@@ -1,27 +1,13 @@
package cc.winboll.studio.libappbase;
import android.app.Activity;
import android.app.Application;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
@@ -220,111 +206,5 @@ public final class CrashHandler {
}
}
// ====================== 内部Activity页面 ======================
/**
* 基础极简崩溃页面
* 保险丝熔断时启动,避免复杂布局二次崩溃
*/
public static final class CrashActivity extends Activity implements MenuItem.OnMenuItemClickListener {
private static final int MENUITEM_COPY = 0;
private static final int MENUITEM_RESTART = 1;
private String mLog;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppCrashSafetyWire.getInstance().postResumeCrashSafetyWireHandler(getApplicationContext());
mLog = getIntent().getStringExtra(EXTRA_CRASH_LOG);
setTheme(android.R.style.Theme_DeviceDefault_Light_DarkActionBar);
initLayout();
}
/**
* 动态初始化布局
*/
private void initLayout() {
ScrollView contentView = new ScrollView(this);
contentView.setFillViewport(true);
HorizontalScrollView hw = new HorizontalScrollView(this);
hw.setBackgroundColor(0xFFF5F5F5);
TextView message = new TextView(this);
final int padding = dp2px(16);
message.setPadding(padding, padding, padding, padding);
message.setText(mLog);
message.setTextColor(0xFF000000);
message.setTextIsSelectable(true);
hw.addView(message);
contentView.addView(hw, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
setContentView(contentView);
getActionBar().setTitle(TITTLE);
getActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext()) + " Error");
}
@Override
public void onBackPressed() {
restartApp();
}
/**
* 重启应用
*/
private void restartApp() {
final Intent intent = getPackageManager()
.getLaunchIntentForPackage(getPackageName());
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
finish();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
/**
* dp转px
*/
private int dp2px(final float dpValue) {
final float scale = Resources.getSystem().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
menu.add(0, MENUITEM_COPY, 0, "Copy")
.setOnMenuItemClickListener(this)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
menu.add(0, MENUITEM_RESTART, 0, "Restart")
.setOnMenuItemClickListener(this)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
return true;
}
@Override
public boolean onMenuItemClick(final MenuItem item) {
switch (item.getItemId()) {
case MENUITEM_COPY:
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
Toast.makeText(getApplication(), "The text is copied.", Toast.LENGTH_SHORT).show();
break;
case MENUITEM_RESTART:
AppCrashSafetyWire.getInstance().resumeToMaximumImmediately();
restartApp();
break;
default:
break;
}
return false;
}
}
}
@@ -152,7 +152,7 @@ public class GlobalApplication extends Application {
this,
getPackageName(),
stackTraceStr,
CrashHandler.CrashActivity.class
CrashActivity.class
);
}
}
@@ -66,7 +66,7 @@ public final class GlobalCrashActivity extends Activity implements MenuItem.OnMe
mCrashLog = getIntent().getStringExtra(CrashHandler.EXTRA_CRASH_LOG);
final Intent intent = new Intent();
intent.putExtra(CrashHandler.EXTRA_CRASH_LOG, mCrashLog);
CrashHandleNotifyUtils.handleUncaughtException(GlobalApplication.getInstance(), intent, CrashHandler.CrashActivity.class);
CrashHandleNotifyUtils.handleUncaughtException(GlobalApplication.getInstance(), intent, CrashActivity.class);
StackTraceElement[] stackElements = Thread.currentThread().getStackTrace();
StringBuilder sb = new StringBuilder("GlobalCrashActivity onCreate StackTrace");
+13 -13
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="?attr/themeDebug"
<!-- Theme removed for compatibility -->
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -12,7 +12,7 @@
android:layout_width="match_parent"
android:layout_height="34dp"
android:layout_alignParentTop="true"
android:background="?attr/colorTittleBackgound"
android:background=" android:background="@color/toolbarBackgroundColor""
android:id="@+id/viewlogRelativeLayoutToolbar">
<Button
@@ -20,8 +20,8 @@
android:layout_height="@dimen/log_button_height"
android:textSize="@dimen/log_text_size"
android:text="Clean"
android:textColor="?attr/activityTextColor"
android:background="?attr/toolbarBackgroundColor"
android:textColor=" android:textColor="@color/mainWindowTextColor""
android:background=" android:background="@color/toolbarBackgroundColor""
android:layout_centerVertical="true"
android:id="@+id/viewlogButtonClean"
android:layout_marginLeft="5dp"/>
@@ -35,7 +35,7 @@
android:layout_toRightOf="@+id/viewlogButtonClean"
android:layout_centerVertical="true"
android:id="@+id/viewlogTextView1"
android:background="?attr/colorTittleBackgound"
android:background=" android:background="@color/toolbarBackgroundColor""
android:textColor="?attr/toolbarTextColor"/>
<cc.winboll.studio.libappbase.widget.LogTagSpinner
@@ -53,7 +53,7 @@
android:layout_toLeftOf="@+id/viewlogButtonCopy"
android:layout_centerVertical="true"
android:text="Selectable"
android:background="?attr/colorTittleBackgound"
android:background=" android:background="@color/toolbarBackgroundColor""
android:id="@+id/viewlogCheckBoxSelectable"
android:padding="@dimen/log_text_padding"
android:textColor="?attr/toolbarTextColor"/>
@@ -62,8 +62,8 @@
android:layout_width="@dimen/log_button_width"
android:layout_height="@dimen/log_button_height"
android:textSize="@dimen/log_text_size"
android:textColor="?attr/activityTextColor"
android:background="?attr/toolbarBackgroundColor"
android:textColor=" android:textColor="@color/mainWindowTextColor""
android:background=" android:background="@color/toolbarBackgroundColor""
android:text="Copy"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
@@ -79,7 +79,7 @@
android:layout_below="@+id/viewlogRelativeLayoutToolbar"
android:id="@+id/viewlogLinearLayout1"
android:gravity="center_vertical"
android:background="?attr/colorTittleBackgound">
android:background=" android:background="@color/toolbarBackgroundColor"">
<CheckBox
android:layout_width="wrap_content"
@@ -88,7 +88,7 @@
android:text="ALL"
android:padding="2dp"
android:id="@+id/viewlogCheckBox1"
android:background="?attr/colorTittleBackgound"
android:background=" android:background="@color/toolbarBackgroundColor""
android:textColor="?attr/toolbarTextColor"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"/>
@@ -99,14 +99,14 @@
android:layout_height="@dimen/log_button_height"
android:textSize="@dimen/log_text_size"
android:textColor="?attr/colorText"
android:background="?attr/colorTittleBackgound"
android:background=" android:background="@color/toolbarBackgroundColor""
android:singleLine="true"
android:id="@+id/tagsearch_et"/>
<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="?attr/colorTittleBackgound"
android:background=" android:background="@color/toolbarBackgroundColor""
android:scrollbars="none"
android:padding="2dp"
android:layout_weight="1.0"
@@ -132,7 +132,7 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorTextBackgound"
android:background="@color/colorTextBackgound"
android:id="@+id/viewlogScrollViewLog">
<TextView
-1
View File
@@ -1 +0,0 @@
/build
-55
View File
@@ -1,55 +0,0 @@
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply from: '../.winboll/winboll_lib_build.gradle'
apply from: '../.winboll/winboll_lint_build.gradle'
android {
// 适配MIUI12
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 26
targetSdkVersion 30
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// 网络连接类库
api 'com.squareup.okhttp3:okhttp:4.4.1'
// Gson
api 'com.google.code.gson:gson:2.8.9'
// Html 解析
api 'org.jsoup:jsoup:1.13.1'
// 添加JSch依赖(SFTP核心,com.jcraft:jsch:0.1.54
api 'com.jcraft:jsch:0.1.54'
// 米盟
api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk
//注意:以下5个库必须要引入
//implementation 'androidx.appcompat:appcompat:1.4.1'
api 'androidx.recyclerview:recyclerview:1.0.0'
api 'com.google.code.gson:gson:2.8.5'
api 'com.github.bumptech.glide:glide:4.9.0'
//annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// WinBoLL库 nexus.winboll.cc 地址
api 'cc.winboll.studio:libappbase:15.20.25'
api 'cc.winboll.studio:libaes:15.20.14'
// 备用库 jitpack.io 地址
//api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.25'
//api 'com.github.ZhanGSKen:libaes:aes-v15.20.14'
api fileTree(dir: 'libs', include: ['*.jar'])
}
-8
View File
@@ -1,8 +0,0 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Jun 03 07:32:48 HKT 2026
stageCount=8
libraryProject=libwinboll
baseVersion=15.20
publishVersion=15.20.7
buildCount=0
baseBetaVersion=15.20.8
-17
View File
@@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:/tools/adt-bundle-windows-x86_64-20131030/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# 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 *;
#}
@@ -1,17 +0,0 @@
package cc.winboll.studio.libwinboll;
import android.app.Activity;
import android.os.Bundle;
import cc.winboll.studio.libappbase.ToastUtils;
public class WinBoLLLibraryActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_winbolllibrary);
ToastUtils.show("WinBoLLLibraryActivity onCreate");
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

@@ -1,11 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cc.winboll.studio.libwinboll.WinBoLLLibraryActivity"/>
</LinearLayout>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Material.Light">
</style>
</resources>
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="lib_name">libwinboll</string>
<string name="hello_world">Hello world!</string>
</resources>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
</style>
</resources>
+1
View File
@@ -0,0 +1 @@
/build
+37
View File
@@ -0,0 +1,37 @@
# WinBoLL
#### 介绍
WinBoLL 网站浏览器。
#### 软件架构
适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。
也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。
#### Gradle 编译说明
调试版编译命令 gradle assembleBetaDebug
阶段版编译命令 bash .winboll/bashPublishAPKAddTag.sh winboll
#### 使用说明
3. Termux应用配置:
- 已安装Termux(包名 com.termux );
- 执行  echo "allow-external-apps = true" > ~/.termux/termux.properties
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码 : ZhanGSKen(ZhanGSKen<ZhanGSKen@QQ.COM>)
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
#### 参考文档
+110
View File
@@ -0,0 +1,110 @@
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 {
// 适配MIUI12
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "cc.winboll.studio.mywinboll"
minSdkVersion 26
targetSdkVersion 30
//1. Android 官方规则
//-  versionCode  类型:int 整型
//- Java int 最大值:2147483647
versionCode 1520000
// versionName 更新后需要手动设置
// 项目模块目录的 build.gradle 文件的 stageCount=0
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
versionName "15.20"
if(true) {
versionName = genVersionName("${versionName}")
}
}
}
dependencies {
api 'com.google.code.gson:gson:2.10.1'
// 下拉控件
api 'com.baoyz.pullrefreshlayout:library:1.2.0'
// SSH
api 'com.jcraft:jsch:0.1.55'
// Html 解析
api 'org.jsoup:jsoup:1.13.1'
// 二维码类库
api 'com.google.zxing:core:3.4.1'
api 'com.journeyapps:zxing-android-embedded:3.6.0'
// 应用介绍页类库
api 'io.github.medyo:android-about-page:2.0.0'
// 网络连接类库
api 'com.squareup.okhttp3:okhttp:4.4.1'
// FastJSON解析
implementation 'com.alibaba:fastjson:1.2.76'
// AndroidX 类库
/*api 'androidx.appcompat:appcompat:1.1.0'
//api 'com.google.android.material:material:1.4.0'
//api 'androidx.viewpager:viewpager:1.0.0'
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
//api 'androidx.fragment:fragment:1.1.0'*/
// 米盟
//api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk
//注意:以下5个库必须要引入
//implementation 'androidx.appcompat:appcompat:1.4.1'
api 'androidx.recyclerview:recyclerview:1.0.0'
api 'com.github.bumptech.glide:glide:4.9.0'
//annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation "androidx.annotation:annotation:1.3.0"
implementation "androidx.core:core:1.6.0"
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
implementation "androidx.preference:preference:1.1.1"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "com.google.android.material:material:1.4.0"
implementation "com.google.guava:guava:24.1-jre"
/*
implementation "io.noties.markwon:core:$markwonVersion"
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
implementation "io.noties.markwon:linkify:$markwonVersion"
implementation "io.noties.markwon:recycler:$markwonVersion"
*/
implementation 'com.termux:terminal-emulator:0.118.0'
implementation 'com.termux:terminal-view:0.118.0'
implementation 'com.termux:termux-shared:0.118.0'
// Biometric (指纹识别)
implementation 'androidx.biometric:biometric:1.1.0'
// WinBoLL库 nexus.winboll.cc 地址
api 'cc.winboll.studio:libappbase:15.20.34'
api 'cc.winboll.studio:libaes:15.20.17'
// 备用库 jitpack.io 地址
//api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.33'
//api 'com.github.ZhanGSKen:libaes:aes-v15.20.16'
api fileTree(dir: 'libs', include: ['*.jar'])
}
+8
View File
@@ -0,0 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Jul 01 16:36:17 CST 2026
stageCount=0
libraryProject=
baseVersion=15.20
publishVersion=15.20.0
buildCount=11
baseBetaVersion=15.20.1
+137
View File
@@ -0,0 +1,137 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# ============================== 基础通用规则 ==============================
# 保留系统组件
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
# 保留 WinBoLL 核心包及子类(合并简化规则)
-keep class cc.winboll.studio.** { *; }
-keepclassmembers class cc.winboll.studio.** { *; }
# 保留所有类中的 public static final String TAG 字段(便于日志定位)
-keepclassmembers class * {
public static final java.lang.String TAG;
}
# 保留序列化类(避免Parcelable/Gson解析异常
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# 保留 R 文件(避免资源ID混淆)
-keepclassmembers class **.R$* {
public static <fields>;
}
# 保留 native 方法(避免JNI调用失败)
-keepclasseswithmembernames class * {
native <methods>;
}
# 保留注解和泛型(避免反射/序列化异常)
-keepattributes *Annotation*
-keepattributes Signature
# 屏蔽 Java 8+ 警告(适配 Java 7 语法)
-dontwarn java.lang.invoke.*
-dontwarn android.support.v8.renderscript.*
-dontwarn java.util.function.**
# ============================== 第三方框架专项规则 ==============================
# OkHttp 4.4.1(米盟广告请求依赖,完善Lambda兼容)
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-keep class okhttp3.internal.** { *; }
-keep class okio.** { *; }
-dontwarn okhttp3.internal.platform.**
-dontwarn okio.**
# Glide 4.9.0(米盟广告图片加载依赖)
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$ImageType {
**[] $VALUES;
public *;
}
-keepclassmembers class * implements com.bumptech.glide.module.AppGlideModule {
<init>();
}
-dontwarn com.bumptech.glide.**
# Gson 2.8.5(米盟广告数据序列化依赖)
-keep class com.google.gson.** { *; }
-keep interface com.google.gson.** { *; }
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# 米盟 SDK(核心广告组件,完整保留避免加载失败)
-keep class com.miui.zeus.** { *; }
-keep interface com.miui.zeus.** { *; }
# 保留米盟日志字段(便于广告加载失败排查)
-keepclassmembers class com.miui.zeus.mimo.sdk.** {
public static final java.lang.String TAG;
}
# RecyclerView 1.0.0(米盟广告布局渲染依赖)
-keep class androidx.recyclerview.** { *; }
-keep interface androidx.recyclerview.** { *; }
-keepclassmembers class androidx.recyclerview.widget.RecyclerView$Adapter {
public *;
}
# 其他第三方框架(按引入依赖保留,无则可删除)
# XXPermissions 18.63
-keep class com.hjq.permissions.** { *; }
-keep interface com.hjq.permissions.** { *; }
# ZXing 二维码(核心解析组件)
-keep class com.google.zxing.** { *; }
-keep class com.journeyapps.zxing.** { *; }
# Jsoup HTML解析
-keep class org.jsoup.** { *; }
# Pinyin4j 拼音搜索
-keep class net.sourceforge.pinyin4j.** { *; }
# JSch SSH组件
-keep class com.jcraft.jsch.** { *; }
# AndroidX 基础组件
-keep class androidx.appcompat.** { *; }
-keep interface androidx.appcompat.** { *; }
# ============================== 优化与调试配置 ==============================
# 优化级别(平衡混淆效果与性能)
-optimizationpasses 5
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
# 调试辅助(保留行号便于崩溃定位)
-verbose
-dontpreverify
-dontusemixedcaseclassnames
-keepattributes SourceFile,LineNumberTable
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">StallHelper+</string>
<string name="app_name">MyWinBoLL +</string>
</resources>
+37
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.mywinboll">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:theme="@style/MyAppTheme"
android:resizeableActivity="true"
android:name=".App">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="android.max_aspect"
android:value="4.0"/>
<activity android:name=".GlobalApplication$CrashActivity"/>
</application>
</manifest>
@@ -0,0 +1,358 @@
package cc.winboll.studio.mywinboll;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import cc.winboll.studio.libappbase.CrashActivity;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
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.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
public class App extends GlobalApplication {
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
@Override
public void onCreate() {
try {
super.onCreate();
// 初始化主题样式ID列表
AESThemeUtil.init(null);
// 初始化 Toast 工具类(传入应用全局上下文,确保 Toast 可在任意地方调用)
ToastUtils.init(getApplicationContext());
} catch (Throwable e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.close();
String stackTraceStr = sw.toString();
CrashHandleNotifyUtils.handleUncaughtException(
this,
getPackageName(),
stackTraceStr,
CrashActivity.class
);
}
}
public static void write(InputStream input, OutputStream output) throws IOException {
byte[] buf = new byte[1024 * 8];
int len;
while ((len = input.read(buf)) != -1) {
output.write(buf, 0, len);
}
}
public static void write(File file, byte[] data) throws IOException {
File parent = file.getParentFile();
if (parent != null && !parent.exists()) parent.mkdirs();
ByteArrayInputStream input = new ByteArrayInputStream(data);
FileOutputStream output = new FileOutputStream(file);
try {
write(input, output);
} finally {
closeIO(input, output);
}
}
public static String toString(InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
write(input, output);
try {
return output.toString("UTF-8");
} finally {
closeIO(input, output);
}
}
public static void closeIO(Closeable... closeables) {
for (Closeable closeable : closeables) {
try {
if (closeable != null) closeable.close();
} catch (IOException ignored) {}
}
}
public static class CrashHandler {
public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler();
private static CrashHandler sInstance;
private PartCrashHandler mPartCrashHandler;
public static CrashHandler getInstance() {
if (sInstance == null) {
sInstance = new CrashHandler();
}
return sInstance;
}
public void registerGlobal(Context context) {
registerGlobal(context, null);
}
public void registerGlobal(Context context, String crashDir) {
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir));
}
public void unregister() {
Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER);
}
public void registerPart(Context context) {
unregisterPart(context);
mPartCrashHandler = new PartCrashHandler(context.getApplicationContext());
MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler);
}
public void unregisterPart(Context context) {
if (mPartCrashHandler != null) {
mPartCrashHandler.isRunning.set(false);
mPartCrashHandler = null;
}
}
private static class PartCrashHandler implements Runnable {
private final Context mContext;
public AtomicBoolean isRunning = new AtomicBoolean(true);
public PartCrashHandler(Context context) {
this.mContext = context;
}
@Override
public void run() {
while (isRunning.get()) {
try {
Looper.loop();
} catch (final Throwable e) {
e.printStackTrace();
if (isRunning.get()) {
MAIN_HANDLER.post(new Runnable(){
@Override
public void run() {
Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show();
}
});
} else {
if (e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new RuntimeException(e);
}
}
}
}
}
}
private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler {
private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss");
private final Context mContext;
private final File mCrashDir;
public UncaughtExceptionHandlerImpl(Context context, String crashDir) {
this.mContext = context;
this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir);
}
@Override
public void uncaughtException(Thread thread, Throwable throwable) {
try {
String log = buildLog(throwable);
writeLog(log);
try {
Intent intent = new Intent(mContext, CrashActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_TEXT, log);
mContext.startActivity(intent);
} catch (Throwable e) {
e.printStackTrace();
writeLog(e.toString());
}
throwable.printStackTrace();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
} catch (Throwable e) {
if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable);
}
}
private String buildLog(Throwable throwable) {
String time = DATE_FORMAT.format(new Date());
String versionName = "unknown";
long versionCode = 0;
try {
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
versionName = packageInfo.versionName;
versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode;
} catch (Throwable ignored) {}
LinkedHashMap<String, String> head = new LinkedHashMap<String, String>();
head.put("Time Of Crash", time);
head.put("Device", String.format("%s, %s", Build.MANUFACTURER, Build.MODEL));
head.put("Android Version", String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
head.put("App Version", String.format("%s (%d)", versionName, versionCode));
head.put("Kernel", getKernel());
head.put("Support Abis", Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_ABIS != null ? Arrays.toString(Build.SUPPORTED_ABIS): "unknown");
head.put("Fingerprint", Build.FINGERPRINT);
StringBuilder builder = new StringBuilder();
for (String key : head.keySet()) {
if (builder.length() != 0) builder.append("\n");
builder.append(key);
builder.append(" : ");
builder.append(head.get(key));
}
builder.append("\n\n");
builder.append(Log.getStackTraceString(throwable));
return builder.toString();
}
private void writeLog(String log) {
String time = DATE_FORMAT.format(new Date());
File file = new File(mCrashDir, "crash_" + time + ".txt");
try {
write(file, log.getBytes("UTF-8"));
} catch (Throwable e) {
e.printStackTrace();
}
}
private static String getKernel() {
try {
return App.toString(new FileInputStream("/proc/version")).trim();
} catch (Throwable e) {
return e.getMessage();
}
}
}
}
public static final class CrashActivity extends Activity {
private String mLog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(android.R.style.Theme_DeviceDefault);
setTitle("App Crash");
mLog = getIntent().getStringExtra(Intent.EXTRA_TEXT);
ScrollView contentView = new ScrollView(this);
contentView.setFillViewport(true);
HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
TextView textView = new TextView(this);
int padding = dp2px(16);
textView.setPadding(padding, padding, padding, padding);
textView.setText(mLog);
textView.setTextIsSelectable(true);
textView.setTypeface(Typeface.DEFAULT);
textView.setLinksClickable(true);
horizontalScrollView.addView(textView);
contentView.addView(horizontalScrollView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
setContentView(contentView);
}
private void restart() {
Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
finish();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
private static int dp2px(float dpValue) {
final float scale = Resources.getSystem().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, android.R.id.copy, 0, android.R.string.copy)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.copy:
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
restart();
}
}
}
@@ -0,0 +1,62 @@
package cc.winboll.studio.mywinboll;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.libaes.utils.DevelopUtils;
public class MainActivity extends AppCompatActivity {
public static final String TAG = "MainActivity";
LogView mLogView;
@Override
protected void onCreate(Bundle savedInstanceState) {
AESThemeUtil.applyAppCompatTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mLogView = findViewById(R.id.logview);
ToastUtils.show("onCreate");
}
@Override
protected void onResume() {
super.onResume();
mLogView.start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
AESThemeUtil.inflateCompatThemeMenu(this, menu);
if (GlobalApplication.isDebugging()) {
DevelopUtils.inflateMenu(this, menu);
}
getMenuInflater().inflate(cc.winboll.studio.libaes.R.menu.toolbar_drawerbase, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (AESThemeUtil.onWinBoLLThemeItemSelected(this, item)) {
recreate();
}
if (DevelopUtils.onDevelopItemSelected(this, item)) {
LogUtils.d(TAG, String.format("onOptionsItemSelected item.getItemId() %d ", item.getItemId()));
} else {
return super.onOptionsItemSelected(item);
}
return true;
}
}
@@ -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>
@@ -2,169 +2,169 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="@color/colorPrimary"
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
@@ -0,0 +1,43 @@
<?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">
<cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:gravity="center_vertical|center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MyWinBoLL"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0">
<cc.winboll.studio.libappbase.LogView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/logview"/>
</LinearLayout>
</LinearLayout>
@@ -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>
@@ -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

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#42A5F5</color>
<color name="colorPrimaryDark">#1565C0</color>
<color name="colorAccent">#FFD740</color>
<color name="mainWindowBackgroundColor">#121212</color>
<color name="mainWindowTextColor">#E0E0E0</color>
<color name="toolbarTextColor">#FFFFFF</color>
<color name="toolbarBackgroundColor">#1E3A5F</color>
<color name="debugTextColor">#00E676</color>
<color name="colorTextBackgound">#121212</color>
</resources>
@@ -0,0 +1,29 @@
<resources>
<style name="MyAppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
<item name="themeDebug">@style/MyDebugActivityTheme</item>
<item name="aboutViewBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
<item name="aboutViewTextColor">?attr/mainWindowDarkTextColor</item>
<item name="aboutViewTitleColor">?attr/mainWindowDarkTextColor</item>
<item name="aboutViewDividerColor">?attr/mainWindowTextColor</item>
<item name="dialogBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
<item name="dialogTextColor">?attr/mainWindowDarkTextColor</item>
<item name="toolbarBackgroundColor">@color/toolbarBackgroundColor</item>
<item name="toolbarTextColor">@color/toolbarTextColor</item>
<item name="textViewBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
<item name="textViewTextColor">?attr/mainWindowDarkTextColor</item>
<item name="editTextBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
<item name="editTextTextColor">?attr/mainWindowDarkTextColor</item>
<item name="scrollViewBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
<item name="activityBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
<item name="activityTextColor">?attr/mainWindowDarkTextColor</item>
<item name="mainWindowBackgroundColor">@color/mainWindowBackgroundColor</item>
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
</style>
<style name="MyAESASupportToolbar" parent="AESASupportToolbar" />
</resources>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#1565C0</color>
<color name="colorPrimaryDark">#0D47A1</color>
<color name="colorAccent">#FF6F00</color>
<color name="mainWindowBackgroundColor">#FAFAFA</color>
<color name="mainWindowTextColor">#212121</color>
<color name="toolbarTextColor">#FFFFFF</color>
<color name="toolbarBackgroundColor">#1565C0</color>
<color name="debugTextColor">#616161</color>
<color name="colorTextBackgound">#FAFAFA</color>
</resources>
@@ -0,0 +1,4 @@
<resources>
<string name="app_name">MyWinBoLL</string>
</resources>
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyStallHelperTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
<item name="themeDebug">@style/MyDebugActivityTheme</item>
<item name="aboutViewBackgroundColor">?attr/mainWindowBackgroundColor</item>
<item name="aboutViewTextColor">?attr/mainWindowTextColor</item>
<item name="aboutViewTitleColor">?attr/mainWindowTextColor</item>
<item name="aboutViewDividerColor">?attr/mainWindowDarkTextColor</item>
<item name="dialogBackgroundColor">?attr/mainWindowBackgroundColor</item>
<item name="dialogTextColor">?attr/mainWindowTextColor</item>
<item name="toolbarBackgroundColor">@color/toolbarBackgroundColor</item>
@@ -24,13 +24,14 @@
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
</style>
<style name="MyDebugActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
<style name="MyDebugActivityTheme" parent="DebugActivityTheme">
<item name="colorTittle">?attr/mainWindowTextColor</item>
<item name="colorTittleBackgound">@color/toolbarBackgroundColor</item>
<item name="colorTittleBackgound">?attr/toolbarBackgroundColor</item>
<item name="colorText">?attr/debugTextColor</item>
<item name="colorTextBackgound">?attr/mainWindowBackgroundColor</item>
<item name="debugTextColor">@color/debugTextColor</item>
<item name="toolbarTextColor">@color/toolbarTextColor</item>
</style>
<style name="MyAESASupportToolbar" parent="AESASupportToolbar" />
</resources>
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.winboll.studio.libwinboll" >
xmlns:tools="http://schemas.android.com/tools" >
<application>
<activity
android:name=".WinBoLLLibraryActivity">
</activity>
<!-- Put flavor specific code here -->
</application>
</manifest>
+1
View File
@@ -0,0 +1 @@
/build
+35
View File
@@ -0,0 +1,35 @@
# Positions
#### 介绍
安卓位置应用,有关于地理位置的相关应用。
PS:使用感言~~~『記低用唔到』。
#### 软件架构
适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。
也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。
#### Gradle 编译说明
调试版编译命令 gradle assembleBetaDebug
阶段版编译命令 bash .winboll/bashPublishAPKAddTag.sh positions
#### 使用说明
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码 : ZhanGSKen(ZhanGSKen<zhangsken@188.com>)
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
#### 参考文档
+1
View File
@@ -0,0 +1 @@
@@ -18,33 +18,49 @@ def genVersionName(def versionName){
}
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
// SDK 32 targetSdkVersion 30
compileSdkVersion 32
// 使 33.0.3
buildToolsVersion "33.0.3"
defaultConfig {
applicationId "cc.winboll.studio.stallhelper"
minSdkVersion 26
applicationId "cc.winboll.studio.positions"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
// versionName
// .winboll/winbollBuildProps.properties stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "15.20"
versionName "15.12"
if(true) {
versionName = genVersionName("${versionName}")
}
}
// SDK
packagingOptions {
doNotStrip "*/*/libmimo_1011.so"
}
}
dependencies {
//
api 'com.baoyz.pullrefreshlayout:library:1.2.0'
//
// https://mvnrepository.com/artifact/com.github.open-android/pinyin4j
api 'com.github.open-android:pinyin4j:2.5.0'
//
api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//使sdk
//5
//api 'androidx.appcompat:appcompat:1.4.1'
api 'androidx.recyclerview:recyclerview:1.0.0'
api 'com.google.code.gson:gson:2.8.5'
api 'com.github.bumptech.glide:glide:4.9.0'
//annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// https://mvnrepository.com/artifact/com.jzxiang.pickerview/TimePickerDialog
api 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
// FusedLocationProviderClient所在库
api 'com.google.android.gms:play-services-location:21.0.1'
// SSH
api 'com.jcraft:jsch:0.1.55'
// Html
@@ -58,23 +74,19 @@ dependencies {
api 'com.squareup.okhttp3:okhttp:4.4.1'
// AndroidX
api 'androidx.appcompat:appcompat:1.1.0'
api 'androidx.cardview:cardview:1.0.0'
//api 'com.google.android.material:material:1.4.0'
api 'com.google.android.material:material:1.4.0'
//api 'androidx.viewpager:viewpager:1.0.0'
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
//api 'androidx.fragment:fragment:1.1.0'
//5
//implementation 'androidx.appcompat:appcompat:1.4.1'
api 'androidx.recyclerview:recyclerview:1.0.0'
api 'com.google.code.gson:gson:2.8.5'
api 'com.github.bumptech.glide:glide:4.9.0'
//annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// WinBoLL库 nexus.winboll.cc
api 'cc.winboll.studio:libaes:15.20.14'
api 'cc.winboll.studio:libappbase:15.20.25'
api 'cc.winboll.studio:libaes:15.15.9'
api 'cc.winboll.studio:libappbase:15.15.21'
// WinBoLL备用库 jitpack.io
//api 'com.github.ZhanGSKen:AES:aes-v15.12.9'
//api 'com.github.ZhanGSKen:APPBase:appbase-v15.14.1'
api fileTree(dir: 'libs', include: ['*.jar'])
}
+8
View File
@@ -0,0 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sun Jul 19 20:37:45 HKT 2026
stageCount=24
libraryProject=
baseVersion=15.12
publishVersion=15.12.23
buildCount=0
baseBetaVersion=15.12.24
@@ -3,9 +3,8 @@
xmlns:tools="http://schemas.android.com/tools" >
<application
tools:replace="android:icon"
android:icon="@drawable/ic_stall_beta">
tools:replace="android:icon"
android:icon="@drawable/ic_launcher_beta">
<!-- Put flavor specific code here -->
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">悟空笔记#</string>
<string name="appplus_name">时空任务#</string>
</resources>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Positions</string>
<string name="appplus_name">PositionsPlus+</string>
</resources>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path
name="BaseBean"
path="BaseBean/" />
</paths>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 切换启动入口的快捷菜单 -->
<shortcut
android:shortcutId="open_appplus"
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:shortcutShortLabel="@string/open_appplus"
android:shortcutLongLabel="@string/open_appplus"
android:shortcutDisabledMessage="@string/appplus_open_disabled">
<intent
android:action="cc.winboll.studio.positions.App.ACTION_OPEN_APPPLUS"
android:targetPackage="cc.winboll.studio.positions.beta"
android:targetClass="cc.winboll.studio.positions.activities.ShortcutActionActivity"
android:data="open_appplus" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 切换启动入口的快捷菜单 -->
<shortcut
android:shortcutId="close_appplus"
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:shortcutShortLabel="@string/close_appplus"
android:shortcutLongLabel="@string/close_appplus"
android:shortcutDisabledMessage="@string/appplus_close_disabled">
<intent
android:action="cc.winboll.studio.positions.App.ACTION_CLOSE_APPPLUS"
android:targetPackage="cc.winboll.studio.positions.beta"
android:targetClass="cc.winboll.studio.positions.activities.ShortcutActionActivity"
android:data="close_appplus" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>
+164
View File
@@ -0,0 +1,164 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.winboll.studio.positions">
<!-- 只有在前台运行时才能获取大致位置信息 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<!-- 在后台使用位置信息 -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<!-- 运行前台服务 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- 运行“location”类型的前台服务 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
<!-- 拥有完全的网络访问权限 -->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- 安装快捷方式 -->
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<!-- 读取您共享存储空间中的内容 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- 修改或删除您共享存储空间中的内容 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- 只能在前台获取精确的位置信息 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:name="android.hardware.location.gps"
android:required="false"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyAppTheme"
android:resizeableActivity="true"
android:name=".App">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.EDIT"/>
<data android:mimeType="application/json"/>
<data android:mimeType="text/x-json"/>
</intent-filter>
</activity>
<activity-alias
android:name=".MainActivityWukong"
android:targetActivity=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcutsmain"/>
</activity-alias>
<activity-alias
android:name=".MainActivityLaojun"
android:targetActivity=".MainActivity"
android:exported="true"
android:label="@string/appplus_name"
android:icon="@drawable/ic_positions_plus"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcutsplus"/>
</activity-alias>
<activity android:name="cc.winboll.studio.positions.activities.LocationActivity"/>
<activity android:name="cc.winboll.studio.positions.activities.ShortcutActionActivity"/>
<service
android:name=".services.MainService"
android:exported="false"/>
<service
android:name=".services.AssistantService"
android:exported="false"/>
<service
android:name=".services.DistanceRefreshService"
android:exported="false"/>
<receiver android:name="cc.winboll.studio.positions.receivers.MotionStatusReceiver">
<intent-filter>
<action android:name="cc.winboll.studio.positions.receivers.MotionStatusReceiver"/>
</intent-filter>
</receiver>
<meta-data
android:name="android.max_aspect"
android:value="4.0"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider"/>
</provider>
<activity android:name="cc.winboll.studio.positions.activities.SettingsActivity"/>
<activity android:name="cc.winboll.studio.positions.activities.AboutActivity"/>
</application>
</manifest>
@@ -0,0 +1,496 @@
package cc.winboll.studio.positions;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
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.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.positions.services.MainService;
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;
/**
* 全局Application应用入口类
* 功能概括:
* 1. 全局初始化管理、工具类框架初始化
* 2. 应用全局空转状态统一管理
* 3. IO读写通用工具封装
* 4. 全局崩溃捕获、崩溃日志本地保存、崩溃弹窗页面
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @CreateTime 2026/05/03 12:23:00
* @EditTime 2026/05/03 15:02:47
*/
public class App extends GlobalApplication {
//===================== 全局静态常量与变量 =====================
public static final String TAG = "App";
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
private static App sInstance;
private static final String SP_NAME = "app_idle_config";
private static final String SP_KEY_IDLE_RUNNING = "is_idle_running";
// 应用全局空转状态标记
private static boolean isAppIdleRunning = false;
//===================== 空转状态对外方法 =====================
/**
* 获取当前应用空转运行状态
* @return 是否处于空转状态
*/
public static boolean isAppIdleRunning() {
if (isAppIdleRunning) {
LogUtils.d(TAG, "isAppIdleRunning -> 当前应用处于空转运行状态");
}
return isAppIdleRunning;
}
/**
* 设置应用空转运行状态
* @param idleRunning 空转开关状态
*/
public static void setAppIdleRunning(boolean idleRunning) {
LogUtils.d(TAG, "setAppIdleRunning -> 传入参数 idleRunning = " + idleRunning);
if (isDebugging()) {
isAppIdleRunning = idleRunning;
saveIdleRunningToSp(idleRunning);
LogUtils.i(TAG, "setAppIdleRunning -> 调试模式,空转状态设置生效并持久化");
// 重启MainService服务以同步新的空转状态(stopService对未运行服务无效,故无需判断状态)
if (sInstance != null) {
LogUtils.i(TAG, "setAppIdleRunning -> 重启MainService服务以同步空转状态");
Intent serviceIntent = new Intent(sInstance, MainService.class);
sInstance.stopService(serviceIntent);
sInstance.startService(serviceIntent);
}
} else {
LogUtils.i(TAG, "setAppIdleRunning -> 非调试模式,空转设置无效");
LogUtils.i(TAG, "Non-debug state, app idle setting is meaningless.");
}
}
/**
* 从SharedPreferences加载空转状态
*/
private static void loadIdleRunningFromSp() {
try {
if (sInstance != null) {
SharedPreferences sp = sInstance.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
isAppIdleRunning = sp.getBoolean(SP_KEY_IDLE_RUNNING, false);
LogUtils.i(TAG, "loadIdleRunningFromSp -> 从SP加载空转状态:" + isAppIdleRunning);
}
} catch (Exception e) {
LogUtils.e(TAG, "loadIdleRunningFromSp -> 加载空转状态失败:" + e.getMessage());
isAppIdleRunning = false;
}
}
/**
* 保存空转状态到SharedPreferences
* @param idleRunning 空转状态
*/
private static void saveIdleRunningToSp(boolean idleRunning) {
try {
if (sInstance != null) {
SharedPreferences sp = sInstance.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
sp.edit().putBoolean(SP_KEY_IDLE_RUNNING, idleRunning).apply();
LogUtils.i(TAG, "saveIdleRunningToSp -> 空转状态已保存:" + idleRunning);
}
} catch (Exception e) {
LogUtils.e(TAG, "saveIdleRunningToSp -> 保存空转状态失败:" + e.getMessage());
}
}
//===================== 应用生命周期 =====================
@Override
public void onCreate() {
super.onCreate();
sInstance = this;
LogUtils.i(TAG, "onCreate -> 全局Application初始化开始");
setIsDebugging(BuildConfig.DEBUG);
WinBoLLActivityManager.init(this);
ToastUtils.init(this);
loadIdleRunningFromSp();
LogUtils.i(TAG, "onCreate -> 全局组件初始化全部完成");
}
//===================== IO通用工具方法 =====================
/**
* 流式读写输入输出流
* @param input 输入流
* @param output 输出流
* @throws IOException IO读写异常
*/
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);
}
}
/**
* 将字节数组写入指定文件
* @param file 目标文件
* @param data 字节数据
* @throws IOException IO读写异常
*/
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);
}
}
/**
* 输入流转为UTF-8字符串
* @param input 输入流
* @return 转换后的文本
* @throws IOException IO读写异常
*/
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);
}
}
/**
* 批量关闭IO流
* @param closeables 可关闭对象
*/
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);
}
/**
* 注册全局崩溃并自定义崩溃日志保存目录
* @param crashDir 崩溃日志路径
*/
public void registerGlobal(Context context, String crashDir) {
LogUtils.d(TAG, "CrashHandler -> 注册全局异常捕获器");
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir));
}
/**
* 解除全局崩溃捕获
*/
public void unregister() {
LogUtils.d(TAG, "CrashHandler -> 解除全局异常捕获");
Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER);
}
/**
* 注册局部前台异常捕获
*/
public void registerPart(Context context) {
unregisterPart(context);
mPartCrashHandler = new PartCrashHandler(context.getApplicationContext());
MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler);
LogUtils.d(TAG, "CrashHandler -> 局部异常监听已注册");
}
/**
* 解除局部异常捕获
*/
public void unregisterPart(Context context) {
if (mPartCrashHandler != null) {
mPartCrashHandler.isRunning.set(false);
mPartCrashHandler = null;
LogUtils.d(TAG, "CrashHandler -> 局部异常监听已销毁");
}
}
/**
* 局部前台Looper异常捕获
*/
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) {
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);
Intent intent = new Intent(mContext, CrashActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_TEXT, log);
mContext.startActivity(intent);
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(throwable.toString());
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"));
LogUtils.d(TAG, "崩溃日志已保存至本地文件");
} catch (Throwable e) {
LogUtils.e(TAG, "崩溃日志写入失败");
}
}
/**
* 获取系统内核版本信息
*/
private static String getKernel() {
try {
return App.toString(new FileInputStream("/proc/version")).trim();
} catch (Throwable e) {
return e.getMessage();
}
}
}
}
//===================== 崩溃展示页面 =====================
public static final class CrashActivity extends Activity {
private String mLog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LogUtils.i(TAG, "CrashActivity -> 崩溃展示页面已启动");
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);
}
/**
* dp转px通用方法
*/
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) {
if (item.getItemId() == android.R.id.copy) {
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
LogUtils.d(TAG, "CrashActivity -> 崩溃日志已复制到剪贴板");
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
restart();
}
}
}
@@ -0,0 +1,403 @@
package cc.winboll.studio.positions;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.libaes.utils.DevelopUtils;
import cc.winboll.studio.libaes.views.ADsBannerView;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.positions.activities.AboutActivity;
import cc.winboll.studio.positions.activities.LocationActivity;
import cc.winboll.studio.positions.activities.SettingsActivity;
import cc.winboll.studio.positions.activities.WinBoLLActivity;
import cc.winboll.studio.positions.handlers.AppIdleRunningModeHandler;
import cc.winboll.studio.positions.utils.AppConfigsUtil;
import cc.winboll.studio.positions.utils.ServiceUtil;
import cc.winboll.studio.positions.services.IdleGpsService;
import cc.winboll.studio.positions.services.MainService;
import cc.winboll.studio.positions.R;
import android.os.Handler;
import android.os.Looper;
import android.os.Handler;
import android.os.Handler;
import android.os.Looper;
import android.content.Intent;
import android.os.Handler;
/**
* 主页面控制器
* 功能简述:
* 1. 位置服务启停开关控制
* 2. 页面菜单跳转与主题管理
* 3. 应用空转状态接收与日志实时输出展示
* 4. 全局权限申请与权限结果回调处理
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @CreateTime 2026/05/03 12:23:00
* @EditTime 2026/05/03 15:42:15
*/
public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
// ===================== 常量定义 =====================
public static final String TAG = "MainActivity";
private static final int REQUEST_LOCATION_PERMISSIONS = 1001;
private static final int REQUEST_BACKGROUND_LOCATION_PERMISSION = 1002;
// ===================== UI控件声明 =====================
private Toolbar mToolbar;
private Switch mServiceSwitch;
private Button mManagePositionsButton;
private ADsBannerView mADsBannerView;
private TextView mTvIdleLog;
private ScrollView mScrollIdleLog;
// ===================== 业务标记与回调 =====================
private boolean isServiceBound = false;
private OnAppIdleRunningListener mIdleRunningListener;
/**
* 应用空转状态回调内部接口
*/
public interface OnAppIdleRunningListener {
void onIdleStatusChange(boolean isRunning);
void onIdleLogReceive(String log);
}
// ===================== 回调绑定方法 =====================
public void setOnAppIdleRunningListener(OnAppIdleRunningListener listener) {
this.mIdleRunningListener = listener;
LogUtils.i(TAG, "setOnAppIdleRunningListener -> 空转监听绑定完成");
}
public OnAppIdleRunningListener getOnAppIdleRunningListener() {
return mIdleRunningListener;
}
// ===================== 生命周期重写 =====================
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LogUtils.i(TAG, "onCreate -> MainActivity页面创建完成");
initToolbar();
initViews();
setLLMainBackgroundColor();
if (!checkLocationPermissions()) {
LogUtils.d(TAG, "onCreate -> 定位权限未授予,发起权限申请");
requestLocationPermissions();
}
mADsBannerView = findViewById(R.id.adsbanner);
initAppIdleHandler();
refreshIdleLogLayout();
// 根据调试模式控制日志区域的显示
if (App.isDebugging()) {
mScrollIdleLog.setVisibility(View.VISIBLE);
LogUtils.d(TAG, "onCreate -> 调试模式,显示日志区域");
} else {
mScrollIdleLog.setVisibility(View.GONE);
LogUtils.d(TAG, "onCreate -> 非调试模式,隐藏日志区域");
}
}
@Override
protected void onResume() {
super.onResume();
LogUtils.d(TAG, "onResume -> 页面恢复可见");
if (App.isAppIdleRunning()) {
IdleGpsService.getInstance().start();
}
if (mADsBannerView != null) {
mADsBannerView.resumeADs(MainActivity.this);
}
// 重新加载菜单以根据当前调试状态刷新
invalidateOptionsMenu();
LogUtils.d(TAG, "onResume -> 重新加载菜单完成");
}
@Override
protected void onDestroy() {
super.onDestroy();
LogUtils.i(TAG, "onDestroy -> MainActivity页面销毁释放资源");
if (mADsBannerView != null) {
mADsBannerView.releaseAdResources();
}
mIdleRunningListener = null;
}
// ===================== 初始化相关方法 =====================
private void initToolbar() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(getString(R.string.app_name));
}
LogUtils.d(TAG, "initToolbar -> 顶部工具栏初始化完毕");
}
private void initViews() {
mTvIdleLog = (TextView) findViewById(R.id.tv_idle_log);
mScrollIdleLog = (ScrollView) findViewById(R.id.scroll_idle_log);
mServiceSwitch = (Switch) findViewById(R.id.switch_service_control);
mManagePositionsButton = (Button) findViewById(R.id.btn_manage_positions);
boolean serviceEnable = AppConfigsUtil.getInstance(this).isEnableMainService(true);
mServiceSwitch.setChecked(serviceEnable);
mManagePositionsButton.setEnabled(serviceEnable);
mServiceSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//切换开关时先校验权限,无权限直接强制关闭开关
if(isChecked && !checkLocationPermissions()){
mServiceSwitch.setChecked(false);
Toast.makeText(MainActivity.this,"未获取定位权限,无法开启GPS服务",Toast.LENGTH_SHORT).show();
return;
}
LogUtils.d(TAG, "onCheckedChanged -> 服务开关状态变更,isChecked = " + isChecked);
if (isChecked) {
ServiceUtil.startAutoService(MainActivity.this);
} else {
ServiceUtil.stopAutoService(MainActivity.this);
}
mManagePositionsButton.setEnabled(isChecked);
refreshManageButtonState();
}
});
LogUtils.i(TAG, "initViews -> 全部UI控件初始化绑定完成");
}
private void initAppIdleHandler() {
AppIdleRunningModeHandler.init(MainActivity.this);
setOnAppIdleRunningListener(new OnAppIdleRunningListener() {
@Override
public void onIdleStatusChange(boolean isRunning) {
refreshIdleLogLayout();
appendIdleLog("IdleRunning Status : " + isRunning);
}
@Override
public void onIdleLogReceive(String log) {
appendIdleLog(log);
}
});
LogUtils.i(TAG, "initAppIdleHandler -> 空转处理器初始化与监听绑定完成");
}
private void setLLMainBackgroundColor() {
TypedArray typedArray = getTheme().obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
int colorAccent = typedArray.getColor(0, Color.GRAY);
typedArray.recycle();
LinearLayout llmain = findViewById(R.id.llmain);
llmain.setBackgroundColor(colorAccent);
}
// ===================== 空转日志输出工具 =====================
private void appendIdleLog(final String logText) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String allLog = mTvIdleLog.getText().toString();
mTvIdleLog.setText(allLog + logText + "\n");
mScrollIdleLog.post(new Runnable() {
@Override
public void run() {
mScrollIdleLog.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
});
}
private void refreshIdleLogLayout() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (App.isAppIdleRunning()) {
mScrollIdleLog.setBackgroundResource(R.drawable.shape_log_border);
} else {
//关闭空转时:检测权限,无权限强制关闭GPS开关
if(!checkLocationPermissions()){
mServiceSwitch.setChecked(false);
ServiceUtil.stopAutoService(MainActivity.this);
}
mTvIdleLog.setText("");
mScrollIdleLog.setBackgroundColor(Color.TRANSPARENT);
LogUtils.d(TAG, "refreshIdleLogLayout -> 非空转状态:日志清空、边框已移除");
}
refreshToolbarSubTitle();
refreshManageButtonState();
}
});
}
private void refreshToolbarSubTitle() {
if(getSupportActionBar() == null){
return;
}
if(App.isAppIdleRunning()){
getSupportActionBar().setSubtitle("当前处于空转运行状态");
}else{
getSupportActionBar().setSubtitle("");
}
}
/**
* 空转状态专属:按钮强制可点击 + 文字追加提示
*/
private void refreshManageButtonState() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (App.isAppIdleRunning()) {
mManagePositionsButton.setText("位置与任务管理【当前空转中】");
mManagePositionsButton.setEnabled(true);
} else {
mManagePositionsButton.setText("位置与任务管理");
boolean serviceEnable = AppConfigsUtil.getInstance(MainActivity.this).isEnableMainService(true);
mManagePositionsButton.setEnabled(serviceEnable);
}
}
});
}
// ===================== 权限处理相关 =====================
private boolean checkLocationPermissions() {
int foregroundPerm = checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION);
boolean hasForegroundPerm = (foregroundPerm == PackageManager.PERMISSION_GRANTED);
boolean hasBackgroundPerm = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
int backgroundPerm = checkSelfPermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
hasBackgroundPerm = (backgroundPerm == PackageManager.PERMISSION_GRANTED);
}
return hasForegroundPerm && hasBackgroundPerm;
}
private void requestLocationPermissions() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
String[] foregroundPermissions = new String[]{Manifest.permission.ACCESS_FINE_LOCATION};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(foregroundPermissions, REQUEST_LOCATION_PERMISSIONS);
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION},
REQUEST_BACKGROUND_LOCATION_PERMISSION);
}
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
LogUtils.d(TAG, "onRequestPermissionsResult -> 权限回调 requestCode = " + requestCode);
if (requestCode == REQUEST_LOCATION_PERMISSIONS) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
requestLocationPermissions();
} else {
Toast.makeText(this, "需要前台定位权限才能使用该功能", Toast.LENGTH_SHORT).show();
//权限被拒绝,强制关闭开关
mServiceSwitch.setChecked(false);
ServiceUtil.stopAutoService(MainActivity.this);
mManagePositionsButton.setEnabled(false);
}
} else if (requestCode == REQUEST_BACKGROUND_LOCATION_PERMISSION) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "已获得后台定位权限", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "拒绝后台权限将无法在后台持续定位", Toast.LENGTH_SHORT).show();
}
}
}
// ===================== 菜单与页面跳转 =====================
@Override
public boolean onCreateOptionsMenu(Menu menu) {
AESThemeUtil.inflateMenu(this, menu);
if (App.isDebugging()) {
DevelopUtils.inflateMenu(this, menu);
getMenuInflater().inflate(R.menu.toolbar_main_idle, menu);
}
getMenuInflater().inflate(R.menu.toolbar_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int menuItemId = item.getItemId();
LogUtils.d(TAG, "onOptionsItemSelected -> 点击菜单ID = " + menuItemId);
if (AESThemeUtil.onAppThemeItemSelected(this, item)) {
recreate();
} else if (DevelopUtils.onDevelopItemSelected(this, item)) {
LogUtils.d(TAG, "onOptionsItemSelected -> 进入开发工具菜单");
} else if (menuItemId == R.id.item_idle_switch) {
boolean idleNow = App.isAppIdleRunning();
boolean idleNew = !idleNow;
App.setAppIdleRunning(idleNew);
AppIdleRunningModeHandler.sendIdleSwitch(idleNew);
AppIdleRunningModeHandler.sendIdleLog("菜单手动切换空转状态:" + idleNew);
LogUtils.d(TAG, "onOptionsItemSelected -> 空转状态已切换,当前:" + idleNew);
refreshIdleLogLayout();
} else if (menuItemId == R.id.item_settings) {
Intent intent = new Intent();
intent.setClass(this, SettingsActivity.class);
startActivity(intent);
} else if (menuItemId == R.id.item_about) {
Intent intent = new Intent();
intent.setClass(this, AboutActivity.class);
startActivity(intent);
} else {
return super.onOptionsItemSelected(item);
}
return true;
}
public void onPositions(View view) {
LogUtils.d(TAG, "onPositions -> 跳转位置任务管理页面");
startActivity(new Intent(MainActivity.this, LocationActivity.class));
}
// ===================== 接口实现 =====================
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
}
@@ -0,0 +1,81 @@
package cc.winboll.studio.positions.activities;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.models.APPInfo;
import cc.winboll.studio.libappbase.views.AboutView;
import cc.winboll.studio.positions.R;
/**
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @Date 2026/01/13 11:25
* @Describe 应用介绍窗口
*/
public class AboutActivity extends WinBoLLActivity {
public static final String TAG = "AboutActivity";
private Toolbar mToolbar;
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
// 设置工具栏
initToolbar();
AboutView aboutView = findViewById(R.id.aboutview);
aboutView.setAPPInfo(genDefaultAppInfo());
}
private void initToolbar() {
LogUtils.d(TAG, "initToolbar() 开始初始化");
mToolbar = findViewById(R.id.toolbar);
if (mToolbar == null) {
LogUtils.e(TAG, "initToolbar() | Toolbar未找到");
return;
}
setSupportActionBar(mToolbar);
mToolbar.setSubtitle(getTag());
mToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LogUtils.d(TAG, "导航栏 点击返回按钮");
finish();
}
});
LogUtils.d(TAG, "initToolbar() 配置完成");
}
private APPInfo genDefaultAppInfo() {
LogUtils.d(TAG, "genDefaultAppInfo() 调用");
String branchName = "positions";
APPInfo appInfo = new APPInfo();
appInfo.setAppName(getString(R.string.app_name));
appInfo.setAppIcon(R.drawable.ic_winboll);
appInfo.setAppDescription(getString(R.string.app_description));
appInfo.setAppGitName("Positions");
appInfo.setAppGitOwner("ZhanGSKen");
appInfo.setAppGitAPPBranch(branchName);
appInfo.setAppGitAPPSubProjectFolder(branchName);
appInfo.setAppHomePage("https://www.winboll.cc/apks/index.php?project=Positions");
appInfo.setAppAPKName("Positions");
appInfo.setAppAPKFolderName("Positions");
LogUtils.d(TAG, "genDefaultAppInfo: 应用信息已生成");
return appInfo;
}
}
@@ -0,0 +1,487 @@
package cc.winboll.studio.positions.activities;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.libaes.dialogs.YesNoAlertDialog;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.positions.App;
import cc.winboll.studio.positions.MainActivity;
import cc.winboll.studio.positions.R;
import cc.winboll.studio.positions.adapters.PositionAdapter;
import cc.winboll.studio.positions.models.PositionModel;
import cc.winboll.studio.positions.services.IdleGpsService;
import cc.winboll.studio.positions.services.MainService;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @CreateTime 2025/09/29 18:22:00
* @EditTime 2026/05/03 16:36:54
* @Describe 位置列表页面,适配MainService GPS接口、规范服务交互、完善生命周期资源释放,新增应用空转状态副标题提示
*/
public class LocationActivity extends WinBoLLActivity implements IWinBoLLActivity {
// 常量
public static final String TAG = "LocationActivity";
// 成员属性有序排版
private Toolbar mToolbar;
private RecyclerView mRvPosition;
private PositionAdapter mPositionAdapter;
private MainService mMainService;
private final AtomicBoolean isServiceBound = new AtomicBoolean(false);
private final AtomicBoolean isAdapterInited = new AtomicBoolean(false);
private MainService.GpsUpdateListener mGpsUpdateListener;
private PositionModel mCurrentGpsPos;
private final ArrayList<PositionModel> mLocalPosCache = new ArrayList<PositionModel>();
// 服务连接回调
private final ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(final ComponentName name, final IBinder service) {
LogUtils.d(TAG, "onServiceConnected invoke");
if (!(service instanceof MainService.LocalBinder)) {
LogUtils.e(TAG, "服务绑定失败:Binder类型不匹配");
isServiceBound.set(false);
return;
}
try {
final MainService.LocalBinder binder = (MainService.LocalBinder) service;
mMainService = binder.getService();
isServiceBound.set(true);
LogUtils.d(TAG, "MainService bind success");
syncDataFromMainService();
registerGpsListener();
initPositionAdapter();
} catch (final Exception e) {
LogUtils.e(TAG, "服务绑定异常:" + e.getMessage());
isServiceBound.set(false);
mMainService = null;
showToast("服务初始化失败,无法加载数据");
}
}
@Override
public void onServiceDisconnected(final ComponentName name) {
LogUtils.w(TAG, "MainService 服务断开");
mMainService = null;
isServiceBound.set(false);
isAdapterInited.set(false);
}
};
// 接口方法实现
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
/**
* 刷新空转状态副标题
*/
private void refreshIdleStatusTitle() {
LogUtils.d(TAG, "refreshIdleStatusTitle invoke");
if (mToolbar == null) {
LogUtils.w(TAG, "Toolbar为空,跳过刷新");
return;
}
final boolean idleStatus = App.isAppIdleRunning();
if (idleStatus) {
mToolbar.setSubtitle("当前状态:应用正在空转运行");
LogUtils.d(TAG, "检测应用空转状态为 : " + idleStatus);
} else {
mToolbar.setSubtitle(getTag());
}
}
/**
* 初始化页面控件
*/
private void initView() {
LogUtils.d(TAG, "initView invoke");
mRvPosition = findViewById(R.id.rv_position_list);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRvPosition.setLayoutManager(layoutManager);
mLocalPosCache.clear();
}
/**
* 绑定后台服务
*/
private void bindMainService() {
LogUtils.d(TAG, "bindMainService invoke");
if (isServiceBound.get()) {
LogUtils.w(TAG, "服务已绑定,无需重复执行");
return;
}
final Intent serviceIntent = new Intent(this, MainService.class);
final boolean bindSuccess = bindService(serviceIntent, mServiceConnection, BIND_AUTO_CREATE);
if (!bindSuccess) {
LogUtils.e(TAG, "发起服务绑定请求失败");
showToast("服务绑定失败,无法加载位置数据");
}
}
/**
* 同步服务数据至本地缓存
*/
private void syncDataFromMainService() {
LogUtils.d(TAG, "syncDataFromMainService invoke");
if (!isServiceBound.get() || mMainService == null) {
LogUtils.w(TAG, "服务未就绪,使用本地缓存");
return;
}
try {
final ArrayList<PositionModel> servicePosList = mMainService.getPositionList();
synchronized (mLocalPosCache) {
mLocalPosCache.clear();
if (servicePosList != null && !servicePosList.isEmpty()) {
mLocalPosCache.addAll(servicePosList);
}
}
LogUtils.d(TAG, "同步完成,缓存数量 : " + mLocalPosCache.size());
} catch (final Exception e) {
LogUtils.e(TAG, "数据同步异常 : " + e.getMessage());
}
}
/**
* 初始化列表适配器
*/
private void initPositionAdapter() {
LogUtils.d(TAG, "initPositionAdapter invoke");
if (isAdapterInited.get() || !isServiceBound.get()
|| mMainService == null || mRvPosition == null) {
LogUtils.w(TAG, "适配器初始化条件不满足,跳过");
return;
}
try {
mPositionAdapter = new PositionAdapter(this, mLocalPosCache, mMainService);
mPositionAdapter.setOnDeleteClickListener(new PositionAdapter.OnDeleteClickListener() {
@Override
public void onDeleteClick(final int position) {
LogUtils.d(TAG, "onDeleteClick position = " + position);
YesNoAlertDialog.show(LocationActivity.this, "删除位置提示",
"是否删除此项锚点位置?", new YesNoAlertDialog.OnDialogResultListener() {
@Override
public void onNo() {
}
@Override
public void onYes() {
if (position < 0 || position >= mLocalPosCache.size()) {
LogUtils.w(TAG, "删除索引参数非法");
return;
}
final PositionModel deletePos = mLocalPosCache.get(position);
if (deletePos != null && !deletePos.getPositionId().isEmpty()) {
mMainService.removePosition(deletePos.getPositionId());
synchronized (mLocalPosCache) {
mLocalPosCache.remove(position);
}
mPositionAdapter.notifyItemRemoved(position);
showToast("删除位置成功:" + deletePos.getMemo());
}
}
});
}
});
mPositionAdapter.setOnSavePositionClickListener(new PositionAdapter.OnSavePositionClickListener() {
@Override
public void onSavePositionClick(final int position, final PositionModel updatedPos) {
LogUtils.d(TAG, "onSavePositionClick position = " + position);
if (position < 0 || position >= mLocalPosCache.size() || updatedPos == null) {
LogUtils.w(TAG, "保存参数非法");
showToast("服务未就绪,保存失败");
return;
}
mMainService.updatePosition(updatedPos);
synchronized (mLocalPosCache) {
mLocalPosCache.set(position, updatedPos);
}
mPositionAdapter.notifyItemChanged(position);
showToast("保存位置成功:" + updatedPos.getMemo());
}
});
mRvPosition.setAdapter(mPositionAdapter);
isAdapterInited.set(true);
LogUtils.d(TAG, "适配器初始化完成");
} catch (final Exception e) {
LogUtils.e(TAG, "适配器初始化异常 : " + e.getMessage());
isAdapterInited.set(false);
mPositionAdapter = null;
showToast("位置列表初始化失败,请重试");
}
}
/**
* 通用Toast弹窗
*/
private void showToast(final String content) {
if (isFinishing() || isDestroyed()) {
LogUtils.w(TAG, "页面已销毁,取消Toast");
return;
}
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
}
/**
* 新增位置按钮事件
*/
public void addNewPosition(final View view) {
LogUtils.d(TAG, "addNewPosition invoke");
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null && getCurrentFocus() != null) {
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
if (!isServiceBound.get() || mMainService == null) {
LogUtils.w(TAG, "服务未绑定,无法新增");
showToast("服务未就绪,无法新增位置");
return;
}
final PositionModel newPos = new PositionModel();
newPos.setPositionId(PositionModel.genPositionId());
if (mCurrentGpsPos != null) {
newPos.setLongitude(mCurrentGpsPos.getLongitude());
newPos.setLatitude(mCurrentGpsPos.getLatitude());
newPos.setMemo("当前GPS位置(可编辑)");
} else {
newPos.setLongitude(116.404267);
newPos.setLatitude(39.915119);
newPos.setMemo("默认位置(可编辑备注)");
}
newPos.setIsSimpleView(true);
newPos.setIsEnableRealPositionDistance(true);
mMainService.addPosition(newPos);
synchronized (mLocalPosCache) {
mLocalPosCache.add(newPos);
}
LogUtils.d(TAG, "新增位置成功,ID : " + newPos.getPositionId());
if (isAdapterInited.get() && mPositionAdapter != null) {
mPositionAdapter.notifyItemInserted(mLocalPosCache.size() - 1);
}
showToast("新增位置成功(已启用GPS距离计算)");
}
/**
* 初始化GPS监听实例
*/
private void initGpsUpdateListener() {
LogUtils.d(TAG, "initGpsUpdateListener invoke");
mGpsUpdateListener = new MainService.GpsUpdateListener() {
@Override
public void onGpsPositionUpdated(final PositionModel currentGpsPos) {
if (currentGpsPos == null || isFinishing() || isDestroyed()) {
return;
}
mCurrentGpsPos = currentGpsPos;
LogUtils.d(TAG, "GPS更新 -> 纬度:" + currentGpsPos.getLatitude() + " 经度:" + currentGpsPos.getLongitude());
final TextView tvLat = (TextView) findViewById(R.id.tv_latitude);
final TextView tvLon = (TextView) findViewById(R.id.tv_longitude);
final TextView tvTime = (TextView) findViewById(R.id.tv_timenow);
tvLat.setText(String.format("当前纬度:%f", currentGpsPos.getLatitude()));
tvLon.setText(String.format("当前经度:%f", currentGpsPos.getLongitude()));
final long currentTime = System.currentTimeMillis();
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
final String timeStr = sdf.format(new Date(currentTime));
tvTime.setText("现在时间:" + timeStr);
}
@Override
public void onGpsStatusChanged(final String status) {
if (status == null || isFinishing() || isDestroyed()) {
return;
}
LogUtils.d(TAG, "GPS状态变更 : " + status);
if (status.contains("未开启") || status.contains("权限") || status.contains("失败")) {
ToastUtils.show("GPS提示:" + status);
}
}
};
}
/**
* 刷新GPS监听源(根据空转状态自动切换)
*/
private void refreshGpsListener() {
LogUtils.d(TAG, "refreshGpsListener invoke");
// 统一注销旧监听(防止重复注册)
IdleGpsService.getInstance().unregisterGpsUpdateListener(mGpsUpdateListener);
if (mMainService != null) {
try { mMainService.unregisterGpsUpdateListener(mGpsUpdateListener); } catch (Exception e) {}
}
// 重新注册正确的监听
registerGpsListener();
}
/**
* 注册GPS监听
*/
private void registerGpsListener() {
LogUtils.d(TAG, "registerGpsListener invoke");
if (isFinishing() || isDestroyed() || mGpsUpdateListener == null) {
return;
}
try {
if (App.isAppIdleRunning()) {
IdleGpsService.getInstance().registerGpsUpdateListener(mGpsUpdateListener);
LogUtils.d(TAG, "空转GPS监听注册成功");
} else {
if (mMainService != null) {
mMainService.registerGpsUpdateListener(mGpsUpdateListener);
LogUtils.d(TAG, "系统GPS监听注册成功");
}
}
} catch (final Exception e) {
LogUtils.e(TAG, "GPS注册异常 : " + e.getMessage());
}
}
/**
* 反注册GPS监听
*/
private void unregisterGpsListener() {
LogUtils.d(TAG, "unregisterGpsListener invoke");
if (mGpsUpdateListener == null) {
return;
}
try {
// 尝试从空转服务注销
IdleGpsService.getInstance().unregisterGpsUpdateListener(mGpsUpdateListener);
} catch (Exception e) {
// ignore
}
try {
// 尝试从主服务注销
if (mMainService != null) {
mMainService.unregisterGpsUpdateListener(mGpsUpdateListener);
}
} catch (final Exception e) {
LogUtils.e(TAG, "GPS反注册异常 : " + e.getMessage());
}
}
// 生命周期方法
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LogUtils.d(TAG, "onCreate invoke");
setContentView(R.layout.activity_location);
mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
mToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
LogUtils.d(TAG, "点击返回导航按钮");
final Intent intent = new Intent(LocationActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
});
refreshIdleStatusTitle();
initView();
initGpsUpdateListener();
bindMainService();
}
@Override
protected void onResume() {
super.onResume();
LogUtils.d(TAG, "onResume invoke");
refreshIdleStatusTitle();
refreshGpsListener(); // 根据当前空转状态刷新GPS源
if (isServiceBound.get() && mMainService != null && !isAdapterInited.get()) {
syncDataFromMainService();
initPositionAdapter();
} else if (isServiceBound.get() && mMainService != null && mPositionAdapter != null) {
syncDataFromMainService();
mPositionAdapter.notifyDataSetChanged();
}
}
@Override
protected void onPause() {
super.onPause();
LogUtils.d(TAG, "onPause invoke");
}
@Override
protected void onDestroy() {
super.onDestroy();
LogUtils.d(TAG, "onDestroy invoke,开始释放资源");
unregisterGpsListener();
if (mPositionAdapter != null) {
mPositionAdapter.release();
mPositionAdapter = null;
LogUtils.d(TAG, "Adapter资源释放完成");
}
if (isServiceBound.get()) {
try {
unbindService(mServiceConnection);
LogUtils.d(TAG, "服务解绑完成");
} catch (final IllegalArgumentException e) {
LogUtils.e(TAG, "解绑异常:服务已提前解绑");
}
isServiceBound.set(false);
mMainService = null;
}
synchronized (mLocalPosCache) {
mLocalPosCache.clear();
}
mCurrentGpsPos = null;
mGpsUpdateListener = null;
isAdapterInited.set(false);
LogUtils.d(TAG, "全部资源释放完毕");
}
}
@@ -0,0 +1,51 @@
package cc.winboll.studio.positions.activities;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.positions.R;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2025/12/07 23:29
* @Describe 应用设置活动窗口
*/
public class SettingsActivity extends WinBoLLActivity implements IWinBoLLActivity {
public static final String TAG = "SettingsActivity";
private Toolbar mToolbar;
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
mToolbar.setSubtitle(getTag());
mToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LogUtils.d(TAG, "【导航栏】点击返回");
finish();
}
});
}
}
@@ -0,0 +1,80 @@
package cc.winboll.studio.positions.activities;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2025/09/29 00:11
* @Describe WinBoLL 窗口基础类
*/
import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libaes.models.AESThemeBean;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
import cc.winboll.studio.libappbase.LogUtils;
public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity {
public static final String TAG = "WinBoLLActivity";
protected volatile AESThemeBean.ThemeType mThemeType;
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
mThemeType = getThemeType();
setThemeStyle();
super.onCreate(savedInstanceState);
}
AESThemeBean.ThemeType getThemeType() {
return AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext()));
}
void setThemeStyle() {
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
}
@Override
protected void onResume() {
super.onResume();
LogUtils.d(TAG, String.format("onResume %s", getTag()));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
/*if (item.getItemId() == R.id.item_log) {
WinBoLLActivityManager.getInstance().startLogActivity(this);
return true;
} else if (item.getItemId() == R.id.item_home) {
startActivity(new Intent(this, MainActivity.class));
return true;
}*/
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
return super.onOptionsItemSelected(item);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
WinBoLLActivityManager.getInstance().add(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
WinBoLLActivityManager.getInstance().registeRemove(this);
}
}
@@ -0,0 +1,639 @@
package cc.winboll.studio.positions.adapters;
/**
* @Describe 位置数据适配器(修复视图复用资源加载,支持滚动后重新绑定数据,Java 7语法适配)
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @CreateTime 2025-09-29 20:25:00
* @EditTime 2026-03-31 23:14:55
*/
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.positions.R;
import cc.winboll.studio.positions.models.PositionModel;
import cc.winboll.studio.positions.models.PositionTaskModel;
import cc.winboll.studio.positions.services.MainService;
import cc.winboll.studio.positions.views.PositionTaskListView;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
public class PositionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
implements MainService.TaskUpdateListener {
public static final String TAG = "PositionAdapter";
// 视图类型常量
private static final int VIEW_TYPE_SIMPLE = 0;
private static final int VIEW_TYPE_EDIT = 1;
// 默认配置常量
private static final String DEFAULT_MEMO = "无备注";
private static final String DEFAULT_TASK_DESC = "新任务";
private static final int DEFAULT_TASK_DISTANCE = 50;
private static final String DISTANCE_FORMAT = "实时距离:%.1f 米";
private static final String DISTANCE_DISABLED = "实时距离:未启用";
private static final String DISTANCE_ERROR = "实时距离:计算失败";
// 核心成员变量
private final Context mContext;
private final ArrayList<PositionModel> mCachedPositionList;
private final WeakReference<MainService> mMainServiceRef;
private final ConcurrentHashMap<String, PositionTaskListView> mSimpleTaskViewMap;
private final ConcurrentHashMap<String, PositionTaskListView> mEditTaskViewMap;
private final ConcurrentHashMap<String, TextView> mPosDistanceViewMap;
// 回调接口
public interface OnDeleteClickListener {
void onDeleteClick(int position);
}
public interface OnSavePositionClickListener {
void onSavePositionClick(int position, PositionModel updatedPos);
}
private OnDeleteClickListener mOnDeleteListener;
private OnSavePositionClickListener mOnSavePosListener;
// =========================================================================
// 构造函数
// =========================================================================
public PositionAdapter(Context context, ArrayList<PositionModel> cachedPositionList, MainService mainService) {
LogUtils.d(TAG, "PositionAdapter 构造函数开始,context=" + context
+ "cachedPositionList=" + (cachedPositionList != null ? cachedPositionList.size() : 0)
+ "mainService=" + mainService);
this.mContext = context;
this.mCachedPositionList = (cachedPositionList != null) ? cachedPositionList : new ArrayList<PositionModel>();
this.mMainServiceRef = new WeakReference<MainService>(mainService);
this.mSimpleTaskViewMap = new ConcurrentHashMap<String, PositionTaskListView>();
this.mEditTaskViewMap = new ConcurrentHashMap<String, PositionTaskListView>();
this.mPosDistanceViewMap = new ConcurrentHashMap<String, TextView>();
if (mainService != null) {
mainService.registerTaskUpdateListener(this);
LogUtils.d(TAG, "已注册 MainService 任务监听");
} else {
LogUtils.w(TAG, "构造函数:MainService 为空,无法初始化任务视图");
}
LogUtils.d(TAG, "PositionAdapter 初始化完成,位置数量=" + mCachedPositionList.size());
}
// =========================================================================
// RecyclerView 核心方法
// =========================================================================
@Override
public int getItemViewType(int position) {
PositionModel posModel = getPositionByIndex(position);
return (posModel != null && posModel.isSimpleView()) ? VIEW_TYPE_SIMPLE : VIEW_TYPE_EDIT;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LogUtils.d(TAG, "onCreateViewHolder viewType=" + viewType);
LayoutInflater inflater = LayoutInflater.from(mContext);
if (viewType == VIEW_TYPE_SIMPLE) {
View simpleView = inflater.inflate(R.layout.item_position_simple, parent, false);
return new SimpleViewHolder(simpleView);
} else {
View editView = inflater.inflate(R.layout.item_position_edit, parent, false);
return new EditViewHolder(editView);
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
LogUtils.d(TAG, "onBindViewHolder position=" + position);
PositionModel posModel = getPositionByIndex(position);
if (posModel == null) {
LogUtils.w(TAG, "onBindViewHolder:位置模型为空,索引=" + position);
return;
}
final String posId = posModel.getPositionId();
MainService mainService = mMainServiceRef.get();
if (holder instanceof SimpleViewHolder) {
LogUtils.d(TAG, "绑定 SimpleViewHolderposId=" + posId);
SimpleViewHolder simpleHolder = (SimpleViewHolder) holder;
bindSimplePositionData(simpleHolder, posModel);
initAndBindSimpleTaskView(simpleHolder.ptlvSimpleTasks, posId, mainService);
mSimpleTaskViewMap.put(posId, simpleHolder.ptlvSimpleTasks);
mPosDistanceViewMap.put(posId, simpleHolder.tvSimpleDistance);
} else if (holder instanceof EditViewHolder) {
LogUtils.d(TAG, "绑定 EditViewHolderposId=" + posId);
EditViewHolder editHolder = (EditViewHolder) holder;
bindEditPositionData(editHolder, posModel, position);
initAndBindEditTaskView(editHolder.ptlvEditTasks, posId, mainService, editHolder.btnAddTask);
mEditTaskViewMap.put(posId, editHolder.ptlvEditTasks);
mPosDistanceViewMap.put(posId, editHolder.tvEditDistance);
}
}
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
super.onViewDetachedFromWindow(holder);
PositionModel posModel = getPositionByIndex(holder.getAdapterPosition());
if (posModel == null || TextUtils.isEmpty(posModel.getPositionId())) {
return;
}
String posId = posModel.getPositionId();
if (mPosDistanceViewMap.containsKey(posId)) {
TextView distanceView = mPosDistanceViewMap.get(posId);
if (distanceView == null || !distanceView.isAttachedToWindow()) {
mPosDistanceViewMap.remove(posId);
LogUtils.d(TAG, "视图脱离:移除无效距离控件缓存 posId=" + posId);
}
}
if (holder instanceof SimpleViewHolder && mSimpleTaskViewMap.containsKey(posId)) {
PositionTaskListView taskView = mSimpleTaskViewMap.get(posId);
if (taskView == null || !taskView.isAttachedToWindow()) {
mSimpleTaskViewMap.remove(posId);
LogUtils.d(TAG, "视图脱离:移除无效简单任务视图缓存 posId=" + posId);
}
}
if (holder instanceof EditViewHolder && mEditTaskViewMap.containsKey(posId)) {
PositionTaskListView taskView = mEditTaskViewMap.get(posId);
if (taskView == null || !taskView.isAttachedToWindow()) {
mEditTaskViewMap.remove(posId);
LogUtils.d(TAG, "视图脱离:移除无效编辑任务视图缓存 posId=" + posId);
}
}
}
@Override
public int getItemCount() {
return mCachedPositionList.size();
}
// =========================================================================
// 位置数据绑定
// =========================================================================
private void bindSimplePositionData(SimpleViewHolder holder, final PositionModel posModel) {
LogUtils.d(TAG, "bindSimplePositionData posId=" + posModel.getPositionId());
holder.tvSimpleLon.setText(String.format("经度:%.6f", posModel.getLongitude()));
holder.tvSimpleLat.setText(String.format("纬度:%.6f", posModel.getLatitude()));
String memo = posModel.getMemo();
holder.tvSimpleMemo.setText("备注:" + (TextUtils.isEmpty(memo) ? DEFAULT_MEMO : memo));
updateDistanceDisplay(holder.tvSimpleDistance, posModel);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
posModel.setIsSimpleView(false);
notifyItemChanged(getPositionIndexById(posModel.getPositionId()));
LogUtils.d(TAG, "简单视图点击:切换编辑模式 posId=" + posModel.getPositionId());
}
});
}
private void bindEditPositionData(final EditViewHolder holder, final PositionModel posModel, final int position) {
LogUtils.d(TAG, "bindEditPositionData posId=" + posModel.getPositionId() + " position=" + position);
final String posId = posModel.getPositionId();
holder.tvEditLon.setText(String.format("经度:%.6f", posModel.getLongitude()));
holder.tvEditLat.setText(String.format("纬度:%.6f", posModel.getLatitude()));
String memo = posModel.getMemo();
if (!TextUtils.isEmpty(memo)) {
holder.etEditMemo.setText(memo);
holder.etEditMemo.setSelection(memo.length());
} else {
holder.etEditMemo.setText("");
}
updateDistanceDisplay(holder.tvEditDistance, posModel);
holder.rgDistanceSwitch.check(posModel.isEnableRealPositionDistance()
? R.id.rb_distance_enable
: R.id.rb_distance_disable);
holder.btnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
posModel.setIsSimpleView(true);
notifyItemChanged(position);
hideSoftKeyboard(v);
LogUtils.d(TAG, "取消编辑:切换简单视图 posId=" + posId);
}
});
holder.btnDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnDeleteListener != null) {
mOnDeleteListener.onDeleteClick(position);
}
hideSoftKeyboard(v);
LogUtils.d(TAG, "触发删除位置 posId=" + posId);
}
});
holder.btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String newMemo = holder.etEditMemo.getText().toString().trim();
boolean isDistanceEnable = (holder.rgDistanceSwitch.getCheckedRadioButtonId() == R.id.rb_distance_enable);
PositionModel updatedPos = new PositionModel();
updatedPos.setPositionId(posId);
updatedPos.setLongitude(posModel.getLongitude());
updatedPos.setLatitude(posModel.getLatitude());
updatedPos.setMemo(newMemo);
updatedPos.setIsEnableRealPositionDistance(isDistanceEnable);
updatedPos.setIsSimpleView(true);
if (mOnSavePosListener != null) {
mOnSavePosListener.onSavePositionClick(position, updatedPos);
}
posModel.setMemo(newMemo);
posModel.setIsEnableRealPositionDistance(isDistanceEnable);
posModel.setIsSimpleView(true);
notifyItemChanged(position);
hideSoftKeyboard(v);
LogUtils.d(TAG, "保存位置 posId=" + posId + " 新备注=" + newMemo + " 距离启用=" + isDistanceEnable);
}
});
}
// =========================================================================
// PositionTaskListView 集成
// =========================================================================
private void initAndBindSimpleTaskView(PositionTaskListView taskView, String posId, MainService mainService) {
LogUtils.d(TAG, "initAndBindSimpleTaskView posId=" + posId);
if (taskView == null || TextUtils.isEmpty(posId) || mainService == null) {
LogUtils.w(TAG, "初始化简单任务视图失败:参数无效");
return;
}
taskView.init(mainService, posId);
taskView.setViewStatus(PositionTaskListView.VIEW_MODE_SIMPLE);
taskView.syncTasksFromMainService();
taskView.setOnTaskUpdatedListener(new PositionTaskListView.OnTaskUpdatedListener() {
@Override
public void onTaskUpdated(String positionId, ArrayList updatedTasks) {
LogUtils.d(TAG, "简单模式任务更新 posId=" + positionId + " 任务数=" + updatedTasks.size());
}
});
}
private void initAndBindEditTaskView(final PositionTaskListView taskView, final String posId,
MainService mainService, Button btnAddTask) {
LogUtils.d(TAG, "initAndBindEditTaskView posId=" + posId);
if (taskView == null || TextUtils.isEmpty(posId) || mainService == null || btnAddTask == null) {
LogUtils.w(TAG, "初始化编辑任务视图失败:参数无效");
return;
}
taskView.init(mainService, posId);
taskView.setViewStatus(PositionTaskListView.VIEW_MODE_EDIT);
taskView.syncTasksFromMainService();
btnAddTask.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PositionTaskModel newTask = new PositionTaskModel();
newTask.setTaskId(PositionTaskModel.genTaskId());
newTask.setPositionId(posId);
newTask.setTaskDescription(DEFAULT_TASK_DESC);
newTask.setDiscussDistance(DEFAULT_TASK_DISTANCE);
newTask.setIsEnable(true);
newTask.setIsBingo(false);
taskView.addNewTask(newTask);
hideSoftKeyboard(v);
LogUtils.d(TAG, "新增任务 posId=" + posId + " taskId=" + newTask.getTaskId());
}
});
taskView.setOnTaskUpdatedListener(new PositionTaskListView.OnTaskUpdatedListener() {
@Override
public void onTaskUpdated(String positionId, ArrayList updatedTasks) {
LogUtils.d(TAG, "编辑模式任务更新 posId=" + positionId + " 任务数=" + updatedTasks.size());
}
});
}
// =========================================================================
// 工具方法
// =========================================================================
private void updateDistanceDisplay(TextView distanceView, PositionModel posModel) {
if (distanceView == null || posModel == null) {
LogUtils.w(TAG, "updateDistanceDisplay:参数为空");
return;
}
if (!posModel.isEnableRealPositionDistance()) {
distanceView.setText(DISTANCE_DISABLED);
distanceView.setTextColor(mContext.getResources().getColor(R.color.gray));
return;
}
double distance = posModel.getRealPositionDistance();
if (distance < 0) {
distanceView.setText(DISTANCE_ERROR);
distanceView.setTextColor(mContext.getResources().getColor(R.color.red));
return;
}
distanceView.setText(String.format(DISTANCE_FORMAT, distance));
if (distance <= 100) {
distanceView.setTextColor(mContext.getResources().getColor(R.color.green));
} else if (distance <= 500) {
distanceView.setTextColor(mContext.getResources().getColor(R.color.yellow));
} else {
distanceView.setTextColor(mContext.getResources().getColor(R.color.red));
}
}
private PositionModel getPositionByIndex(int index) {
if (mCachedPositionList == null || index < 0 || index >= mCachedPositionList.size()) {
LogUtils.w(TAG, "getPositionByIndex:无效索引 index=" + index);
return null;
}
return mCachedPositionList.get(index);
}
private int getPositionIndexById(String positionId) {
if (TextUtils.isEmpty(positionId) || mCachedPositionList == null || mCachedPositionList.isEmpty()) {
LogUtils.w(TAG, "getPositionIndexById:参数无效");
return -1;
}
for (int i = 0; i < mCachedPositionList.size(); i++) {
PositionModel pos = mCachedPositionList.get(i);
if (positionId.equals(pos.getPositionId())) {
return i;
}
}
LogUtils.w(TAG, "未找到位置ID=" + positionId);
return -1;
}
public void updateSinglePositionDistance(String positionId) {
LogUtils.d(TAG, "updateSinglePositionDistance posId=" + positionId);
if (TextUtils.isEmpty(positionId) || mPosDistanceViewMap.isEmpty()) {
return;
}
MainService mainService = getMainServiceWithRetry(2);
if (mainService == null) {
LogUtils.e(TAG, "无法获取 MainService");
return;
}
PositionModel latestPos = null;
try {
ArrayList servicePosList = mainService.getPositionList();
if (servicePosList != null && !servicePosList.isEmpty()) {
Iterator iter = servicePosList.iterator();
while (iter.hasNext()) {
PositionModel pos = (PositionModel) iter.next();
if (positionId.equals(pos.getPositionId())) {
latestPos = pos;
break;
}
}
}
} catch (Exception e) {
LogUtils.e(TAG, "获取位置数据异常", e);
return;
}
if (latestPos == null) {
LogUtils.w(TAG, "未找到位置 posId=" + positionId);
return;
}
final TextView distanceView = mPosDistanceViewMap.get(positionId);
if (distanceView != null && distanceView.isAttachedToWindow()) {
final PositionModel finalLatestPos = latestPos;
distanceView.post(new Runnable() {
@Override
public void run() {
updateDistanceDisplay(distanceView, finalLatestPos);
}
});
} else {
mPosDistanceViewMap.remove(positionId);
}
}
public void updateAllPositionData(ArrayList<PositionModel> newPosList) {
LogUtils.d(TAG, "updateAllPositionData 新数据数量=" + (newPosList != null ? newPosList.size() : 0));
if (newPosList == null) {
return;
}
ArrayList<PositionModel> validPosList = new ArrayList<PositionModel>();
for (PositionModel pos : newPosList) {
if (TextUtils.isEmpty(pos.getPositionId())
|| pos.getLongitude() < -180 || pos.getLongitude() > 180
|| pos.getLatitude() < -90 || pos.getLatitude() > 90) {
continue;
}
validPosList.add(pos);
}
ConcurrentHashMap<String, PositionModel> uniquePosMap = new ConcurrentHashMap<String, PositionModel>();
for (PositionModel pos : validPosList) {
uniquePosMap.put(pos.getPositionId(), pos);
}
ArrayList uniquePosList = new ArrayList(uniquePosMap.values());
mCachedPositionList.clear();
mCachedPositionList.addAll(uniquePosList);
mPosDistanceViewMap.clear();
mSimpleTaskViewMap.clear();
mEditTaskViewMap.clear();
notifyDataSetChanged();
LogUtils.d(TAG, "全量更新完成,有效数量=" + uniquePosList.size());
}
private void hideSoftKeyboard(View view) {
if (mContext == null || view == null) {
return;
}
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
private MainService getMainServiceWithRetry(int retryCount) {
MainService mainService = mMainServiceRef.get();
if (mainService != null) {
return mainService;
}
for (int i = 0; i < retryCount; i++) {
try {
Thread.sleep(100);
mainService = mMainServiceRef.get();
if (mainService != null) {
LogUtils.d(TAG, "重试获取 MainService 成功,第" + (i + 1) + "");
return mainService;
}
} catch (InterruptedException e) {
LogUtils.e(TAG, "重试被中断", e);
Thread.currentThread().interrupt();
break;
}
}
LogUtils.e(TAG, "重试" + retryCount + "次仍未获取到 MainService");
return null;
}
// =========================================================================
// 任务更新监听
// =========================================================================
@Override
public void onTaskUpdated() {
LogUtils.d(TAG, "onTaskUpdated:收到服务任务更新");
if (!mSimpleTaskViewMap.isEmpty()) {
Iterator<ConcurrentHashMap.Entry<String, PositionTaskListView>> iter = mSimpleTaskViewMap.entrySet().iterator();
while (iter.hasNext()) {
ConcurrentHashMap.Entry<String, PositionTaskListView> entry = iter.next();
PositionTaskListView taskView = entry.getValue();
if (taskView != null && taskView.isAttachedToWindow()) {
taskView.syncTasksFromMainService();
} else {
iter.remove();
}
}
}
if (!mEditTaskViewMap.isEmpty()) {
Iterator<ConcurrentHashMap.Entry<String, PositionTaskListView>> iter = mEditTaskViewMap.entrySet().iterator();
while (iter.hasNext()) {
ConcurrentHashMap.Entry<String, PositionTaskListView> entry = iter.next();
PositionTaskListView taskView = entry.getValue();
if (taskView != null && taskView.isAttachedToWindow()) {
taskView.syncTasksFromMainService();
} else {
iter.remove();
}
}
}
}
// =========================================================================
// 外部回调设置
// =========================================================================
public void setOnDeleteClickListener(OnDeleteClickListener listener) {
LogUtils.d(TAG, "setOnDeleteClickListener listener=" + listener);
this.mOnDeleteListener = listener;
}
public void setOnSavePositionClickListener(OnSavePositionClickListener listener) {
LogUtils.d(TAG, "setOnSavePositionClickListener listener=" + listener);
this.mOnSavePosListener = listener;
}
// =========================================================================
// 资源释放
// =========================================================================
public void release() {
LogUtils.d(TAG, "release:开始释放 Adapter 资源");
MainService mainService = mMainServiceRef.get();
if (mainService != null) {
mainService.unregisterTaskUpdateListener(this);
LogUtils.d(TAG, "已反注册任务监听");
}
if (!mSimpleTaskViewMap.isEmpty()) {
Iterator<ConcurrentHashMap.Entry<String, PositionTaskListView>> iter = mSimpleTaskViewMap.entrySet().iterator();
while (iter.hasNext()) {
PositionTaskListView taskView = iter.next().getValue();
if (taskView != null) {
taskView.clearData();
taskView.setOnTaskUpdatedListener(null);
}
iter.remove();
}
}
if (!mEditTaskViewMap.isEmpty()) {
Iterator<ConcurrentHashMap.Entry<String, PositionTaskListView>> iter = mEditTaskViewMap.entrySet().iterator();
while (iter.hasNext()) {
PositionTaskListView taskView = iter.next().getValue();
if (taskView != null) {
taskView.clearData();
taskView.setOnTaskUpdatedListener(null);
}
iter.remove();
}
}
mPosDistanceViewMap.clear();
if (mCachedPositionList != null) {
mCachedPositionList.clear();
}
mOnDeleteListener = null;
mOnSavePosListener = null;
LogUtils.d(TAG, "release:资源释放完成");
}
// =========================================================================
// ViewHolder
// =========================================================================
public static class SimpleViewHolder extends RecyclerView.ViewHolder {
TextView tvSimpleLon;
TextView tvSimpleLat;
TextView tvSimpleMemo;
TextView tvSimpleDistance;
PositionTaskListView ptlvSimpleTasks;
public SimpleViewHolder(View itemView) {
super(itemView);
tvSimpleLon = (TextView) itemView.findViewById(R.id.tv_simple_longitude);
tvSimpleLat = (TextView) itemView.findViewById(R.id.tv_simple_latitude);
tvSimpleMemo = (TextView) itemView.findViewById(R.id.tv_simple_memo);
tvSimpleDistance = (TextView) itemView.findViewById(R.id.tv_simple_distance);
ptlvSimpleTasks = (PositionTaskListView) itemView.findViewById(R.id.ptlv_simple_tasks);
}
}
public static class EditViewHolder extends RecyclerView.ViewHolder {
TextView tvEditLon;
TextView tvEditLat;
EditText etEditMemo;
TextView tvEditDistance;
RadioGroup rgDistanceSwitch;
Button btnCancel;
Button btnDelete;
Button btnSave;
Button btnAddTask;
TextView tvTaskCount;
PositionTaskListView ptlvEditTasks;
public EditViewHolder(View itemView) {
super(itemView);
tvEditLon = (TextView) itemView.findViewById(R.id.tv_edit_longitude);
tvEditLat = (TextView) itemView.findViewById(R.id.tv_edit_latitude);
etEditMemo = (EditText) itemView.findViewById(R.id.et_edit_memo);
tvEditDistance = (TextView) itemView.findViewById(R.id.tv_edit_distance);
rgDistanceSwitch = (RadioGroup) itemView.findViewById(R.id.rg_distance_switch);
btnCancel = (Button) itemView.findViewById(R.id.btn_edit_cancel);
btnDelete = (Button) itemView.findViewById(R.id.btn_edit_delete);
btnSave = (Button) itemView.findViewById(R.id.btn_edit_save);
btnAddTask = (Button) itemView.findViewById(R.id.btn_add_task);
tvTaskCount = (TextView) itemView.findViewById(R.id.tv_task_count);
ptlvEditTasks = (PositionTaskListView) itemView.findViewById(R.id.ptlv_edit_tasks);
}
}
// =========================================================================
// 方法说明类(保留不动)
// =========================================================================
public static class PositionTaskListViewRequiredMethods {
}
}
@@ -0,0 +1,143 @@
package cc.winboll.studio.positions.handlers;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.positions.App;
import cc.winboll.studio.positions.MainActivity;
/**
* 应用空转事务处理器
* 作用:接收空转开关消息、空转日志消息,回调MainActivity内部接口实现UI联动
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @CreateTime 2026/05/03 12:23:00
* @EditTime 2026/05/03 14:42:18
*/
public class AppIdleRunningModeHandler extends Handler {
//===================== 常量标识 =====================
public static final String TAG = "AppIdleRunningModeHandler";
public static final int MSG_IDLE_MODE_SWITCH = 1001;
public static final int MSG_IDLE_LOG_PRINT = 1002;
//===================== 成员变量 =====================
private static AppIdleRunningModeHandler mHandler;
private MainActivity mMainActivity;
//===================== 静态初始化 =====================
static {
mHandler = new AppIdleRunningModeHandler();
LogUtils.d(TAG, "静态代码块:默认主线程Looper完成初始化");
}
//===================== 构造方法 =====================
/**
* 私有无参构造,禁止外部直接实例化
*/
private AppIdleRunningModeHandler() {
super(Looper.getMainLooper());
}
/**
* 带MainActivity绑定构造
* @param activity 主页面实例
*/
public AppIdleRunningModeHandler(MainActivity activity) {
super(Looper.getMainLooper());
this.mMainActivity = activity;
LogUtils.d(TAG, "构造方法:完成MainActivity绑定初始化");
}
//===================== 对外初始化与获取 =====================
/**
* 全局静态初始化、重新绑定MainActivity
* @param activity 主页面实例
*/
public static void init(MainActivity activity) {
if (mHandler == null) {
mHandler = new AppIdleRunningModeHandler(activity);
} else {
mHandler.mMainActivity = activity;
}
LogUtils.i(TAG, "init -> AppIdleRunningModeHandler初始化绑定成功");
}
/**
* 获取当前绑定的MainActivity实例
* @return 已绑定的Activity
*/
public MainActivity getBindMainActivity() {
return mMainActivity;
}
//===================== 对外静态发送方法 =====================
/**
* 发送空转开关控制消息
* @param isOpen 是否开启空转状态
*/
public static void sendIdleSwitch(boolean isOpen) {
if (!App.isAppIdleRunning()) {
LogUtils.d(TAG, "sendIdleSwitch -> 当前非空转状态,函数执行无效");
return;
}
LogUtils.d(TAG, "sendIdleSwitch -> 发送空转开关信号,参数isOpen = " + isOpen);
Message message = Message.obtain();
message.what = MSG_IDLE_MODE_SWITCH;
message.obj = isOpen;
mHandler.sendMessage(message);
}
/**
* 发送空转日志打印消息
* @param logText 待输出的日志内容
*/
public static void sendIdleLog(String logText) {
if (!App.isAppIdleRunning()) {
LogUtils.d(TAG, "sendIdleLog -> 当前非空转状态,函数执行无效");
return;
}
LogUtils.d(TAG, "sendIdleLog -> 发送空转日志消息");
Message message = Message.obtain();
message.what = MSG_IDLE_LOG_PRINT;
message.obj = logText;
mHandler.sendMessage(message);
}
//===================== 消息接收处理 =====================
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
// 全局状态校验
if (!App.isAppIdleRunning()) {
return;
}
// 空指针安全防护
if (mMainActivity == null || mMainActivity.getOnAppIdleRunningListener() == null) {
LogUtils.d(TAG, "handleMessage -> Activity或监听接口为空,终止回调");
return;
}
switch (msg.what) {
case MSG_IDLE_MODE_SWITCH:
boolean idleState = (boolean) msg.obj;
App.setAppIdleRunning(idleState);
LogUtils.i(TAG, "handleMessage -> 空转状态已变更:" + idleState);
// 回调主页面接口
mMainActivity.getOnAppIdleRunningListener().onIdleStatusChange(idleState);
break;
case MSG_IDLE_LOG_PRINT:
String logContent = (String) msg.obj;
LogUtils.i(TAG, logContent);
// 回调主页面日志接收接口
mMainActivity.getOnAppIdleRunningListener().onIdleLogReceive(logContent);
break;
}
}
}

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