commit 2a74fd2c304b571ab5ae349ffc3b7f06c5b4daf7 Author: ZhanGSKen Date: Fri Dec 5 18:19:49 2025 +0800 clone https://gitea.winboll.cc/Studio/WinBoLL_Bck20251205_175044_440.git and fix build.gradle file maven key settings. diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..b25cbb5 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,87 @@ +name: Android CI + +# 触发器 +on: + push: + tags: + - *-beta + pull_request: + tags: + - *-beta + +jobs: + build: + + runs-on: ubuntu-latest + + # 设置 JDK 环境 + steps: + - uses: actions/checkout@v3 + - name: set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + # 获取应用打包秘钥库 + - name: Checkout Android Keystore + uses: actions/checkout@v3 + with: + repository: zhangsken/keystore # 存储应用打包用的 keystore 的仓库(格式:用户名/仓库名) + token: ${{ secrets.APP_SECRET_TOKEN_1 }} # 连接仓库的 token , 需要单独配置 + path: keystore # 仓库的根目录名 + + # 打包 Stage Release 版本应用 + - name: Build with Gradle + run: bash ./gradlew assembleBetaRelease + # 创建release + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.APP_SECRET_TOKEN_1 }} + # GitHub 会自动创建 GITHUB_TOKEN 密码以在工作流程中使用。 + # 您可以使用 GITHUB_TOKEN 在工作流程运行中进行身份验证。 + # 当您启用 GitHub Actions 时,GitHub 在您的仓库中安装 GitHub 应用程序。 + # GITHUB_TOKEN 密码是一种 GitHub 应用程序 安装访问令牌。 + # 您可以使用安装访问令牌代表仓库中安装的 GitHub 应用程序 进行身份验证。 + # 令牌的权限仅限于包含您的工作流程的仓库。 更多信息请参阅“GITHUB_TOKEN 的权限”。 + # 在每个作业开始之前, GitHub 将为作业提取安装访问令牌。 令牌在作业完成后过期。 + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + # 获取 APK 版本号 + - name: Get Version Name + uses: actions/github-script@v3 + id: get-version + with: + script: | + const str=process.env.GITHUB_REF; + return str.substring(str.indexOf("v")); + result-encoding: string + # 上传至 Release 的资源 + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.APP_SECRET_TOKEN_1 }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # 上传网址,无需改动 + #asset_path: app/build/outputs/apk/release/app-release.apk # 上传路径(Release) + asset_path: app/build/outputs/apk/beta/release/app-beta-release.apk # 上传路径(WinBoll Stage Release) + asset_name: WinBoll-${{steps.get-version.outputs.result}}0.apk # 资源名 + asset_content_type: application/vnd.android.package-archiv # 资源类型 + + # 存档打包的文件 + - name: Archive production artifacts + uses: actions/upload-artifact@v2 + with: + name: build + path: app/build/outputs # 将打包之后的文件全部上传(里面会有混淆的 map 文件) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..110c6f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,101 @@ +# Built application files +*.apk +*.aar +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +# Uncomment the following line in case you need and you don't have the release build type files in your app +# release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +*.jks +*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild +.cxx/ + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +# Android Profiling +*.hprof + +# 忽略 Lint 输出文件 +lint-results.xml +lint-results.html + +## 忽略 AndroidIDE 临时文件夹 +.androidide + +## 忽略模块应用编译配置 +/settings.gradle +/gradle.properties +/winboll.properties +/local.properties diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c97416e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libjc/jcc/libs"] + path = libjc/jcc/libs + url = https://gitea.winboll.cc/Studio/APP_libjc_jcc_libs.git diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..3553804 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +appbase \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..ed59606 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0ad17cb --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.winboll/Readme.txt b/.winboll/Readme.txt new file mode 100644 index 0000000..f618520 --- /dev/null +++ b/.winboll/Readme.txt @@ -0,0 +1,18 @@ +## WinBoLL 主机编译事项提醒 + +## 类库类型源码发布 +# 类库发布使用以下面命令 +git pull && bash .winboll/bashPublishLIBAddTag.sh <类库模块文件夹名称> + +## 纯应用类型源码发布 +# 应用发布使用以下命令 +git pull && bash .winboll/bashPublishAPKAddTag.sh <应用模块文件夹名称> + +## 编译时提问。Add Github Workflows Tag? (yes/No) +回答yes: 将会添加一个 GitHub 工作流标签 + GitHub 仓库会执行以该标签为标志的编译工作流。 +回答No(默认): 就忽略 GitHub 标签,忽略 GitHub 工作流调用。 + +## Github Workflows 工作流设置注意事项 +应用名称改变时需要修改.github/workflows/android.yml文件设置, +在第79行:asset_name: 处有应用包名称设置。 diff --git a/.winboll/bashCheckGitCommitStatus.sh b/.winboll/bashCheckGitCommitStatus.sh new file mode 100644 index 0000000..1adb83c --- /dev/null +++ b/.winboll/bashCheckGitCommitStatus.sh @@ -0,0 +1,32 @@ +#!/usr/bin/bash + +# 使用 `-z` 命令检查变量是否为空 +if [ -z "$1" ] || [ -z "$2" ]; then + echo "Script parameter error: $0" + exit 2 +fi + +# 进入项目根目录 +cd ${1} +echo -e "Work dir : \n"`pwd` + +git config --global --add safe.directory "${1}" +echo "Current dir : "`pwd` +versionName=${2} + +## 设置要检查的标签 +tag="v"${versionName} + +## 如果Git已经提交了所有代码就执行标签检查操作 +if [[ -n $(git diff --stat) ]] +then + echo 'Source is no commit git completely, tag action cancel.' + exit 1 +else + echo "Git status is clean." + if [ "$(git tag -l ${tag})" == "${tag}" ]; then + echo "Tag ${tag} exist." + exit 2 + fi + echo "${0}: Git tag is checked OK: (${tag})" +fi diff --git a/.winboll/bashCommitAppPublishBuildFlagInfo.sh b/.winboll/bashCommitAppPublishBuildFlagInfo.sh new file mode 100644 index 0000000..791e58c --- /dev/null +++ b/.winboll/bashCommitAppPublishBuildFlagInfo.sh @@ -0,0 +1,17 @@ +#!/usr/bin/bash +## 提交新的 APK 编译配置标志信息,并推送到Git仓库。 + +# 使用 `-z` 命令检查变量是否为空 +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then + echo "$0 Script parameter error." + echo "(Script Demo : [ bashCommitAppPublishBuildFlagInfo.sh ])" + exit 2 +fi + +# 进入项目根目录 +cd ${1} +echo -e "Work dir : \n"`pwd` + +git add . +git commit -m "<$4>APK ${2} ${3} Publish." +git push origin && git push origin --tags diff --git a/.winboll/bashCommitLibReleaseBuildFlagInfo.sh b/.winboll/bashCommitLibReleaseBuildFlagInfo.sh new file mode 100644 index 0000000..d92f320 --- /dev/null +++ b/.winboll/bashCommitLibReleaseBuildFlagInfo.sh @@ -0,0 +1,48 @@ +#!/usr/bin/bash +## 提交新的 Library 编译配置标志信息,并推送到Git仓库。 + +# 检查是否指定了将要发布的类库名称 +# 使用 `-z` 命令检查变量是否为空 +if [ -z "$1" ]; then + echo "Library name error: $0" + exit 2 +fi + +## 开始执行脚本 +echo -e "Current dir : \n"`pwd` +# 检查当前目录是否是项目根目录 +if [[ -e $1/build.properties ]]; then + echo "The $1/build.properties file exists." + echo -e "Work dir correctly." +else + echo "The $1/build.properties file does not exist." + echo "尝试进入根目录" + # 进入项目根目录 + cd .. +fi +## 本脚本需要在项目根目录下执行 +echo -e "Current dir : \n"`pwd` +# 检查当前目录是否是项目根目录 +if [[ -e $1/build.properties ]]; then + echo "The $1/build.properties file exists." + echo -e "Work dir correctly." +else + echo "The $1/build.properties file does not exist." + echo -e "Work dir error." + exit 1 +fi + +# 就读取脚本 .winboll/winboll_app_build.gradle 生成的 publishVersion。 +# 如果文件中有 publishVersion 这一项, +# 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值 +PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}') +echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >" +## 设新的 WinBoLL 标签 +# 脚本调试时使用 +#tag="v7.6.4-test1" +# 正式设置标签时使用 +#tag="v"${PUBLISH_VERSION} + +git add . +git commit -m "<$1>Library Release ${PUBLISH_VERSION}" +git push origin && git push origin --tags diff --git a/.winboll/bashPublishAPKAddTag.sh b/.winboll/bashPublishAPKAddTag.sh new file mode 100644 index 0000000..d210d28 --- /dev/null +++ b/.winboll/bashPublishAPKAddTag.sh @@ -0,0 +1,166 @@ +#!/usr/bin/bash + +# 检查是否指定了将要发布的应用名称 +# 使用 `-z` 命令检查变量是否为空 +if [ -z "$1" ]; then + echo "No APP name specified : $0" + exit 2 +fi + +## 定义相关函数 +## 检查 Git 源码是否完全提交了,完全提交就返回0 +function checkGitSources { + #local input="$1" + #echo "The string is: $input" + git config --global --add safe.directory `pwd` + if [[ -n $(git diff --stat) ]] + then + local result="Source is no commit completely." + echo $result + # 脚本调试时使用 + #return 0 + # 正式检查源码时使用 + return 1 + fi + local result="Git Source Check OK." + echo $result + return 0 +} + +function askAddWorkflowsTag { + read answer + if [[ $answer =~ ^[Yy]$ ]]; then + #echo "You chose yes." + return 1 + else + #echo "You chose no." + return 0 + fi +} + +function addWinBoLLTag { + # 就读取脚本 .winboll/winboll_app_build.gradle 生成的 publishVersion。 + # 如果文件中有 publishVersion 这一项, + # 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值 + PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}') + echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >" + ## 设新的 WinBoLL 标签 + # 脚本调试时使用 + #tag="projectname-v7.6.4-test1" + # 正式设置标签时使用 + tag=$1"-v"${PUBLISH_VERSION} + echo "< WinBoLL Tag To: $tag >"; + # 检查是否已经添加了 WinBoLL Tag + if [ "$(git tag -l ${tag})" == "${tag}" ]; then + echo -e "< WinBoLL Tag ${tag} exist! >" + return 1 # WinBoLL标签重复 + fi + # 添加WinBoLL标签 + git tag -a ${tag} -F $1/app_update_description.txt + return 0 +} + +function addWorkflowsTag { + # 就读取脚本 .winboll/winboll_app_build.gradle 生成的 baseBetaVersion。 + # 如果文件中有 baseBetaVersion 这一项, + # 使用grep找到包含"baseBetaVersion="的那一行,然后用awk提取其后的值 + BASE_BETA_VERSION=$(grep -o "baseBetaVersion=.*" $1/build.properties | awk -F '=' '{print $2}') + echo "< $1/build.properties baseBetaVersion : ${BASE_BETA_VERSION} >" + ## 设新的 workflows 标签 + # 脚本调试时使用 + #tag="projectname-v7.6.4-beta" + # 正式设置标签时使用 + tag=$1"-v"${BASE_BETA_VERSION}-beta + echo "< Workflows Tag To: $tag >"; + # 检查是否已经添加了工作流 Tag + if [ "$(git tag -l ${tag})" == "${tag}" ]; then + echo -e "< Github Workflows Tag ${tag} exist! >" + return 1 # 工作流标签重复 + fi + # 添加工作流标签 + git tag -a ${tag} -F $1/app_update_description.txt + return 0 +} + +## 开始执行脚本 +echo -e "Current dir : \n"`pwd` +# 检查当前目录是否是项目根目录 +if [[ -e $1/build.properties ]]; then + echo "The $1/build.properties file exists." + echo -e "Work dir correctly." +else + echo "The $1/build.properties file does not exist." + echo "尝试进入根目录" + # 进入项目根目录 + cd .. +fi +## 本脚本需要在项目根目录下执行 +echo -e "Current dir : \n"`pwd` +# 检查当前目录是否是项目根目录 +if [[ -e $1/build.properties ]]; then + echo "The $1/build.properties file exists." + echo -e "Work dir correctly." +else + echo "The $1/build.properties file does not exist." + echo -e "Work dir error." + exit 1 +fi + +# 检查源码状态 +result=$(checkGitSources) +if [[ $? -eq 0 ]]; then + echo $result + # 如果Git已经提交了所有代码就执行标签和应用发布操作 + + # 预先询问是否添加工作流标签 + #echo "Add Github Workflows Tag? (yes/No)" + #result=$(askAddWorkflowsTag) + #nAskAddWorkflowsTag=$? + #echo $result + + # 发布应用 + echo "Publishing WinBoLL APK ..." + # 脚本调试时使用 + #bash gradlew :$1:assembleBetaDebug + # 正式发布 + bash gradlew :$1:assembleStageRelease + echo "Publishing WinBoLL APK OK." + + # 添加 WinBoLL 标签 + result=$(addWinBoLLTag $1) + echo $result + if [[ $? -eq 0 ]]; then + echo $result + # WinBoLL 标签添加成功 + else + echo -e "${0}: addWinBoLLTag $1\n${result}\nAdd WinBoLL tag cancel." + exit 1 # addWinBoLLTag 异常 + fi + + # 添加 GitHub 工作流标签 + #if [[ $nAskAddWorkflowsTag -eq 1 ]]; then + # 如果用户选择添加工作流标签 + #result=$(addWorkflowsTag $1) + #if [[ $? -eq 0 ]]; then + # echo $result + # 工作流标签添加成功 + #else + #echo -e "${0}: addWorkflowsTag $1\n${result}\nAdd workflows tag cancel." + #exit 1 # addWorkflowsTag 异常 + #fi + #fi + + ## 清理更新描述文件内容 + echo "" > $1/app_update_description.txt + + # 设置新版本开发参数配置 + # 提交配置 + git add . + git commit -m "<$1>Start New Stage Version." + echo "Push sources to git repositories ..." + # 推送源码到所有仓库 + git push origin && git push origin --tags +else + echo -e "${0}: checkGitSources\n${result}\nShell cancel." + exit 1 # checkGitSources 异常 +fi diff --git a/.winboll/bashPublishDebugAPKAddTag.sh b/.winboll/bashPublishDebugAPKAddTag.sh new file mode 100644 index 0000000..0deb526 --- /dev/null +++ b/.winboll/bashPublishDebugAPKAddTag.sh @@ -0,0 +1,166 @@ +#!/usr/bin/bash + +# 检查是否指定了将要发布的调试版应用名称 +# 使用 `-z` 命令检查变量是否为空 +if [ -z "$1" ]; then + echo "No APP name specified : $0" + exit 2 +fi + +## 定义相关函数 +## 检查 Git 源码是否完全提交了,完全提交就返回0 +function checkGitSources { + #local input="$1" + #echo "The string is: $input" + git config --global --add safe.directory `pwd` + if [[ -n $(git diff --stat) ]] + then + local result="Source is no commit completely." + echo $result + # 脚本调试时使用 + #return 0 + # 正式检查源码时使用 + return 1 + fi + local result="Git Source Check OK." + echo $result + return 0 +} + +function askAddWorkflowsTag { + read answer + if [[ $answer =~ ^[Yy]$ ]]; then + #echo "You chose yes." + return 1 + else + #echo "You chose no." + return 0 + fi +} + +function addWinBoLLTag { + # 就读取脚本 .winboll/winboll_app_build.gradle 生成的 publishVersion。 + # 如果文件中有 publishVersion 这一项, + # 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值 + PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}') + echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >" + ## 设新的 WinBoLL 标签 + # 脚本调试时使用 + #tag="v7.6.4-test1" + # 正式调试版设置标签时使用 + tag=$1"-v"${PUBLISH_VERSION}"-debug" + echo "< WinBoLL Tag To: $tag >"; + # 检查是否已经添加了 WinBoLL Tag + if [ "$(git tag -l ${tag})" == "${tag}" ]; then + echo -e "< WinBoLL Tag ${tag} exist! >" + return 1 # WinBoLL标签重复 + fi + # 添加WinBoLL标签 + git tag -a ${tag} -F $1/app_update_description.txt + return 0 +} + +function addWorkflowsTag { + # 就读取脚本 .winboll/winboll_app_build.gradle 生成的 baseBetaVersion。 + # 如果文件中有 baseBetaVersion 这一项, + # 使用grep找到包含"baseBetaVersion="的那一行,然后用awk提取其后的值 + BASE_BETA_VERSION=$(grep -o "baseBetaVersion=.*" $1/build.properties | awk -F '=' '{print $2}') + echo "< $1/build.properties baseBetaVersion : ${BASE_BETA_VERSION} >" + ## 设新的 workflows 标签 + # 脚本调试时使用 + #tag="v7.6.4-beta" + # 正式设置标签时使用 + tag=$1"-"v"${BASE_BETA_VERSION}-beta-debug + echo "< Workflows Tag To: $tag >"; + # 检查是否已经添加了工作流 Tag + if [ "$(git tag -l ${tag})" == "${tag}" ]; then + echo -e "< Github Workflows Tag ${tag} exist! >" + return 1 # 工作流标签重复 + fi + # 添加工作流标签 + git tag -a ${tag} -F $1/app_update_description.txt + return 0 +} + +## 开始执行脚本 +echo -e "Current dir : \n"`pwd` +# 检查当前目录是否是项目根目录 +if [[ -e $1/build.properties ]]; then + echo "The $1/build.properties file exists." + echo -e "Work dir correctly." +else + echo "The $1/build.properties file does not exist." + echo "尝试进入根目录" + # 进入项目根目录 + cd .. +fi +## 本脚本需要在项目根目录下执行 +echo -e "Current dir : \n"`pwd` +# 检查当前目录是否是项目根目录 +if [[ -e $1/build.properties ]]; then + echo "The $1/build.properties file exists." + echo -e "Work dir correctly." +else + echo "The $1/build.properties file does not exist." + echo -e "Work dir error." + exit 1 +fi + +# 检查源码状态 +result=$(checkGitSources) +if [[ $? -eq 0 ]]; then + echo $result + # 如果Git已经提交了所有代码就执行标签和应用发布操作 + + # 预先询问是否添加工作流标签 + echo "Add Github Workflows Tag? (yes/no)" + result=$(askAddWorkflowsTag) + nAskAddWorkflowsTag=$? + echo $result + + # 发布应用 + echo "Publishing WinBoLL Debug APK ..." + # 脚本调试时使用 + #bash gradlew :$1:assembleBetaDebug + # 正式发布调试版 + bash gradlew :$1:assembleStageDebug + echo "Publishing WinBoLL Debug APK OK." + + # 添加 WinBoLL 标签 + result=$(addWinBoLLTag $1) + echo $result + if [[ $? -eq 0 ]]; then + echo $result + # WinBoLL 标签添加成功 + else + echo -e "${0}: addWinBoLLTag $1\n${result}\nAdd WinBoLL tag cancel." + exit 1 # addWinBoLLTag 异常 + fi + + # 添加 GitHub 工作流标签 + if [[ $nAskAddWorkflowsTag -eq 1 ]]; then + # 如果用户选择添加工作流标签 + result=$(addWorkflowsTag $1) + if [[ $? -eq 0 ]]; then + echo $result + # 工作流标签添加成功 + else + echo -e "${0}: addWorkflowsTag $1\n${result}\nAdd workflows tag cancel." + exit 1 # addWorkflowsTag 异常 + fi + fi + + ## 清理更新描述文件内容 + echo "" > $1/app_update_description.txt + + # 设置新版本开发参数配置 + # 提交配置 + git add . + git commit -m "<$1>Start New Stage Debug Version." + echo "Push sources to git repositories ..." + # 推送源码到所有仓库 + git push origin && git push origin --tags +else + echo -e "${0}: checkGitSources\n${result}\nShell cancel." + exit 1 # checkGitSources 异常 +fi diff --git a/.winboll/bashPublishLIBAddTag.sh b/.winboll/bashPublishLIBAddTag.sh new file mode 100644 index 0000000..7ab6a3a --- /dev/null +++ b/.winboll/bashPublishLIBAddTag.sh @@ -0,0 +1,14 @@ +#!/usr/bin/bash + +# 检查是否指定了将要发布的类库名称 +# 使用 `-z` 命令检查变量是否为空 +if [ -z "$1" ]; then + echo "No Library name specified : $0" + exit 2 +fi + +## 正式发布使用 +git pull && bash gradlew :$1:publishReleasePublicationToWinBoLLReleaseRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1 + +## 调试使用 +#bash gradlew :$1:publishSnapshotWinBoLLPublicationToWinBoLLSnapshotRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1 diff --git a/.winboll/winboll_app_build.gradle b/.winboll/winboll_app_build.gradle new file mode 100644 index 0000000..54b28ba --- /dev/null +++ b/.winboll/winboll_app_build.gradle @@ -0,0 +1,325 @@ +// WinBoLL 应用签名配置 +// + +android { + def winbollProps = new Properties() + def winbollPropsFile = rootProject.file("${winbollFilePath}") + assert(winbollPropsFile.exists()) + winbollProps.load(new FileInputStream(winbollPropsFile)) + + // 读取秘钥配置文件 + // + def keyProps = new Properties() + def keyPropsFile = rootProject.file("${keyPropsFilePath}") + //println 'Test keystore path' + //println 'KeyProsFile :' + Boolean.toString(keyPropsFile.exists()) + //assert(false) + assert(keyPropsFile.exists()) + keyProps.load(new FileInputStream(keyPropsFile)) + + // 配置签名 + signingConfigs { + winboll { + assert(keyProps['keyAlias'] != null && keyProps['keyPassword'] != null && keyProps['storeFile'] != null && keyProps['storePassword'] != null) + keyAlias keyProps['keyAlias'] + keyPassword keyProps['keyPassword'] + storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null + storePassword keyProps['storePassword'] + } + } + buildTypes { + debug { + signingConfig signingConfigs.winboll + } + release { + signingConfig signingConfigs.winboll + minifyEnabled true // 开启混淆(核心开关) + shrinkResources true // 可选:移除无用资源(进一步减小体积) + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), // 官方默认规则(优化版) + 'proguard-rules.pro' // 自定义规则文件 + } + + } + + flavorDimensions "WinBoLLApp" + productFlavors { + beta { + // 检查编译标志位配置 + assert (winbollBuildProps['buildCount'] != null) + dimension "WinBoLLApp" + applicationIdSuffix ".beta" + LocalDateTime localDateTimeNow = LocalDateTime.now(ZoneId.of("Asia/Shanghai")); + versionNameSuffix "-beta" + winbollBuildProps['buildCount'] + "_" + localDateTimeNow.format('mmss') + } + stage { + dimension "WinBoLLApp" + } + } + + // 应用包输出配置 + // + android.applicationVariants.all { variant -> + // + // GitHub 应用包输出配置 + // 1. 配置 Beta Release 版应用包输出 + // 注意 :GitHub 打包使用 android.yml 的 "bash ./gradlew assembleBetaRelease" 命令 + // + if(variant.flavorName == "beta" && variant.buildType.name == "release") { + /* 后期管理预留代码 */ + /* 暂时没有需要的 GitHub 应用包输出配置 */ + /* GitHub 部分代码忽略 */ + } + + // + // WinBoLL 应用包输出配置 + // 1. 配置 Stage Release 版应用包输出 + // 2. 配置 Beta Debug 版应用包输出 + // + if((variant.flavorName == "beta" && variant.buildType.name == "debug") + || (variant.flavorName == "beta" && variant.buildType.name == "release") + || (variant.flavorName == "stage" && variant.buildType.name == "debug") + || (variant.flavorName == "stage" && variant.buildType.name == "release")) { + println "Project root directory: " + project.rootDir.toString() + println "Project root directory name : " + project.rootDir.name + def outputPath="${project.projectDir.absolutePath}/build/outputs/apk/${variant.buildType.name}" + //def outputFileName="${rootProject.name}_${versionName}.apk" + def outputFileName=project.rootDir.name + "_${versionName}.apk" + + // 创建 WinBoLL Studio 发布接口文件夹 + File fWinBoLLStudioDir = file("/sdcard/WinBoLLStudio/APKs"); + if(!fWinBoLLStudioDir.exists()) { + //fWinBoLLStudioDir.mkdirs(); + // 如果没有发布接口文件就不用进行APK发布和源码管理操作 + // 当前编译环境不是 WinBoLL 主机, 以下将忽略APK发布和源码管理操作。 + println 'The current compilation environment is not in WinBoLL host, and the following APK publishing and source management operations will be ignore.' + } else { + /// WINBOLL 主机的 APK 发布和源码管理操作 /// + variant.getAssembleProvider().get().doFirst { + /* 后期管理预留代码 */ + } //doFirst { + + // 编译输出后处理文件部分 + // + variant.getAssembleProvider().get().doLast { + variant.outputs.forEach{ file-> + // 如果正在调试,就拷贝到 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()) { + outBuildBckDir.mkdirs(); + println "Output Folder Created.(WinBoLLStudio) : " + outBuildBckDir.getAbsolutePath() + } + if(outBuildBckDir.exists()) { + copy{ + from file.outputFile + into outBuildBckDir + rename { + String fileName -> "${outputFileName}" + } + println "Output APK (WinBoLLStudio): " + outBuildBckDir.getAbsolutePath() + "/${outputFileName}" + } + // 检查编译标志位配置 + assert (winbollBuildProps['buildCount'] != null) + assert (winbollBuildProps['libraryProject'] != null) + //构建计数增加 + int buildCount = Integer.parseInt(winbollBuildProps['buildCount']) + 1; + // 设置编译计数 + winbollBuildProps.setProperty("buildCount", Integer.toString(buildCount)); + + //保存编译标志配置 + FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile) + winbollBuildProps.store(fos, "${winbollBuildPropsDesc}"); + fos.close(); + println "\n\n>>> Project build.properties saved.\n\n"; + + 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); + + println "\n\n>>> Library Project build.properties saved.\n\n"; + } + } + } + + // 如果正在发布,就拷贝到 WinBoLL 标签管理文件夹,和处理 Git 仓库管理任务。 + // + 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()) { + outTagDir.mkdirs(); + println "Output Folder Created.(Tags) : " + outTagDir.getAbsolutePath() + } + + if(outTagDir.exists()) { + File targetAPK = new File(outTagDir, "${szCommonTagAPKName}") + if(targetAPK.exists()) { + // 标签版本APK文件已经存在,构建拷贝任务停止 + assert (!targetAPK.exists()) + // 可选择删除并继续输出APK文件 + //delete targetAPK + } + // 复制一个备份 + copy{ + from file.outputFile + into outTagDir + rename { + String fileName -> "${outputFileName}" + } + println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${outputFileName}" + } + // 复制一个并重命名为短版本名 + copy{ + from file.outputFile + into outTagDir + rename { + String fileName -> "${szCommonTagAPKName}" + } + println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${szCommonTagAPKName}" + } + // 检查编译标志位配置 + assert (winbollBuildProps['stageCount'] != null) + assert (winbollBuildProps['publishVersion'] != null) + assert (winbollBuildProps['buildCount'] != null) + assert (winbollBuildProps['baseVersion'] != null) + assert (winbollBuildProps['baseBetaVersion'] != null) + assert (winbollBuildProps['libraryProject'] != null) + + // 设置类库的默认版本名 + winbollBuildProps.setProperty("publishVersion", "${versionName}"); + // Stage 发布计数增加 + int stageCount = Integer.parseInt(winbollBuildProps['stageCount']) + 1; + winbollBuildProps.setProperty("stageCount", Integer.toString(stageCount)); + // 设置类库的默认Beta版本名 + winbollBuildProps.setProperty("baseBetaVersion", winbollBuildProps['baseVersion'] + "." + Integer.toString(stageCount)); + // 构建计数重置 + winbollBuildProps.setProperty("buildCount", "0"); + + //保存编译标志配置 + FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile) + winbollBuildProps.store(fos, "${winbollBuildPropsDesc}"); + 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); + } + + // 提交新的编译标志配置 + println 'exec bashCommitAppPublishBuildFlagInfoFilePath ...' + def resultCommitBuildFlag = exec { + commandLine 'bash', '--', "${RootProjectDir}/${bashCommitAppPublishBuildFlagInfoFilePath}", "${RootProjectDir}", "${versionName}", variant.buildType.name , rootProject.name + } + // 检查bash命令的返回值(假设非零表示失败) + assert(resultCommitBuildFlag.getExitValue() == 0) + } + } // if(variant.buildType.name == "release"){ + + // 如果正在调试发布版,就只生成和输出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()) { + outTagDir.mkdirs(); + println "Output Folder Created.(Tags) : " + outTagDir.getAbsolutePath() + } + + 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 + } + // 复制一个备份 + copy{ + from file.outputFile + into outTagDir + rename { + String fileName -> "${outputFileName}" + } + println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${outputFileName}" + } + // 复制一个并重命名为短版本名 + copy{ + from file.outputFile + into outTagDir + rename { + String fileName -> "${szCommonTagAPKName}" + } + println "Output APK (Tags): "+ outTagDir.getAbsolutePath() + "/${szCommonTagAPKName}" + } + + //不保存编译标志配置 + } + } + + // 如果配置了APK额外输出路径,就复制一份拷贝到额外路径。 + // + if(winbollProps['ExtraAPKOutputPath'] != null ) { + File apkFile = new File(winbollProps['ExtraAPKOutputPath']) + File outCommonDir = apkFile.getParentFile(); + String commandAPKName = apkFile.getName(); + if(outCommonDir.exists()) { + copy{ + from file.outputFile + into outCommonDir + rename { + String fileName -> "${commandAPKName}" + } + println "Output APK (Common): " + outCommonDir.getAbsolutePath() + "/${commandAPKName}" + } + } + } + + + } + }// End of (variant.getAssembleProvider().get().doLast {) + }/// WINBOLL 主机的 APK 发布和源码管理操作结束 /// + } + + } // End of (android.applicationVariants.all { variant ->) +} + diff --git a/.winboll/winboll_lib_build.gradle b/.winboll/winboll_lib_build.gradle new file mode 100644 index 0000000..f63aa52 --- /dev/null +++ b/.winboll/winboll_lib_build.gradle @@ -0,0 +1,211 @@ +// 本机和 WinBoLL Maven 仓库传输配置。 +// + +def getDefaultVersion(){ + // 检查编译标志位配置 + assert (winbollBuildProps['publishVersion'] != null) + // 返回编译版本号 + return winbollBuildProps['publishVersion'] +} + +def siteUrl = 'https://winboll.cc/?page=studio/details.php&app=${rootProject.name}' // 项目主页 +def gitUrl = 'https://gitea.winboll.cc/WinBoLL/${rootProject.name}' // 项目的git地址 +def DefaultGroupId = 'cc.winboll.studio' // 类库所有者groupId +def DefaultVersion = getDefaultVersion() // 版本号 +def DeveloperId='zhangsken' // 开发者账号 +def DeveloperName='ZhanGSKen' // 开发者名称 +def DeveloperEMail='zhangsken@188.com' // 开发者邮箱地址 +def LicenseName='The Apache Software License, Version 2.0' +def LicenseUrl='http://www.apache.org/licenses/LICENSE-2.0.txt' + +Properties properties = new Properties() + +afterEvaluate { + publishing { + repositories { + if(file("${RootProjectDir}/${winbollFilePath}").exists()) { + properties.load(file("${RootProjectDir}/${winbollFilePath}").newDataInputStream()) + def NexusUserName = properties.getProperty("Nexus.name") + def NexusPassword = properties.getProperty("Nexus.password") + // WinBoLL Release 仓库 + maven{ + //仓库的名字和地址 + name = "WinBoLLRelease" + url="https://nexus.winboll.cc/repository/maven-releases/" + // 仓库用户名密码 + credentials { + username = NexusUserName + password = NexusPassword + } + } + // WinBoLL Snapshot 仓库 + maven{ + //仓库的名字和地址 + name = "WinBoLLSnapshot" + url="https://nexus.winboll.cc/repository/maven-snapshots/" + // 仓库用户名密码 + credentials { + username = NexusUserName + password = NexusPassword + } + } + } + } + publications { + // Local Maven 仓库传输任务 + // + release(MavenPublication) { + groupId = DefaultGroupId + artifactId = project.name + version = DefaultVersion + + //from components.java + // 必须有这个 否则不会上传AAR包 + afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) } + // 上传source,这样使用方可以看到方法注释 + //artifact generateSourcesJar + //要上传的aar路径 + //artifact "$buildDir/outputs/aar/${project.getName()}-release.aar" + //artifact "$buildDir/outputs/aar/${project.getName()}-debug.aar" + + //对pom进行的操作 + pom.withXml{ + Node pomNode = asNode() + pomNode.dependencies.'*'.findAll() { + //将所有的默认依赖移除 + //it.parent().remove(it) + } + } + pom { + name = artifactId + url = siteUrl + licenses { + license { //证书说明 + name=LicenseName // 开源协议名称 + url=LicenseUrl // 协议地址 + } + } + developers { + developer { + id=DeveloperId // 开发者账号 + name=DeveloperName // 开发者名称 + email=DeveloperEMail // 开发者邮箱地址 + } + } + //软件配置管理 + scm { + connection=gitUrl + developerConnection=gitUrl + url=siteUrl + } + } + } + + // WinBoLL Maven Release 仓库传输任务 + // + releaseWinBoLL(MavenPublication) { + // 需要使用的变体,假设有free和pay两个变体,可以选择一个 + //from components.free + + groupId = DefaultGroupId // 文件的groupId + artifactId = project.name //文件的名字 + version = DefaultVersion //版本号 + + //from components.java + // 必须有这个 否则不会上传AAR包 + afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) } + // 上传source,这样使用方可以看到方法注释 + //artifact generateSourcesJar + //要上传的aar路径 + //artifact "$buildDir/outputs/aar/${project.getName()}-release.aar" + //artifact "$buildDir/outputs/aar/${project.getName()}-debug.aar" + + //对pom进行的操作 + pom.withXml{ + Node pomNode = asNode() + pomNode.dependencies.'*'.findAll() { + //将所有的默认依赖移除 + //it.parent().remove(it) + } + } + pom { + name = artifactId + url = siteUrl + licenses { + license { //证书说明 + name=LicenseName // 开源协议名称 + url=LicenseUrl // 协议地址 + } + } + developers { + developer { + id=DeveloperId // 开发者账号 + name=DeveloperName // 开发者名称 + email=DeveloperEMail // 开发者邮箱地址 + } + } + //软件配置管理 + scm { + connection=gitUrl + developerConnection=gitUrl + url=siteUrl + } + } + + } // 创建名为 release 的任务结束 + + // WinBoLL Maven Snapshot 仓库传输任务 + // + snapshotWinBoLL(MavenPublication) { + // 需要使用的变体,假设有free和pay两个变体,可以选择一个 + //from components.free + + groupId = DefaultGroupId // 文件的groupId + artifactId = project.name //文件的名字 + version = DefaultVersion + "-SNAPSHOT" //版本号 + + //from components.java + // 必须有这个 否则不会上传AAR包 + afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) } + // 上传source,这样使用方可以看到方法注释 + //artifact generateSourcesJar + //要上传的aar路径 + //artifact "$buildDir/outputs/aar/${project.getName()}-release.aar" + //artifact "$buildDir/outputs/aar/${project.getName()}-debug.aar" + + //对pom进行的操作 + pom.withXml{ + Node pomNode = asNode() + pomNode.dependencies.'*'.findAll() { + //将所有的默认依赖移除 + //it.parent().remove(it) + } + } + pom { + name = artifactId + url = siteUrl + licenses { + license { //证书说明 + name=LicenseName // 开源协议名称 + url=LicenseUrl // 协议地址 + } + } + developers { + developer { + id=DeveloperId // 开发者账号 + name=DeveloperName // 开发者名称 + email=DeveloperEMail // 开发者邮箱地址 + } + } + //软件配置管理 + scm { + connection=gitUrl + developerConnection=gitUrl + url=siteUrl + } + } + } // 创建名为 snapshot 的任务结束 + } + + } +} diff --git a/.winboll/winboll_lint_build.gradle b/.winboll/winboll_lint_build.gradle new file mode 100644 index 0000000..b2ec440 --- /dev/null +++ b/.winboll/winboll_lint_build.gradle @@ -0,0 +1,50 @@ +android { + lintOptions { + // true--关闭lint报告的分析进度 + //quiet true + // true--错误发生后停止gradle构建 + abortOnError false + // true--只报告error + //ignoreWarnings true + // true--忽略有错误的文件的全/绝对路径(默认是true) + //absolutePaths true + // true--检查所有问题点,包含其他默认关闭项 + checkAllWarnings true + // true--所有warning当做error + //warningsAsErrors true + // 关闭指定问题检查 + //disable 'ExpiredTargetSdkVersion','HardcodedText','UnknownNullness','ButtonStyle','GradleDependency','UnusedResources' + // 打开指定问题检查 + //enable 'RtlHardcoded','RtlCompat', 'RtlEnabled' + // 仅检查指定问题 + //check 'NewApi', 'InlinedApi' + // true--error输出文件不包含源码行号 + //noLines true + // true--显示错误的所有发生位置,不截取 + showAll true + // 回退lint设置(默认规则) + //lintConfig file("default-lint.xml") + // true--生成txt格式报告(默认false) + //textReport true + // 重定向输出;可以是文件或'stdout' + //textOutput 'stdout' + // true--生成XML格式报告 + xmlReport true + // 指定xml报告文档(默认lint-results.xml) + xmlOutput file("${lintXmlReportFilePath}") + // true--生成HTML报告(带问题解释,源码位置,等) + htmlReport true + // html报告可选路径(构建器默认是lint-results.html ) + htmlOutput file("${lintHTMLReportFilePath}") + // true--所有正式版构建执行规则生成崩溃的lint检查,如果有崩溃问题将停止构建 + checkReleaseBuilds true + // 在发布版本编译时检查(即使不包含lint目标),指定问题的规则生成崩溃 + //fatal 'NewApi', 'InlineApi' + // 指定问题的规则生成错误 + //error 'Wakelock', 'TextViewEdits' + // 指定问题的规则生成警告 + //warning 'ResourceAsColor' + // 忽略指定问题的规则(同关闭检查) + //ignore 'TypographyQuotes' + } +} diff --git a/GenKeyStore/gen_debug_keystore.sh b/GenKeyStore/gen_debug_keystore.sh new file mode 100644 index 0000000..6ecd6ac --- /dev/null +++ b/GenKeyStore/gen_debug_keystore.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# 应用秘钥创建脚本 +# Linux 命令行创建JKS秘钥,alias和keyAlias可配置,文件名含时间戳 + +# 可配置参数(按需修改) +ALIAS="WinBoLL.CC_Debug" # 别名(与keyAlias一致) +STORE_PASS="androiddebugkey" +KEY_PASS="androiddebugkey" +COUNTRY="CN" # 国家代码 + +# 获取当前时间戳 +TIMESTAMP=$(date +%Y%m%d%H%M%S) +FILENAME="${ALIAS}_${TIMESTAMP}.jks" +STORENAME="${ALIAS}_${TIMESTAMP}.keystore" + +# 生成JKS文件(alias与keyAlias同步) +keytool -genkeypair \ + -alias "${ALIAS}" \ + -keyalg RSA \ + -keysize 2048 \ + -validity 1 \ + -keystore "${FILENAME}" \ + -dname "CN=WBFans, OU=Studio, O=WinBoLL, L=Shanwei, ST=Guangdong, C=${COUNTRY}" \ + -storepass "${STORE_PASS}" \ + -keypass "${KEY_PASS}" + +# 写入配置文件 +cat < ${STORENAME} +keyAlias=${ALIAS} +keyPassword=${KEY_PASS} +storeFile=../appkey.jks +storePassword=${STORE_PASS} +EOF + +echo "已生成秘钥:${FILENAME}" +echo "配置已写入 ${STORENAME}(keyAlias=${ALIAS})" + +# 询问是否复制文件 +read -p "是否需要将文件复制为 appkey.jks 和 appkey.keystore?(y/n): " CONFIRM + +if [[ $CONFIRM =~ ^[Yy]$ ]]; then + # 复制 jks 文件为 appkey.jks + cp -v ${FILENAME} ../appkey.jks + # 复制 keystore 文件为 appkey.keystore + cp -v ${STORENAME} ../appkey.keystore + echo "文件复制完成" +else + echo "已取消文件复制" +fi diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec445dc --- /dev/null +++ b/README.md @@ -0,0 +1,156 @@ +# OriginMaster +【OriginMaster】WinBoLL 源生态计划。正如话,我需要一个 Point, 去撬动成个地球。 + +######## +## ☁ ☁ ☁ WinBoLL APP ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ +# ☁ ☁ WinBoLL Studio Android 应用开源项目。☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ +# ☁ ☁ ☁ WinBoLL 网站地址 https://www.winboll.cc/ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ +# ☁ ☁ ☁ WinBoLL 源码地址 ☁ ☁ ☁ ☁ ☁ ☁ ☁ +# ☁ ☁ ☁ GitHub 源码地址 ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ +# ☁ ☁ ☁ 码云 源码地址 ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ + +## WinBoLL 提问 +同样是 /sdcard 目录,在开发 Android 应用时, +能否实现手机编译与电脑编译的源码同步。 +☁因而 WinBoLL 项目组诞生了。 + +## WinBoLL 项目组研发计划 +致力于把 WinBoLL-APP 应用在手机端 Android 项目开发。 +也在探索 https://gitea.winboll.cc//APP.git 应用于 WinBoLL-APP APK 分发。 +更想进阶 https://github.com//APP.git 应用于 WinBoLL-APP Beta APK 分发。 + +## WinBoLL-APP 汗下... +#### ☁应用何置如此呢。且观用户云云。 + +#### ☁ 正当下 ☁ ### +#### ☁ 且容傻家叙说 ☁ WinBoLL-APP 应用场景 +### ☁ WinBoLL 设备资源概述 +#### ☁ 1. Raid Disk. +概述:这是一个矩阵存储类设备。 +优点:该设备具有数据容错存储功能, + 数据存储具有特长持久性。 +缺点:设备使用能源消耗比较高, + 设备存取速度一般。 + +#### ☁ 2. Data Disk. +概述:这是一个普通硬盘存储设备 +优点:该设备独立于操作系统, + 数据持久性一般, + 存取能源消耗小于 Raid Disk。 +缺点:数据存储速度一般,存储能源消耗一般。 + +#### ☁ 3. SSD Disk. +概述:这是一个 SSD 硬盘存储设备。 +优点:存取速度快于 Data Disk 与 Raid Disk, + 存取能源消耗小于 Data Disk 与 Raid Disk。 +缺点:数据持久性一般, + 设备位于操作系统内部文件系统。 + 数据持久性与操作系统挂钩。 + +#### ☁ 4. WinBoLL 用户资源概述。 +1> /home/<用户名> 位于 WinBoLL 操作系统目录下。 +2> /rdisk/<用户名> 挂载用户 Raid Disk. +3> /data/<用户名> 挂载用户 Data Disk. +4> /sdcard/<用户名> 挂载用户 SSD Disk. + +#### ☁ 5. WinBoLL-APP 用户资源概述。 +1> /sdcard 挂载用户手机 SD 存储/storage/emulated/0 + +### ☁ 稍稍歇 ☁ ### +### ☁ 急急停 ☁ WinBoLL 应用前置条件 +☁ WinBoLL 主机建立 1Panel MySQL 应用。 +☁ WinBoLL 主机建立 1Panel Gitea 应用。 +☁ WinBoLL 主机设置 WinBoLL 应用为非登录状态。 +☁ WinBoLL 主机建立 WinBoLL 账户与 WinBoLL 用户组。 +☁ WinBoLL 账户 User ID 为: J。 +☁ WinBoLL 用户组 Group ID 为: Studio。 +☁ WinBoLL 主机 WinBoLL 1Panel Gitea 建立 WinBoLL 工作组。 +☁ WinBoLL 主机 WinBoLL 1Panel Gitea 用户项目 APK 编译输出目录为 /sdcard/WinBoLLStudio/<用户名>/APKs/ +☁ WinBoLL 项目配置文件示例为 "/.winboll/winboll.properties-demo"(WinBoLL 项目已设置) +☁ WinBoLL 项目配置文件为 "/.winboll/winboll.properties" +☁ WinBoLL 项目配置文件设定为源码提交时忽略。(WinBoLL 项目已设置) +☁ Gradle 项目配置文件示例为 "/.winboll/local.properties-demo"(WinBoLL 项目已设置) +☁ Gradle 项目配置文件为 "/local.properties"(WinBoLL 项目已设置) +☁ Gradle 项目配置文件设定为源码提交时忽略。(WinBoLL 项目已设置) + +### ☁ 登高处 ☁ WinBoLL 应用需求规划 +☁ WinBoLL 主机建立 WinBoLL 客户端用户数据库为 MySQL winbollclient 数据库。 +☁ WinBoLL 主机设置 WinBoLL 客户端用户信息存储在 winbollclient 数据库中。 +☁ MySQL winbollclient 数据库中 + WinBoLL 客户端用户信息设定为: + <用户名, 验证密码, 验证邮箱, 验证手机, 唯一存储令牌Token, 备用验证邮箱>。 +☁ WinBoLL 项目源码仓库托管在 WinBoLL 1Panel Gitea 目录 /opt/1panel/apps/gitea/gitea/data/git/repositories/studio/app.git中。 +☁ WinBoLL 主机提供 WinBoLL 1Panel Gitea 应用的 WinBoLL 项目源码仓库存取功能。(Gitea 应用已提供) +☁ WinBoLL 主机提供 WinBoLL Gitea 项目仓库存档功能。(Gitea 应用已提供) +☁ 提供 WinBoLL 客户端用户登录功能。(Gitea 应用已提供) + +### ☁ 看远方 ☁ ### +### ☁ 心忧虑 ☁ WinBoLL-APP 应用前置需求 +☁ WinBoLL-APP WinBoLL 项目根目录设定为手机的 /sdcard/WinBoLLStudio/Sources 目录。(需要用户手动建立文件夹) +☁ WinBoLL-APP 具有手机 /sdcard/WinBoLL 目录的存储权限。(需要手机操作系统授权) +☁ WinBoLL-APP WinBoLL 项目仓库源码存储路径为 /sdcard/WinBoLLStudio/Sources/APP.git(需要用户手动建立文件夹) +☁ WinBoLL-APP 项目 APK 编译输出目录为 /sdcard/WinBoLLStudio/APKs/ +☁ WinBoLL-APP 应用签名验证可定制化。(WinBoLL 项目已提供) +☁ WinBoLL-APP 与系列衍生 APP 应用共享 cc.winboll.studio 命名空间资源。(WinBoLL 项目已提供) +☁ WinBoLL-APP 用户客户端信息存储在命名空间为 WinBoLL APP MySQLLite 应用的 winbollappclient 数据库中。 +☁ WinBoLL-APP MySQLLite 应用的 winbollappclient 数据库中, + WinBoLL 用户客户端信息设定为: + <用户名, 唯一存储令牌Token>。 + +### ☁ 云游四方 ☁ ### +### ☁ 呔! ☁ WinBoLL-APP 应用需求规划 +☁ 如要使用 WinBoLL Android 项目的 Gradle 编译功能,则需要设置以下两个文件夹。 +☁ 1. 则需要建立数据存储目录 /sdcard/WinBoLLStudio/APKs。 + WinBoLL 项目源码编译出来的安装包会拷贝一份到 /sdcard/WinBoLLStudio/APKs 目录下。 +☁ 2. 则需要建立数据存储目录 /sdcard/AppProjects。 + WinBoLL 项目源码编译出来的安装包会拷贝一份并命名 "app.apk" 的安装文件为到 /sdcard/AppProjects 目录下。 + + +### ☁ 吁! ☁ WinBoLL-APP 共享计划前景 +☁ WinBoLL-APP 将会实现 https://winboll.cc/api 访问功能。 +☁ WinBoLL-APP 将会实现手机端 Android 应用的开发与管理功能。 + +## ☁ WinBoLL ☁ WinBoLL 主机忧虑 +☁ WinBoLL 将会提供 gitea.winboll.cc 域名用户注册登录功能。 +☁ WinBoLL 将会提供 WinBoLL-APP 及其衍生应用的 Gitea 仓库管理服务。 +☁ WinBoLL 将会提供 winboll.cc 域名 WinBoLL 项目组注册登录功能。 + +# 本项目要实际运用需要注意以下几个步骤: +# 在项目根目录下: +## ★. 项目模块编译环境设置(必须),settings.gradle-demo 要复制为 settings.gradle,并取消相应项目模块的注释。 +## ★. 项目模块编译环境设置(必须) 在根目录拷贝 gradle.properties-androidx-demo 或者 gradle.properties-android-demo 文件为 gradle.properties。 +## ★. 项目 Android SDK 编译环境设置(可选),local.properties-demo 要复制为 local.properties,并按需要设置 Android SDK 目录。 +## ★. 应用签名密钥 keystore 设置问题。一般调试编译只需用【Termux】cd 进 GenKeyStore 目录执行 $ bash gen_debug_keystore.sh 命令即可完成设置。 +## ☆. 应用 WiBoLL 签名密钥配置问题<非必须考虑>。设置时需要 clone 【keystore】模块源码并拷贝模块目录的 appkey.jks 与 appkey.keystore 到项目根目录即可。 +## ☆. 类库型模块编译环境设置(可选),winboll.properties-demo 要复制为 winboll.properties,并按需要设置 WinBoLL Maven 库登录用户信息, 和 APK 文件额外输出路径。 + + +# ☆类库型项目编译方法 +## 先编译类库对应的模块测试项目 +### 修改模块测试项目的 build.properties 文件 +设置属性 libraryProject=<类库项目模块文件夹名称> +### 再编译测试项目 +$ bash .winboll/bashPublishAPKAddTag.sh <应用项目模块文件夹名称> +#### 测试项目编译后,编译器会复制一份 APK 到 路径:"/sdcard/WinBoLLStudio/APKs/<项目根目录名称>/tag/" 文件夹。 +#### 若是 winboll.properties 文件的 [ExtraAPKOutputPath] 属性设置了路径。编译器也会复制一份 APK 到这个路径。 +### 最后编译类库项目 +$ bash .winboll/bashPublishLIBAddTag.sh <类库项目模块文件夹名称> +#### 类库模块编译命令执行后,编译器会发布到 WinBoLL Nexus Maven 库:Maven 库地址可以参阅根项目目录配置 build.gradle 文件。 + +# ☆应用型项目编译方法 +## 直接调用以下命令编译应用型项目 +$ bash .winboll/bashPublishAPKAddTag.sh <应用项目模块文件夹名称> +#### 应用模块编译命令执行后,编译器会复制一份 APK 到 +#### 测试项目编译后,编译器会复制一份 APK 到 路径:"/sdcard/WinBoLLStudio/APKs/<项目根目录名称>/tag/" 文件夹。 +#### 若是 winboll.properties 文件的 [ExtraAPKOutputPath] 属性设置了路径。编译器也会复制一份 APK 到这个路径。 + +## ☆应用调试编译方法 +使用以下命令编译调试: + +### Beta调试使用: +$ bash gradlew assembleBetaDebug + +### Stage调试使用: +$ bash gradlew assembleStageDebug + +### 若是 winboll.properties 文件的 [ExtraAPKOutputPath] 属性设置了路径。编译器也会复制一份 APK 到这个路径。 diff --git a/aes/.gitignore b/aes/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/aes/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/aes/README.md b/aes/README.md new file mode 100644 index 0000000..5598442 --- /dev/null +++ b/aes/README.md @@ -0,0 +1,35 @@ +# AES + +#### 介绍 +WinBoLL 安卓可视化元素类库测试应用。 + +#### 软件架构 +适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。 +也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。 + + +#### Gradle 编译说明 +调试版编译命令 :gradle assembleBetaDebug +阶段版编译命令 :bash .winboll/bashPublishAPKAddTag.sh aes +阶段版类库发布命令 :git pull &&bash .winboll/bashPublishLIBAddTag.sh libaes + +#### 使用说明 + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 : ZhanGSKen(ZhanGSKen) +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/) + +#### 参考文档 diff --git a/aes/app_update_description.txt b/aes/app_update_description.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/aes/app_update_description.txt @@ -0,0 +1 @@ + diff --git a/aes/build.gradle b/aes/build.gradle new file mode 100644 index 0000000..dda017d --- /dev/null +++ b/aes/build.gradle @@ -0,0 +1,51 @@ +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 { + + // 1. compileSdkVersion:必须 ≥ targetSdkVersion,建议直接等于 targetSdkVersion(30) + compileSdkVersion 30 + + // 2. buildToolsVersion:需匹配 compileSdkVersion,建议使用 30.x.x 最新稳定版(无需高于 compileSdkVersion) + buildToolsVersion "30.0.3" // 这是 30 对应的最新稳定版,避免使用 beta 版 + + defaultConfig { + applicationId "cc.winboll.studio.aes" + minSdkVersion 23 + targetSdkVersion 30 + versionCode 1 + // versionName 更新后需要手动设置 + // 项目模块目录的 build.gradle 文件的 stageCount=0 + // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" + versionName "15.11" + if(true) { + versionName = genVersionName("${versionName}") + } + } + + // 米盟 SDK + packagingOptions { + doNotStrip "*/*/libmimo_1011.so" + } +} + +dependencies { + api project(':libaes') + api fileTree(dir: 'libs', include: ['*.jar']) +} diff --git a/aes/build.properties b/aes/build.properties new file mode 100644 index 0000000..f685fed --- /dev/null +++ b/aes/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Wed Nov 26 15:54:26 GMT 2025 +stageCount=7 +libraryProject=libaes +baseVersion=15.11 +publishVersion=15.11.6 +buildCount=32 +baseBetaVersion=15.11.7 diff --git a/aes/proguard-rules.pro b/aes/proguard-rules.pro new file mode 100644 index 0000000..a18de74 --- /dev/null +++ b/aes/proguard-rules.pro @@ -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 ; +} + +# 保留 native 方法(避免JNI调用失败) +-keepclasseswithmembernames class * { + native ; +} + +# 保留注解和泛型(避免反射/序列化异常) +-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 { + (); +} +-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 ; +} + +# 米盟 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 + diff --git a/aes/src/beta/AndroidManifest.xml b/aes/src/beta/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/aes/src/beta/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/aes/src/beta/res/values/strings.xml b/aes/src/beta/res/values/strings.xml new file mode 100644 index 0000000..6f287f2 --- /dev/null +++ b/aes/src/beta/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + + AES+ + diff --git a/aes/src/main/AndroidManifest.xml b/aes/src/main/AndroidManifest.xml new file mode 100644 index 0000000..40eb674 --- /dev/null +++ b/aes/src/main/AndroidManifest.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/aes/src/main/java/cc/winboll/studio/aes/AboutActivity.java b/aes/src/main/java/cc/winboll/studio/aes/AboutActivity.java new file mode 100644 index 0000000..39dc20e --- /dev/null +++ b/aes/src/main/java/cc/winboll/studio/aes/AboutActivity.java @@ -0,0 +1,93 @@ +package cc.winboll.studio.aes; + +/** + * @Author ZhanGSKen + * @Date 2025/03/24 23:52:29 + * @Describe AES应用介绍窗口 + */ +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity; +import cc.winboll.studio.libaes.models.APPInfo; +import cc.winboll.studio.libaes.utils.WinBoLLActivityManager; +import cc.winboll.studio.libaes.views.AboutView; + +public class AboutActivity extends WinBoLLActivity implements IWinBoLLActivity { + + public static final String TAG = "AboutActivity"; + + Context mContext; + Toolbar mToolbar; + + @Override + public Activity getActivity() { + return this; + } + + @Override + public String getTag() { + return TAG; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mContext = this; + setContentView(R.layout.activity_about); + + mToolbar = findViewById(R.id.toolbar); + setSupportActionBar(mToolbar); + mToolbar.setSubtitle(TAG); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + AboutView aboutView = CreateAboutView(); + // 在 Activity 的 onCreate 或其他生命周期方法中调用 +// LinearLayout layout = new LinearLayout(this); +// layout.setOrientation(LinearLayout.VERTICAL); +// // 创建布局参数(宽度和高度) +// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( +// ViewGroup.LayoutParams.MATCH_PARENT, +// ViewGroup.LayoutParams.MATCH_PARENT +// ); +// addContentView(aboutView, params); + + LinearLayout layout = findViewById(R.id.aboutviewroot_ll); + // 创建布局参数(宽度和高度) + ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + ); + layout.addView(aboutView, params); + + WinBoLLActivityManager.getInstance().add(this); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + WinBoLLActivityManager.getInstance().registeRemove(this); + } + + public AboutView CreateAboutView() { + String szBranchName = "aes"; + APPInfo appInfo = new APPInfo(); + appInfo.setAppName("AES"); + appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll); + appInfo.setAppDescription("AES Description"); + appInfo.setAppGitName("APPBase"); + appInfo.setAppGitOwner("Studio"); + appInfo.setAppGitAPPBranch(szBranchName); + appInfo.setAppGitAPPSubProjectFolder(szBranchName); + appInfo.setAppHomePage("https://www.winboll.cc/apks/index.php?project=AES"); + appInfo.setAppAPKName("AES"); + appInfo.setAppAPKFolderName("AES"); + //appInfo.setIsAddDebugTools(false); + //appInfo.setIsAddDebugTools(BuildConfig.DEBUG); + return new AboutView(mContext, appInfo); + } +} diff --git a/aes/src/main/java/cc/winboll/studio/aes/App.java b/aes/src/main/java/cc/winboll/studio/aes/App.java new file mode 100644 index 0000000..9a6674c --- /dev/null +++ b/aes/src/main/java/cc/winboll/studio/aes/App.java @@ -0,0 +1,33 @@ +package cc.winboll.studio.aes; + +/** + * @Author ZhanGSKen + * @Date 2024/06/13 19:03:58 + * @Describe AES应用类 + */ +import android.view.Gravity; +import cc.winboll.studio.libaes.utils.WinBoLLActivityManager; +import cc.winboll.studio.libappbase.GlobalApplication; +import cc.winboll.studio.libappbase.ToastUtils; + + +public class App extends GlobalApplication { + + public static final String TAG = "App"; + + @Override + public void onCreate() { + super.onCreate(); + setIsDebugging(BuildConfig.DEBUG); + WinBoLLActivityManager.init(this); + + // 初始化 Toast 框架 + ToastUtils.init(this); + } + + @Override + public void onTerminate() { + super.onTerminate(); + ToastUtils.release(); + } +} diff --git a/aes/src/main/java/cc/winboll/studio/aes/MainActivity.java b/aes/src/main/java/cc/winboll/studio/aes/MainActivity.java new file mode 100644 index 0000000..0733873 --- /dev/null +++ b/aes/src/main/java/cc/winboll/studio/aes/MainActivity.java @@ -0,0 +1,201 @@ +package cc.winboll.studio.aes; + +/** + * @Author ZhanGSKen + * @Date 2024/06/13 19:05:52 + * @Describe 应用主窗口 + */ +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Toast; +import cc.winboll.studio.aes.R; +import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity; +import cc.winboll.studio.libaes.dialogs.LocalFileSelectDialog; +import cc.winboll.studio.libaes.dialogs.StoragePathDialog; +import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity; +import cc.winboll.studio.libaes.models.DrawerMenuBean; +import cc.winboll.studio.libaes.unittests.SecondaryLibraryActivity; +import cc.winboll.studio.libaes.unittests.TestAButtonFragment; +import cc.winboll.studio.libaes.unittests.TestASupportToolbarActivity; +import cc.winboll.studio.libaes.unittests.TestAToolbarActivity; +import cc.winboll.studio.libaes.unittests.TestDrawerFragmentActivity; +import cc.winboll.studio.libaes.unittests.TestViewPageFragment; +import cc.winboll.studio.libappbase.LogUtils; +import cc.winboll.studio.libappbase.ToastUtils; +import com.a4455jkjh.colorpicker.ColorPickerDialog; +import java.util.ArrayList; +import cc.winboll.studio.libaes.utils.WinBoLLActivityManager; + +public class MainActivity extends DrawerFragmentActivity implements IWinBoLLActivity { + + + public static final String TAG = "MainActivity"; + + TestAButtonFragment mTestAButtonFragment; + TestViewPageFragment mTestViewPageFragment; + + @Override + public Activity getActivity() { + return this; + } + + @Override + public String getTag() { + return TAG; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (mTestAButtonFragment == null) { + mTestAButtonFragment = new TestAButtonFragment(); + addFragment(mTestAButtonFragment); + } + showFragment(mTestAButtonFragment); + //setSubtitle(TAG); + //ToastUtils.show("onCreate"); + } + + @Override + public void initDrawerMenuItemList(ArrayList listDrawerMenu) { + super.initDrawerMenuItemList(listDrawerMenu); + LogUtils.d(TAG, "initDrawerMenuItemList"); + //listDrawerMenu.clear(); + // 添加抽屉菜单项 + listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestAButtonFragment.TAG)); + listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestViewPageFragment.TAG)); + notifyDrawerMenuDataChanged(); + } + + @Override + public void reinitDrawerMenuItemList(ArrayList listDrawerMenu) { + super.reinitDrawerMenuItemList(listDrawerMenu); + LogUtils.d(TAG, "reinitDrawerMenuItemList"); + //listDrawerMenu.clear(); + // 添加抽屉菜单项 + listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestAButtonFragment.TAG)); + listDrawerMenu.add(new DrawerMenuBean(R.drawable.ic_launcher, TestViewPageFragment.TAG)); + notifyDrawerMenuDataChanged(); + } + + @Override + public DrawerFragmentActivity.ActivityType initActivityType() { + return DrawerFragmentActivity.ActivityType.Main; + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.toolbar_main, menu); + if(App.isDebugging()) { + getMenuInflater().inflate(cc.winboll.studio.libaes.R.menu.toolbar_studio_debug, menu); + } + return super.onCreateOptionsMenu(menu); + } + + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + super.onItemClick(parent, view, position, id); + switch (position) { + case 0 : { + if (mTestAButtonFragment == null) { + mTestAButtonFragment = new TestAButtonFragment(); + addFragment(mTestAButtonFragment); + } + showFragment(mTestAButtonFragment); + break; + } + case 1 : { + if (mTestViewPageFragment == null) { + mTestViewPageFragment = new TestViewPageFragment(); + addFragment(mTestViewPageFragment); + } + showFragment(mTestViewPageFragment); + break; + } + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int nItemId = item.getItemId(); + if (item.getItemId() == R.id.item_testactivitymanager) { + WinBoLLActivityManager.getInstance().startWinBoLLActivity(this, TestActivityManagerActivity.class); + //ToastUtils.show("item_testactivitymanager"); + } else + if (nItemId == R.id.item_atoast) { + Toast.makeText(getApplication(), "item_testatoast", Toast.LENGTH_SHORT).show(); + } else if (nItemId == R.id.item_atoolbar) { + Intent intent = new Intent(this, TestAToolbarActivity.class); + startActivity(intent); + + } else if (nItemId == R.id.item_asupporttoolbar) { + Intent intent = new Intent(this, TestASupportToolbarActivity.class); + startActivity(intent); + + } else if (nItemId == R.id.item_colordialog) { + ColorPickerDialog dlg = new ColorPickerDialog(this, getResources().getColor(R.color.colorPrimary)); + dlg.setOnColorChangedListener(new com.a4455jkjh.colorpicker.view.OnColorChangedListener() { + + @Override + public void beforeColorChanged() { + } + + @Override + public void onColorChanged(int color) { + + } + + @Override + public void afterColorChanged() { + } + + + }); + dlg.show(); + + } else if (nItemId == R.id.item_dialogstoragepath) { + final StoragePathDialog dialog = new StoragePathDialog(this, 0); + dialog.setOnOKClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + dialog.show(); + + } else if (nItemId == R.id.item_localfileselectdialog) { + final LocalFileSelectDialog dialog = new LocalFileSelectDialog(this); + dialog.setOnOKClickListener(new LocalFileSelectDialog.OKClickListener() { + @Override + public void onOKClick(String sz) { + Toast.makeText(getApplication(), sz, Toast.LENGTH_SHORT).show(); + //dialog.dismiss(); + } + }); + dialog.open(); + + } else if (nItemId == R.id.item_secondarylibraryactivity) { + Intent intent = new Intent(this, SecondaryLibraryActivity.class); + startActivity(intent); + } else if (nItemId == R.id.item_drawerfragmentactivity) { + Intent intent = new Intent(this, TestDrawerFragmentActivity.class); + startActivity(intent); + } else if (nItemId == R.id.item_settings) { + Intent intent = new Intent(this, SettingsActivity.class); + startActivity(intent); + } else if (nItemId == R.id.item_about) { + Intent intent = new Intent(this, AboutActivity.class); + startActivity(intent); + return true; + } + + return super.onOptionsItemSelected(item); + } + + +} diff --git a/aes/src/main/java/cc/winboll/studio/aes/SettingsActivity.java b/aes/src/main/java/cc/winboll/studio/aes/SettingsActivity.java new file mode 100644 index 0000000..3a9a394 --- /dev/null +++ b/aes/src/main/java/cc/winboll/studio/aes/SettingsActivity.java @@ -0,0 +1,38 @@ +package cc.winboll.studio.aes; + +import android.app.Activity; +import android.os.Bundle; +import cc.winboll.studio.libaes.enums.ADsMode; +import cc.winboll.studio.libaes.views.ADsControlView; +import cc.winboll.studio.libappbase.ToastUtils; + +/** + * @Author ZhanGSKen&豆包大模型 + * @Date 2025/11/26 18:01 + * @Describe SettingsActivity + */ +public class SettingsActivity extends Activity { + + public static final String TAG = "SettingsActivity"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_settings); + ADsControlView adsControlView = (ADsControlView) findViewById(R.id.ads_control_view); + +// adsControlView.setOnAdsModeSelectedListener(new ADsControlView.OnAdsModeSelectedListener() { +// @Override +// public void onModeSelected(ADsMode selectedMode) { +// if (selectedMode == ADsMode.STANDALONE) { +// // 处理单机模式逻辑(如释放米盟资源) +// ToastUtils.show("STANDALONE"); +// } else if (selectedMode == ADsMode.MIMO_SDK) { +// // 处理米盟SDK模式逻辑(如初始化SDK) +// ToastUtils.show("MIMO_SDK"); +// } +// } +// }); + } + +} diff --git a/aes/src/main/java/cc/winboll/studio/aes/TestActivityManagerActivity.java b/aes/src/main/java/cc/winboll/studio/aes/TestActivityManagerActivity.java new file mode 100644 index 0000000..71d114d --- /dev/null +++ b/aes/src/main/java/cc/winboll/studio/aes/TestActivityManagerActivity.java @@ -0,0 +1,33 @@ +package cc.winboll.studio.aes; + +import android.app.Activity; +import android.os.Bundle; +import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity; + +/** + * @Author ZhanGSKen&豆包大模型 + * @Date 2025/09/28 21:07 + * @Describe 窗口管理类测试窗口 + */ +public class TestActivityManagerActivity extends WinBoLLActivity implements IWinBoLLActivity { + + public static final String TAG = "TestActivityManagerActivity"; + + @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_testactivitymanager); + + } + +} diff --git a/aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java b/aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java new file mode 100644 index 0000000..76005db --- /dev/null +++ b/aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java @@ -0,0 +1,60 @@ +package cc.winboll.studio.aes; + +/** + * @Author ZhanGSKen&豆包大模型 + * @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.utils.WinBoLLActivityManager; +import cc.winboll.studio.libappbase.LogUtils; + +public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity { + + public static final String TAG = "WinBoLLActivity"; + + @Override + public Activity getActivity() { + return this; + } + + @Override + public String getTag() { + return TAG; + } + + @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); + } +} diff --git a/aes/src/main/res/layout/activity_about.xml b/aes/src/main/res/layout/activity_about.xml new file mode 100644 index 0000000..3de4825 --- /dev/null +++ b/aes/src/main/res/layout/activity_about.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/aes/src/main/res/layout/activity_settings.xml b/aes/src/main/res/layout/activity_settings.xml new file mode 100644 index 0000000..c2df838 --- /dev/null +++ b/aes/src/main/res/layout/activity_settings.xml @@ -0,0 +1,12 @@ + + + + diff --git a/aes/src/main/res/layout/activity_testactivitymanager.xml b/aes/src/main/res/layout/activity_testactivitymanager.xml new file mode 100644 index 0000000..e030ebb --- /dev/null +++ b/aes/src/main/res/layout/activity_testactivitymanager.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/aes/src/main/res/menu/toolbar_main.xml b/aes/src/main/res/menu/toolbar_main.xml new file mode 100644 index 0000000..7f2f26b --- /dev/null +++ b/aes/src/main/res/menu/toolbar_main.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + diff --git a/aes/src/main/res/values/colors.xml b/aes/src/main/res/values/colors.xml new file mode 100644 index 0000000..87d3836 --- /dev/null +++ b/aes/src/main/res/values/colors.xml @@ -0,0 +1,7 @@ + + + #FF00B322 + #FF005C12 + #FF8DFFA2 + #FFFFFB8D + diff --git a/aes/src/main/res/values/strings.xml b/aes/src/main/res/values/strings.xml new file mode 100644 index 0000000..6b856ff --- /dev/null +++ b/aes/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + AES + + diff --git a/aes/src/main/res/values/styles.xml b/aes/src/main/res/values/styles.xml new file mode 100644 index 0000000..1da88ba --- /dev/null +++ b/aes/src/main/res/values/styles.xml @@ -0,0 +1,5 @@ + + + + diff --git a/aes/src/main/res/xml/network_security_config.xml b/aes/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..ee39aa4 --- /dev/null +++ b/aes/src/main/res/xml/network_security_config.xml @@ -0,0 +1,6 @@ + + + + winboll.cc + + diff --git a/aes/src/stage/AndroidManifest.xml b/aes/src/stage/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/aes/src/stage/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/aes/src/stage/res/values/strings.xml b/aes/src/stage/res/values/strings.xml new file mode 100644 index 0000000..ace0c41 --- /dev/null +++ b/aes/src/stage/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/androiddemo/.gitignore b/androiddemo/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/androiddemo/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/androiddemo/app_update_description.txt b/androiddemo/app_update_description.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/androiddemo/app_update_description.txt @@ -0,0 +1 @@ + diff --git a/androiddemo/build.gradle b/androiddemo/build.gradle new file mode 100644 index 0000000..d32957f --- /dev/null +++ b/androiddemo/build.gradle @@ -0,0 +1,72 @@ +apply plugin: 'com.android.application' +apply from: '../.winboll/winboll_app_build.gradle' +apply from: '../.winboll/winboll_lint_build.gradle' + +def genVersionName(def versionName){ + // 检查编译标志位配置 + assert (winbollBuildProps['stageCount'] != null) + assert (winbollBuildProps['baseVersion'] != null) + // 保存基础版本号 + winbollBuildProps.setProperty("baseVersion", "${versionName}"); + //保存编译标志配置 + FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile) + winbollBuildProps.store(fos, "${winbollBuildPropsDesc}"); + fos.close(); + + // 返回编译版本号 + return "${versionName}." + winbollBuildProps['stageCount'] +} + +android { + compileSdkVersion 32 + buildToolsVersion "32.0.0" + + defaultConfig { + applicationId "cc.winboll.studio.androiddemo" + minSdkVersion 24 + targetSdkVersion 30 + versionCode 1 + // versionName 更新后需要手动设置 + // .winboll/winbollBuildProps.properties 文件的 stageCount=0 + // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" + versionName "15.0" + if(true) { + versionName = genVersionName("${versionName}") + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + api fileTree(dir: 'libs', include: ['*.jar']) + + // Android 类库 + //api 'com.android.support:appcompat-v7:28.0.0' + api('com.android.support:appcompat-v7:28.0.0'){ + //exclude group: "com.android.support", module: "support-vector-drawable" + exclude group: "com.android.support:animated-vector-drawable:28.0.0" + } + // https://mvnrepository.com/artifact/com.android.support/support-compat + api 'com.android.support:support-compat:28.0.0' // 保留原有依赖(可选) + // https://mvnrepository.com/artifact/com.android.support/support-v4 + api 'com.android.support:support-v4:28.0.0' + // https://mvnrepository.com/artifact/com.android.support/support-media-compat + api 'com.android.support:support-media-compat:28.0.0' + // https://mvnrepository.com/artifact/com.android.support/support-core-utils + api 'com.android.support:support-core-utils:28.0.0' + // https://mvnrepository.com/artifact/com.android.support/support-core-ui + api 'com.android.support:support-core-ui:28.0.0' + // https://mvnrepository.com/artifact/com.android.support/support-fragment + api 'com.android.support:support-fragment:28.0.0' + // https://mvnrepository.com/artifact/com.android.support/recyclerview-v7 + api 'com.android.support:recyclerview-v7:28.0.0' + + api 'cc.winboll.studio:libapputils:15.8.5' + api 'cc.winboll.studio:libappbase:15.9.5' +} diff --git a/androiddemo/build.properties b/androiddemo/build.properties new file mode 100644 index 0000000..5e7cbee --- /dev/null +++ b/androiddemo/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Sun Aug 31 05:11:26 CST 2025 +stageCount=1 +libraryProject= +baseVersion=15.0 +publishVersion=15.0.0 +buildCount=0 +baseBetaVersion=15.0.1 diff --git a/androiddemo/proguard-rules.pro b/androiddemo/proguard-rules.pro new file mode 100644 index 0000000..64b4a05 --- /dev/null +++ b/androiddemo/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/androiddemo/src/beta/AndroidManifest.xml b/androiddemo/src/beta/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/androiddemo/src/beta/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/androiddemo/src/beta/res/values/strings.xml b/androiddemo/src/beta/res/values/strings.xml new file mode 100644 index 0000000..e0c92e9 --- /dev/null +++ b/androiddemo/src/beta/res/values/strings.xml @@ -0,0 +1,7 @@ + + + + + Android Demo + + + diff --git a/androiddemo/src/main/AndroidManifest.xml b/androiddemo/src/main/AndroidManifest.xml new file mode 100644 index 0000000..57a1145 --- /dev/null +++ b/androiddemo/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/androiddemo/src/main/java/cc/winboll/studio/androiddemo/App.java b/androiddemo/src/main/java/cc/winboll/studio/androiddemo/App.java new file mode 100644 index 0000000..54f102f --- /dev/null +++ b/androiddemo/src/main/java/cc/winboll/studio/androiddemo/App.java @@ -0,0 +1,334 @@ +package cc.winboll.studio.androiddemo; + +import android.app.Activity; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.res.Resources; +import android.graphics.Typeface; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.text.TextUtils; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.ViewGroup; +import android.widget.HorizontalScrollView; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; +import cc.winboll.studio.libappbase.GlobalApplication; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.Thread.UncaughtExceptionHandler; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.concurrent.atomic.AtomicBoolean; + +public class App extends GlobalApplication { + + private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper()); + + @Override + public void onCreate() { + super.onCreate(); + //CrashHandler.getInstance().registerGlobal(this); + //CrashHandler.getInstance().registerPart(this); + } + + public static void write(InputStream input, OutputStream output) throws IOException { + byte[] buf = new byte[1024 * 8]; + int len; + while ((len = input.read(buf)) != -1) { + output.write(buf, 0, len); + } + } + + public static void write(File file, byte[] data) throws IOException { + File parent = file.getParentFile(); + if (parent != null && !parent.exists()) parent.mkdirs(); + + ByteArrayInputStream input = new ByteArrayInputStream(data); + FileOutputStream output = new FileOutputStream(file); + try { + write(input, output); + } finally { + closeIO(input, output); + } + } + + public static String toString(InputStream input) throws IOException { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + write(input, output); + try { + return output.toString("UTF-8"); + } finally { + closeIO(input, output); + } + } + + public static void closeIO(Closeable... closeables) { + for (Closeable closeable : closeables) { + try { + if (closeable != null) closeable.close(); + } catch (IOException ignored) {} + } + } + + public static class CrashHandler { + + public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler(); + + private static CrashHandler sInstance; + + private PartCrashHandler mPartCrashHandler; + + public static CrashHandler getInstance() { + if (sInstance == null) { + sInstance = new CrashHandler(); + } + return sInstance; + } + + public void registerGlobal(Context context) { + registerGlobal(context, null); + } + + public void registerGlobal(Context context, String crashDir) { + Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir)); + } + + public void unregister() { + Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER); + } + + public void registerPart(Context context) { + unregisterPart(context); + mPartCrashHandler = new PartCrashHandler(context.getApplicationContext()); + MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler); + } + + public void unregisterPart(Context context) { + if (mPartCrashHandler != null) { + mPartCrashHandler.isRunning.set(false); + mPartCrashHandler = null; + } + } + + private static class PartCrashHandler implements Runnable { + + private final Context mContext; + + public AtomicBoolean isRunning = new AtomicBoolean(true); + + public PartCrashHandler(Context context) { + this.mContext = context; + } + + @Override + public void run() { + while (isRunning.get()) { + try { + Looper.loop(); + } catch (final Throwable e) { + e.printStackTrace(); + if (isRunning.get()) { + MAIN_HANDLER.post(new Runnable(){ + + @Override + public void run() { + Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show(); + } + }); + } else { + if (e instanceof RuntimeException) { + throw (RuntimeException)e; + } else { + throw new RuntimeException(e); + } + } + } + } + } + } + + private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler { + + private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss"); + + private final Context mContext; + + private final File mCrashDir; + + public UncaughtExceptionHandlerImpl(Context context, String crashDir) { + this.mContext = context; + this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir); + } + + @Override + public void uncaughtException(Thread thread, Throwable throwable) { + try { + + String log = buildLog(throwable); + writeLog(log); + + try { + Intent intent = new Intent(mContext, CrashActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra(Intent.EXTRA_TEXT, log); + mContext.startActivity(intent); + } catch (Throwable e) { + e.printStackTrace(); + writeLog(e.toString()); + } + + throwable.printStackTrace(); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(0); + + } catch (Throwable e) { + if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable); + } + } + + private String buildLog(Throwable throwable) { + String time = DATE_FORMAT.format(new Date()); + + String versionName = "unknown"; + long versionCode = 0; + try { + PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0); + versionName = packageInfo.versionName; + versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode; + } catch (Throwable ignored) {} + + LinkedHashMap head = new LinkedHashMap(); + 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(); + } + } +} diff --git a/androiddemo/src/main/java/cc/winboll/studio/androiddemo/MainActivity.java b/androiddemo/src/main/java/cc/winboll/studio/androiddemo/MainActivity.java new file mode 100644 index 0000000..cfde770 --- /dev/null +++ b/androiddemo/src/main/java/cc/winboll/studio/androiddemo/MainActivity.java @@ -0,0 +1,25 @@ +package cc.winboll.studio.androiddemo; + +import android.app.Activity; +import android.os.Bundle; +import cc.winboll.studio.libappbase.LogView; + +public class MainActivity extends Activity { + + LogView mLogView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + mLogView = findViewById(R.id.logview); + mLogView.start(); + } + + @Override + protected void onResume() { + super.onResume(); + mLogView.start(); + } +} diff --git a/androiddemo/src/main/res/drawable/ic_launcher.png b/androiddemo/src/main/res/drawable/ic_launcher.png new file mode 100644 index 0000000..b824ebd Binary files /dev/null and b/androiddemo/src/main/res/drawable/ic_launcher.png differ diff --git a/androiddemo/src/main/res/layout/activity_main.xml b/androiddemo/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..40d2031 --- /dev/null +++ b/androiddemo/src/main/res/layout/activity_main.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + diff --git a/androiddemo/src/main/res/values-v21/styles.xml b/androiddemo/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..0aed032 --- /dev/null +++ b/androiddemo/src/main/res/values-v21/styles.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/androiddemo/src/main/res/values/colors.xml b/androiddemo/src/main/res/values/colors.xml new file mode 100644 index 0000000..294809a --- /dev/null +++ b/androiddemo/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #009688 + #00796B + #FF9800 + \ No newline at end of file diff --git a/androiddemo/src/main/res/values/strings.xml b/androiddemo/src/main/res/values/strings.xml new file mode 100644 index 0000000..21acbbd --- /dev/null +++ b/androiddemo/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + Android Demo + diff --git a/androiddemo/src/main/res/values/styles.xml b/androiddemo/src/main/res/values/styles.xml new file mode 100644 index 0000000..6799c28 --- /dev/null +++ b/androiddemo/src/main/res/values/styles.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/androiddemo/src/stage/AndroidManifest.xml b/androiddemo/src/stage/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/androiddemo/src/stage/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/androiddemo/src/stage/res/values/strings.xml b/androiddemo/src/stage/res/values/strings.xml new file mode 100644 index 0000000..ace0c41 --- /dev/null +++ b/androiddemo/src/stage/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/androidxdemo/.gitignore b/androidxdemo/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/androidxdemo/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/androidxdemo/app_update_description.txt b/androidxdemo/app_update_description.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/androidxdemo/app_update_description.txt @@ -0,0 +1 @@ + diff --git a/androidxdemo/build.gradle b/androidxdemo/build.gradle new file mode 100644 index 0000000..a3c520e --- /dev/null +++ b/androidxdemo/build.gradle @@ -0,0 +1,73 @@ +apply plugin: 'com.android.application' +apply from: '../.winboll/winboll_app_build.gradle' +apply from: '../.winboll/winboll_lint_build.gradle' + +def genVersionName(def versionName){ + // 检查编译标志位配置 + assert (winbollBuildProps['stageCount'] != null) + assert (winbollBuildProps['baseVersion'] != null) + // 保存基础版本号 + winbollBuildProps.setProperty("baseVersion", "${versionName}"); + //保存编译标志配置 + FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile) + winbollBuildProps.store(fos, "${winbollBuildPropsDesc}"); + fos.close(); + + // 返回编译版本号 + return "${versionName}." + winbollBuildProps['stageCount'] +} + +android { + compileSdkVersion 32 + buildToolsVersion "32.0.0" + + defaultConfig { + applicationId "cc.winboll.studio.androidxdemo" + minSdkVersion 24 + targetSdkVersion 30 + versionCode 1 + // versionName 更新后需要手动设置 + // .winboll/winbollBuildProps.properties 文件的 stageCount=0 + // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" + versionName "15.1" + if(true) { + versionName = genVersionName("${versionName}") + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + api fileTree(dir: 'libs', include: ['*.jar']) + + // SSH + api 'com.jcraft:jsch:0.1.55' + // Html 解析 + api 'org.jsoup:jsoup:1.13.1' + // 二维码类库 + api 'com.google.zxing:core:3.4.1' + api 'com.journeyapps:zxing-android-embedded:3.6.0' + // 应用介绍页类库 + api 'io.github.medyo:android-about-page:2.0.0' + // 吐司类库 + api 'com.github.getActivity:ToastUtils:10.5' + // 网络连接类库 + api 'com.squareup.okhttp3:okhttp:4.4.1' + // AndroidX 类库 + api 'androidx.appcompat:appcompat:1.1.0' + api 'com.google.android.material:material:1.4.0' + //api 'androidx.viewpager:viewpager:1.0.0' + //api 'androidx.vectordrawable:vectordrawable:1.1.0' + //api 'androidx.vectordrawable:vectordrawable-animated:1.1.0' + //api 'androidx.fragment:fragment:1.1.0' + + api 'cc.winboll.studio:libaes:15.9.3' + api 'cc.winboll.studio:libapputils:15.8.5' + api 'cc.winboll.studio:libappbase:15.9.5' +} diff --git a/androidxdemo/build.properties b/androidxdemo/build.properties new file mode 100644 index 0000000..ac0d006 --- /dev/null +++ b/androidxdemo/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Sun Aug 31 05:42:50 CST 2025 +stageCount=2 +libraryProject= +baseVersion=15.1 +publishVersion=15.1.1 +buildCount=0 +baseBetaVersion=15.1.2 diff --git a/androidxdemo/proguard-rules.pro b/androidxdemo/proguard-rules.pro new file mode 100644 index 0000000..64b4a05 --- /dev/null +++ b/androidxdemo/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/androidxdemo/src/beta/AndroidManifest.xml b/androidxdemo/src/beta/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/androidxdemo/src/beta/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/androidxdemo/src/beta/res/values/strings.xml b/androidxdemo/src/beta/res/values/strings.xml new file mode 100644 index 0000000..bf50bcf --- /dev/null +++ b/androidxdemo/src/beta/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + AndroidX Demo + + + diff --git a/androidxdemo/src/main/AndroidManifest.xml b/androidxdemo/src/main/AndroidManifest.xml new file mode 100644 index 0000000..1b70e90 --- /dev/null +++ b/androidxdemo/src/main/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/androidxdemo/src/main/java/cc/winboll/studio/androidxdemo/App.java b/androidxdemo/src/main/java/cc/winboll/studio/androidxdemo/App.java new file mode 100644 index 0000000..825cb09 --- /dev/null +++ b/androidxdemo/src/main/java/cc/winboll/studio/androidxdemo/App.java @@ -0,0 +1,345 @@ +package cc.winboll.studio.androidxdemo; + +import android.app.Activity; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.res.Resources; +import android.graphics.Typeface; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.text.TextUtils; +import android.util.Log; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuItem; +import android.view.ViewGroup; +import android.widget.HorizontalScrollView; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; +import cc.winboll.studio.libappbase.GlobalApplication; +import com.hjq.toast.ToastUtils; +import com.hjq.toast.style.WhiteToastStyle; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.Thread.UncaughtExceptionHandler; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.concurrent.atomic.AtomicBoolean; + +public class App extends GlobalApplication { + + private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper()); + + @Override + public void onCreate() { + super.onCreate(); + + // 初始化 Toast 框架 + ToastUtils.init(this); + // 设置 Toast 布局样式 + //ToastUtils.setView(R.layout.view_toast); + ToastUtils.setStyle(new WhiteToastStyle()); + ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); + + //CrashHandler.getInstance().registerGlobal(this); + //CrashHandler.getInstance().registerPart(this); + } + + public static void write(InputStream input, OutputStream output) throws IOException { + byte[] buf = new byte[1024 * 8]; + int len; + while ((len = input.read(buf)) != -1) { + output.write(buf, 0, len); + } + } + + public static void write(File file, byte[] data) throws IOException { + File parent = file.getParentFile(); + if (parent != null && !parent.exists()) parent.mkdirs(); + + ByteArrayInputStream input = new ByteArrayInputStream(data); + FileOutputStream output = new FileOutputStream(file); + try { + write(input, output); + } finally { + closeIO(input, output); + } + } + + public static String toString(InputStream input) throws IOException { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + write(input, output); + try { + return output.toString("UTF-8"); + } finally { + closeIO(input, output); + } + } + + public static void closeIO(Closeable... closeables) { + for (Closeable closeable : closeables) { + try { + if (closeable != null) closeable.close(); + } catch (IOException ignored) {} + } + } + + public static class CrashHandler { + + public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler(); + + private static CrashHandler sInstance; + + private PartCrashHandler mPartCrashHandler; + + public static CrashHandler getInstance() { + if (sInstance == null) { + sInstance = new CrashHandler(); + } + return sInstance; + } + + public void registerGlobal(Context context) { + registerGlobal(context, null); + } + + public void registerGlobal(Context context, String crashDir) { + Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir)); + } + + public void unregister() { + Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER); + } + + public void registerPart(Context context) { + unregisterPart(context); + mPartCrashHandler = new PartCrashHandler(context.getApplicationContext()); + MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler); + } + + public void unregisterPart(Context context) { + if (mPartCrashHandler != null) { + mPartCrashHandler.isRunning.set(false); + mPartCrashHandler = null; + } + } + + private static class PartCrashHandler implements Runnable { + + private final Context mContext; + + public AtomicBoolean isRunning = new AtomicBoolean(true); + + public PartCrashHandler(Context context) { + this.mContext = context; + } + + @Override + public void run() { + while (isRunning.get()) { + try { + Looper.loop(); + } catch (final Throwable e) { + e.printStackTrace(); + if (isRunning.get()) { + MAIN_HANDLER.post(new Runnable(){ + + @Override + public void run() { + Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show(); + } + }); + } else { + if (e instanceof RuntimeException) { + throw (RuntimeException)e; + } else { + throw new RuntimeException(e); + } + } + } + } + } + } + + private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler { + + private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss"); + + private final Context mContext; + + private final File mCrashDir; + + public UncaughtExceptionHandlerImpl(Context context, String crashDir) { + this.mContext = context; + this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir); + } + + @Override + public void uncaughtException(Thread thread, Throwable throwable) { + try { + + String log = buildLog(throwable); + writeLog(log); + + try { + Intent intent = new Intent(mContext, CrashActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra(Intent.EXTRA_TEXT, log); + mContext.startActivity(intent); + } catch (Throwable e) { + e.printStackTrace(); + writeLog(e.toString()); + } + + throwable.printStackTrace(); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(0); + + } catch (Throwable e) { + if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable); + } + } + + private String buildLog(Throwable throwable) { + String time = DATE_FORMAT.format(new Date()); + + String versionName = "unknown"; + long versionCode = 0; + try { + PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0); + versionName = packageInfo.versionName; + versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode; + } catch (Throwable ignored) {} + + LinkedHashMap head = new LinkedHashMap(); + 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(); + } + } +} diff --git a/androidxdemo/src/main/java/cc/winboll/studio/androidxdemo/MainActivity.java b/androidxdemo/src/main/java/cc/winboll/studio/androidxdemo/MainActivity.java new file mode 100644 index 0000000..6755e6f --- /dev/null +++ b/androidxdemo/src/main/java/cc/winboll/studio/androidxdemo/MainActivity.java @@ -0,0 +1,31 @@ +package cc.winboll.studio.androidxdemo; + +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import cc.winboll.studio.libappbase.LogView; +import com.hjq.toast.ToastUtils; + +public class MainActivity extends AppCompatActivity { + + LogView mLogView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + mLogView = findViewById(R.id.logview); + + ToastUtils.show("onCreate"); + } + + @Override + protected void onResume() { + super.onResume(); + mLogView.start(); + } +} diff --git a/androidxdemo/src/main/res/drawable-v24/ic_launcher_foreground.xml b/androidxdemo/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/androidxdemo/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/androidxdemo/src/main/res/drawable/ic_launcher_background.xml b/androidxdemo/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/androidxdemo/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/androidxdemo/src/main/res/layout/activity_main.xml b/androidxdemo/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..12fdc32 --- /dev/null +++ b/androidxdemo/src/main/res/layout/activity_main.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/androidxdemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/androidxdemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/androidxdemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/androidxdemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/androidxdemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/androidxdemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/androidxdemo/src/main/res/mipmap-hdpi/ic_launcher.png b/androidxdemo/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a2f5908 Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/androidxdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png b/androidxdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..1b52399 Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/androidxdemo/src/main/res/mipmap-mdpi/ic_launcher.png b/androidxdemo/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..ff10afd Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/androidxdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png b/androidxdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..115a4c7 Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/androidxdemo/src/main/res/mipmap-xhdpi/ic_launcher.png b/androidxdemo/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..dcd3cd8 Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/androidxdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/androidxdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..459ca60 Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/androidxdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png b/androidxdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..8ca12fe Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/androidxdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/androidxdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8e19b41 Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/androidxdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/androidxdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..b824ebd Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/androidxdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/androidxdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..4c19a13 Binary files /dev/null and b/androidxdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/androidxdemo/src/main/res/values/colors.xml b/androidxdemo/src/main/res/values/colors.xml new file mode 100644 index 0000000..479769a --- /dev/null +++ b/androidxdemo/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #009688 + #00796B + #FF9800 + \ No newline at end of file diff --git a/androidxdemo/src/main/res/values/strings.xml b/androidxdemo/src/main/res/values/strings.xml new file mode 100644 index 0000000..6aea12c --- /dev/null +++ b/androidxdemo/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + AndroidX Demo + + diff --git a/androidxdemo/src/main/res/values/styles.xml b/androidxdemo/src/main/res/values/styles.xml new file mode 100644 index 0000000..a70e242 --- /dev/null +++ b/androidxdemo/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/androidxdemo/src/stage/AndroidManifest.xml b/androidxdemo/src/stage/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/androidxdemo/src/stage/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/androidxdemo/src/stage/res/values/strings.xml b/androidxdemo/src/stage/res/values/strings.xml new file mode 100644 index 0000000..ace0c41 --- /dev/null +++ b/androidxdemo/src/stage/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/appbase/.gitignore b/appbase/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/appbase/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/appbase/app_update_description.txt b/appbase/app_update_description.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/appbase/app_update_description.txt @@ -0,0 +1 @@ + diff --git a/appbase/build.gradle b/appbase/build.gradle new file mode 100644 index 0000000..0d5af49 --- /dev/null +++ b/appbase/build.gradle @@ -0,0 +1,52 @@ +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 { + + // 1. compileSdkVersion:必须 ≥ targetSdkVersion,建议直接等于 targetSdkVersion(30) + compileSdkVersion 30 + + // 2. buildToolsVersion:需匹配 compileSdkVersion,建议使用 30.x.x 最新稳定版(无需高于 compileSdkVersion) + buildToolsVersion "30.0.3" // 这是 30 对应的最新稳定版,避免使用 beta 版 + + defaultConfig { + applicationId "cc.winboll.studio.appbase" + minSdkVersion 23 + targetSdkVersion 30 + versionCode 1 + // versionName 更新后需要手动设置 + // .winboll/winbollBuildProps.properties 文件的 stageCount=0 + // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" + versionName "15.11" + if(true) { + versionName = genVersionName("${versionName}") + } + } + + // 确保 Java 7 兼容性(已适配项目技术栈) + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } +} + +dependencies { + api project(':libappbase') + api fileTree(dir: 'libs', include: ['*.jar']) +} diff --git a/appbase/build.properties b/appbase/build.properties new file mode 100644 index 0000000..ca3c782 --- /dev/null +++ b/appbase/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Fri Nov 21 11:41:04 HKT 2025 +stageCount=2 +libraryProject=libappbase +baseVersion=15.11 +publishVersion=15.11.1 +buildCount=0 +baseBetaVersion=15.11.2 diff --git a/appbase/proguard-rules.pro b/appbase/proguard-rules.pro new file mode 100644 index 0000000..574eeec --- /dev/null +++ b/appbase/proguard-rules.pro @@ -0,0 +1,126 @@ +# 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 *; +#} + +# ============================== 基础通用规则 ============================== +# 保留系统组件 +-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 public class * extends com.winboll.WinBoLLActivity +#-keep public class * extends com.winboll.WinBoLLFragment +# 主包名 +-keep class cc.winboll.studio.*.** { *; } +# beta包名 +-keep class cc.winboll.studio.*.beta.** { *; } +-keepclassmembers class cc.winboll.studio.*.** { *; } +-keepclassmembers class cc.winboll.studio.*.beta.** { *; } + +# 保留所有类中的 public static final String TAG 字段 +-keepclassmembers class * { + public static final java.lang.String TAG; +} + +# 保留序列化类 +-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 文件 +-keepclassmembers class **.R$* { + public static ; +} + +# 保留 native 方法 +-keepclasseswithmembernames class * { + native ; +} + +# 保留注解和泛型 +-keepattributes *Annotation* +-keepattributes Signature + +# 屏蔽 Java 8+ 警告(适配 Java 7) +-dontwarn java.lang.invoke.* +-dontwarn android.support.v8.renderscript.* +-dontwarn java.util.function.** + +# ============================== 第三方框架规则 ============================== +# Retrofit + OkHttp +-keep class retrofit2.** { *; } +-keep interface retrofit2.** { *; } +-keep class okhttp3.** { *; } +-keep interface okhttp3.** { *; } +-keep class okio.** { *; } +-keepclasseswithmembers class * { + @retrofit2.http.* ; +} + +# Glide 4.x +-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 *; +} +-dontwarn com.bumptech.glide.load.resource.bitmap.VideoDecoder + +# GreenDAO 3.x +-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao { + public static java.lang.String TABLENAME; +} +-keep class **$Properties +# 实体类包名(按实际调整) +#-keep class cc.winboll.studio.appbase.model.** { *; } + +# ButterKnife 8.x +-keep class butterknife.** { *; } +-dontwarn butterknife.internal.** +-keep class **$$ViewBinder { *; } +-keepclasseswithmembernames class * { + @butterknife.BindView ; + @butterknife.OnClick ; +} + +# EventBus 3.x +-keepclassmembers class ** { + @org.greenrobot.eventbus.Subscribe ; +} +-keep enum org.greenrobot.eventbus.ThreadMode { *; } + +# ============================== 优化与调试 ============================== +-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* +-optimizationpasses 5 +-verbose +-dontpreverify +-dontusemixedcaseclassnames +# 保留行号(便于崩溃定位) +-keepattributes SourceFile,LineNumberTable + diff --git a/appbase/src/beta/AndroidManifest.xml b/appbase/src/beta/AndroidManifest.xml new file mode 100644 index 0000000..105d636 --- /dev/null +++ b/appbase/src/beta/AndroidManifest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/appbase/src/beta/res/values/strings.xml b/appbase/src/beta/res/values/strings.xml new file mode 100644 index 0000000..024cdd2 --- /dev/null +++ b/appbase/src/beta/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + AppBase+ + + diff --git a/appbase/src/main/AndroidManifest.xml b/appbase/src/main/AndroidManifest.xml new file mode 100644 index 0000000..284d7af --- /dev/null +++ b/appbase/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/App.java b/appbase/src/main/java/cc/winboll/studio/appbase/App.java new file mode 100644 index 0000000..888d581 --- /dev/null +++ b/appbase/src/main/java/cc/winboll/studio/appbase/App.java @@ -0,0 +1,40 @@ +package cc.winboll.studio.appbase; + +import cc.winboll.studio.libappbase.GlobalApplication; +import cc.winboll.studio.libappbase.ToastUtils; + +/** + * @Author ZhanGSKen + * @Date 2025/01/05 09:54:42 + * @Describe 应用全局入口类(继承基础库 GlobalApplication) + * 负责应用初始化、全局资源管理与生命周期回调处理,是整个应用的核心入口 + */ +public class App extends GlobalApplication { + + /** 当前应用类的日志 TAG(用于调试输出,标识日志来源) */ + public static final String TAG = "App"; + + /** + * 应用创建时回调(全局初始化入口) + * 在应用进程启动时执行,仅调用一次,用于初始化全局工具类、第三方库等 + */ + @Override + public void onCreate() { + super.onCreate(); // 调用父类初始化逻辑(如基础库配置、全局上下文设置) + // 初始化 Toast 工具类(传入应用全局上下文,确保 Toast 可在任意地方调用) + ToastUtils.init(getApplicationContext()); + } + + /** + * 应用终止时回调(资源释放入口) + * 仅在模拟环境(如 Android Studio 模拟器)中可靠触发,真机上可能因系统回收进程不执行 + * 用于释放全局资源,避免内存泄漏 + */ + @Override + public void onTerminate() { + super.onTerminate(); // 调用父类终止逻辑(如基础库资源释放) + // 释放 Toast 工具类资源(销毁全局 Toast 实例,避免内存泄漏) + ToastUtils.release(); + } +} + diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/MainActivity.java b/appbase/src/main/java/cc/winboll/studio/appbase/MainActivity.java new file mode 100644 index 0000000..387fab3 --- /dev/null +++ b/appbase/src/main/java/cc/winboll/studio/appbase/MainActivity.java @@ -0,0 +1,140 @@ +package cc.winboll.studio.appbase; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.Toolbar; +import cc.winboll.studio.appbase.R; +import cc.winboll.studio.libappbase.LogActivity; +import cc.winboll.studio.libappbase.LogUtils; +import cc.winboll.studio.libappbase.ToastUtils; + +/** + * @Author ZhanGSKen + * @Date 未标注(建议补充创建日期) + * @Describe 应用主界面 Activity(入口界面) + * 包含功能测试按钮(崩溃测试、日志查看、Toast测试)、顶部工具栏(菜单功能),是应用交互的核心入口 + */ +public class MainActivity extends Activity { + + /** 当前 Activity 的日志 TAG(用于调试输出,标识日志来源) */ + public static final String TAG = "MainActivity"; + + /** 顶部工具栏(用于展示标题、菜单,绑定布局中的 Toolbar 控件) */ + private Toolbar mToolbar; + + /** + * Activity 创建时回调(初始化界面) + * 在 Activity 首次创建时执行,用于加载布局、初始化控件、设置事件监听 + * @param savedInstanceState 保存 Activity 状态的 Bundle(如屏幕旋转时的数据恢复) + */ + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ToastUtils.show("onCreate"); // 显示 Activity 创建提示(调试用) + setContentView(R.layout.activity_main); // 加载主界面布局 + + // 初始化 Toolbar 并设置为 ActionBar + mToolbar = findViewById(R.id.toolbar); + setActionBar(mToolbar); // 将 Toolbar 替代系统默认 ActionBar + } + + /** + * 创建菜单时回调(加载工具栏菜单) + * 初始化 ActionBar 菜单,加载自定义菜单布局 + * @param menu 菜单对象(用于承载菜单项) + * @return true:显示菜单;false:不显示菜单 + */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // 加载菜单布局(R.menu.toolbar_main 为自定义菜单文件) + getMenuInflater().inflate(R.menu.toolbar_main, menu); + return super.onCreateOptionsMenu(menu); + } + + /** + * 菜单 item 点击时回调(处理菜单事件) + * 响应 Toolbar 菜单项的点击事件,执行对应业务逻辑 + * @param item 被点击的菜单项 + * @return true:消费点击事件;false:不消费(传递给父类) + */ + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.item_home: + // 点击 "首页/官网" 菜单项,唤起浏览器打开指定网站 + openWebsiteInBrowser(this); + break; + // 可扩展其他菜单项(如设置、关于等)的处理逻辑 + } + return super.onOptionsItemSelected(item); + } + + /** + * 崩溃测试按钮点击事件(触发应用崩溃,用于调试异常捕获) + * 故意执行非法操作(循环获取不存在的字符串资源),强制应用崩溃 + * @param view 触发事件的 View(对应布局中的崩溃测试按钮) + */ + public void onCrashTest(View view) { + // 循环从 Integer.MIN_VALUE 到 Integer.MAX_VALUE,获取不存在的字符串资源 ID,触发崩溃 + for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; i++) { + getString(i); // i 超出资源 ID 范围,抛出 Resources.NotFoundException 导致崩溃 + } + } + + /** + * 日志测试按钮点击事件(打开日志查看界面) + * 启动 LogActivity,用于查看应用运行日志 + * @param view 触发事件的 View(对应布局中的日志测试按钮) + */ + public void onLogTest(View view) { + // 启动日志查看 Activity(通过静态方法传入上下文,简化跳转逻辑) + LogActivity.startLogActivity(this); + } + + /** + * Toast 工具测试按钮点击事件(测试全局 Toast 功能) + * 测试主线程、子线程中 Toast 的显示效果,验证 ToastUtils 的可用性 + * @param view 触发事件的 View(对应布局中的 Toast 测试按钮) + */ + public void onToastUtilsTest(View view) { + LogUtils.d(TAG, "onToastUtilsTest"); // 打印调试日志,标识进入 Toast 测试 + ToastUtils.show("Hello, WinBoLL!"); // 主线程显示 Toast + + // 开启子线程,延迟 2 秒后显示 Toast(测试子线程 Toast 兼容性) + new Thread(new Runnable() { + @Override + public void run() { + try { + Thread.sleep(2000); // 线程休眠 2 秒 + // 若 ToastUtils 已处理主线程切换,此处可直接调用;否则需通过 Handler 切换到主线程 + ToastUtils.show("Thread.sleep(2000);ToastUtils.show..."); + } catch (InterruptedException e) { + // 捕获线程中断异常(如线程被销毁时),不做处理(测试场景) + e.printStackTrace(); + } + } + }).start(); + } + + /** + * 唤起系统默认浏览器打开指定网站(跳转至应用官网) + * 通过 Intent.ACTION_VIEW 隐式意图,触发浏览器打开目标 URL + * @param context 上下文对象(如 Activity、Application,此处为 MainActivity) + */ + public void openWebsiteInBrowser(Context context) { + String url = "https://www.winboll.cc"; // 目标网站 URL(应用官网) + // 构建隐式意图:ACTION_VIEW 表示查看指定数据(Uri 为网站地址) + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + // 设置标志:在新的任务栈中启动 Activity(避免与当前应用任务栈混淆) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + // 启动意图(唤起浏览器) + context.startActivity(intent); + } +} + diff --git a/appbase/src/main/res/drawable/btn_light_blue.xml b/appbase/src/main/res/drawable/btn_light_blue.xml new file mode 100644 index 0000000..58415fd --- /dev/null +++ b/appbase/src/main/res/drawable/btn_light_blue.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/appbase/src/main/res/layout/activity_main.xml b/appbase/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..5ba647d --- /dev/null +++ b/appbase/src/main/res/layout/activity_main.xml @@ -0,0 +1,67 @@ + + + + + + + + + +