Merge remote-tracking branch 'origin/appbase' into powerbell
This commit is contained in:
commit
103c1101ce
@ -1,4 +1,4 @@
|
|||||||
## WinBoll 主机编译事项提醒
|
## WinBoLL 主机编译事项提醒
|
||||||
|
|
||||||
## 类库类型源码发布
|
## 类库类型源码发布
|
||||||
# 类库发布使用以下面命令
|
# 类库发布使用以下面命令
|
||||||
|
@ -37,7 +37,7 @@ fi
|
|||||||
# 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值
|
# 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值
|
||||||
PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}')
|
PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}')
|
||||||
echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >"
|
echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >"
|
||||||
## 设新的 WinBoll 标签
|
## 设新的 WinBoLL 标签
|
||||||
# 脚本调试时使用
|
# 脚本调试时使用
|
||||||
#tag="v7.6.4-test1"
|
#tag="v7.6.4-test1"
|
||||||
# 正式设置标签时使用
|
# 正式设置标签时使用
|
||||||
|
@ -38,24 +38,24 @@ function askAddWorkflowsTag {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function addWinBollTag {
|
function addWinBoLLTag {
|
||||||
# 就读取脚本 .winboll/winboll_app_build.gradle 生成的 publishVersion。
|
# 就读取脚本 .winboll/winboll_app_build.gradle 生成的 publishVersion。
|
||||||
# 如果文件中有 publishVersion 这一项,
|
# 如果文件中有 publishVersion 这一项,
|
||||||
# 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值
|
# 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值
|
||||||
PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}')
|
PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}')
|
||||||
echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >"
|
echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >"
|
||||||
## 设新的 WinBoll 标签
|
## 设新的 WinBoLL 标签
|
||||||
# 脚本调试时使用
|
# 脚本调试时使用
|
||||||
#tag="projectname-v7.6.4-test1"
|
#tag="projectname-v7.6.4-test1"
|
||||||
# 正式设置标签时使用
|
# 正式设置标签时使用
|
||||||
tag=$1"-v"${PUBLISH_VERSION}
|
tag=$1"-v"${PUBLISH_VERSION}
|
||||||
echo "< WinBoll Tag To: $tag >";
|
echo "< WinBoLL Tag To: $tag >";
|
||||||
# 检查是否已经添加了 WinBoll Tag
|
# 检查是否已经添加了 WinBoLL Tag
|
||||||
if [ "$(git tag -l ${tag})" == "${tag}" ]; then
|
if [ "$(git tag -l ${tag})" == "${tag}" ]; then
|
||||||
echo -e "< WinBoll Tag ${tag} exist! >"
|
echo -e "< WinBoLL Tag ${tag} exist! >"
|
||||||
return 1 # WinBoll标签重复
|
return 1 # WinBoLL标签重复
|
||||||
fi
|
fi
|
||||||
# 添加WinBoll标签
|
# 添加WinBoLL标签
|
||||||
git tag -a ${tag} -F $1/app_update_description.txt
|
git tag -a ${tag} -F $1/app_update_description.txt
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -119,22 +119,22 @@ if [[ $? -eq 0 ]]; then
|
|||||||
echo $result
|
echo $result
|
||||||
|
|
||||||
# 发布应用
|
# 发布应用
|
||||||
echo "Publishing WinBoll APK ..."
|
echo "Publishing WinBoLL APK ..."
|
||||||
# 脚本调试时使用
|
# 脚本调试时使用
|
||||||
#bash gradlew :$1:assembleBetaDebug
|
#bash gradlew :$1:assembleBetaDebug
|
||||||
# 正式发布
|
# 正式发布
|
||||||
bash gradlew :$1:assembleStageRelease
|
bash gradlew :$1:assembleStageRelease
|
||||||
echo "Publishing WinBoll APK OK."
|
echo "Publishing WinBoLL APK OK."
|
||||||
|
|
||||||
# 添加 WinBoll 标签
|
# 添加 WinBoLL 标签
|
||||||
result=$(addWinBollTag $1)
|
result=$(addWinBoLLTag $1)
|
||||||
echo $result
|
echo $result
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo $result
|
echo $result
|
||||||
# WinBoll 标签添加成功
|
# WinBoLL 标签添加成功
|
||||||
else
|
else
|
||||||
echo -e "${0}: addWinBollTag $1\n${result}\nAdd WinBoll tag cancel."
|
echo -e "${0}: addWinBoLLTag $1\n${result}\nAdd WinBoLL tag cancel."
|
||||||
exit 1 # addWinBollTag 异常
|
exit 1 # addWinBoLLTag 异常
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 添加 GitHub 工作流标签
|
# 添加 GitHub 工作流标签
|
||||||
|
@ -38,24 +38,24 @@ function askAddWorkflowsTag {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function addWinBollTag {
|
function addWinBoLLTag {
|
||||||
# 就读取脚本 .winboll/winboll_app_build.gradle 生成的 publishVersion。
|
# 就读取脚本 .winboll/winboll_app_build.gradle 生成的 publishVersion。
|
||||||
# 如果文件中有 publishVersion 这一项,
|
# 如果文件中有 publishVersion 这一项,
|
||||||
# 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值
|
# 使用grep找到包含"publishVersion="的那一行,然后用awk提取其后的值
|
||||||
PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}')
|
PUBLISH_VERSION=$(grep -o "publishVersion=.*" $1/build.properties | awk -F '=' '{print $2}')
|
||||||
echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >"
|
echo "< $1/build.properties publishVersion : ${PUBLISH_VERSION} >"
|
||||||
## 设新的 WinBoll 标签
|
## 设新的 WinBoLL 标签
|
||||||
# 脚本调试时使用
|
# 脚本调试时使用
|
||||||
#tag="v7.6.4-test1"
|
#tag="v7.6.4-test1"
|
||||||
# 正式调试版设置标签时使用
|
# 正式调试版设置标签时使用
|
||||||
tag=$1"-v"${PUBLISH_VERSION}"-debug"
|
tag=$1"-v"${PUBLISH_VERSION}"-debug"
|
||||||
echo "< WinBoll Tag To: $tag >";
|
echo "< WinBoLL Tag To: $tag >";
|
||||||
# 检查是否已经添加了 WinBoll Tag
|
# 检查是否已经添加了 WinBoLL Tag
|
||||||
if [ "$(git tag -l ${tag})" == "${tag}" ]; then
|
if [ "$(git tag -l ${tag})" == "${tag}" ]; then
|
||||||
echo -e "< WinBoll Tag ${tag} exist! >"
|
echo -e "< WinBoLL Tag ${tag} exist! >"
|
||||||
return 1 # WinBoll标签重复
|
return 1 # WinBoLL标签重复
|
||||||
fi
|
fi
|
||||||
# 添加WinBoll标签
|
# 添加WinBoLL标签
|
||||||
git tag -a ${tag} -F $1/app_update_description.txt
|
git tag -a ${tag} -F $1/app_update_description.txt
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -119,22 +119,22 @@ if [[ $? -eq 0 ]]; then
|
|||||||
echo $result
|
echo $result
|
||||||
|
|
||||||
# 发布应用
|
# 发布应用
|
||||||
echo "Publishing WinBoll Debug APK ..."
|
echo "Publishing WinBoLL Debug APK ..."
|
||||||
# 脚本调试时使用
|
# 脚本调试时使用
|
||||||
#bash gradlew :$1:assembleBetaDebug
|
#bash gradlew :$1:assembleBetaDebug
|
||||||
# 正式发布调试版
|
# 正式发布调试版
|
||||||
bash gradlew :$1:assembleStageDebug
|
bash gradlew :$1:assembleStageDebug
|
||||||
echo "Publishing WinBoll Debug APK OK."
|
echo "Publishing WinBoLL Debug APK OK."
|
||||||
|
|
||||||
# 添加 WinBoll 标签
|
# 添加 WinBoLL 标签
|
||||||
result=$(addWinBollTag $1)
|
result=$(addWinBoLLTag $1)
|
||||||
echo $result
|
echo $result
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo $result
|
echo $result
|
||||||
# WinBoll 标签添加成功
|
# WinBoLL 标签添加成功
|
||||||
else
|
else
|
||||||
echo -e "${0}: addWinBollTag $1\n${result}\nAdd WinBoll tag cancel."
|
echo -e "${0}: addWinBoLLTag $1\n${result}\nAdd WinBoLL tag cancel."
|
||||||
exit 1 # addWinBollTag 异常
|
exit 1 # addWinBoLLTag 异常
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 添加 GitHub 工作流标签
|
# 添加 GitHub 工作流标签
|
||||||
|
@ -8,7 +8,7 @@ if [ -z "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
## 正式发布使用
|
## 正式发布使用
|
||||||
git pull && bash gradlew :$1:publishReleasePublicationToWinBollReleaseRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1
|
git pull && bash gradlew :$1:publishReleasePublicationToWinBoLLReleaseRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1
|
||||||
|
|
||||||
## 调试使用
|
## 调试使用
|
||||||
#bash gradlew :$1:publishSnapshotWinBollPublicationToWinBollSnapshotRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1
|
#bash gradlew :$1:publishSnapshotWinBoLLPublicationToWinBoLLSnapshotRepository && bash .winboll/bashCommitLibReleaseBuildFlagInfo.sh $1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// WinBoll 应用签名配置
|
// WinBoLL 应用签名配置
|
||||||
//
|
//
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@ -31,18 +31,18 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "WinBollApp"
|
flavorDimensions "WinBoLLApp"
|
||||||
productFlavors {
|
productFlavors {
|
||||||
beta {
|
beta {
|
||||||
// 检查编译标志位配置
|
// 检查编译标志位配置
|
||||||
assert (winbollBuildProps['buildCount'] != null)
|
assert (winbollBuildProps['buildCount'] != null)
|
||||||
dimension "WinBollApp"
|
dimension "WinBoLLApp"
|
||||||
applicationIdSuffix ".beta"
|
applicationIdSuffix ".beta"
|
||||||
LocalDateTime localDateTimeNow = LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
|
LocalDateTime localDateTimeNow = LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
|
||||||
versionNameSuffix "-beta" + winbollBuildProps['buildCount'] + "_" + localDateTimeNow.format('mmss')
|
versionNameSuffix "-beta" + winbollBuildProps['buildCount'] + "_" + localDateTimeNow.format('mmss')
|
||||||
}
|
}
|
||||||
stage {
|
stage {
|
||||||
dimension "WinBollApp"
|
dimension "WinBoLLApp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// WinBoll 应用包输出配置
|
// WinBoLL 应用包输出配置
|
||||||
// 1. 配置 Stage Release 版应用包输出
|
// 1. 配置 Stage Release 版应用包输出
|
||||||
// 2. 配置 Beta Debug 版应用包输出
|
// 2. 配置 Beta Debug 版应用包输出
|
||||||
//
|
//
|
||||||
@ -74,13 +74,13 @@ android {
|
|||||||
//def outputFileName="${rootProject.name}_${versionName}.apk"
|
//def outputFileName="${rootProject.name}_${versionName}.apk"
|
||||||
def outputFileName=project.rootDir.name + "_${versionName}.apk"
|
def outputFileName=project.rootDir.name + "_${versionName}.apk"
|
||||||
|
|
||||||
// 创建 WinBoll Studio 发布接口文件夹
|
// 创建 WinBoLL Studio 发布接口文件夹
|
||||||
File fWinBollStudioDir = file("/sdcard/WinBollStudio/APKs");
|
File fWinBoLLStudioDir = file("/sdcard/WinBoLLStudio/APKs");
|
||||||
if(!fWinBollStudioDir.exists()) {
|
if(!fWinBoLLStudioDir.exists()) {
|
||||||
//fWinBollStudioDir.mkdirs();
|
//fWinBoLLStudioDir.mkdirs();
|
||||||
// 如果没有发布接口文件就不用进行APK发布和源码管理操作
|
// 如果没有发布接口文件就不用进行APK发布和源码管理操作
|
||||||
// 当前编译环境不是 WinBoll 主机, 以下将忽略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.'
|
println 'The current compilation environment is not in WinBoLL host, and the following APK publishing and source management operations will be ignore.'
|
||||||
} else {
|
} else {
|
||||||
/// WINBOLL 主机的 APK 发布和源码管理操作 ///
|
/// WINBOLL 主机的 APK 发布和源码管理操作 ///
|
||||||
variant.getAssembleProvider().get().doFirst {
|
variant.getAssembleProvider().get().doFirst {
|
||||||
@ -91,15 +91,15 @@ android {
|
|||||||
//
|
//
|
||||||
variant.getAssembleProvider().get().doLast {
|
variant.getAssembleProvider().get().doLast {
|
||||||
variant.outputs.forEach{ file->
|
variant.outputs.forEach{ file->
|
||||||
// 如果正在调试,就拷贝到 WinBoll 备份管理文件夹
|
// 如果正在调试,就拷贝到 WinBoLL 备份管理文件夹
|
||||||
//
|
//
|
||||||
if(variant.flavorName == "beta"&&variant.buildType.name == "debug"){
|
if(variant.flavorName == "beta"&&variant.buildType.name == "debug"){
|
||||||
//File outBuildBckDir = new File(fWinBollStudioDir, "/${rootProject.name}/${variant.buildType.name}")
|
//File outBuildBckDir = new File(fWinBoLLStudioDir, "/${rootProject.name}/${variant.buildType.name}")
|
||||||
File outBuildBckDir = new File(fWinBollStudioDir, "/" + project.rootDir.name + "/${variant.buildType.name}")
|
File outBuildBckDir = new File(fWinBoLLStudioDir, "/" + project.rootDir.name + "/${variant.buildType.name}")
|
||||||
// 创建目标路径目录
|
// 创建目标路径目录
|
||||||
if(!outBuildBckDir.exists()) {
|
if(!outBuildBckDir.exists()) {
|
||||||
outBuildBckDir.mkdirs();
|
outBuildBckDir.mkdirs();
|
||||||
println "Output Folder Created.(WinBollStudio) : " + outBuildBckDir.getAbsolutePath()
|
println "Output Folder Created.(WinBoLLStudio) : " + outBuildBckDir.getAbsolutePath()
|
||||||
}
|
}
|
||||||
if(outBuildBckDir.exists()) {
|
if(outBuildBckDir.exists()) {
|
||||||
copy{
|
copy{
|
||||||
@ -108,7 +108,7 @@ android {
|
|||||||
rename {
|
rename {
|
||||||
String fileName -> "${outputFileName}"
|
String fileName -> "${outputFileName}"
|
||||||
}
|
}
|
||||||
println "Output APK (WinBollStudio): " + outBuildBckDir.getAbsolutePath() + "/${outputFileName}"
|
println "Output APK (WinBoLLStudio): " + outBuildBckDir.getAbsolutePath() + "/${outputFileName}"
|
||||||
}
|
}
|
||||||
// 检查编译标志位配置
|
// 检查编译标志位配置
|
||||||
assert (winbollBuildProps['buildCount'] != null)
|
assert (winbollBuildProps['buildCount'] != null)
|
||||||
@ -137,7 +137,7 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果正在发布,就拷贝到 WinBoll 标签管理文件夹
|
// 如果正在发布,就拷贝到 WinBoLL 标签管理文件夹
|
||||||
//
|
//
|
||||||
if((variant.flavorName == "stage"&&variant.buildType.name == "debug")
|
if((variant.flavorName == "stage"&&variant.buildType.name == "debug")
|
||||||
|| (variant.flavorName == "stage"&&variant.buildType.name == "release")){
|
|| (variant.flavorName == "stage"&&variant.buildType.name == "release")){
|
||||||
@ -151,8 +151,8 @@ android {
|
|||||||
String szCommonTagAPKName = project.rootDir.name + "_" + szShortVersionName + ".apk"
|
String szCommonTagAPKName = project.rootDir.name + "_" + szShortVersionName + ".apk"
|
||||||
println "CommonTagAPKName is : " + szCommonTagAPKName
|
println "CommonTagAPKName is : " + szCommonTagAPKName
|
||||||
|
|
||||||
//File outTagDir = new File(fWinBollStudioDir, "/${rootProject.name}/tag/")
|
//File outTagDir = new File(fWinBoLLStudioDir, "/${rootProject.name}/tag/")
|
||||||
File outTagDir = new File(fWinBollStudioDir, "/" + project.rootDir.name + "/tag/")
|
File outTagDir = new File(fWinBoLLStudioDir, "/" + project.rootDir.name + "/tag/")
|
||||||
// 创建目标路径目录
|
// 创建目标路径目录
|
||||||
if(!outTagDir.exists()) {
|
if(!outTagDir.exists()) {
|
||||||
outTagDir.mkdirs();
|
outTagDir.mkdirs();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// 本机和 WinBoll Maven 仓库传输配置。
|
// 本机和 WinBoLL Maven 仓库传输配置。
|
||||||
//
|
//
|
||||||
|
|
||||||
def getDefaultVersion(){
|
def getDefaultVersion(){
|
||||||
@ -9,12 +9,12 @@ def getDefaultVersion(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
def siteUrl = 'https://winboll.cc/?page=studio/details.php&app=${rootProject.name}' // 项目主页
|
def siteUrl = 'https://winboll.cc/?page=studio/details.php&app=${rootProject.name}' // 项目主页
|
||||||
def gitUrl = 'https://gitea.winboll.cc/WinBoll/${rootProject.name}' // 项目的git地址
|
def gitUrl = 'https://gitea.winboll.cc/WinBoLL/${rootProject.name}' // 项目的git地址
|
||||||
def DefaultGroupId = 'cc.winboll.studio' // 类库所有者groupId
|
def DefaultGroupId = 'cc.winboll.studio' // 类库所有者groupId
|
||||||
def DefaultVersion = getDefaultVersion() // 版本号
|
def DefaultVersion = getDefaultVersion() // 版本号
|
||||||
def DeveloperId='zhangsken' // 开发者账号
|
def DeveloperId='zhangsken' // 开发者账号
|
||||||
def DeveloperName='ZhanGSKen' // 开发者名称
|
def DeveloperName='ZhanGSKen' // 开发者名称
|
||||||
def DeveloperEMail='ZhanGSKen@QQ.COM' // 开发者邮箱地址
|
def DeveloperEMail='zhangsken@188.com' // 开发者邮箱地址
|
||||||
def LicenseName='The Apache Software License, Version 2.0'
|
def LicenseName='The Apache Software License, Version 2.0'
|
||||||
def LicenseUrl='http://www.apache.org/licenses/LICENSE-2.0.txt'
|
def LicenseUrl='http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||||
|
|
||||||
@ -27,10 +27,10 @@ afterEvaluate {
|
|||||||
properties.load(file("${RootProjectDir}/${winbollFilePath}").newDataInputStream())
|
properties.load(file("${RootProjectDir}/${winbollFilePath}").newDataInputStream())
|
||||||
def NexusUserName = properties.getProperty("Nexus.name")
|
def NexusUserName = properties.getProperty("Nexus.name")
|
||||||
def NexusPassword = properties.getProperty("Nexus.password")
|
def NexusPassword = properties.getProperty("Nexus.password")
|
||||||
// WinBoll Release 仓库
|
// WinBoLL Release 仓库
|
||||||
maven{
|
maven{
|
||||||
//仓库的名字和地址
|
//仓库的名字和地址
|
||||||
name = "WinBollRelease"
|
name = "WinBoLLRelease"
|
||||||
url="https://nexus.winboll.cc/repository/maven-releases/"
|
url="https://nexus.winboll.cc/repository/maven-releases/"
|
||||||
// 仓库用户名密码
|
// 仓库用户名密码
|
||||||
credentials {
|
credentials {
|
||||||
@ -38,10 +38,10 @@ afterEvaluate {
|
|||||||
password = NexusPassword
|
password = NexusPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// WinBoll Snapshot 仓库
|
// WinBoLL Snapshot 仓库
|
||||||
maven{
|
maven{
|
||||||
//仓库的名字和地址
|
//仓库的名字和地址
|
||||||
name = "WinBollSnapshot"
|
name = "WinBoLLSnapshot"
|
||||||
url="https://nexus.winboll.cc/repository/maven-snapshots/"
|
url="https://nexus.winboll.cc/repository/maven-snapshots/"
|
||||||
// 仓库用户名密码
|
// 仓库用户名密码
|
||||||
credentials {
|
credentials {
|
||||||
@ -101,9 +101,9 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WinBoll Maven Release 仓库传输任务
|
// WinBoLL Maven Release 仓库传输任务
|
||||||
//
|
//
|
||||||
releaseWinBoll(MavenPublication) {
|
releaseWinBoLL(MavenPublication) {
|
||||||
// 需要使用的变体,假设有free和pay两个变体,可以选择一个
|
// 需要使用的变体,假设有free和pay两个变体,可以选择一个
|
||||||
//from components.free
|
//from components.free
|
||||||
|
|
||||||
@ -154,9 +154,9 @@ afterEvaluate {
|
|||||||
|
|
||||||
} // 创建名为 release 的任务结束
|
} // 创建名为 release 的任务结束
|
||||||
|
|
||||||
// WinBoll Maven Snapshot 仓库传输任务
|
// WinBoLL Maven Snapshot 仓库传输任务
|
||||||
//
|
//
|
||||||
snapshotWinBoll(MavenPublication) {
|
snapshotWinBoLL(MavenPublication) {
|
||||||
// 需要使用的变体,假设有free和pay两个变体,可以选择一个
|
// 需要使用的变体,假设有free和pay两个变体,可以选择一个
|
||||||
//from components.free
|
//from components.free
|
||||||
|
|
||||||
|
127
README.md
127
README.md
@ -1,23 +1,23 @@
|
|||||||
# ☁ ☁ ☁ WinBoll APP ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
# ☁ ☁ ☁ WinBoLL APP ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
||||||
# ☁ ☁ 这是 WinBoll 系列 APP 汇总项目。☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
# ☁ ☁ WinBoLL Studio Android 应用开源项目。☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
||||||
# ☁ ☁ ☁ WinBoll 网站地址 https://www.winboll.cc/studio/app/ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
# ☁ ☁ ☁ WinBoLL 网站地址 https://www.winboll.cc/ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
||||||
|
|
||||||
## WinBoll 提问
|
## WinBoLL 提问
|
||||||
同样是 /sdcard 目录,在开发 Android 应用时,
|
同样是 /sdcard 目录,在开发 Android 应用时,
|
||||||
能否实现手机编译与电脑编译的源码同步。
|
能否实现手机编译与电脑编译的源码同步。
|
||||||
☁因而 WinBoll 项目组诞生了。
|
☁因而 WinBoLL 项目组诞生了。
|
||||||
|
|
||||||
## WinBoll 项目组研发计划
|
## WinBoLL 项目组研发计划
|
||||||
致力于把 WinBoll-APP 应用在手机端 Android 项目开发。
|
致力于把 WinBoLL-APP 应用在手机端 Android 项目开发。
|
||||||
也在探索 https://gitea.winboll.cc/<WinBoll 项目组>/WinBoll-APP.git 应用于 WinBoll-APP APK 分发。
|
也在探索 https://gitea.winboll.cc/<WinBoLL 项目组>/APP.git 应用于 WinBoLL-APP APK 分发。
|
||||||
更想进阶 https://github.com/<WinBoll 项目组>/WinBoll-APP.git 应用于 WinBoll-APP Beta APK 分发。
|
更想进阶 https://github.com/<WinBoLL 项目组>/APP.git 应用于 WinBoLL-APP Beta APK 分发。
|
||||||
|
|
||||||
## WinBoll-APP 汗下...
|
## WinBoLL-APP 汗下...
|
||||||
#### ☁应用何置如此呢。且观用户云云。
|
#### ☁应用何置如此呢。且观用户云云。
|
||||||
|
|
||||||
#### ☁ 正当下 ☁ ###
|
#### ☁ 正当下 ☁ ###
|
||||||
#### ☁ 且容傻家叙说 ☁ WinBoll-APP 应用场景
|
#### ☁ 且容傻家叙说 ☁ WinBoLL-APP 应用场景
|
||||||
### ☁ WinBoll 设备资源概述
|
### ☁ WinBoLL 设备资源概述
|
||||||
#### ☁ 1. Raid Disk.
|
#### ☁ 1. Raid Disk.
|
||||||
概述:这是一个矩阵存储类设备。
|
概述:这是一个矩阵存储类设备。
|
||||||
优点:该设备具有数据容错存储功能,
|
优点:该设备具有数据容错存储功能,
|
||||||
@ -40,74 +40,79 @@
|
|||||||
设备位于操作系统内部文件系统。
|
设备位于操作系统内部文件系统。
|
||||||
数据持久性与操作系统挂钩。
|
数据持久性与操作系统挂钩。
|
||||||
|
|
||||||
#### ☁ 4. WinBoll 用户资源概述。
|
#### ☁ 4. WinBoLL 用户资源概述。
|
||||||
1> /home/<用户名> 位于 WinBoll 操作系统目录下。
|
1> /home/<用户名> 位于 WinBoLL 操作系统目录下。
|
||||||
2> /rdisk/<用户名> 挂载用户 Raid Disk.
|
2> /rdisk/<用户名> 挂载用户 Raid Disk.
|
||||||
3> /data/<用户名> 挂载用户 Data Disk.
|
3> /data/<用户名> 挂载用户 Data Disk.
|
||||||
4> /sdcard/<用户名> 挂载用户 SSD Disk.
|
4> /sdcard/<用户名> 挂载用户 SSD Disk.
|
||||||
|
|
||||||
#### ☁ 5. WinBoll-APP 用户资源概述。
|
#### ☁ 5. WinBoLL-APP 用户资源概述。
|
||||||
1> /sdcard 挂载用户手机 SD 存储/storage/emulated/0
|
1> /sdcard 挂载用户手机 SD 存储/storage/emulated/0
|
||||||
|
|
||||||
### ☁ 稍稍歇 ☁ ###
|
### ☁ 稍稍歇 ☁ ###
|
||||||
### ☁ 急急停 ☁ WinBoll 应用前置条件
|
### ☁ 急急停 ☁ WinBoLL 应用前置条件
|
||||||
☁ WinBoll 主机建立 1Panel MySQL 应用。
|
☁ WinBoLL 主机建立 1Panel MySQL 应用。
|
||||||
☁ WinBoll 主机建立 1Panel Gitea 应用。
|
☁ WinBoLL 主机建立 1Panel Gitea 应用。
|
||||||
☁ WinBoll 主机设置 WinBoll 应用为非登录状态。
|
☁ WinBoLL 主机设置 WinBoLL 应用为非登录状态。
|
||||||
☁ WinBoll 主机建立 WinBoll 账户与 WinBoll 用户组。
|
☁ WinBoLL 主机建立 WinBoLL 账户与 WinBoLL 用户组。
|
||||||
☁ WinBoll 账户 User ID 为: winboll。
|
☁ WinBoLL 账户 User ID 为: J。
|
||||||
☁ WinBoll 用户组 Group ID 为: winboll。
|
☁ WinBoLL 用户组 Group ID 为: Studio。
|
||||||
☁ WinBoll 主机 WinBoll 1Panel Gitea 建立 WinBoll 工作组。
|
☁ WinBoLL 主机 WinBoLL 1Panel Gitea 建立 WinBoLL 工作组。
|
||||||
☁ WinBoll 主机 WinBoll 1Panel Gitea 用户项目 APK 编译输出目录为 /sdcard/<用户名>/WinBoll/app/
|
☁ WinBoLL 主机 WinBoLL 1Panel Gitea 用户项目 APK 编译输出目录为 /sdcard/WinBoLLStudio/<用户名>/APKs/
|
||||||
☁ WinBoll 项目配置文件示例为 "<WinBoll 项目根目录>/.winboll/winboll.properties-demo"(WinBoll 项目已设置)
|
☁ WinBoLL 项目配置文件示例为 "<WinBoLL 项目根目录>/.winboll/winboll.properties-demo"(WinBoLL 项目已设置)
|
||||||
☁ WinBoll 项目配置文件为 "<WinBoll 项目根目录>/.winboll/winboll.properties"
|
☁ WinBoLL 项目配置文件为 "<WinBoLL 项目根目录>/.winboll/winboll.properties"
|
||||||
☁ WinBoll 项目配置文件设定为源码提交时忽略。(WinBoll 项目已设置)
|
☁ WinBoLL 项目配置文件设定为源码提交时忽略。(WinBoLL 项目已设置)
|
||||||
☁ Gradle 项目配置文件示例为 "<WinBoll 项目根目录>/.winboll/local.properties-demo"(WinBoll 项目已设置)
|
☁ Gradle 项目配置文件示例为 "<WinBoLL 项目根目录>/.winboll/local.properties-demo"(WinBoLL 项目已设置)
|
||||||
☁ Gradle 项目配置文件为 "<WinBoll 项目根目录>/local.properties"(WinBoll 项目已设置)
|
☁ Gradle 项目配置文件为 "<WinBoLL 项目根目录>/local.properties"(WinBoLL 项目已设置)
|
||||||
☁ Gradle 项目配置文件设定为源码提交时忽略。(WinBoll 项目已设置)
|
☁ Gradle 项目配置文件设定为源码提交时忽略。(WinBoLL 项目已设置)
|
||||||
|
|
||||||
### ☁ 登高处 ☁ WinBoll 应用需求规划
|
### ☁ 登高处 ☁ WinBoLL 应用需求规划
|
||||||
☁ WinBoll 主机建立 WinBoll 客户端用户数据库为 MySQL winbollclient 数据库。
|
☁ WinBoLL 主机建立 WinBoLL 客户端用户数据库为 MySQL winbollclient 数据库。
|
||||||
☁ WinBoll 主机设置 WinBoll 客户端用户信息存储在 winbollclient 数据库中。
|
☁ WinBoLL 主机设置 WinBoLL 客户端用户信息存储在 winbollclient 数据库中。
|
||||||
☁ MySQL winbollclient 数据库中
|
☁ MySQL winbollclient 数据库中
|
||||||
WinBoll 客户端用户信息设定为:
|
WinBoLL 客户端用户信息设定为:
|
||||||
<用户名, 验证密码, 验证邮箱, 验证手机, 唯一存储令牌Token, 备用验证邮箱>。
|
<用户名, 验证密码, 验证邮箱, 验证手机, 唯一存储令牌Token, 备用验证邮箱>。
|
||||||
☁ WinBoll 项目源码仓库托管在 WinBoll 1Panel Gitea 目录 /opt/1panel/apps/gitea/gitea/data/git/repositories/winboll/winboll.git中。
|
☁ WinBoLL 项目源码仓库托管在 WinBoLL 1Panel Gitea 目录 /opt/1panel/apps/gitea/gitea/data/git/repositories/studio/app.git中。
|
||||||
☁ WinBoll 主机提供 WinBoll 1Panel Gitea 应用的 WinBoll 项目源码仓库存取功能。(Gitea 应用已提供)
|
☁ WinBoLL 主机提供 WinBoLL 1Panel Gitea 应用的 WinBoLL 项目源码仓库存取功能。(Gitea 应用已提供)
|
||||||
☁ WinBoll 主机提供 WinBoll Gitea 项目仓库存档功能。(Gitea 应用已提供)
|
☁ WinBoLL 主机提供 WinBoLL Gitea 项目仓库存档功能。(Gitea 应用已提供)
|
||||||
☁ 提供 WinBoll 客户端用户登录功能。(Gitea 应用已提供)
|
☁ 提供 WinBoLL 客户端用户登录功能。(Gitea 应用已提供)
|
||||||
|
|
||||||
### ☁ 看远方 ☁ ###
|
### ☁ 看远方 ☁ ###
|
||||||
### ☁ 心忧虑 ☁ WinBoll-APP 应用前置需求
|
### ☁ 心忧虑 ☁ WinBoLL-APP 应用前置需求
|
||||||
☁ WinBoll-APP WinBoll 项目根目录设定为手机的 /sdcard/WinBoll 目录。(需要用户手动建立文件夹)
|
☁ WinBoLL-APP WinBoLL 项目根目录设定为手机的 /sdcard/WinBoLLStudio/Sources 目录。(需要用户手动建立文件夹)
|
||||||
☁ WinBoll-APP 具有手机 /sdcard/WinBoll 目录的存储权限。(需要手机操作系统授权)
|
☁ WinBoLL-APP 具有手机 /sdcard/WinBoLL 目录的存储权限。(需要手机操作系统授权)
|
||||||
☁ WinBoll-APP WinBoll 项目仓库源码存储路径为 /sdcard/WinBoll/repositories/winboll.git(需要用户手动建立文件夹)
|
☁ WinBoLL-APP WinBoLL 项目仓库源码存储路径为 /sdcard/WinBoLLStudio/Sources/APP.git(需要用户手动建立文件夹)
|
||||||
☁ WinBoll-APP 项目 APK 编译输出目录为 /sdcard/WinBoll/app/
|
☁ WinBoLL-APP 项目 APK 编译输出目录为 /sdcard/WinBoLLStudio/APKs/
|
||||||
☁ WinBoll-APP 应用签名验证可定制化。(WinBoll 项目已提供)
|
☁ WinBoLL-APP 应用签名验证可定制化。(WinBoLL 项目已提供)
|
||||||
☁ WinBoll-APP 与系列衍生 APP 应用共享 cc.winboll.studio 命名空间资源。(WinBoll 项目已提供)
|
☁ WinBoLL-APP 与系列衍生 APP 应用共享 cc.winboll.studio 命名空间资源。(WinBoLL 项目已提供)
|
||||||
☁ WinBoll-APP 用户客户端信息存储在命名空间为 WinBoll APP MySQLLite 应用的 winbollappclient 数据库中。
|
☁ WinBoLL-APP 用户客户端信息存储在命名空间为 WinBoLL APP MySQLLite 应用的 winbollappclient 数据库中。
|
||||||
☁ WinBoll-APP MySQLLite 应用的 winbollappclient 数据库中,
|
☁ WinBoLL-APP MySQLLite 应用的 winbollappclient 数据库中,
|
||||||
WinBoll 用户客户端信息设定为:
|
WinBoLL 用户客户端信息设定为:
|
||||||
<用户名, 唯一存储令牌Token>。
|
<用户名, 唯一存储令牌Token>。
|
||||||
|
|
||||||
### ☁ 云游四方 ☁ ###
|
### ☁ 云游四方 ☁ ###
|
||||||
### ☁ 呔! ☁ WinBoll-APP 应用需求规划
|
### ☁ 呔! ☁ WinBoLL-APP 应用需求规划
|
||||||
☁ WinBoll-APP 提供手机目录 /sdcard/WinBoll 的 WinBoll 项目源码管理功能。
|
☁ 如要使用 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-APP 共享计划前景
|
||||||
☁ WinBoll 将会提供 gitea.winboll.cc 域名用户注册登录功能。
|
☁ WinBoLL-APP 将会实现 https://winboll.cc/api 访问功能。
|
||||||
☁ WinBoll 将会提供 WinBoll-APP 及其衍生应用的 Gitea 仓库管理服务。
|
☁ WinBoLL-APP 将会实现手机端 Android 应用的开发与管理功能。
|
||||||
☁ WinBoll 将会提供 winboll.cc 域名 WinBoll 项目组注册登录功能。
|
|
||||||
|
## ☁ WinBoLL ☁ WinBoLL 主机忧虑
|
||||||
|
☁ WinBoLL 将会提供 gitea.winboll.cc 域名用户注册登录功能。
|
||||||
|
☁ WinBoLL 将会提供 WinBoLL-APP 及其衍生应用的 Gitea 仓库管理服务。
|
||||||
|
☁ WinBoLL 将会提供 winboll.cc 域名 WinBoLL 项目组注册登录功能。
|
||||||
|
|
||||||
# 本项目要实际运用需要注意以下几个步骤:
|
# 本项目要实际运用需要注意以下几个步骤:
|
||||||
# 在项目根目录下:
|
# 在项目根目录下:
|
||||||
## 1. 项目模块编译环境设置(必须),settings.gradle-demo 要复制为 settings.gradle,并取消相应项目模块的注释。
|
## 1. 项目模块编译环境设置(必须),settings.gradle-demo 要复制为 settings.gradle,并取消相应项目模块的注释。
|
||||||
## 2. 项目 Android SDK 编译环境设置(可选),local.properties-demo 要复制为 local.properties,并按需要设置 Android SDK 目录。
|
## 2. 项目 Android SDK 编译环境设置(可选),local.properties-demo 要复制为 local.properties,并按需要设置 Android SDK 目录。
|
||||||
## 3. 类库型模块编译环境设置(可选),winboll.properties-demo 要复制为 winboll.properties,并按需要设置 WinBoll Maven 库登录用户信息。
|
## 3. 类库型模块编译环境设置(可选),winboll.properties-demo 要复制为 winboll.properties,并按需要设置 WinBoLL Maven 库登录用户信息。
|
||||||
|
|
||||||
|
|
||||||
# ☆类库型项目编译方法
|
# ☆类库型项目编译方法
|
||||||
@ -116,12 +121,12 @@
|
|||||||
设置属性 libraryProject=<类库项目模块文件夹名称>
|
设置属性 libraryProject=<类库项目模块文件夹名称>
|
||||||
### 再编译测试项目
|
### 再编译测试项目
|
||||||
$ bash .winboll/bashPublishAPKAddTag.sh <应用项目模块文件夹名称>
|
$ bash .winboll/bashPublishAPKAddTag.sh <应用项目模块文件夹名称>
|
||||||
#### 测试项目编译后,编译器会复制一份 APK 到以下路径:"/sdcard/WinBollStudio/APKs/<项目根目录名称>/tag/" 文件夹。
|
#### 测试项目编译后,编译器会复制一份 APK 到以下路径:"/sdcard/WinBoLLStudio/APKs/<项目根目录名称>/tag/" 文件夹。
|
||||||
### 最后编译类库项目
|
### 最后编译类库项目
|
||||||
$ bash .winboll/bashPublishLIBAddTag.sh <类库项目模块文件夹名称>
|
$ bash .winboll/bashPublishLIBAddTag.sh <类库项目模块文件夹名称>
|
||||||
#### 类库模块编译命令执行后,编译器会发布到 WinBoll Nexus Maven 库:Maven 库地址可以参阅根项目目录配置 build.gradle 文件。
|
#### 类库模块编译命令执行后,编译器会发布到 WinBoLL Nexus Maven 库:Maven 库地址可以参阅根项目目录配置 build.gradle 文件。
|
||||||
|
|
||||||
# ☆应用型项目编译方法
|
# ☆应用型项目编译方法
|
||||||
## 直接调用以下命令编译应用型项目
|
## 直接调用以下命令编译应用型项目
|
||||||
$ bash .winboll/bashPublishAPKAddTag.sh <应用项目模块文件夹名称>
|
$ bash .winboll/bashPublishAPKAddTag.sh <应用项目模块文件夹名称>
|
||||||
#### 应用模块编译命令执行后,编译器会复制一份 APK 到以下路径:"/sdcard/WinBollStudio/APKs/<项目根目录名称>/tag/" 文件夹。
|
#### 应用模块编译命令执行后,编译器会复制一份 APK 到以下路径:"/sdcard/WinBoLLStudio/APKs/<项目根目录名称>/tag/" 文件夹。
|
||||||
|
@ -24,12 +24,12 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.aes"
|
applicationId "cc.winboll.studio.aes"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.2"
|
versionName "15.6"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Mon Mar 31 02:04:47 HKT 2025
|
#Tue Apr 29 15:14:41 HKT 2025
|
||||||
stageCount=4
|
stageCount=1
|
||||||
libraryProject=libaes
|
libraryProject=libaes
|
||||||
baseVersion=15.2
|
baseVersion=15.6
|
||||||
publishVersion=15.2.3
|
publishVersion=15.6.0
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.2.4
|
baseBetaVersion=15.6.1
|
||||||
|
@ -10,14 +10,13 @@ import android.content.Context;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import cc.winboll.studio.libaes.winboll.APPInfo;
|
import cc.winboll.studio.libaes.winboll.APPInfo;
|
||||||
import cc.winboll.studio.libaes.winboll.AboutView;
|
import cc.winboll.studio.libaes.winboll.AboutView;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
|
||||||
public class AboutActivity extends WinBollActivity implements IWinBollActivity {
|
public class AboutActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "AboutActivity";
|
public static final String TAG = "AboutActivity";
|
||||||
|
|
||||||
@ -64,13 +63,13 @@ public class AboutActivity extends WinBollActivity implements IWinBollActivity {
|
|||||||
);
|
);
|
||||||
layout.addView(aboutView, params);
|
layout.addView(aboutView, params);
|
||||||
|
|
||||||
GlobalApplication.getWinBollActivityManager().add(this);
|
GlobalApplication.getWinBoLLActivityManager().add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
GlobalApplication.getWinBollActivityManager().registeRemove(this);
|
GlobalApplication.getWinBoLLActivityManager().registeRemove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AboutView CreateAboutView() {
|
public AboutView CreateAboutView() {
|
||||||
@ -86,6 +85,8 @@ public class AboutActivity extends WinBollActivity implements IWinBollActivity {
|
|||||||
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=AES");
|
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=AES");
|
||||||
appInfo.setAppAPKName("AES");
|
appInfo.setAppAPKName("AES");
|
||||||
appInfo.setAppAPKFolderName("AES");
|
appInfo.setAppAPKFolderName("AES");
|
||||||
|
//appInfo.setIsAddDebugTools(false);
|
||||||
|
appInfo.setIsAddDebugTools(BuildConfig.DEBUG);
|
||||||
return new AboutView(mContext, appInfo);
|
return new AboutView(mContext, appInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,19 +5,27 @@ package cc.winboll.studio.aes;
|
|||||||
* @Date 2024/06/13 19:03:58
|
* @Date 2024/06/13 19:03:58
|
||||||
* @Describe AES应用类
|
* @Describe AES应用类
|
||||||
*/
|
*/
|
||||||
|
import android.view.Gravity;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import com.hjq.toast.style.WhiteToastStyle;
|
||||||
|
|
||||||
|
|
||||||
public class App extends GlobalApplication {
|
public class App extends GlobalApplication {
|
||||||
|
|
||||||
public static final String TAG = "App";
|
public static final String TAG = "App";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
|
// 初始化 Toast 框架
|
||||||
ToastUtils.init(this);
|
ToastUtils.init(this);
|
||||||
//ToastUtils.show("App onCreate");
|
// 设置 Toast 布局样式
|
||||||
|
//ToastUtils.setView(R.layout.view_toast);
|
||||||
|
ToastUtils.setStyle(new WhiteToastStyle());
|
||||||
|
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,12 @@ import cc.winboll.studio.libaes.unittests.TestAToolbarActivity;
|
|||||||
import cc.winboll.studio.libaes.unittests.TestDrawerFragmentActivity;
|
import cc.winboll.studio.libaes.unittests.TestDrawerFragmentActivity;
|
||||||
import cc.winboll.studio.libaes.unittests.TestViewPageFragment;
|
import cc.winboll.studio.libaes.unittests.TestViewPageFragment;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
import com.a4455jkjh.colorpicker.ColorPickerDialog;
|
import com.a4455jkjh.colorpicker.ColorPickerDialog;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class MainActivity extends DrawerFragmentActivity implements IWinBollActivity {
|
public class MainActivity extends DrawerFragmentActivity implements IWinBoLLActivity {
|
||||||
|
|
||||||
|
|
||||||
public static final String TAG = "MainActivity";
|
public static final String TAG = "MainActivity";
|
||||||
@ -123,7 +123,7 @@ public class MainActivity extends DrawerFragmentActivity implements IWinBollActi
|
|||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int nItemId = item.getItemId();
|
int nItemId = item.getItemId();
|
||||||
// if (item.getItemId() == R.id.item_log) {
|
// if (item.getItemId() == R.id.item_log) {
|
||||||
// WinBollActivityManager.getInstance(this).startWinBollActivity(getApplicationContext(), LogActivity.class);
|
// WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(getApplicationContext(), LogActivity.class);
|
||||||
// } else
|
// } else
|
||||||
if (nItemId == R.id.item_atoast) {
|
if (nItemId == R.id.item_atoast) {
|
||||||
Toast.makeText(getApplication(), "item_testatoast", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplication(), "item_testatoast", Toast.LENGTH_SHORT).show();
|
||||||
|
60
aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java
Normal file
60
aes/src/main/java/cc/winboll/studio/aes/WinBoLLActivity.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package cc.winboll.studio.aes;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import cc.winboll.studio.libaes.beans.AESThemeBean;
|
||||||
|
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||||
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/30 00:34:02
|
||||||
|
* @Describe WinBoLL 活动窗口通用基类
|
||||||
|
*/
|
||||||
|
public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "WinBoLLActivity";
|
||||||
|
|
||||||
|
protected volatile AESThemeBean.ThemeType mThemeType;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Activity getActivity() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
mThemeType = getThemeType();
|
||||||
|
setThemeStyle();
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
AESThemeBean.ThemeType getThemeType() {
|
||||||
|
/*SharedPreferences sharedPreferences = getSharedPreferences(
|
||||||
|
SHAREDPREFERENCES_NAME, MODE_PRIVATE);
|
||||||
|
return AESThemeBean.ThemeType.values()[((sharedPreferences.getInt(DRAWER_THEME_TYPE, AESThemeBean.ThemeType.DEFAULT.ordinal())))];
|
||||||
|
*/
|
||||||
|
return AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void setThemeStyle() {
|
||||||
|
//setTheme(AESThemeBean.getThemeStyle(getThemeType()));
|
||||||
|
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if(item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
@ -49,7 +49,8 @@ dependencies {
|
|||||||
// Android 类库
|
// Android 类库
|
||||||
//api 'com.android.support:appcompat-v7:28.0.0'
|
//api 'com.android.support:appcompat-v7:28.0.0'
|
||||||
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", module: "support-vector-drawable"
|
||||||
|
exclude group: "com.android.support:animated-vector-drawable:28.0.0"
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/com.android.support/support-compat
|
// https://mvnrepository.com/artifact/com.android.support/support-compat
|
||||||
api 'com.android.support:support-compat:28.0.0' // 保留原有依赖(可选)
|
api 'com.android.support:support-compat:28.0.0' // 保留原有依赖(可选)
|
||||||
@ -66,6 +67,6 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/com.android.support/recyclerview-v7
|
// https://mvnrepository.com/artifact/com.android.support/recyclerview-v7
|
||||||
api 'com.android.support:recyclerview-v7:28.0.0'
|
api 'com.android.support:recyclerview-v7:28.0.0'
|
||||||
|
|
||||||
api 'cc.winboll.studio:libapputils:15.2.1'
|
api 'cc.winboll.studio:libapputils:15.2.2'
|
||||||
api 'cc.winboll.studio:libappbase:15.2.2'
|
api 'cc.winboll.studio:libappbase:15.2.2'
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Mar 29 04:34:14 GMT 2025
|
#Thu Apr 03 03:17:18 GMT 2025
|
||||||
stageCount=0
|
stageCount=0
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.0
|
publishVersion=15.0.0
|
||||||
buildCount=15
|
buildCount=21
|
||||||
baseBetaVersion=15.0.1
|
baseBetaVersion=15.0.1
|
||||||
|
@ -67,7 +67,7 @@ dependencies {
|
|||||||
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
||||||
//api 'androidx.fragment:fragment:1.1.0'
|
//api 'androidx.fragment:fragment:1.1.0'
|
||||||
|
|
||||||
api 'cc.winboll.studio:libaes:15.2.3'
|
api 'cc.winboll.studio:libaes:15.2.6'
|
||||||
api 'cc.winboll.studio:libapputils:15.2.1'
|
api 'cc.winboll.studio:libapputils:15.2.2'
|
||||||
api 'cc.winboll.studio:libappbase:15.2.2'
|
api 'cc.winboll.studio:libappbase:15.2.2'
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Mon Mar 31 03:57:35 GMT 2025
|
#Thu Apr 03 03:15:55 GMT 2025
|
||||||
stageCount=0
|
stageCount=0
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.0
|
publishVersion=15.0.0
|
||||||
buildCount=12
|
buildCount=18
|
||||||
baseBetaVersion=15.0.1
|
baseBetaVersion=15.0.1
|
||||||
|
@ -14,6 +14,7 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -21,7 +22,9 @@ import android.widget.HorizontalScrollView;
|
|||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import cc.winboll.studio.androidxdemo.R;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
@ -46,6 +49,14 @@ public class App extends GlobalApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.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().registerGlobal(this);
|
||||||
//CrashHandler.getInstance().registerPart(this);
|
//CrashHandler.getInstance().registerPart(this);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import android.os.Bundle;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import cc.winboll.studio.libappbase.LogView;
|
import cc.winboll.studio.libappbase.LogView;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@ -18,6 +19,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
mLogView = findViewById(R.id.logview);
|
mLogView = findViewById(R.id.logview);
|
||||||
|
|
||||||
|
ToastUtils.show("onCreate");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
|
||||||
#Sun Jan 05 07:55:24 HKT 2025
|
|
||||||
stageCount=17
|
|
||||||
libraryProject=winboll-shared
|
|
||||||
baseVersion=1.8
|
|
||||||
publishVersion=1.8.16
|
|
||||||
buildCount=0
|
|
||||||
baseBetaVersion=1.8.17
|
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools" >
|
|
||||||
|
|
||||||
<application
|
|
||||||
tools:replace="android:icon"
|
|
||||||
android:icon="@drawable/ic_winbollbeta">
|
|
||||||
|
|
||||||
<!-- Put flavor specific code here -->
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">WinBoll-APP+</string>
|
|
||||||
|
|
||||||
</resources>
|
|
@ -1,48 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="cc.winboll.studio.app">
|
|
||||||
|
|
||||||
<!-- BIND_AUTOFILL_SERVICE -->
|
|
||||||
<uses-permission android:name="android.permission.BIND_AUTOFILL_SERVICE"/>
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:name=".App"
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@drawable/ic_winboll"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/WinBoll.SupportThemeNoActionBar"
|
|
||||||
android:supportsRtl="true">
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<provider
|
|
||||||
android:name="androidx.core.content.FileProvider"
|
|
||||||
android:authorities="${applicationId}.fileprovider"
|
|
||||||
android:exported="false"
|
|
||||||
android:grantUriPermissions="true">
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
||||||
android:resource="@xml/studio_provider"/>
|
|
||||||
|
|
||||||
</provider>
|
|
||||||
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
@ -1,24 +0,0 @@
|
|||||||
package cc.winboll.studio.app;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2024/12/08 15:10:51
|
|
||||||
* @Describe 全局应用类
|
|
||||||
*/
|
|
||||||
import cc.winboll.studio.shared.app.WinBollApplication;
|
|
||||||
import cc.winboll.studio.shared.log.LogUtils;
|
|
||||||
|
|
||||||
public class App extends WinBollApplication {
|
|
||||||
|
|
||||||
public static final String TAG = "App";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
// 必须在调用基类前设置应用调试标志,
|
|
||||||
// 这样可以预先设置日志与数据的存储根目录。
|
|
||||||
//setIsDebug(BuildConfig.DEBUG);
|
|
||||||
super.onCreate();
|
|
||||||
LogUtils.d(TAG, "onCreate");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,168 +0,0 @@
|
|||||||
package cc.winboll.studio.app;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import cc.winboll.studio.shared.app.WinBollActivity;
|
|
||||||
import cc.winboll.studio.shared.app.WinBollActivityManager;
|
|
||||||
import cc.winboll.studio.shared.app.WinBollApplication;
|
|
||||||
import cc.winboll.studio.shared.log.LogUtils;
|
|
||||||
import cc.winboll.studio.shared.util.UriUtils;
|
|
||||||
import cc.winboll.studio.shared.view.StringToQrCodeView;
|
|
||||||
import cc.winboll.studio.shared.view.YesNoAlertDialog;
|
|
||||||
import cc.winboll.studio.unittest.UnitTestActivity;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
final public class MainActivity extends WinBollActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "MainActivity";
|
|
||||||
|
|
||||||
public static final int REQUEST_HOME_ACTIVITY = 0;
|
|
||||||
public static final int REQUEST_ABOUT_ACTIVITY = 1;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isEnableDisplayHomeAsUp() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
// 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回
|
|
||||||
if (prosessIntents(getIntent())) return;
|
|
||||||
// 以下正常创建主窗口
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
// 设置 WinBoll 应用 UI 类型
|
|
||||||
WinBollApplication.setWinBollUI_TYPE(WinBollApplication.WinBollUI_TYPE.Aplication);
|
|
||||||
//ToastUtils.show("WinBollUI_TYPE " + WinBollApplication.getWinBollUI_TYPE());
|
|
||||||
LogUtils.d(TAG, "BuildConfig.DEBUG : " + Boolean.toString(BuildConfig.DEBUG));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
|
||||||
super.onPostCreate(savedInstanceState);
|
|
||||||
setSubTitle("");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 处理传入的 Intent 数据
|
|
||||||
//
|
|
||||||
boolean prosessIntents(Intent intent) {
|
|
||||||
if (intent == null
|
|
||||||
|| intent.getAction() == null
|
|
||||||
|| intent.getAction().equals(""))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) {
|
|
||||||
try {
|
|
||||||
WinBollActivity clazzActivity = UnitTestActivity.class.newInstance();
|
|
||||||
String tag = clazzActivity.getTag();
|
|
||||||
LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag);
|
|
||||||
Intent subIntent = new Intent(this, UnitTestActivity.class);
|
|
||||||
subIntent.setAction(intent.getAction());
|
|
||||||
File file = new File(getCacheDir(), UUID.randomUUID().toString());
|
|
||||||
//取出文件uri
|
|
||||||
Uri uri = intent.getData();
|
|
||||||
if (uri == null) {
|
|
||||||
uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
|
||||||
}
|
|
||||||
//获取文件真实地址
|
|
||||||
String szSrcPath = UriUtils.getFileFromUri(getApplication(), uri);
|
|
||||||
if (TextUtils.isEmpty(szSrcPath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath()));
|
|
||||||
//startWinBollActivity(subIntent, tag);
|
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class);
|
|
||||||
} catch (IllegalAccessException | InstantiationException | IOException e) {
|
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
|
||||||
// 函数处理异常返回失败
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LogUtils.d(TAG, "prosessIntents|" + intent.getAction() + "|yet");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isAddWinBollToolBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void exit() {
|
|
||||||
YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onYes() {
|
|
||||||
WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNo() {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Toolbar initToolBar() {
|
|
||||||
return findViewById(R.id.activitymainToolbar1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_winboll_app_main, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == R.id.item_unittest) {
|
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, UnitTestActivity.class);
|
|
||||||
} else if (item.getItemId() == R.id.item_exit) {
|
|
||||||
exit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
switch (resultCode) {
|
|
||||||
case REQUEST_HOME_ACTIVITY : {
|
|
||||||
LogUtils.d(TAG, "REQUEST_HOME_ACTIVITY");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case REQUEST_ABOUT_ACTIVITY : {
|
|
||||||
LogUtils.d(TAG, "REQUEST_ABOUT_ACTIVITY");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default : {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:clickable="true">
|
|
||||||
<item android:drawable="@drawable/ic_launcher_background"/>
|
|
||||||
<item
|
|
||||||
android:left="15dp"
|
|
||||||
android:top="15dp"
|
|
||||||
android:right="15dp"
|
|
||||||
android:bottom="15dp"
|
|
||||||
android:drawable="@drawable/ic_launcher_foreground"/>
|
|
||||||
</layer-list>
|
|
@ -1,170 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/colorPrimary"
|
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M9,0L9,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,0L19,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,0L29,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,0L39,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,0L49,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,0L59,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,0L69,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,0L79,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M89,0L89,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M99,0L99,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,9L108,9"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,19L108,19"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,29L108,29"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,39L108,39"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,49L108,49"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,59L108,59"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,69L108,69"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,79L108,79"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,89L108,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,99L108,99"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,29L89,29"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,39L89,39"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,49L89,49"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,59L89,59"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,69L89,69"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,79L89,79"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,19L29,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,19L39,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,19L49,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,19L59,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,19L69,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,19L79,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
</vector>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="M16.61,15.15C16.15,15.15 15.77,14.78 15.77,14.32S16.15,13.5 16.61,13.5H16.61C17.07,13.5 17.45,13.86 17.45,14.32C17.45,14.78 17.07,15.15 16.61,15.15M7.41,15.15C6.95,15.15 6.57,14.78 6.57,14.32C6.57,13.86 6.95,13.5 7.41,13.5H7.41C7.87,13.5 8.24,13.86 8.24,14.32C8.24,14.78 7.87,15.15 7.41,15.15M16.91,10.14L18.58,7.26C18.67,7.09 18.61,6.88 18.45,6.79C18.28,6.69 18.07,6.75 18,6.92L16.29,9.83C14.95,9.22 13.5,8.9 12,8.91C10.47,8.91 9,9.24 7.73,9.82L6.04,6.91C5.95,6.74 5.74,6.68 5.57,6.78C5.4,6.87 5.35,7.08 5.44,7.25L7.1,10.13C4.25,11.69 2.29,14.58 2,18H22C21.72,14.59 19.77,11.7 16.91,10.14H16.91Z"/>
|
|
||||||
</vector>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<gradient
|
|
||||||
android:angle="180"
|
|
||||||
android:endColor="#FFFFFFFF"
|
|
||||||
android:startColor="#FFFFFFFF"
|
|
||||||
android:type="linear" />
|
|
||||||
|
|
||||||
<corners android:radius="10dp" />
|
|
||||||
</shape>
|
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/activitymainToolbar1"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_weight="1.0">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Hello, WinBoll!"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/shape_gradient"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:src="@drawable/ic_launcher"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/message"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:textColor="#FF000000"
|
|
||||||
android:textSize="16sp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<!-- WinBoll 默认方案 -->
|
|
||||||
<color name="colorPrimary">#FF196ABC</color>
|
|
||||||
<color name="colorPrimaryDark">#FF002B57</color>
|
|
||||||
<color name="colorAccent">#FF80BFFF</color>
|
|
||||||
<color name="colorToastFrame">#FFA9A9A9</color>
|
|
||||||
<color name="colorToastShadow">#FF000000</color>
|
|
||||||
<color name="colorToastBackgroung">#FFFFFFFF</color>
|
|
||||||
</resources>
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">WinBoll-APP</string>
|
|
||||||
|
|
||||||
</resources>
|
|
@ -1,3 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
</resources>
|
|
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<paths>
|
|
||||||
<external-path
|
|
||||||
name="external_storage_root"
|
|
||||||
path="." />
|
|
||||||
<files-path
|
|
||||||
name="files_path"
|
|
||||||
path="." />
|
|
||||||
<cache-path
|
|
||||||
name="cache_path"
|
|
||||||
path="." />
|
|
||||||
<!--/storage/emulated/0/Android/data/...-->
|
|
||||||
<external-files-path
|
|
||||||
name="external_file_path"
|
|
||||||
path="." />
|
|
||||||
<!--代表app 外部存储区域根目录下的文件 Context.getExternalCacheDir目录下的目录-->
|
|
||||||
<external-cache-path
|
|
||||||
name="external_cache_path"
|
|
||||||
path="." />
|
|
||||||
<!--配置root-path。这样子可以读取到sd卡和一些应用分身的目录,否则微信分身保存的图片,就会导致 java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/999/tencent/MicroMsg/WeiXin/export1544062754693.jpg,在小米6的手机上微信分身有这个crash,华为没有
|
|
||||||
-->
|
|
||||||
<root-path
|
|
||||||
name="root_path"
|
|
||||||
path="" />
|
|
||||||
</paths>
|
|
@ -25,12 +25,12 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.appbase"
|
applicationId "cc.winboll.studio.appbase"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.2"
|
versionName "15.7"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Mar 29 11:28:02 HKT 2025
|
#Tue Apr 29 14:47:34 HKT 2025
|
||||||
stageCount=3
|
stageCount=7
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.2
|
baseVersion=15.7
|
||||||
publishVersion=15.2.2
|
publishVersion=15.7.6
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.2.3
|
baseBetaVersion=15.7.7
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".App"
|
android:name=".App"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_miapp"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/MyAPPBaseTheme"
|
android:theme="@style/MyAPPBaseTheme"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
|
@ -4,11 +4,11 @@ import android.app.Activity;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.Toolbar;
|
||||||
import cc.winboll.studio.appbase.R;
|
import cc.winboll.studio.appbase.R;
|
||||||
import cc.winboll.studio.appbase.activities.NewActivity;
|
import cc.winboll.studio.appbase.activities.NewActivity;
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
import cc.winboll.studio.appbase.services.MainService;
|
||||||
@ -21,10 +21,9 @@ import cc.winboll.studio.libappbase.LogUtils;
|
|||||||
import cc.winboll.studio.libappbase.sos.SOS;
|
import cc.winboll.studio.libappbase.sos.SOS;
|
||||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||||
import cc.winboll.studio.libappbase.widgets.StatusWidget;
|
import cc.winboll.studio.libappbase.widgets.StatusWidget;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
|
||||||
|
|
||||||
public class MainActivity extends WinBollActivityBase implements IWinBollActivity {
|
public class MainActivity extends WinBoLLActivityBase implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "MainActivity";
|
public static final String TAG = "MainActivity";
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ public class MainActivity extends WinBollActivityBase implements IWinBollActivit
|
|||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(mToolbar);
|
setActionBar(mToolbar);
|
||||||
|
|
||||||
CheckBox cbIsDebugMode = findViewById(R.id.activitymainCheckBox1);
|
CheckBox cbIsDebugMode = findViewById(R.id.activitymainCheckBox1);
|
||||||
cbIsDebugMode.setChecked(GlobalApplication.isDebuging());
|
cbIsDebugMode.setChecked(GlobalApplication.isDebuging());
|
||||||
@ -177,7 +176,7 @@ public class MainActivity extends WinBollActivityBase implements IWinBollActivit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onTestOpenNewActivity(View view) {
|
public void onTestOpenNewActivity(View view) {
|
||||||
GlobalApplication.getWinBollActivityManager().startWinBollActivity(this, NewActivity.class);
|
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(this, NewActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
package cc.winboll.studio.appbase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/28 15:34:16
|
||||||
|
* @Describe 应用活动窗口基类
|
||||||
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import cc.winboll.studio.appbase.App;
|
||||||
|
import cc.winboll.studio.appbase.R;
|
||||||
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
|
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
||||||
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
import cc.winboll.studio.libappbase.winboll.WinBoLLActivityManager;
|
||||||
|
|
||||||
|
public class WinBoLLActivityBase extends Activity implements IWinBoLLActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "WinBoLLActivityBase";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Activity getActivity() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
WinBoLLActivityManager getWinBoLLActivityManager() {
|
||||||
|
return WinBoLLActivityManager.getInstance(GlobalApplication.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
getWinBoLLActivityManager().add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
|
||||||
|
super.onPostCreate(savedInstanceState, persistentState);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
||||||
|
GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
|
||||||
|
return true;
|
||||||
|
} else if(item.getItemId() == cc.winboll.studio.appbase.R.id.item_minimal) {
|
||||||
|
//moveTaskToBack(true);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void exit() {
|
||||||
|
YesNoAlertDialog.show(this, "Exit " + getString(R.string.app_name), "Close all activity and exit?", new YesNoAlertDialog.OnDialogResultListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onYes() {
|
||||||
|
App.getWinBoLLActivityManager().finishAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNo() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getWinBoLLActivityManager().registeRemove(this);
|
||||||
|
}
|
||||||
|
}
|
@ -7,16 +7,16 @@ package cc.winboll.studio.appbase.activities;
|
|||||||
*/
|
*/
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Toolbar;
|
||||||
import cc.winboll.studio.appbase.R;
|
import cc.winboll.studio.appbase.R;
|
||||||
import cc.winboll.studio.appbase.WinBollActivityBase;
|
import cc.winboll.studio.appbase.WinBoLLActivityBase;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
|
||||||
public class New2Activity extends WinBollActivityBase implements IWinBollActivity {
|
public class New2Activity extends WinBoLLActivityBase implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "New2Activity";
|
public static final String TAG = "New2Activity";
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class New2Activity extends WinBollActivityBase implements IWinBollActivit
|
|||||||
// mLogView = findViewById(R.id.logview);
|
// mLogView = findViewById(R.id.logview);
|
||||||
// mLogView.start();
|
// mLogView.start();
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(mToolbar);
|
setActionBar(mToolbar);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,15 +52,15 @@ public class New2Activity extends WinBollActivityBase implements IWinBollActivit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCloseThisActivity(View view) {
|
public void onCloseThisActivity(View view) {
|
||||||
GlobalApplication.getWinBollActivityManager().finish(this);
|
GlobalApplication.getWinBoLLActivityManager().finish(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCloseAllActivity(View view) {
|
public void onCloseAllActivity(View view) {
|
||||||
GlobalApplication.getWinBollActivityManager().finishAll();
|
GlobalApplication.getWinBoLLActivityManager().finishAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNewActivity(View view) {
|
public void onNewActivity(View view) {
|
||||||
GlobalApplication.getWinBollActivityManager().startWinBollActivity(this, NewActivity.class);
|
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(this, NewActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public class New2Activity extends WinBollActivityBase implements IWinBollActivit
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
||||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||||
|
@ -6,16 +6,16 @@ package cc.winboll.studio.appbase.activities;
|
|||||||
*/
|
*/
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Toolbar;
|
||||||
import cc.winboll.studio.appbase.R;
|
import cc.winboll.studio.appbase.R;
|
||||||
import cc.winboll.studio.appbase.WinBollActivityBase;
|
import cc.winboll.studio.appbase.WinBoLLActivityBase;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
|
||||||
public class NewActivity extends WinBollActivityBase implements IWinBollActivity {
|
public class NewActivity extends WinBoLLActivityBase implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "NewActivity";
|
public static final String TAG = "NewActivity";
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class NewActivity extends WinBollActivityBase implements IWinBollActivity
|
|||||||
// mLogView = findViewById(R.id.logview);
|
// mLogView = findViewById(R.id.logview);
|
||||||
// mLogView.start();
|
// mLogView.start();
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(mToolbar);
|
setActionBar(mToolbar);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,15 +50,15 @@ public class NewActivity extends WinBollActivityBase implements IWinBollActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCloseThisActivity(View view) {
|
public void onCloseThisActivity(View view) {
|
||||||
GlobalApplication.getWinBollActivityManager().finish(this);
|
GlobalApplication.getWinBoLLActivityManager().finish(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCloseAllActivity(View view) {
|
public void onCloseAllActivity(View view) {
|
||||||
GlobalApplication.getWinBollActivityManager().finishAll();
|
GlobalApplication.getWinBoLLActivityManager().finishAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNew2Activity(View view) {
|
public void onNew2Activity(View view) {
|
||||||
GlobalApplication.getWinBollActivityManager().startWinBollActivity(this, New2Activity.class);
|
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(this, New2Activity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class NewActivity extends WinBollActivityBase implements IWinBollActivity
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
||||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||||
|
@ -1,56 +1,54 @@
|
|||||||
package cc.winboll.studio.libapputils.bean;
|
package cc.winboll.studio.appbase.models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@QQ.COM
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
* @Date 2024/12/25 12:38:07
|
* @Date 2025/02/17 10:05:09
|
||||||
* @Describe 应用调试配置类
|
* @Describe APPSOSReportBean
|
||||||
*/
|
*/
|
||||||
import android.util.JsonReader;
|
import android.util.JsonReader;
|
||||||
import android.util.JsonWriter;
|
import android.util.JsonWriter;
|
||||||
|
import cc.winboll.studio.libappbase.BaseBean;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class DebugBean extends BaseBean {
|
public class WinBoLLNewsBean extends BaseBean {
|
||||||
|
|
||||||
public static final String TAG = "DebugBean";
|
|
||||||
|
|
||||||
// 应用是否处于正在调试状态
|
|
||||||
//
|
|
||||||
boolean isDebuging = false;
|
|
||||||
|
|
||||||
public DebugBean() {
|
public static final String TAG = "WinBoLLNewsBean";
|
||||||
this.isDebuging = false;
|
|
||||||
|
protected String message;
|
||||||
|
|
||||||
|
public WinBoLLNewsBean() {
|
||||||
|
this.message = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public DebugBean(boolean isDebuging) {
|
public WinBoLLNewsBean(String message) {
|
||||||
this.isDebuging = isDebuging;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsDebuging(boolean isDebuging) {
|
public void setMessage(String message) {
|
||||||
this.isDebuging = isDebuging;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDebuging() {
|
public String getMessage() {
|
||||||
return isDebuging;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return DebugBean.class.getName();
|
return WinBoLLNewsBean.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||||
super.writeThisToJsonWriter(jsonWriter);
|
super.writeThisToJsonWriter(jsonWriter);
|
||||||
DebugBean bean = this;
|
jsonWriter.name("message").value(getMessage());
|
||||||
jsonWriter.name("isDebuging").value(bean.isDebuging());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||||
if (name.equals("isDebuging")) {
|
if (name.equals("message")) {
|
||||||
setIsDebuging(jsonReader.nextBoolean());
|
setMessage(jsonReader.nextString());
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import cc.winboll.studio.appbase.models.WinBollNewsBean;
|
import cc.winboll.studio.appbase.models.WinBoLLNewsBean;
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
import cc.winboll.studio.appbase.services.MainService;
|
||||||
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
||||||
import cc.winboll.studio.libappbase.AppUtils;
|
import cc.winboll.studio.libappbase.AppUtils;
|
||||||
@ -18,7 +18,7 @@ import cc.winboll.studio.libappbase.LogUtils;
|
|||||||
import cc.winboll.studio.libappbase.sos.APPModel;
|
import cc.winboll.studio.libappbase.sos.APPModel;
|
||||||
import cc.winboll.studio.libappbase.sos.SOS;
|
import cc.winboll.studio.libappbase.sos.SOS;
|
||||||
import cc.winboll.studio.libappbase.sos.SOSObject;
|
import cc.winboll.studio.libappbase.sos.SOSObject;
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
import cc.winboll.studio.libappbase.sos.WinBoLL;
|
||||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@ -42,11 +42,11 @@ public class MainReceiver extends BroadcastReceiver {
|
|||||||
String szAction = intent.getAction();
|
String szAction = intent.getAction();
|
||||||
if (szAction.equals(ACTION_BOOT_COMPLETED)) {
|
if (szAction.equals(ACTION_BOOT_COMPLETED)) {
|
||||||
ToastUtils.show("ACTION_BOOT_COMPLETED");
|
ToastUtils.show("ACTION_BOOT_COMPLETED");
|
||||||
} else if (szAction.equals(WinBoll.ACTION_BIND)) {
|
} else if (szAction.equals(WinBoLL.ACTION_BIND)) {
|
||||||
LogUtils.d(TAG, "ACTION_BIND");
|
LogUtils.d(TAG, "ACTION_BIND");
|
||||||
LogUtils.d(TAG, String.format("context.getPackageName() %s", context.getPackageName()));
|
LogUtils.d(TAG, String.format("context.getPackageName() %s", context.getPackageName()));
|
||||||
LogUtils.d(TAG, String.format("intent.getAction() %s", intent.getAction()));
|
LogUtils.d(TAG, String.format("intent.getAction() %s", intent.getAction()));
|
||||||
String szAPPModel = intent.getStringExtra(WinBoll.EXTRA_APPMODEL);
|
String szAPPModel = intent.getStringExtra(WinBoLL.EXTRA_APPMODEL);
|
||||||
LogUtils.d(TAG, String.format("szAPPModel %s", szAPPModel));
|
LogUtils.d(TAG, String.format("szAPPModel %s", szAPPModel));
|
||||||
if (szAPPModel != null && !szAPPModel.equals("")) {
|
if (szAPPModel != null && !szAPPModel.equals("")) {
|
||||||
try {
|
try {
|
||||||
@ -80,7 +80,7 @@ public class MainReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
String appName = AppUtils.getAppNameByPackageName(context, szObjectPackageName);
|
String appName = AppUtils.getAppNameByPackageName(context, szObjectPackageName);
|
||||||
LogUtils.d(TAG, String.format("appName %s", appName));
|
LogUtils.d(TAG, String.format("appName %s", appName));
|
||||||
WinBollNewsBean appWinBollNewsBean = new WinBollNewsBean(appName);
|
WinBoLLNewsBean appWinBoLLNewsBean = new WinBoLLNewsBean(appName);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
String currentTime = sdf.format(new Date());
|
String currentTime = sdf.format(new Date());
|
||||||
StringBuilder sbLine = new StringBuilder();
|
StringBuilder sbLine = new StringBuilder();
|
||||||
@ -88,9 +88,9 @@ public class MainReceiver extends BroadcastReceiver {
|
|||||||
sbLine.append(currentTime);
|
sbLine.append(currentTime);
|
||||||
sbLine.append("] Power to ");
|
sbLine.append("] Power to ");
|
||||||
sbLine.append(appName);
|
sbLine.append(appName);
|
||||||
appWinBollNewsBean.setMessage(sbLine.toString());
|
appWinBoLLNewsBean.setMessage(sbLine.toString());
|
||||||
|
|
||||||
APPNewsWidget.addWinBollNewsBean(context, appWinBollNewsBean);
|
APPNewsWidget.addWinBoLLNewsBean(context, appWinBoLLNewsBean);
|
||||||
|
|
||||||
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
||||||
intentWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
intentWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
||||||
@ -110,7 +110,7 @@ public class MainReceiver extends BroadcastReceiver {
|
|||||||
IntentFilter filter=new IntentFilter();
|
IntentFilter filter=new IntentFilter();
|
||||||
filter.addAction(ACTION_BOOT_COMPLETED);
|
filter.addAction(ACTION_BOOT_COMPLETED);
|
||||||
filter.addAction(SOS.ACTION_SOS);
|
filter.addAction(SOS.ACTION_SOS);
|
||||||
filter.addAction(WinBoll.ACTION_BIND);
|
filter.addAction(WinBoLL.ACTION_BIND);
|
||||||
//filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
//filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||||
service.registerReceiver(this, filter);
|
service.registerReceiver(this, filter);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import android.os.Binder;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import cc.winboll.studio.appbase.models.TestDemoBindServiceBean;
|
import cc.winboll.studio.appbase.models.TestDemoBindServiceBean;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
import cc.winboll.studio.libappbase.sos.WinBoLL;
|
||||||
import cc.winboll.studio.appbase.App;
|
import cc.winboll.studio.appbase.App;
|
||||||
import cc.winboll.studio.libappbase.sos.SOS;
|
import cc.winboll.studio.libappbase.sos.SOS;
|
||||||
|
|
||||||
@ -156,9 +156,9 @@ public class TestDemoBindService extends Service {
|
|||||||
super.run();
|
super.run();
|
||||||
LogUtils.d(TAG, "run() start");
|
LogUtils.d(TAG, "run() start");
|
||||||
if (App.isDebuging()) {
|
if (App.isDebuging()) {
|
||||||
WinBoll.bindToAPPBaseBeta(mContext, TestDemoBindService.class.getName());
|
WinBoLL.bindToAPPBaseBeta(mContext, TestDemoBindService.class.getName());
|
||||||
} else {
|
} else {
|
||||||
WinBoll.bindToAPPBase(mContext, TestDemoBindService.class.getName());
|
WinBoLL.bindToAPPBase(mContext, TestDemoBindService.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!isExit()) {
|
while (!isExit()) {
|
||||||
|
@ -12,7 +12,7 @@ import android.os.Binder;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import cc.winboll.studio.appbase.models.TestDemoServiceBean;
|
import cc.winboll.studio.appbase.models.TestDemoServiceBean;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
import cc.winboll.studio.libappbase.sos.WinBoLL;
|
||||||
|
|
||||||
public class TestDemoService extends Service {
|
public class TestDemoService extends Service {
|
||||||
|
|
||||||
|
@ -12,12 +12,12 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
import cc.winboll.studio.appbase.R;
|
import cc.winboll.studio.appbase.R;
|
||||||
import cc.winboll.studio.appbase.models.WinBollNewsBean;
|
import cc.winboll.studio.appbase.models.WinBoLLNewsBean;
|
||||||
import cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener;
|
import cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener;
|
||||||
import cc.winboll.studio.libappbase.AppUtils;
|
import cc.winboll.studio.libappbase.AppUtils;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.sos.APPModel;
|
import cc.winboll.studio.libappbase.sos.APPModel;
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
import cc.winboll.studio.libappbase.sos.WinBoLL;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -31,14 +31,14 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
public static final String ACTION_RELOAD_REPORT = APPNewsWidget.class.getName() + ".ACTION_RELOAD_REPORT";
|
public static final String ACTION_RELOAD_REPORT = APPNewsWidget.class.getName() + ".ACTION_RELOAD_REPORT";
|
||||||
|
|
||||||
|
|
||||||
volatile static ArrayList<WinBollNewsBean> _WinBollNewsBeanList;
|
volatile static ArrayList<WinBoLLNewsBean> _WinBoLLNewsBeanList;
|
||||||
final static int _MAX_PAGES = 10;
|
final static int _MAX_PAGES = 10;
|
||||||
final static int _OnePageLinesCount = 5;
|
final static int _OnePageLinesCount = 5;
|
||||||
volatile static int _CurrentPageIndex = 0;
|
volatile static int _CurrentPageIndex = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||||
initWinBollNewsBeanList(context);
|
initWinBoLLNewsBeanList(context);
|
||||||
for (int appWidgetId : appWidgetIds) {
|
for (int appWidgetId : appWidgetIds) {
|
||||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
super.onReceive(context, intent);
|
super.onReceive(context, intent);
|
||||||
initWinBollNewsBeanList(context);
|
initWinBoLLNewsBeanList(context);
|
||||||
if (intent.getAction().equals(ACTION_RELOAD_REPORT)) {
|
if (intent.getAction().equals(ACTION_RELOAD_REPORT)) {
|
||||||
LogUtils.d(TAG, "ACTION_RELOAD_REPORT");
|
LogUtils.d(TAG, "ACTION_RELOAD_REPORT");
|
||||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||||
@ -57,7 +57,7 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
}else if (intent.getAction().equals(ACTION_WAKEUP_SERVICE)) {
|
}else if (intent.getAction().equals(ACTION_WAKEUP_SERVICE)) {
|
||||||
LogUtils.d(TAG, "ACTION_WAKEUP_SERVICE");
|
LogUtils.d(TAG, "ACTION_WAKEUP_SERVICE");
|
||||||
String szAPPModel = intent.getStringExtra(WinBoll.EXTRA_APPMODEL);
|
String szAPPModel = intent.getStringExtra(WinBoLL.EXTRA_APPMODEL);
|
||||||
LogUtils.d(TAG, String.format("szAPPModel %s", szAPPModel));
|
LogUtils.d(TAG, String.format("szAPPModel %s", szAPPModel));
|
||||||
if (szAPPModel != null && !szAPPModel.equals("")) {
|
if (szAPPModel != null && !szAPPModel.equals("")) {
|
||||||
try {
|
try {
|
||||||
@ -71,7 +71,7 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
|
|
||||||
String appName = AppUtils.getAppNameByPackageName(context, szAppPackageName);
|
String appName = AppUtils.getAppNameByPackageName(context, szAppPackageName);
|
||||||
LogUtils.d(TAG, String.format("appName %s", appName));
|
LogUtils.d(TAG, String.format("appName %s", appName));
|
||||||
WinBollNewsBean winBollNewsBean = new WinBollNewsBean(appName);
|
WinBoLLNewsBean winBollNewsBean = new WinBoLLNewsBean(appName);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
String currentTime = sdf.format(new Date());
|
String currentTime = sdf.format(new Date());
|
||||||
StringBuilder sbLine = new StringBuilder();
|
StringBuilder sbLine = new StringBuilder();
|
||||||
@ -81,7 +81,7 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
sbLine.append(appName);
|
sbLine.append(appName);
|
||||||
winBollNewsBean.setMessage(sbLine.toString());
|
winBollNewsBean.setMessage(sbLine.toString());
|
||||||
|
|
||||||
addWinBollNewsBean(context, winBollNewsBean);
|
addWinBoLLNewsBean(context, winBollNewsBean);
|
||||||
|
|
||||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, APPNewsWidget.class));
|
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, APPNewsWidget.class));
|
||||||
@ -99,24 +99,24 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
//
|
//
|
||||||
// 加入新报告信息
|
// 加入新报告信息
|
||||||
//
|
//
|
||||||
public synchronized static void addWinBollNewsBean(Context context, WinBollNewsBean bean) {
|
public synchronized static void addWinBoLLNewsBean(Context context, WinBoLLNewsBean bean) {
|
||||||
initWinBollNewsBeanList(context);
|
initWinBoLLNewsBeanList(context);
|
||||||
_WinBollNewsBeanList.add(0, bean);
|
_WinBoLLNewsBeanList.add(0, bean);
|
||||||
// 控制记录总数
|
// 控制记录总数
|
||||||
while (_WinBollNewsBeanList.size() > _MAX_PAGES * _OnePageLinesCount) {
|
while (_WinBoLLNewsBeanList.size() > _MAX_PAGES * _OnePageLinesCount) {
|
||||||
_WinBollNewsBeanList.remove(_WinBollNewsBeanList.size() - 1);
|
_WinBoLLNewsBeanList.remove(_WinBoLLNewsBeanList.size() - 1);
|
||||||
}
|
}
|
||||||
WinBollNewsBean.saveBeanList(context, _WinBollNewsBeanList, WinBollNewsBean.class);
|
WinBoLLNewsBean.saveBeanList(context, _WinBoLLNewsBeanList, WinBoLLNewsBean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized static void initWinBollNewsBeanList(Context context) {
|
synchronized static void initWinBoLLNewsBeanList(Context context) {
|
||||||
if (_WinBollNewsBeanList == null) {
|
if (_WinBoLLNewsBeanList == null) {
|
||||||
_WinBollNewsBeanList = new ArrayList<WinBollNewsBean>();
|
_WinBoLLNewsBeanList = new ArrayList<WinBoLLNewsBean>();
|
||||||
WinBollNewsBean.loadBeanList(context, _WinBollNewsBeanList, WinBollNewsBean.class);
|
WinBoLLNewsBean.loadBeanList(context, _WinBoLLNewsBeanList, WinBoLLNewsBean.class);
|
||||||
}
|
}
|
||||||
if (_WinBollNewsBeanList == null) {
|
if (_WinBoLLNewsBeanList == null) {
|
||||||
_WinBollNewsBeanList = new ArrayList<WinBollNewsBean>();
|
_WinBoLLNewsBeanList = new ArrayList<WinBoLLNewsBean>();
|
||||||
WinBollNewsBean.saveBeanList(context, _WinBollNewsBeanList, WinBollNewsBean.class);
|
WinBoLLNewsBean.saveBeanList(context, _WinBoLLNewsBeanList, WinBoLLNewsBean.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,11 +141,11 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
|
|
||||||
public static String getMessage() {
|
public static String getMessage() {
|
||||||
ArrayList<String> msgTemp = new ArrayList<String>();
|
ArrayList<String> msgTemp = new ArrayList<String>();
|
||||||
if (_WinBollNewsBeanList != null) {
|
if (_WinBoLLNewsBeanList != null) {
|
||||||
int start = _OnePageLinesCount * _CurrentPageIndex;
|
int start = _OnePageLinesCount * _CurrentPageIndex;
|
||||||
start = _WinBollNewsBeanList.size() > start ? start : _WinBollNewsBeanList.size() - 1;
|
start = _WinBoLLNewsBeanList.size() > start ? start : _WinBoLLNewsBeanList.size() - 1;
|
||||||
for (int i = start, j = 0; i < _WinBollNewsBeanList.size() && j < _OnePageLinesCount && start > -1; i++, j++) {
|
for (int i = start, j = 0; i < _WinBoLLNewsBeanList.size() && j < _OnePageLinesCount && start > -1; i++, j++) {
|
||||||
msgTemp.add(_WinBollNewsBeanList.get(i).getMessage());
|
msgTemp.add(_WinBoLLNewsBeanList.get(i).getMessage());
|
||||||
}
|
}
|
||||||
String message = String.join("\n", msgTemp);
|
String message = String.join("\n", msgTemp);
|
||||||
return message;
|
return message;
|
||||||
@ -154,7 +154,7 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void prePage(Context context) {
|
public static void prePage(Context context) {
|
||||||
if (_WinBollNewsBeanList != null) {
|
if (_WinBoLLNewsBeanList != null) {
|
||||||
if (_CurrentPageIndex > 0) {
|
if (_CurrentPageIndex > 0) {
|
||||||
_CurrentPageIndex = _CurrentPageIndex - 1;
|
_CurrentPageIndex = _CurrentPageIndex - 1;
|
||||||
}
|
}
|
||||||
@ -165,8 +165,8 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void nextPage(Context context) {
|
public static void nextPage(Context context) {
|
||||||
if (_WinBollNewsBeanList != null) {
|
if (_WinBoLLNewsBeanList != null) {
|
||||||
if ((_CurrentPageIndex + 1) * _OnePageLinesCount < _WinBollNewsBeanList.size()) {
|
if ((_CurrentPageIndex + 1) * _OnePageLinesCount < _WinBoLLNewsBeanList.size()) {
|
||||||
_CurrentPageIndex = _CurrentPageIndex + 1;
|
_CurrentPageIndex = _CurrentPageIndex + 1;
|
||||||
}
|
}
|
||||||
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
||||||
@ -176,11 +176,11 @@ public class APPNewsWidget extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getPageInfo() {
|
String getPageInfo() {
|
||||||
if (_WinBollNewsBeanList == null) {
|
if (_WinBoLLNewsBeanList == null) {
|
||||||
return "0/0";
|
return "0/0";
|
||||||
}
|
}
|
||||||
int leftCount = _WinBollNewsBeanList.size() % _OnePageLinesCount;
|
int leftCount = _WinBoLLNewsBeanList.size() % _OnePageLinesCount;
|
||||||
int currentPageCount = _WinBollNewsBeanList.size() / _OnePageLinesCount + (leftCount == 0 ?0: 1);
|
int currentPageCount = _WinBoLLNewsBeanList.size() / _OnePageLinesCount + (leftCount == 0 ?0: 1);
|
||||||
return String.format("%d/%d", _CurrentPageIndex + 1, currentPageCount);
|
return String.format("%d/%d", _CurrentPageIndex + 1, currentPageCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/toolbar"/>
|
android:id="@+id/toolbar"/>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Hello, WinBoll!"/>
|
android:text="Hello, WinBoLL!"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/toolbar"/>
|
android:id="@+id/toolbar"/>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/toolbar"/>
|
android:id="@+id/toolbar"/>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_title"
|
||||||
android:layout_weight="1.0"
|
android:layout_weight="1.0"
|
||||||
android:text="WinBollNews"
|
android:text="WinBoLLNews"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textSize="16sp"/>
|
android:textSize="16sp"/>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">AppBase</string>
|
<string name="app_name">AppBase</string>
|
||||||
<string name="tileservice_name">WinBoll</string>
|
<string name="tileservice_name">WinBoLL</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -19,17 +19,17 @@ def genVersionName(def versionName){
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 32
|
compileSdkVersion 32
|
||||||
buildToolsVersion "33.0.3"
|
buildToolsVersion "32.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.apputils"
|
applicationId "cc.winboll.studio.apputils"
|
||||||
minSdkVersion 21
|
minSdkVersion 26
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "9.2"
|
versionName "15.3"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@ -41,15 +41,9 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':libapputils')
|
api project(':libapputils')
|
||||||
api 'cc.winboll.studio:libappbase:1.0.3'
|
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Jan 18 13:03:10 HKT 2025
|
#Tue Apr 29 15:04:17 HKT 2025
|
||||||
stageCount=2
|
stageCount=5
|
||||||
libraryProject=libapputils
|
libraryProject=libapputils
|
||||||
baseVersion=9.2
|
baseVersion=15.3
|
||||||
publishVersion=9.2.1
|
publishVersion=15.3.4
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=9.2.2
|
baseBetaVersion=15.3.5
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_winboll"
|
android:icon="@drawable/ic_winboll"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/WinBoll.SupportThemeNoActionBar"
|
android:theme="@style/MyUtilsTheme"
|
||||||
android:supportsRtl="true">
|
android:supportsRtl="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@ -27,9 +27,13 @@
|
|||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".TestWinBollActivity"/>
|
<activity android:name=".TestStringToQRCodeViewActivity"/>
|
||||||
|
|
||||||
<activity android:name=".TestStringToQrCodeViewActivity"/>
|
<activity android:name=".TestBBMorseCodeActivity"/>
|
||||||
|
|
||||||
|
<activity android:name=".AssetsHtmlActivity"/>
|
||||||
|
|
||||||
|
<activity android:name=".QRCodeDecodeActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -5,27 +5,16 @@ package cc.winboll.studio.apputils;
|
|||||||
* @Date 2024/12/08 15:10:51
|
* @Date 2024/12/08 15:10:51
|
||||||
* @Describe 全局应用类
|
* @Describe 全局应用类
|
||||||
*/
|
*/
|
||||||
import android.view.Gravity;
|
import android.app.Application;
|
||||||
import cc.winboll.studio.libapputils.app.WinBollApplication;
|
import android.content.Context;
|
||||||
import com.hjq.toast.ToastUtils;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import com.hjq.toast.style.WhiteToastStyle;
|
|
||||||
|
|
||||||
public class App extends WinBollApplication {
|
public class App extends GlobalApplication {
|
||||||
|
|
||||||
public static final String TAG = "App";
|
public static final String TAG = "App";
|
||||||
|
|
||||||
public static final String _ACTION_DEBUGVIEW = WinBollApplication.class.getName() + "_ACTION_DEBUGVIEW";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
// 初始化 Toast 框架
|
|
||||||
//
|
|
||||||
ToastUtils.init(this);
|
|
||||||
// 设置 Toast 布局样式
|
|
||||||
//ToastUtils.setView(R.layout.view_toast);
|
|
||||||
ToastUtils.setStyle(new WhiteToastStyle());
|
|
||||||
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,59 +1,53 @@
|
|||||||
package cc.winboll.studio.libapputils.activities;
|
package cc.winboll.studio.apputils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@QQ.COM
|
* @Author ZhanGSKen@QQ.COM
|
||||||
* @Date 2025/01/03 11:02:49
|
* @Date 2025/01/03 11:02:49
|
||||||
* @Describe 一个可以浏览随 APP 附带的 Html 文档的窗口
|
* @Describe 一个可以浏览随 APP 附带的 Html 文档的窗口
|
||||||
*/
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
import cc.winboll.studio.libapputils.R;
|
import cc.winboll.studio.apputils.R;
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivity;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libapputils.log.LogUtils;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
import cc.winboll.studio.libapputils.view.SimpleWebView;
|
import cc.winboll.studio.libapputils.views.SimpleWebView;
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import android.os.PersistableBundle;
|
|
||||||
|
|
||||||
public class AssetsHtmlActivity extends WinBollActivity {
|
public class AssetsHtmlActivity extends WinBoLLActivityBase implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "AssetsHtmlActivity";
|
@Override
|
||||||
|
public Activity getActivity() {
|
||||||
public static final String EXTRA_HTMLFILENAME = "EXTRA_HTMLFILENAME";
|
return super.getActivity();
|
||||||
|
}
|
||||||
String mszHelpIndexFilePath = "";
|
|
||||||
Uri mszHelpIndexFileUri;
|
|
||||||
Context mContext;
|
|
||||||
|
|
||||||
// Assets 文件夹里的 Html 文件的名称
|
|
||||||
String mszHtmlFileName;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isEnableDisplayHomeAsUp() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static final String TAG = "AssetsHtmlActivity";
|
||||||
|
|
||||||
@Override
|
public static final String EXTRA_HTMLFILENAME = "EXTRA_HTMLFILENAME";
|
||||||
protected boolean isAddWinBollToolBar() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
String mszHelpIndexFilePath = "";
|
||||||
protected Toolbar initToolBar() {
|
Uri mszHelpIndexFileUri;
|
||||||
return findViewById(R.id.activityassetshtmlToolbar1);
|
Context mContext;
|
||||||
}
|
|
||||||
|
// Assets 文件夹里的 Html 文件的名称
|
||||||
|
String mszHtmlFileName;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public Activity getActivity() {
|
||||||
|
// return this;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
@ -63,7 +57,7 @@ public class AssetsHtmlActivity extends WinBollActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
// if (item.getItemId() == android.R.id.home) {
|
// if (item.getItemId() == android.R.id.home) {
|
||||||
// WinBollActivityManager.getInstance(this).finish(this);
|
// WinBoLLActivityManager.getInstance(this).finish(this);
|
||||||
// }
|
// }
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@ -73,6 +67,10 @@ public class AssetsHtmlActivity extends WinBollActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_assetshtml);
|
setContentView(R.layout.activity_assetshtml);
|
||||||
|
|
||||||
|
// 初始化工具栏
|
||||||
|
Toolbar mToolbar = findViewById(R.id.toolbar);
|
||||||
|
setActionBar(mToolbar);
|
||||||
|
|
||||||
mszHtmlFileName = "index.html";
|
mszHtmlFileName = "index.html";
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
@ -81,7 +79,7 @@ public class AssetsHtmlActivity extends WinBollActivity {
|
|||||||
if (szTemp != null && !szTemp.trim().equals("")) {
|
if (szTemp != null && !szTemp.trim().equals("")) {
|
||||||
mszHtmlFileName = szTemp.trim();
|
mszHtmlFileName = szTemp.trim();
|
||||||
}
|
}
|
||||||
ToastUtils.show(mszHtmlFileName);
|
//ToastUtils.show(mszHtmlFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 与其他应用分享 html 帮助
|
// 与其他应用分享 html 帮助
|
||||||
@ -107,13 +105,6 @@ public class AssetsHtmlActivity extends WinBollActivity {
|
|||||||
// myWebView.loadUrl(mszHelpIndexFileUri.toString());
|
// myWebView.loadUrl(mszHelpIndexFileUri.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
|
|
||||||
super.onPostCreate(savedInstanceState, persistentState);
|
|
||||||
setSubTitle(mszHtmlFileName);
|
|
||||||
//setSubTitle(TAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
void initWebViewFromAssets(String szHtmlFileName) {
|
void initWebViewFromAssets(String szHtmlFileName) {
|
||||||
try {
|
try {
|
@ -1,87 +1,159 @@
|
|||||||
package cc.winboll.studio.apputils;
|
package cc.winboll.studio.apputils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
import cc.winboll.studio.libapputils.activities.AssetsHtmlActivity;
|
import cc.winboll.studio.apputils.R;
|
||||||
import cc.winboll.studio.libapputils.activities.QRCodeDecodeActivity;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivity;
|
import cc.winboll.studio.libappbase.LogView;
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
|
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||||
import cc.winboll.studio.libapputils.log.LogActivity;
|
import java.util.List;
|
||||||
import cc.winboll.studio.libapputils.log.LogUtils;
|
import java.util.Set;
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
|
|
||||||
final public class MainActivity extends WinBollActivity {
|
final public class MainActivity extends Activity {
|
||||||
|
|
||||||
public static final String TAG = "MainActivity";
|
public static final String TAG = "MainActivity";
|
||||||
|
|
||||||
public static final int REQUEST_QRCODEDECODE_ACTIVITY = 0;
|
public static final int REQUEST_QRCODEDECODE_ACTIVITY = 0;
|
||||||
|
|
||||||
@Override
|
Toolbar mToolbar;
|
||||||
protected boolean isEnableDisplayHomeAsUp() {
|
LogView mLogView;
|
||||||
return false;
|
//
|
||||||
}
|
// @Override
|
||||||
|
// public Activity getActivity() {
|
||||||
|
// return this;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
//Toolbar toolbar = findViewById(R.id.activitymainToolbar1);
|
mLogView = findViewById(R.id.logview);
|
||||||
//setActionBar(toolbar);
|
mLogView.start();
|
||||||
|
|
||||||
|
// 初始化工具栏
|
||||||
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
|
setActionBar(mToolbar);
|
||||||
|
// if (isEnableDisplayHomeAsUp()) {
|
||||||
|
// // 显示后退按钮
|
||||||
|
// getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
// }
|
||||||
|
// getActionBar().setSubtitle(getTag());
|
||||||
|
|
||||||
|
checkResolveActivity();
|
||||||
|
archiveInstance();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回
|
// 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回
|
||||||
//if (prosessIntents(getIntent())) return;
|
//if (prosessIntents(getIntent())) return;
|
||||||
// 以下正常创建主窗口
|
// 以下正常创建主窗口
|
||||||
|
|
||||||
// // 设置 WinBoll 应用 UI 类型
|
// // 设置 WinBoLL 应用 UI 类型
|
||||||
// WinBollApplication.setWinBollUI_TYPE(WinBollApplication.WinBollUI_TYPE.Aplication);
|
// WinBoLLApplication.setWinBoLLUI_TYPE(WinBoLLApplication.WinBoLLUI_TYPE.Aplication);
|
||||||
// //ToastUtils.show("WinBollUI_TYPE " + WinBollApplication.getWinBollUI_TYPE());
|
// //ToastUtils.show("WinBoLLUI_TYPE " + WinBoLLApplication.getWinBoLLUI_TYPE());
|
||||||
// LogUtils.d(TAG, "BuildConfig.DEBUG : " + Boolean.toString(BuildConfig.DEBUG));
|
// LogUtils.d(TAG, "BuildConfig.DEBUG : " + Boolean.toString(BuildConfig.DEBUG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean checkResolveActivity() {
|
||||||
|
PackageManager packageManager = getPackageManager();
|
||||||
|
//Intent intent = new Intent("your_action_here");
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent != null) {
|
||||||
|
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||||
|
if (resolveInfoList.size() > 0) {
|
||||||
|
// 传入的Intent action在Activity清单的intent-filter的action节点里有定义
|
||||||
|
if (intent.getAction() != null) {
|
||||||
|
// if (intent.getAction().equals(cc.winboll.studio.libapputils.intent.action.DEBUGVIEW)) {
|
||||||
|
// App.setIsDebug(true);
|
||||||
|
// //ToastUtils.show!("WinBoLLApplication.setIsDebug(true) by action : " + intent.getAction());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// 传入的Intent action在Activity清单的intent-filter的action节点里没有定义
|
||||||
|
//ToastUtils.show("false : " + intent.getAction());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// action在清单文件中没有声明
|
||||||
|
ToastUtils.show("false");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void archiveInstance() {
|
||||||
|
Intent intent = getIntent();
|
||||||
|
StringBuilder sb = new StringBuilder("\n### Archive Instance ###\n");
|
||||||
|
|
||||||
|
if (intent != null) {
|
||||||
|
ComponentName componentName = intent.getComponent();
|
||||||
|
if (componentName != null) {
|
||||||
|
String packageName = componentName.getPackageName();
|
||||||
|
//Log.d("AppStarter", "启动本应用的应用包名: " + packageName);
|
||||||
|
sb.append("启动本应用的应用包名: \n" + packageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append("\nImplicit Intent Tracker :\n接收到的 Intent 动作: \n" + intent.getAction());
|
||||||
|
Set<String> categories = intent.getCategories();
|
||||||
|
if (categories != null) {
|
||||||
|
for (String category : categories) {
|
||||||
|
sb.append("\n接收到的 Intent 类别 :\n" + category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Uri data = intent.getData();
|
||||||
|
if (data != null) {
|
||||||
|
sb.append("\n接收到的 Intent 数据 :\n" + data.toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sb.append("Intent is null.");
|
||||||
|
}
|
||||||
|
sb.append("\n\n");
|
||||||
|
LogUtils.d(TAG, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
super.onPostCreate(savedInstanceState);
|
||||||
|
// 缓存当前 activity
|
||||||
|
//WinBoLLActivityManager.getInstance(this).add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
//WinBoLLActivityManager.getInstance(this).registeRemove(this);
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
public void onTestLogClick(View view) {
|
public void onTestLogClick(View view) {
|
||||||
LogUtils.d(TAG, "onTestLogClick");
|
LogUtils.d(TAG, "onTestLogClick");
|
||||||
Toast.makeText(getApplication(), "onTestLogClick", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplication(), "onTestLogClick", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLogUtilsClick(View view) {
|
public void onTestLogActivity(View view) {
|
||||||
Intent intent = new Intent(this, LogActivity.class);
|
// Intent intent = new Intent(this, LogActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
startActivity(intent);
|
// startActivity(intent);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
//WinBoLLActivityManager.getInstance().printAvtivityListInfo();
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
//WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, LogActivity.class);
|
||||||
super.onPostCreate(savedInstanceState);
|
|
||||||
// setSubTitle("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
// exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void exit() {
|
|
||||||
// YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onYes() {
|
|
||||||
// WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onNo() {
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// 处理传入的 Intent 数据
|
// 处理传入的 Intent 数据
|
||||||
//
|
//
|
||||||
@ -93,7 +165,7 @@ final public class MainActivity extends WinBollActivity {
|
|||||||
|
|
||||||
// if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) {
|
// if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) {
|
||||||
// try {
|
// try {
|
||||||
// WinBollActivity clazzActivity = UnitTestActivity.class.newInstance();
|
// WinBoLLActivity clazzActivity = UnitTestActivity.class.newInstance();
|
||||||
// String tag = clazzActivity.getTag();
|
// String tag = clazzActivity.getTag();
|
||||||
// LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag);
|
// LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag);
|
||||||
// Intent subIntent = new Intent(this, UnitTestActivity.class);
|
// Intent subIntent = new Intent(this, UnitTestActivity.class);
|
||||||
@ -111,8 +183,8 @@ final public class MainActivity extends WinBollActivity {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath()));
|
// Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath()));
|
||||||
// //startWinBollActivity(subIntent, tag);
|
// //startWinBoLLActivity(subIntent, tag);
|
||||||
// WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class);
|
// WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, subIntent, UnitTestActivity.class);
|
||||||
// } catch (IllegalAccessException | InstantiationException | IOException e) {
|
// } catch (IllegalAccessException | InstantiationException | IOException e) {
|
||||||
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
// // 函数处理异常返回失败
|
// // 函数处理异常返回失败
|
||||||
@ -125,58 +197,107 @@ final public class MainActivity extends WinBollActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isAddWinBollToolBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Toolbar initToolBar() {
|
|
||||||
return findViewById(R.id.activitymainToolbar1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
//ToastUtils.show("onCreateOptionsMenu");
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
||||||
|
// if (isAddWinBoLLToolBar()) {
|
||||||
|
// //ToastUtils.show("mIWinBoLL.isAddWinBoLLToolBar()");
|
||||||
|
// getMenuInflater().inflate(R.menu.toolbar_winboll_shared_main, menu);
|
||||||
|
// }
|
||||||
|
if (App.isDebuging()) {
|
||||||
|
getMenuInflater().inflate(R.menu.toolbar_studio_debug, menu);
|
||||||
|
}
|
||||||
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.item_testwinboll) {
|
if (item.getItemId() == R.id.item_exit) {
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, TestWinBollActivity.class);
|
//exit();
|
||||||
|
return true;
|
||||||
} else if (item.getItemId() == R.id.item_teststringtoqrcodeview) {
|
} else if (item.getItemId() == R.id.item_teststringtoqrcodeview) {
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, TestStringToQrCodeViewActivity.class);
|
Intent intent = new Intent(this, TestStringToQRCodeViewActivity.class);
|
||||||
|
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
|
||||||
|
//WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, TestStringToQrCodeViewActivity.class);
|
||||||
} else if (item.getItemId() == R.id.item_testqrcodedecodeactivity) {
|
} else if (item.getItemId() == R.id.item_testqrcodedecodeactivity) {
|
||||||
Intent intent = new Intent(this, QRCodeDecodeActivity.class);
|
Intent intent = new Intent(this, QRCodeDecodeActivity.class);
|
||||||
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
|
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
|
||||||
|
} else if (item.getItemId() == R.id.item_testcrashreport) {
|
||||||
|
for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; i++) {
|
||||||
|
getString(i);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.item_log) {
|
||||||
|
//WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, LogActivity.class);
|
||||||
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.item_exitdebug) {
|
||||||
|
//AboutView.setApp2NormalMode(this);
|
||||||
|
return true;
|
||||||
|
} else if (item.getItemId() == android.R.id.home) {
|
||||||
|
//WinBoLLActivityManager.getInstance(this).finish(this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTestJavascriptHtmlActivity(View view) {
|
// void exit() {
|
||||||
|
// YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onYes() {
|
||||||
|
// //WinBoLLActivityManager.getInstance(getApplicationContext()).finishAll();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onNo() {
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
// if (WinBoLLActivityManager.getInstance(getApplicationContext()).isFirstIWinBoLLActivity(this)) {
|
||||||
|
// exit();
|
||||||
|
// } else {
|
||||||
|
// WinBoLLActivityManager.getInstance(this).finish(this);
|
||||||
|
// super.onBackPressed();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onTestAssetsHtmlActivity(View view) {
|
||||||
Intent intent = new Intent(this, AssetsHtmlActivity.class);
|
Intent intent = new Intent(this, AssetsHtmlActivity.class);
|
||||||
intent.putExtra(AssetsHtmlActivity.EXTRA_HTMLFILENAME, "javascript_test.html");
|
intent.putExtra(AssetsHtmlActivity.EXTRA_HTMLFILENAME, "javascript_test.html");
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AssetsHtmlActivity.class);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
//WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, intent, AssetsHtmlActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onResume() {
|
||||||
switch (requestCode) {
|
super.onResume();
|
||||||
case REQUEST_QRCODEDECODE_ACTIVITY : {
|
mLogView.start();
|
||||||
String text = data.getStringExtra(QRCodeDecodeActivity.EXTRA_RESULT);
|
|
||||||
ToastUtils.show(text);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default : {
|
|
||||||
ToastUtils.show(String.format("%d, %d", requestCode, resultCode));
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
protected void onActivithyResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
switch (requestCode) {
|
||||||
|
case REQUEST_QRCODEDECODE_ACTIVITY : {
|
||||||
|
if (data != null) {
|
||||||
|
String text = data.getStringExtra(QRCodeDecodeActivity.EXTRA_RESULT);
|
||||||
|
ToastUtils.show(text);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default : {
|
||||||
|
//ToastUtils.show(String.format("%d, %d", requestCode, resultCode));
|
||||||
|
super.prosessActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -1,72 +1,59 @@
|
|||||||
package cc.winboll.studio.libapputils.activities;
|
package cc.winboll.studio.apputils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@QQ.COM
|
* @Author ZhanGSKen@QQ.COM
|
||||||
* @Date 2025/01/18 10:32:21
|
* @Date 2025/01/18 10:32:21
|
||||||
* @Describe 二维码扫码解码窗口
|
* @Describe 二维码扫码解码窗口
|
||||||
*/
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
import androidx.core.app.ActivityCompat;
|
import cc.winboll.studio.apputils.R;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import cc.winboll.studio.libapputils.R;
|
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivity;
|
|
||||||
import com.google.zxing.ResultPoint;
|
import com.google.zxing.ResultPoint;
|
||||||
import com.journeyapps.barcodescanner.BarcodeCallback;
|
import com.journeyapps.barcodescanner.BarcodeCallback;
|
||||||
import com.journeyapps.barcodescanner.BarcodeResult;
|
import com.journeyapps.barcodescanner.BarcodeResult;
|
||||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class QRCodeDecodeActivity extends WinBollActivity {
|
public class QRCodeDecodeActivity extends Activity {
|
||||||
|
|
||||||
public static final String TAG = "QRCodeDecodeActivity";
|
public static final String TAG = "QRCodeDecodeActivity";
|
||||||
public static final String EXTRA_RESULT = "EXTRA_RESULT";
|
|
||||||
|
|
||||||
|
public static final String EXTRA_RESULT = "EXTRA_RESULT";
|
||||||
private static final int REQUEST_CAMERA_PERMISSION = 1;
|
private static final int REQUEST_CAMERA_PERMISSION = 1;
|
||||||
|
|
||||||
TextView resultTextView;
|
TextView resultTextView;
|
||||||
DecoratedBarcodeView barcodeView;
|
DecoratedBarcodeView barcodeView;
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
protected boolean isEnableDisplayHomeAsUp() {
|
// public Activity getActivity() {
|
||||||
return true;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isAddWinBollToolBar() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Toolbar initToolBar() {
|
|
||||||
return findViewById(R.id.activityqrcodedecodeToolbar1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_qrcodedecode);
|
setContentView(R.layout.activity_qrcodedecode);
|
||||||
resultTextView = findViewById(R.id.activityqrcodedecodeTextView1);
|
|
||||||
|
// 初始化工具栏
|
||||||
|
// Toolbar mToolbar = findViewById(R.id.toolbar);
|
||||||
|
// setActionBar(mToolbar);
|
||||||
|
|
||||||
|
//resultTextView = findViewById(R.id.activityqrcodedecodeTextView1);
|
||||||
barcodeView = findViewById(R.id.activityqrcodedecodeDecoratedBarcodeView1);
|
barcodeView = findViewById(R.id.activityqrcodedecodeDecoratedBarcodeView1);
|
||||||
// 请求相机权限
|
// 请求相机权限
|
||||||
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
|
// if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
// != PackageManager.PERMISSION_GRANTED) {
|
||||||
ActivityCompat.requestPermissions(this,
|
// ActivityCompat.requestPermissions(this,
|
||||||
new String[]{android.Manifest.permission.CAMERA},
|
// new String[]{android.Manifest.permission.CAMERA},
|
||||||
REQUEST_CAMERA_PERMISSION);
|
// REQUEST_CAMERA_PERMISSION);
|
||||||
} else {
|
// } else {
|
||||||
startScanning();
|
// startScanning();
|
||||||
}
|
// }
|
||||||
|
startScanning();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startScanning() {
|
private void startScanning() {
|
@ -0,0 +1,20 @@
|
|||||||
|
package cc.winboll.studio.apputils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/23 16:14:45
|
||||||
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class TestBBMorseCodeActivity extends Activity {
|
||||||
|
|
||||||
|
public static final String TAG = "TestBBMorseCodeActivity";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_testbbmorsecode);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package cc.winboll.studio.apputils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@QQ.COM
|
||||||
|
* @Date 2025/01/17 19:50:46
|
||||||
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Toolbar;
|
||||||
|
import cc.winboll.studio.apputils.R;
|
||||||
|
import cc.winboll.studio.libapputils.views.StringToQrCodeView;
|
||||||
|
|
||||||
|
public class TestStringToQRCodeViewActivity extends Activity {
|
||||||
|
|
||||||
|
public static final String TAG = "TestStringToQrCodeViewActivity";
|
||||||
|
|
||||||
|
StringToQrCodeView mStringToQrCodeView;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public Activity getActivity() {
|
||||||
|
// return this;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_teststringtoqrcodeview);
|
||||||
|
|
||||||
|
// 初始化工具栏
|
||||||
|
Toolbar mToolbar = findViewById(R.id.toolbar);
|
||||||
|
mToolbar.setSubtitle(TAG);
|
||||||
|
setActionBar(mToolbar);
|
||||||
|
|
||||||
|
mStringToQrCodeView = findViewById(R.id.activityteststringtoqrcodeviewStringToQrCodeView1);
|
||||||
|
}
|
||||||
|
}
|
@ -1,50 +0,0 @@
|
|||||||
package cc.winboll.studio.apputils;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivity;
|
|
||||||
import cc.winboll.studio.libapputils.view.StringToQrCodeView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2025/01/17 19:50:46
|
|
||||||
*/
|
|
||||||
public class TestStringToQrCodeViewActivity extends WinBollActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "TestStringToQrCodeViewActivity";
|
|
||||||
|
|
||||||
StringToQrCodeView mStringToQrCodeView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Toolbar initToolBar() {
|
|
||||||
return findViewById(R.id.activityteststringtoqrcodeviewToolbar1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isEnableDisplayHomeAsUp() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isAddWinBollToolBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_teststringtoqrcodeview);
|
|
||||||
mStringToQrCodeView = findViewById(R.id.activityteststringtoqrcodeviewStringToQrCodeView1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
|
||||||
super.onPostCreate(savedInstanceState);
|
|
||||||
setSubTitle(TAG);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package cc.winboll.studio.apputils;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import cc.winboll.studio.libapputils.activities.AssetsHtmlActivity;
|
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivity;
|
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2025/01/13 15:09:46
|
|
||||||
*/
|
|
||||||
public class TestWinBollActivity extends WinBollActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "TestWinBollActivity";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Toolbar initToolBar() {
|
|
||||||
return findViewById(R.id.activitytestwinbollToolbar1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isEnableDisplayHomeAsUp() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isAddWinBollToolBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_testwinboll);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
|
||||||
super.onPostCreate(savedInstanceState);
|
|
||||||
setSubTitle(TAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,51 @@
|
|||||||
|
package cc.winboll.studio.apputils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/28 17:11:37
|
||||||
|
* @Describe 应用活动窗口基类
|
||||||
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
import cc.winboll.studio.libappbase.winboll.WinBoLLActivityManager;
|
||||||
|
|
||||||
|
public class WinBoLLActivityBase extends Activity implements IWinBoLLActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "WinBoLLActivityBase";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Activity getActivity() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
WinBoLLActivityManager getWinBoLLActivityManager() {
|
||||||
|
return WinBoLLActivityManager.getInstance(GlobalApplication.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
getWinBoLLActivityManager().add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
|
||||||
|
super.onPostCreate(savedInstanceState, persistentState);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getWinBoLLActivityManager().registeRemove(this);
|
||||||
|
}
|
||||||
|
}
|
21
apputils/src/main/res/layout/activity_assetshtml.xml
Normal file
21
apputils/src/main/res/layout/activity_assetshtml.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<android.widget.Toolbar
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/toolbar"/>
|
||||||
|
|
||||||
|
<cc.winboll.studio.libapputils.views.SimpleWebView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:id="@+id/activityassetshtmlSimpleWebView1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -5,10 +5,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<android.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activitymainToolbar1"/>
|
android:id="@+id/toolbar"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
@ -27,32 +27,39 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="TestLog"
|
android:text="TestLog"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onTestLogClick"/>
|
android:onClick="onTestLogClick"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="LogUtils"
|
android:text="TestLogActivity"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onLogUtilsClick"/>
|
android:onClick="onTestLogActivity"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right">
|
android:gravity="right">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:text="Test Javascript Html Activity"
|
android:text="TestAssetsHtmlActivity"
|
||||||
android:onClick="onTestJavascriptHtmlActivity"/>
|
android:onClick="onTestAssetsHtmlActivity"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<cc.winboll.studio.libappbase.LogView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:text="Button"
|
||||||
|
android:id="@+id/logview"
|
||||||
|
android:layout_weight="1.0"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
20
apputils/src/main/res/layout/activity_qrcodedecode.xml
Normal file
20
apputils/src/main/res/layout/activity_qrcodedecode.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="QRCodeDecodeActivity"/>
|
||||||
|
|
||||||
|
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/activityqrcodedecodeDecoratedBarcodeView1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -5,11 +5,5 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Text"
|
|
||||||
android:id="@+id/page_text"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -6,10 +6,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<android.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activityteststringtoqrcodeviewToolbar1"/>
|
android:id="@+id/toolbar"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1.0">
|
android:layout_weight="1.0">
|
||||||
|
|
||||||
<cc.winboll.studio.libapputils.view.StringToQrCodeView
|
<cc.winboll.studio.libapputils.views.StringToQrCodeView
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="300dp"
|
android:layout_height="300dp"
|
||||||
android:id="@+id/activityteststringtoqrcodeviewStringToQrCodeView1"/>
|
android:id="@+id/activityteststringtoqrcodeviewStringToQrCodeView1"/>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#FF36B5B3">
|
android:background="#FF36B5B3">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<android.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activitytestwinbollToolbar1"/>
|
android:id="@+id/activitytestwinbollToolbar1"/>
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/shape_gradient"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:src="@drawable/ic_launcher"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/message"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:textColor="#FF000000"
|
|
||||||
android:textSize="16sp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,16 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<item
|
|
||||||
android:id="@+id/item_testwinboll"
|
|
||||||
android:title="TestWinBollActivity"
|
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/item_teststringtoqrcodeview"
|
android:id="@+id/item_teststringtoqrcodeview"
|
||||||
android:title="TestStringToQrCodeViewActivity"
|
android:title="TestStringToQRCodeViewActivity"/>
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/item_testqrcodedecodeactivity"
|
android:id="@+id/item_testqrcodedecodeactivity"
|
||||||
android:title="TestQRCodeDecodeActivity"
|
android:title="TestQRCodeDecodeActivity"/>
|
||||||
app:showAsAction="ifRoom"/>
|
<item
|
||||||
|
android:id="@+id/item_testcrashreport"
|
||||||
|
android:title="TestCrashReportActivity"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- WinBoll 默认方案 -->
|
<!-- WinBoLL 默认方案 -->
|
||||||
<color name="colorPrimary">#FF196ABC</color>
|
<color name="colorPrimary">#FF196ABC</color>
|
||||||
<color name="colorPrimaryDark">#FF002B57</color>
|
<color name="colorPrimaryDark">#FF002B57</color>
|
||||||
<color name="colorAccent">#FF80BFFF</color>
|
<color name="colorAccent">#FF80BFFF</color>
|
||||||
<color name="colorToastFrame">#FFA9A9A9</color>
|
|
||||||
<color name="colorToastShadow">#FF000000</color>
|
|
||||||
<color name="colorToastBackgroung">#FFFFFFFF</color>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<style name="MyUtilsTheme" parent="UtilsTheme">
|
||||||
|
<item name="attrColorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="themeGlobalCrashActivity">@style/MyUtilsGlobalCrashActivityTheme</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="MyUtilsGlobalCrashActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
|
||||||
|
<item name="colorTittle">#FFF2F2F2</item>
|
||||||
|
<item name="colorTittleBackgound">#FF55ABF8</item>
|
||||||
|
<item name="colorText">#FF55ABF8</item>
|
||||||
|
<item name="colorTextBackgound">#FFF2F2F2</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
17
build.gradle
17
build.gradle
@ -1,10 +1,15 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
// 本地 Maven 仓库(默认路径为 ~/.m2/repository)
|
||||||
|
mavenLocal()
|
||||||
|
// 或自定义本地仓库路径
|
||||||
|
maven { url "file:///sdcard/.m2/repository" }
|
||||||
|
|
||||||
// Nexus Maven 库地址
|
// Nexus Maven 库地址
|
||||||
// "WinBoll Release"
|
// "WinBoLL Release"
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
||||||
// "WinBoll Snapshot"
|
// "WinBoLL Snapshot"
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
||||||
|
|
||||||
maven { url 'https://maven.aliyun.com/repository/public/' }
|
maven { url 'https://maven.aliyun.com/repository/public/' }
|
||||||
@ -15,7 +20,7 @@ buildscript {
|
|||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
mavenLocal()
|
//mavenLocal()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.2.1' // 对应 compileSdkVersion 32
|
classpath 'com.android.tools.build:gradle:7.2.1' // 对应 compileSdkVersion 32
|
||||||
@ -27,9 +32,9 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
// Nexus Maven 库地址
|
// Nexus Maven 库地址
|
||||||
// "WinBoll Release"
|
// "WinBoLL Release"
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
||||||
// "WinBoll Snapshot"
|
// "WinBoLL Snapshot"
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
||||||
|
|
||||||
maven { url 'https://maven.aliyun.com/repository/public/' }
|
maven { url 'https://maven.aliyun.com/repository/public/' }
|
||||||
@ -51,7 +56,7 @@ allprojects {
|
|||||||
bashCommitAppPublishBuildFlagInfoFilePath = ".winboll/bashCommitAppPublishBuildFlagInfo.sh"
|
bashCommitAppPublishBuildFlagInfoFilePath = ".winboll/bashCommitAppPublishBuildFlagInfo.sh"
|
||||||
|
|
||||||
winbollFilePath = "winboll.properties"
|
winbollFilePath = "winboll.properties"
|
||||||
keyPropsFilePath = "winboll-x/current.keystore"
|
keyPropsFilePath = "current.keystore"
|
||||||
// 定义 lint 输出文件
|
// 定义 lint 输出文件
|
||||||
lintXmlReportFilePath = "build/reports/lint-results.xml"
|
lintXmlReportFilePath = "build/reports/lint-results.xml"
|
||||||
lintHTMLReportFilePath = "build/reports/lint-results.html"
|
lintHTMLReportFilePath = "build/reports/lint-results.html"
|
||||||
|
@ -19,17 +19,17 @@ def genVersionName(def versionName){
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 32
|
compileSdkVersion 32
|
||||||
buildToolsVersion "33.0.3"
|
buildToolsVersion "32.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.contacts"
|
applicationId "cc.winboll.studio.contacts"
|
||||||
minSdkVersion 21
|
minSdkVersion 24
|
||||||
targetSdkVersion 30
|
targetSdkVersion 29
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "1.0"
|
versionName "15.2"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@ -41,31 +41,48 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// 二维码使用的类库
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
||||||
|
api 'com.github.getActivity:XXPermissions:18.63'
|
||||||
|
// 下拉控件
|
||||||
|
api 'com.baoyz.pullrefreshlayout:library:1.2.0'
|
||||||
|
// 拼音搜索
|
||||||
|
// https://mvnrepository.com/artifact/com.github.open-android/pinyin4j
|
||||||
|
api 'com.github.open-android:pinyin4j:2.5.0'
|
||||||
|
// 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.google.zxing:core:3.4.1'
|
||||||
api 'com.journeyapps:zxing-android-embedded:3.6.0'
|
api 'com.journeyapps:zxing-android-embedded:3.6.0'
|
||||||
|
// 应用介绍页类库
|
||||||
api 'io.github.medyo:android-about-page:2.0.0'
|
api 'io.github.medyo:android-about-page:2.0.0'
|
||||||
|
// 吐司类库
|
||||||
api 'com.github.getActivity:ToastUtils:10.5'
|
api 'com.github.getActivity:ToastUtils:10.5'
|
||||||
api 'com.jcraft:jsch:0.1.55'
|
// 网络连接类库
|
||||||
api 'org.jsoup:jsoup:1.13.1'
|
|
||||||
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||||
|
|
||||||
|
// AndroidX 类库
|
||||||
|
/*implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
|
implementation 'androidx.viewpager:viewpager:1.0.0'
|
||||||
|
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||||
|
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
||||||
|
implementation 'androidx.fragment:fragment:1.1.0'
|
||||||
|
implementation 'com.google.android.material:material:1.4.0'
|
||||||
|
*/
|
||||||
api 'androidx.appcompat:appcompat:1.1.0'
|
api 'androidx.appcompat:appcompat:1.1.0'
|
||||||
api 'androidx.viewpager:viewpager:1.0.0'
|
|
||||||
api 'androidx.fragment:fragment:1.1.0'
|
|
||||||
api 'com.google.android.material:material:1.4.0'
|
api 'com.google.android.material:material:1.4.0'
|
||||||
|
//api 'androidx.viewpager:viewpager:1.0.0'
|
||||||
|
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||||
|
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
||||||
|
//api 'androidx.fragment:fragment:1.1.0'
|
||||||
|
|
||||||
api 'cc.winboll.studio:libapputils:9.3.2'
|
api 'cc.winboll.studio:libaes:15.2.4'
|
||||||
api 'cc.winboll.studio:libappbase:1.5.6'
|
api 'cc.winboll.studio:libapputils:15.2.1'
|
||||||
|
api 'cc.winboll.studio:libappbase:15.2.2'
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Feb 25 00:17:29 HKT 2025
|
#Sun Apr 13 02:46:09 HKT 2025
|
||||||
stageCount=2
|
stageCount=8
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=1.0
|
baseVersion=15.2
|
||||||
publishVersion=1.0.1
|
publishVersion=15.2.7
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=1.0.2
|
baseBetaVersion=15.2.8
|
||||||
|
@ -29,9 +29,13 @@
|
|||||||
|
|
||||||
<!-- 更改您的音频设置 -->
|
<!-- 更改您的音频设置 -->
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
<!-- 读取通话记录 -->
|
||||||
|
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
|
||||||
|
|
||||||
|
<!-- 录音 -->
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".App"
|
android:name=".App"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@ -65,7 +69,7 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".phonecallui.PhoneCallActivity"
|
android:name=".phonecallui.PhoneCallActivity"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleTask"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -182,6 +186,10 @@
|
|||||||
|
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
|
<activity android:name="cc.winboll.studio.contacts.activities.UnitTestActivity"/>
|
||||||
|
|
||||||
|
<activity android:name="cc.winboll.studio.contacts.activities.AboutActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -5,9 +5,10 @@ package cc.winboll.studio.contacts;
|
|||||||
* @Date 2024/12/08 15:10:51
|
* @Date 2024/12/08 15:10:51
|
||||||
* @Describe 全局应用类
|
* @Describe 全局应用类
|
||||||
*/
|
*/
|
||||||
|
import android.view.Gravity;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.winboll.WinBollActivityManager;
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
|
import com.hjq.toast.ToastUtils;
|
||||||
|
|
||||||
public class App extends GlobalApplication {
|
public class App extends GlobalApplication {
|
||||||
|
|
||||||
@ -17,12 +18,20 @@ public class App extends GlobalApplication {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
// 必须在调用基类前设置应用调试标志,
|
// 必须在调用基类前设置应用调试标志,
|
||||||
// 这样可以预先设置日志与数据的存储根目录。
|
// 这样可以预先设置日志与数据的存储根目录。
|
||||||
setIsDebuging(this, BuildConfig.DEBUG);
|
//setIsDebuging(BuildConfig.DEBUG);
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
// 设置 WinBoll 应用 UI 类型
|
// 设置 WinBoll 应用 UI 类型
|
||||||
WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Aplication);
|
WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Aplication);
|
||||||
|
|
||||||
LogUtils.d(TAG, "onCreate");
|
//LogUtils.d(TAG, "onCreate");
|
||||||
|
|
||||||
|
// 初始化 Toast 框架
|
||||||
|
ToastUtils.init(this);
|
||||||
|
// 设置 Toast 布局样式
|
||||||
|
//ToastUtils.setView(R.layout.toast_custom_view);
|
||||||
|
//ToastUtils.setStyle(new WhiteToastStyle());
|
||||||
|
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,52 +1,44 @@
|
|||||||
package cc.winboll.studio.contacts;
|
package cc.winboll.studio.contacts;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.role.RoleManager;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.telecom.TelecomManager;
|
import android.telecom.TelecomManager;
|
||||||
import android.view.LayoutInflater;
|
import android.telephony.PhoneStateListener;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
import cc.winboll.studio.contacts.R;
|
import cc.winboll.studio.contacts.R;
|
||||||
import cc.winboll.studio.contacts.activities.CallActivity;
|
import cc.winboll.studio.contacts.activities.SettingsActivity;
|
||||||
import cc.winboll.studio.contacts.adapters.MyPagerAdapter;
|
|
||||||
import cc.winboll.studio.contacts.beans.MainServiceBean;
|
import cc.winboll.studio.contacts.beans.MainServiceBean;
|
||||||
|
import cc.winboll.studio.contacts.fragments.CallLogFragment;
|
||||||
|
import cc.winboll.studio.contacts.fragments.ContactsFragment;
|
||||||
|
import cc.winboll.studio.contacts.fragments.LogFragment;
|
||||||
import cc.winboll.studio.contacts.services.MainService;
|
import cc.winboll.studio.contacts.services.MainService;
|
||||||
|
import cc.winboll.studio.libaes.winboll.APPInfo;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.LogView;
|
import cc.winboll.studio.libappbase.LogView;
|
||||||
import cc.winboll.studio.libapputils.app.IWinBollActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
|
|
||||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
|
||||||
import cc.winboll.studio.libapputils.view.YesNoAlertDialog;
|
|
||||||
import cc.winboll.studio.contacts.listenphonecall.CallListenerService;
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import cc.winboll.studio.contacts.activities.SettingsActivity;
|
|
||||||
|
|
||||||
final public class MainActivity extends AppCompatActivity implements IWinBollActivity, ViewPager.OnPageChangeListener, View.OnClickListener {
|
final public class MainActivity extends AppCompatActivity implements IWinBollActivity, ViewPager.OnPageChangeListener, View.OnClickListener {
|
||||||
|
|
||||||
@ -57,11 +49,13 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
|
|
||||||
public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoll.ACTION_SOS";
|
public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoll.ACTION_SOS";
|
||||||
|
|
||||||
|
static MainActivity _MainActivity;
|
||||||
LogView mLogView;
|
LogView mLogView;
|
||||||
Toolbar mToolbar;
|
Toolbar mToolbar;
|
||||||
CheckBox cbMainService;
|
CheckBox cbMainService;
|
||||||
MainServiceBean mMainServiceBean;
|
MainServiceBean mMainServiceBean;
|
||||||
ViewPager viewPager;
|
private TabLayout tabLayout;
|
||||||
|
private ViewPager viewPager;
|
||||||
private List<View> views; //用来存放放进ViewPager里面的布局
|
private List<View> views; //用来存放放进ViewPager里面的布局
|
||||||
//实例化存储imageView(导航原点)的集合
|
//实例化存储imageView(导航原点)的集合
|
||||||
ImageView[] imageViews;
|
ImageView[] imageViews;
|
||||||
@ -70,15 +64,20 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
LinearLayout linearLayout;//下标所在在LinearLayout布局里
|
LinearLayout linearLayout;//下标所在在LinearLayout布局里
|
||||||
int currentPoint = 0;//当前被选中中页面的下标
|
int currentPoint = 0;//当前被选中中页面的下标
|
||||||
|
|
||||||
|
private TelephonyManager telephonyManager;
|
||||||
|
private MyPhoneStateListener phoneStateListener;
|
||||||
|
List<Fragment> fragmentList;
|
||||||
|
List<String> tabTitleList;
|
||||||
|
|
||||||
private static final int DIALER_REQUEST_CODE = 1;
|
private static final int DIALER_REQUEST_CODE = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppCompatActivity getActivity() {
|
public Activity getActivity() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public APPInfo getAppInfo() {
|
// public APPInfo getAppInfo() {
|
||||||
// String szBranchName = "contacts";
|
// String szBranchName = "contacts";
|
||||||
//
|
//
|
||||||
// APPInfo appInfo = AboutActivityFactory.buildDefaultAPPInfo();
|
// APPInfo appInfo = AboutActivityFactory.buildDefaultAPPInfo();
|
||||||
@ -93,8 +92,8 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
// appInfo.setAppAPKName("Contacts");
|
// appInfo.setAppAPKName("Contacts");
|
||||||
// appInfo.setAppAPKFolderName("Contacts");
|
// appInfo.setAppAPKFolderName("Contacts");
|
||||||
// return appInfo;
|
// return appInfo;
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -102,28 +101,51 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
//if (prosessIntents(getIntent())) return;
|
//if (prosessIntents(getIntent())) return;
|
||||||
// 以下正常创建主窗口
|
// 以下正常创建主窗口
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
_MainActivity = this;
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
// 初始化工具栏
|
// 初始化工具栏
|
||||||
mToolbar = findViewById(R.id.activitymainToolbar1);
|
mToolbar = findViewById(R.id.activitymainToolbar1);
|
||||||
setSupportActionBar(mToolbar);
|
setSupportActionBar(mToolbar);
|
||||||
if (isEnableDisplayHomeAsUp()) {
|
// if (isEnableDisplayHomeAsUp()) {
|
||||||
// 显示后退按钮
|
// // 显示后退按钮
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
// }
|
||||||
getSupportActionBar().setSubtitle(getTag());
|
getSupportActionBar().setSubtitle(getTag());
|
||||||
|
|
||||||
initData();
|
tabLayout = findViewById(R.id.tabLayout);
|
||||||
initView();
|
viewPager = findViewById(R.id.viewPager);
|
||||||
//initPoint();//调用初始化导航原点的方法
|
|
||||||
viewPager.addOnPageChangeListener(this);//滑动事件
|
|
||||||
|
|
||||||
ViewPager viewPager = findViewById(R.id.activitymainViewPager1);
|
// 创建Fragment列表和标题列表
|
||||||
MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
|
fragmentList = new ArrayList<>();
|
||||||
viewPager.setAdapter(pagerAdapter);
|
tabTitleList = new ArrayList<>();
|
||||||
TabLayout tabLayout = findViewById(R.id.activitymainTabLayout1);
|
fragmentList.add(CallLogFragment.newInstance(0));
|
||||||
|
fragmentList.add(ContactsFragment.newInstance(1));
|
||||||
|
fragmentList.add(LogFragment.newInstance(2));
|
||||||
|
tabTitleList.add("通话记录");
|
||||||
|
tabTitleList.add("联系人");
|
||||||
|
tabTitleList.add("应用日志");
|
||||||
|
|
||||||
|
// 设置ViewPager的适配器
|
||||||
|
MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager(), fragmentList, tabTitleList);
|
||||||
|
viewPager.setAdapter(adapter);
|
||||||
|
|
||||||
|
// 关联TabLayout和ViewPager
|
||||||
tabLayout.setupWithViewPager(viewPager);
|
tabLayout.setupWithViewPager(viewPager);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// initData();
|
||||||
|
// initView();
|
||||||
|
// //initPoint();//调用初始化导航原点的方法
|
||||||
|
// viewPager.addOnPageChangeListener(this);//滑动事件
|
||||||
|
|
||||||
|
//ViewPager viewPager = findViewById(R.id.activitymainViewPager1);
|
||||||
|
//MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
|
||||||
|
//viewPager.setAdapter(pagerAdapter);
|
||||||
|
//TabLayout tabLayout = findViewById(R.id.activitymainTabLayout1);
|
||||||
|
//tabLayout.setupWithViewPager(viewPager);
|
||||||
|
|
||||||
// mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
// mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
||||||
// if (mMainServiceBean == null) {
|
// if (mMainServiceBean == null) {
|
||||||
// mMainServiceBean = new MainServiceBean();
|
// mMainServiceBean = new MainServiceBean();
|
||||||
@ -140,36 +162,86 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
MainService.startMainService(MainActivity.this);
|
|
||||||
|
MainServiceBean mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
||||||
|
if (mMainServiceBean == null) {
|
||||||
|
mMainServiceBean = new MainServiceBean();
|
||||||
|
MainServiceBean.saveBean(this, mMainServiceBean);
|
||||||
|
}
|
||||||
|
if (mMainServiceBean.isEnable()) {
|
||||||
|
MainService.startMainService(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化TelephonyManager和PhoneStateListener
|
||||||
|
telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
|
||||||
|
phoneStateListener = new MyPhoneStateListener();
|
||||||
|
telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ViewPager的适配器
|
||||||
|
private class MyPagerAdapter extends FragmentPagerAdapter {
|
||||||
|
|
||||||
|
private List<Fragment> fragmentList;
|
||||||
|
private List<String> tabTitleList;
|
||||||
|
|
||||||
|
public MyPagerAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> tabTitleList) {
|
||||||
|
super(fm);
|
||||||
|
this.fragmentList = fragmentList;
|
||||||
|
this.tabTitleList = tabTitleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
return fragmentList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return fragmentList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getPageTitle(int position) {
|
||||||
|
return tabTitleList.get(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void dialPhoneNumber(String phoneNumber) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||||
|
intent.setData(android.net.Uri.parse("tel:" + phoneNumber));
|
||||||
|
if (ActivityCompat.checkSelfPermission(_MainActivity, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_MainActivity.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化view,即显示的图片
|
//初始化view,即显示的图片
|
||||||
void initView() {
|
// void initView() {
|
||||||
viewPager = findViewById(R.id.activitymainViewPager1);
|
// viewPager = findViewById(R.id.activitymainViewPager1);
|
||||||
pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
|
// pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
|
||||||
viewPager.setAdapter(pagerAdapter);
|
// viewPager.setAdapter(pagerAdapter);
|
||||||
//adapter = new MyPagerAdapter(views);
|
// //adapter = new MyPagerAdapter(views);
|
||||||
//viewPager = findViewById(R.id.activitymainViewPager1);
|
// //viewPager = findViewById(R.id.activitymainViewPager1);
|
||||||
//viewPager.setAdapter(adapter);
|
// //viewPager.setAdapter(adapter);
|
||||||
//linearLayout = findViewById(R.id.activitymainLinearLayout1);
|
// //linearLayout = findViewById(R.id.activitymainLinearLayout1);
|
||||||
//initPoint();//初始化页面下方的点
|
// //initPoint();//初始化页面下方的点
|
||||||
viewPager.setOnPageChangeListener(this);
|
// viewPager.setOnPageChangeListener(this);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
//初始化所要显示的布局
|
//初始化所要显示的布局
|
||||||
void initData() {
|
// void initData() {
|
||||||
ViewPager viewPager = findViewById(R.id.activitymainViewPager1);
|
// LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||||
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
// View view1 = inflater.inflate(R.layout.fragment_call_log, viewPager, false);
|
||||||
View view1 = inflater.inflate(R.layout.fragment_call, viewPager, false);
|
// View view2 = inflater.inflate(R.layout.fragment_contacts, viewPager, false);
|
||||||
View view2 = inflater.inflate(R.layout.fragment_contacts, viewPager, false);
|
// View view3 = inflater.inflate(R.layout.fragment_log, viewPager, false);
|
||||||
View view3 = inflater.inflate(R.layout.fragment_log, viewPager, false);
|
//
|
||||||
|
// views = new ArrayList<>();
|
||||||
views = new ArrayList<>();
|
// views.add(view1);
|
||||||
views.add(view1);
|
// views.add(view2);
|
||||||
views.add(view2);
|
// views.add(view3);
|
||||||
views.add(view3);
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
// void initPoint() {
|
// void initPoint() {
|
||||||
// imageViews = new ImageView[5];//实例化5个图片
|
// imageViews = new ImageView[5];//实例化5个图片
|
||||||
@ -231,6 +303,23 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
//setSubTitle("");
|
//setSubTitle("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MyPhoneStateListener extends PhoneStateListener {
|
||||||
|
@Override
|
||||||
|
public void onCallStateChanged(int state, String incomingNumber) {
|
||||||
|
switch (state) {
|
||||||
|
case TelephonyManager.CALL_STATE_IDLE:
|
||||||
|
LogUtils.d(TAG, "电话已挂断");
|
||||||
|
break;
|
||||||
|
case TelephonyManager.CALL_STATE_OFFHOOK:
|
||||||
|
LogUtils.d(TAG, "正在通话中");
|
||||||
|
break;
|
||||||
|
case TelephonyManager.CALL_STATE_RINGING:
|
||||||
|
LogUtils.d(TAG, "来电: " + incomingNumber);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -287,40 +376,25 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public Toolbar initToolBar() {
|
// public void onBackPressed() {
|
||||||
return findViewById(R.id.activitymainToolbar1);
|
// exit();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// void exit() {
|
||||||
public boolean isAddWinBollToolBar() {
|
// YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
|
||||||
return true;
|
//
|
||||||
}
|
// @Override
|
||||||
|
// public void onYes() {
|
||||||
@Override
|
// WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
||||||
public boolean isEnableDisplayHomeAsUp() {
|
// }
|
||||||
return false;
|
//
|
||||||
}
|
// @Override
|
||||||
|
// public void onNo() {
|
||||||
@Override
|
// }
|
||||||
public void onBackPressed() {
|
// };
|
||||||
exit();
|
// YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void exit() {
|
|
||||||
YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onYes() {
|
|
||||||
WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNo() {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
@ -331,11 +405,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.item_call) {
|
if (item.getItemId() == R.id.item_settings) {
|
||||||
Intent intent = new Intent(this, CallActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
|
||||||
} else if (item.getItemId() == R.id.item_settings) {
|
|
||||||
Intent intent = new Intent(this, SettingsActivity.class);
|
Intent intent = new Intent(this, SettingsActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
package cc.winboll.studio.contacts;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/20 21:14:52
|
|
||||||
* @Describe PhoneCallManager
|
|
||||||
*/
|
|
||||||
|
|
||||||
import android.telecom.Call;
|
|
||||||
import android.telecom.VideoProfile;
|
|
||||||
|
|
||||||
public class PhoneCallManager {
|
|
||||||
|
|
||||||
public static final String TAG = "PhoneCallManager";
|
|
||||||
|
|
||||||
public static Call call;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接听电话
|
|
||||||
*/
|
|
||||||
public void answer() {
|
|
||||||
if (call != null) {
|
|
||||||
call.answer(VideoProfile.STATE_AUDIO_ONLY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 断开电话,包括来电时的拒接以及接听后的挂断
|
|
||||||
*/
|
|
||||||
public void disconnect() {
|
|
||||||
if (call != null) {
|
|
||||||
call.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,91 @@
|
|||||||
|
package cc.winboll.studio.contacts.activities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/31 15:15:54
|
||||||
|
* @Describe 应用介绍窗口
|
||||||
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import cc.winboll.studio.contacts.R;
|
||||||
|
import cc.winboll.studio.libaes.winboll.APPInfo;
|
||||||
|
import cc.winboll.studio.libaes.winboll.AboutView;
|
||||||
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
|
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||||
|
|
||||||
|
public class AboutActivity extends WinBollActivity implements IWinBollActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "AboutActivity";
|
||||||
|
|
||||||
|
Context mContext;
|
||||||
|
Toolbar mToolbar;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Activity getActivity() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mContext = this;
|
||||||
|
setContentView(R.layout.activity_about);
|
||||||
|
|
||||||
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(mToolbar);
|
||||||
|
mToolbar.setSubtitle(TAG);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
AboutView aboutView = CreateAboutView();
|
||||||
|
// 在 Activity 的 onCreate 或其他生命周期方法中调用
|
||||||
|
// LinearLayout layout = new LinearLayout(this);
|
||||||
|
// layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
// // 创建布局参数(宽度和高度)
|
||||||
|
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
||||||
|
// ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
// ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
// );
|
||||||
|
// addContentView(aboutView, params);
|
||||||
|
|
||||||
|
LinearLayout layout = findViewById(R.id.aboutviewroot_ll);
|
||||||
|
// 创建布局参数(宽度和高度)
|
||||||
|
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
layout.addView(aboutView, params);
|
||||||
|
|
||||||
|
GlobalApplication.getWinBollActivityManager().add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
GlobalApplication.getWinBollActivityManager().registeRemove(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AboutView CreateAboutView() {
|
||||||
|
String szBranchName = "contacts";
|
||||||
|
APPInfo appInfo = new APPInfo();
|
||||||
|
appInfo.setAppName("Contacts");
|
||||||
|
appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll);
|
||||||
|
appInfo.setAppDescription("通讯录与拨号");
|
||||||
|
appInfo.setAppGitName("APP");
|
||||||
|
appInfo.setAppGitOwner("Studio");
|
||||||
|
appInfo.setAppGitAPPBranch(szBranchName);
|
||||||
|
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
|
||||||
|
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=Contacts");
|
||||||
|
appInfo.setAppAPKName("Contacts");
|
||||||
|
appInfo.setAppAPKFolderName("Contacts");
|
||||||
|
return new AboutView(mContext, appInfo);
|
||||||
|
}
|
||||||
|
}
|
@ -34,6 +34,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
//setContentView(R.layout.activity_main);
|
//setContentView(R.layout.activity_main);
|
||||||
setContentView(R.layout.activity_call);
|
setContentView(R.layout.activity_call);
|
||||||
|
@ -4,7 +4,6 @@ package cc.winboll.studio.contacts.activities;
|
|||||||
* @Author ZhanGSKen@AliYun.Com
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
* @Date 2025/02/21 05:37:42
|
* @Date 2025/02/21 05:37:42
|
||||||
*/
|
*/
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -15,17 +14,33 @@ import android.os.Bundle;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.SeekBar;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import cc.winboll.studio.contacts.R;
|
import cc.winboll.studio.contacts.R;
|
||||||
|
import cc.winboll.studio.contacts.adapters.PhoneConnectRuleAdapter;
|
||||||
|
import cc.winboll.studio.contacts.beans.MainServiceBean;
|
||||||
|
import cc.winboll.studio.contacts.beans.PhoneConnectRuleModel;
|
||||||
import cc.winboll.studio.contacts.beans.RingTongBean;
|
import cc.winboll.studio.contacts.beans.RingTongBean;
|
||||||
import cc.winboll.studio.libappbase.IWinBollActivity;
|
import cc.winboll.studio.contacts.beans.SettingsModel;
|
||||||
import cc.winboll.studio.libappbase.bean.APPInfo;
|
import cc.winboll.studio.contacts.bobulltoon.TomCat;
|
||||||
|
import cc.winboll.studio.contacts.dun.Rules;
|
||||||
|
import cc.winboll.studio.contacts.services.MainService;
|
||||||
|
import cc.winboll.studio.contacts.views.DuInfoTextView;
|
||||||
|
import cc.winboll.studio.libaes.winboll.APPInfo;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.List;
|
||||||
|
import cc.winboll.studio.contacts.App;
|
||||||
|
|
||||||
public class SettingsActivity extends AppCompatActivity implements IWinBollActivity {
|
public class SettingsActivity extends AppCompatActivity implements IWinBollActivity {
|
||||||
|
|
||||||
@ -33,11 +48,25 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv
|
|||||||
|
|
||||||
Toolbar mToolbar;
|
Toolbar mToolbar;
|
||||||
Switch swSilent;
|
Switch swSilent;
|
||||||
|
SeekBar msbVolume;
|
||||||
|
TextView mtvVolume;
|
||||||
|
int mnStreamMaxVolume;
|
||||||
|
int mnStreamVolume;
|
||||||
|
Switch mswMainService;
|
||||||
|
static DuInfoTextView _DuInfoTextView;
|
||||||
|
|
||||||
@Override
|
// 云盾防御层数量
|
||||||
public APPInfo getAppInfo() {
|
EditText etDunTotalCount;
|
||||||
return null;
|
// 防御层恢复时间间隔(秒钟)
|
||||||
}
|
EditText etDunResumeSecondCount;
|
||||||
|
// 每次恢复防御层数
|
||||||
|
EditText etDunResumeCount;
|
||||||
|
// 是否启用云盾
|
||||||
|
Switch swIsEnableDun;
|
||||||
|
|
||||||
|
private RecyclerView recyclerView;
|
||||||
|
private PhoneConnectRuleAdapter adapter;
|
||||||
|
private List<PhoneConnectRuleModel> ruleList;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppCompatActivity getActivity() {
|
public AppCompatActivity getActivity() {
|
||||||
@ -49,21 +78,6 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv
|
|||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Toolbar initToolBar() {
|
|
||||||
return findViewById(R.id.activitymainToolbar1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAddWinBollToolBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnableDisplayHomeAsUp() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -72,11 +86,136 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv
|
|||||||
// 初始化工具栏
|
// 初始化工具栏
|
||||||
mToolbar = findViewById(R.id.activitymainToolbar1);
|
mToolbar = findViewById(R.id.activitymainToolbar1);
|
||||||
setSupportActionBar(mToolbar);
|
setSupportActionBar(mToolbar);
|
||||||
if (isEnableDisplayHomeAsUp()) {
|
// 显示后退按钮
|
||||||
// 显示后退按钮
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
getSupportActionBar().setSubtitle(getTag());
|
getSupportActionBar().setSubtitle(getTag());
|
||||||
|
|
||||||
|
mswMainService = findViewById(R.id.sw_mainservice);
|
||||||
|
MainServiceBean mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
||||||
|
mswMainService.setChecked(mMainServiceBean.isEnable());
|
||||||
|
mswMainService.setOnClickListener(new View.OnClickListener(){
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
LogUtils.d(TAG, "mswMainService onClick");
|
||||||
|
// TODO: Implement this method
|
||||||
|
if (mswMainService.isChecked()) {
|
||||||
|
//ToastUtils.show("Is Checked");
|
||||||
|
MainService.startMainServiceAndSaveStatus(SettingsActivity.this);
|
||||||
|
} else {
|
||||||
|
//ToastUtils.show("Not Checked");
|
||||||
|
MainService.stopMainServiceAndSaveStatus(SettingsActivity.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
msbVolume = findViewById(R.id.bellvolume);
|
||||||
|
mtvVolume = findViewById(R.id.tv_volume);
|
||||||
|
final AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
|
||||||
|
// 设置SeekBar的最大值为系统铃声音量的最大刻度
|
||||||
|
mnStreamMaxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
|
||||||
|
msbVolume.setMax(mnStreamMaxVolume);
|
||||||
|
// 获取当前铃声音量并设置为SeekBar的初始进度
|
||||||
|
mnStreamVolume = audioManager.getStreamVolume(AudioManager.STREAM_RING);
|
||||||
|
msbVolume.setProgress(mnStreamVolume);
|
||||||
|
|
||||||
|
updateStreamVolumeTextView();
|
||||||
|
|
||||||
|
msbVolume.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||||
|
if (fromUser) {
|
||||||
|
// 设置铃声音量
|
||||||
|
audioManager.setStreamVolume(AudioManager.STREAM_RING, progress, 0);
|
||||||
|
RingTongBean bean = RingTongBean.loadBean(SettingsActivity.this, RingTongBean.class);
|
||||||
|
if (bean == null) {
|
||||||
|
bean = new RingTongBean();
|
||||||
|
}
|
||||||
|
bean.setStreamVolume(progress);
|
||||||
|
RingTongBean.saveBean(SettingsActivity.this, bean);
|
||||||
|
mnStreamVolume = progress;
|
||||||
|
updateStreamVolumeTextView();
|
||||||
|
//Toast.makeText(SettingsActivity.this, "音量设置为: " + progress, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||||
|
// 当开始拖动SeekBar时的操作
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
|
// 当停止拖动SeekBar时的操作
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
recyclerView = findViewById(R.id.recycler_view);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
|
||||||
|
ruleList = Rules.getInstance(this).getPhoneBlacRuleBeanList();
|
||||||
|
|
||||||
|
adapter = new PhoneConnectRuleAdapter(this, ruleList);
|
||||||
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
// 设置参数云盾
|
||||||
|
_DuInfoTextView = findViewById(R.id.tv_DunInfo);
|
||||||
|
etDunTotalCount = findViewById(R.id.et_DunTotalCount);
|
||||||
|
etDunResumeSecondCount = findViewById(R.id.et_DunResumeSecondCount);
|
||||||
|
etDunResumeCount = findViewById(R.id.et_DunResumeCount);
|
||||||
|
swIsEnableDun = findViewById(R.id.sw_IsEnableDun);
|
||||||
|
SettingsModel settingsModel = Rules.getInstance(this).getSettingsModel();
|
||||||
|
|
||||||
|
etDunTotalCount.setText(Integer.toString(settingsModel.getDunTotalCount()));
|
||||||
|
etDunResumeSecondCount.setText(Integer.toString(settingsModel.getDunResumeSecondCount()));
|
||||||
|
etDunResumeCount.setText(Integer.toString(settingsModel.getDunResumeCount()));
|
||||||
|
swIsEnableDun.setChecked(settingsModel.isEnableDun());
|
||||||
|
|
||||||
|
boolean isEnableDun = settingsModel.isEnableDun();
|
||||||
|
etDunTotalCount.setEnabled(!isEnableDun);
|
||||||
|
etDunResumeSecondCount.setEnabled(!isEnableDun);
|
||||||
|
etDunResumeCount.setEnabled(!isEnableDun);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void notifyDunInfoUpdate() {
|
||||||
|
if (_DuInfoTextView != null) {
|
||||||
|
_DuInfoTextView.notifyInfoUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSW_IsEnableDun(View view) {
|
||||||
|
LogUtils.d(TAG, "onSW_IsEnableDun");
|
||||||
|
boolean isEnableDun = swIsEnableDun.isChecked();
|
||||||
|
etDunTotalCount.setEnabled(!isEnableDun);
|
||||||
|
etDunResumeSecondCount.setEnabled(!isEnableDun);
|
||||||
|
etDunResumeCount.setEnabled(!isEnableDun);
|
||||||
|
|
||||||
|
SettingsModel settingsModel = Rules.getInstance(this).getSettingsModel();
|
||||||
|
if (isEnableDun) {
|
||||||
|
settingsModel.setDunTotalCount(Integer.parseInt(etDunTotalCount.getText().toString()));
|
||||||
|
settingsModel.setDunResumeSecondCount(Integer.parseInt(etDunResumeSecondCount.getText().toString()));
|
||||||
|
settingsModel.setDunResumeCount(Integer.parseInt(etDunResumeCount.getText().toString()));
|
||||||
|
}
|
||||||
|
settingsModel.setIsEnableDun(isEnableDun);
|
||||||
|
Rules.getInstance(this).saveDun();
|
||||||
|
Rules.getInstance(this).reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateStreamVolumeTextView() {
|
||||||
|
mtvVolume.setText(String.format("%d/%d", mnStreamVolume, mnStreamMaxVolume));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onUnitTest(View view) {
|
||||||
|
Intent intent = new Intent(this, UnitTestActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onAddNewConnectionRule(View view) {
|
||||||
|
Rules.getInstance(this).getPhoneBlacRuleBeanList().add(new PhoneConnectRuleModel());
|
||||||
|
Rules.getInstance(this).saveRules();
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDefaultPhone(View view) {
|
public void onDefaultPhone(View view) {
|
||||||
@ -94,6 +233,38 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDownloadBoBullToon(View view) {
|
||||||
|
final TomCat tomCat = TomCat.getInstance(this);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (tomCat.downloadBoBullToon()) {
|
||||||
|
ToastUtils.show("BoBullToon downlaod OK!");
|
||||||
|
MainService.restartMainService(SettingsActivity.this);
|
||||||
|
Rules.getInstance(SettingsActivity.this).reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void onSearchBoBullToonPhone(View view) {
|
||||||
|
TomCat tomCat = TomCat.getInstance(this);
|
||||||
|
EditText etPhone = findViewById(R.id.activitysettingsEditText1);
|
||||||
|
String phone = etPhone.getText().toString().trim();
|
||||||
|
if (tomCat.loadPhoneBoBullToon()) {
|
||||||
|
if (tomCat.isPhoneBoBullToon(phone)) {
|
||||||
|
ToastUtils.show("It is a BoBullToon Phone!");
|
||||||
|
} else {
|
||||||
|
ToastUtils.show("Not in BoBullToon.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToastUtils.show("没有下载 BoBullToon。");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void askForDrawOverlay() {
|
private void askForDrawOverlay() {
|
||||||
AlertDialog alertDialog = new AlertDialog.Builder(this)
|
AlertDialog alertDialog = new AlertDialog.Builder(this)
|
||||||
.setTitle("允许显示悬浮框")
|
.setTitle("允许显示悬浮框")
|
||||||
@ -140,4 +311,8 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onAbout(View view) {
|
||||||
|
App.getWinBollActivityManager().startWinBollActivity(this, AboutActivity.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,94 @@
|
|||||||
|
package cc.winboll.studio.contacts.activities;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import cc.winboll.studio.contacts.R;
|
||||||
|
import cc.winboll.studio.contacts.dun.Rules;
|
||||||
|
import cc.winboll.studio.contacts.utils.IntUtils;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.LogView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/02 16:07:04
|
||||||
|
*/
|
||||||
|
public class UnitTestActivity extends Activity {
|
||||||
|
|
||||||
|
public static final String TAG = "UnitTestActivity";
|
||||||
|
|
||||||
|
LogView logView;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_unittest);
|
||||||
|
logView = findViewById(R.id.logview);
|
||||||
|
logView.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTestPhone(View view) {
|
||||||
|
// 开始测试数据
|
||||||
|
EditText etPhone = findViewById(R.id.phone_et);
|
||||||
|
Rules rules = Rules.getInstance(this);
|
||||||
|
String phone = etPhone.getText().toString().trim();
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTestMain(View view) {
|
||||||
|
LogUtils.d(TAG, "IntUtils.unittest_getIntInRange();");
|
||||||
|
IntUtils.unittest_getIntInRange();
|
||||||
|
|
||||||
|
Rules rules = Rules.getInstance(this);
|
||||||
|
|
||||||
|
// 如果没有规则就添加测试规则
|
||||||
|
if (rules.getPhoneBlacRuleBeanList().size() == 0) {
|
||||||
|
// 手机号码允许
|
||||||
|
// 中国手机号码正则表达式,以1开头,第二位可以是3、4、5、6、7、8、9,后面跟9位数字
|
||||||
|
String regex = "^1[3-9]\\d{9}$";
|
||||||
|
rules.add(regex, true, true);
|
||||||
|
|
||||||
|
// 指定区号号码允许
|
||||||
|
regex = "^0660\\d+$";
|
||||||
|
rules.add(regex, true, true);
|
||||||
|
|
||||||
|
// 指定区号号码允许
|
||||||
|
regex = "^020\\d+$";
|
||||||
|
rules.add(regex, true, true);
|
||||||
|
|
||||||
|
// 添加默认拒接规则
|
||||||
|
regex = ".*";
|
||||||
|
rules.add(regex, false, true);
|
||||||
|
|
||||||
|
// 保存规则到文件
|
||||||
|
rules.saveRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始测试数据
|
||||||
|
String phone = "16769764848";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
phone = "16856582777";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
phone = "17519703124";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
phone = "0205658955";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
phone = "0108965253";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
phone = "+8616769764848";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
phone = "4005816769764848";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
|
||||||
|
phone = "95566";
|
||||||
|
LogUtils.d(TAG, String.format("Test phone : %s\n%s", phone, rules.isAllowed(phone)));
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,18 @@
|
|||||||
package cc.winboll.studio.aes;
|
package cc.winboll.studio.contacts.activities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/31 15:16:45
|
||||||
|
* @Describe 应用窗口基类
|
||||||
|
*/
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import cc.winboll.studio.libaes.beans.AESThemeBean;
|
import cc.winboll.studio.libaes.beans.AESThemeBean;
|
||||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/03/30 00:34:02
|
|
||||||
* @Describe WinBoll 活动窗口通用基类
|
|
||||||
*/
|
|
||||||
public class WinBollActivity extends AppCompatActivity implements IWinBollActivity {
|
public class WinBollActivity extends AppCompatActivity implements IWinBollActivity {
|
||||||
|
|
||||||
public static final String TAG = "WinBollActivity";
|
public static final String TAG = "WinBollActivity";
|
||||||
@ -47,4 +48,13 @@ public class WinBollActivity extends AppCompatActivity implements IWinBollActivi
|
|||||||
//setTheme(AESThemeBean.getThemeStyle(getThemeType()));
|
//setTheme(AESThemeBean.getThemeStyle(getThemeType()));
|
||||||
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if(item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package cc.winboll.studio.contacts.adapters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/02/26 13:09:32
|
||||||
|
* @Describe CallLogAdapter
|
||||||
|
*/
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import cc.winboll.studio.contacts.R;
|
||||||
|
import cc.winboll.studio.contacts.beans.CallLogModel;
|
||||||
|
import cc.winboll.studio.contacts.utils.ContactUtils;
|
||||||
|
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class CallLogAdapter extends RecyclerView.Adapter<CallLogAdapter.CallLogViewHolder> {
|
||||||
|
public static final String TAG = "CallLogAdapter";
|
||||||
|
|
||||||
|
private List<CallLogModel> callLogList;
|
||||||
|
ContactUtils mContactUtils;
|
||||||
|
Context mContext;
|
||||||
|
|
||||||
|
public CallLogAdapter(Context context, List<CallLogModel> callLogList) {
|
||||||
|
mContext = context;
|
||||||
|
this.mContactUtils = ContactUtils.getInstance(mContext);
|
||||||
|
this.callLogList = callLogList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public CallLogViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_call_log, parent, false);
|
||||||
|
return new CallLogViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull CallLogViewHolder holder, int position) {
|
||||||
|
final CallLogModel callLog = callLogList.get(position);
|
||||||
|
holder.phoneNumber.setText(callLog.getPhoneNumber() + "☎" + mContactUtils.getContactsName(callLog.getPhoneNumber()));
|
||||||
|
holder.callStatus.setText(callLog.getCallStatus());
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||||
|
holder.callDate.setText(dateFormat.format(callLog.getCallDate()));
|
||||||
|
|
||||||
|
// 初始化拉动后拨号控件
|
||||||
|
holder.dialAOHPCTCSeekBar.setThumb(holder.itemView.getContext().getDrawable(R.drawable.ic_call));
|
||||||
|
holder.dialAOHPCTCSeekBar.setBlurRightDP(80);
|
||||||
|
holder.dialAOHPCTCSeekBar.setThumbOffset(0);
|
||||||
|
holder.dialAOHPCTCSeekBar.setOnOHPCListener(
|
||||||
|
new AOHPCTCSeekBar.OnOHPCListener(){
|
||||||
|
@Override
|
||||||
|
public void onOHPCommit() {
|
||||||
|
String phoneNumber = callLog.getPhoneNumber().replaceAll("\\s", "");
|
||||||
|
ToastUtils.show(phoneNumber);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_CALL);
|
||||||
|
intent.setData(android.net.Uri.parse("tel:" + phoneNumber));
|
||||||
|
// 添加 FLAG_ACTIVITY_NEW_TASK 标志
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
holder.itemView.getContext().startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return callLogList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CallLogViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView phoneNumber, callStatus, callDate;
|
||||||
|
Button dialButton;
|
||||||
|
AOHPCTCSeekBar dialAOHPCTCSeekBar;
|
||||||
|
|
||||||
|
public CallLogViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
phoneNumber = itemView.findViewById(R.id.phone_number);
|
||||||
|
callStatus = itemView.findViewById(R.id.call_status);
|
||||||
|
callDate = itemView.findViewById(R.id.call_date);
|
||||||
|
dialAOHPCTCSeekBar = itemView.findViewById(R.id.aohpctcseekbar_dial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
|||||||
|
package cc.winboll.studio.contacts.adapters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/02/26 13:35:44
|
||||||
|
* @Describe ContactAdapter
|
||||||
|
*/
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import cc.winboll.studio.contacts.R;
|
||||||
|
import cc.winboll.studio.contacts.beans.ContactModel;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
||||||
|
|
||||||
|
public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactViewHolder> {
|
||||||
|
|
||||||
|
public static final String TAG = "ContactAdapter";
|
||||||
|
|
||||||
|
private static final int REQUEST_CALL_PHONE = 1;
|
||||||
|
|
||||||
|
private List<ContactModel> contactList;
|
||||||
|
|
||||||
|
public ContactAdapter(List<ContactModel> contactList) {
|
||||||
|
this.contactList = contactList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ContactViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_contact, parent, false);
|
||||||
|
return new ContactViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ContactViewHolder holder, int position) {
|
||||||
|
final ContactModel contact = contactList.get(position);
|
||||||
|
holder.contactName.setText(contact.getName());
|
||||||
|
holder.contactNumber.setText(contact.getNumber());
|
||||||
|
|
||||||
|
// 初始化拉动后拨号控件
|
||||||
|
holder.dialAOHPCTCSeekBar.setThumb(holder.itemView.getContext().getDrawable(R.drawable.ic_call));
|
||||||
|
holder.dialAOHPCTCSeekBar.setBlurRightDP(80);
|
||||||
|
holder.dialAOHPCTCSeekBar.setThumbOffset(0);
|
||||||
|
holder.dialAOHPCTCSeekBar.setOnOHPCListener(
|
||||||
|
new AOHPCTCSeekBar.OnOHPCListener(){
|
||||||
|
@Override
|
||||||
|
public void onOHPCommit() {
|
||||||
|
String phoneNumber = contact.getNumber().replaceAll("\\s", "");
|
||||||
|
ToastUtils.show(phoneNumber);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_CALL);
|
||||||
|
intent.setData(android.net.Uri.parse("tel:" + phoneNumber));
|
||||||
|
// 添加 FLAG_ACTIVITY_NEW_TASK 标志
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
holder.itemView.getContext().startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return contactList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ContactViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView contactName;
|
||||||
|
TextView contactNumber;
|
||||||
|
AOHPCTCSeekBar dialAOHPCTCSeekBar;
|
||||||
|
|
||||||
|
public ContactViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
contactName = itemView.findViewById(R.id.contact_name);
|
||||||
|
contactNumber = itemView.findViewById(R.id.contact_number);
|
||||||
|
dialAOHPCTCSeekBar = itemView.findViewById(R.id.aohpctcseekbar_dial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
package cc.winboll.studio.contacts.adapters;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
|
||||||
* @Date 2025/02/20 13:33:04
|
|
||||||
* @Describe MyPagerAdapter
|
|
||||||
*/
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentPagerAdapter;
|
|
||||||
import cc.winboll.studio.contacts.fragments.CallFragment;
|
|
||||||
import cc.winboll.studio.contacts.fragments.ContactsFragment;
|
|
||||||
import cc.winboll.studio.contacts.fragments.LogFragment;
|
|
||||||
|
|
||||||
public class MyPagerAdapter extends FragmentPagerAdapter {
|
|
||||||
public static final String TAG = "MyPagerAdapter";
|
|
||||||
|
|
||||||
private static final int PAGE_COUNT = 3;
|
|
||||||
|
|
||||||
public MyPagerAdapter(@NonNull FragmentManager fm) {
|
|
||||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Fragment getItem(int position) {
|
|
||||||
if(position == 1) {
|
|
||||||
return ContactsFragment.newInstance(position);
|
|
||||||
} else if(position == 2) {
|
|
||||||
return LogFragment.newInstance(position);
|
|
||||||
} else {
|
|
||||||
return CallFragment.newInstance(position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCount() {
|
|
||||||
return PAGE_COUNT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,247 @@
|
|||||||
|
package cc.winboll.studio.contacts.adapters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/02 17:27:41
|
||||||
|
* @Describe PhoneConnectRuleAdapter
|
||||||
|
*/
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import cc.winboll.studio.contacts.R;
|
||||||
|
import cc.winboll.studio.contacts.beans.PhoneConnectRuleModel;
|
||||||
|
import cc.winboll.studio.contacts.dun.Rules;
|
||||||
|
import cc.winboll.studio.contacts.views.LeftScrollView;
|
||||||
|
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PhoneConnectRuleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
public static final String TAG = "PhoneConnectRuleAdapter";
|
||||||
|
|
||||||
|
private static final int VIEW_TYPE_SIMPLE = 0;
|
||||||
|
private static final int VIEW_TYPE_EDIT = 1;
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private List<PhoneConnectRuleModel> ruleList;
|
||||||
|
|
||||||
|
public PhoneConnectRuleAdapter(Context context, List<PhoneConnectRuleModel> ruleList) {
|
||||||
|
this.context = context;
|
||||||
|
this.ruleList = ruleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
|
if (viewType == VIEW_TYPE_SIMPLE) {
|
||||||
|
View view = inflater.inflate(R.layout.view_phone_connect_rule_simple, parent, false);
|
||||||
|
return new SimpleViewHolder(parent, view);
|
||||||
|
} else {
|
||||||
|
View view = inflater.inflate(R.layout.view_phone_connect_rule, parent, false);
|
||||||
|
return new EditViewHolder(parent, view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
|
||||||
|
final PhoneConnectRuleModel model = ruleList.get(position);
|
||||||
|
if (holder instanceof SimpleViewHolder) {
|
||||||
|
final SimpleViewHolder simpleViewHolder = (SimpleViewHolder) holder;
|
||||||
|
String szView = model.getRuleText().trim().equals("") ?"[NULL]": model.getRuleText();
|
||||||
|
simpleViewHolder.tvRuleText.setText(szView);
|
||||||
|
simpleViewHolder.scrollView.setOnActionListener(new LeftScrollView.OnActionListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUp() {
|
||||||
|
ArrayList<PhoneConnectRuleModel> list = Rules.getInstance(context).getPhoneBlacRuleBeanList();
|
||||||
|
if (position > 0) {
|
||||||
|
ToastUtils.show("onUp");
|
||||||
|
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||||
|
// PhoneConnectRuleModel newBean = new PhoneConnectRuleModel();
|
||||||
|
// newBean.setRuleText(list.get(position).getRuleText());
|
||||||
|
// newBean.setIsAllowConnection(list.get(position).isAllowConnection());
|
||||||
|
// newBean.setIsEnable(list.get(position).isEnable());
|
||||||
|
// newBean.setIsSimpleView(list.get(position).isSimpleView());
|
||||||
|
list.add(position - 1, list.get(position));
|
||||||
|
list.remove(position + 1);
|
||||||
|
Rules.getInstance(context).saveRules();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDown() {
|
||||||
|
ArrayList<PhoneConnectRuleModel> list = Rules.getInstance(context).getPhoneBlacRuleBeanList();
|
||||||
|
if (position < list.size() - 1) {
|
||||||
|
ToastUtils.show("onDown");
|
||||||
|
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||||
|
// PhoneConnectRuleModel newBean = new PhoneConnectRuleModel();
|
||||||
|
// newBean.setRuleText(list.get(position).getRuleText());
|
||||||
|
// newBean.setIsAllowConnection(list.get(position).isAllowConnection());
|
||||||
|
// newBean.setIsEnable(list.get(position).isEnable());
|
||||||
|
// newBean.setIsSimpleView(list.get(position).isSimpleView());
|
||||||
|
list.add(position + 2, list.get(position));
|
||||||
|
list.remove(position);
|
||||||
|
Rules.getInstance(context).saveRules();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEdit() {
|
||||||
|
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||||
|
model.setIsSimpleView(false);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
//notifyItemChanged(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDelete() {
|
||||||
|
YesNoAlertDialog.show(simpleViewHolder.scrollView.getContext(), "删除确认", "是否删除该通话规则?", new YesNoAlertDialog.OnDialogResultListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onYes() {
|
||||||
|
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||||
|
model.setIsSimpleView(true);
|
||||||
|
ArrayList<PhoneConnectRuleModel> list = Rules.getInstance(context).getPhoneBlacRuleBeanList();
|
||||||
|
list.remove(position);
|
||||||
|
Rules.getInstance(context).saveRules();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
//notifyItemChanged(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNo() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// simpleViewHolder.editButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(View v) {
|
||||||
|
// model.setIsSimpleView(false);
|
||||||
|
// notifyItemChanged(position);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// simpleViewHolder.deleteButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(View v) {
|
||||||
|
// model.setIsSimpleView(false);
|
||||||
|
// ArrayList<PhoneConnectRuleModel> list = Rules.getInstance(context).getPhoneBlacRuleBeanList();
|
||||||
|
// list.remove(position);
|
||||||
|
// Rules.getInstance(context).saveRules();
|
||||||
|
// notifyItemChanged(position);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// // 触摸事件处理
|
||||||
|
// simpleViewHolder.contentLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
// @Override
|
||||||
|
// public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
// switch (event.getAction()) {
|
||||||
|
// case MotionEvent.ACTION_DOWN:
|
||||||
|
// simpleViewHolder.startX = event.getX();
|
||||||
|
// simpleViewHolder.isSwiping = true;
|
||||||
|
// break;
|
||||||
|
// case MotionEvent.ACTION_MOVE:
|
||||||
|
// if (simpleViewHolder.isSwiping) {
|
||||||
|
// float deltaX = simpleViewHolder.startX - event.getX();
|
||||||
|
// if (deltaX > 0) { // 左滑
|
||||||
|
// float translationX = Math.max(-simpleViewHolder.actionLayout.getWidth(), -deltaX);
|
||||||
|
// simpleViewHolder.contentLayout.setTranslationX(translationX);
|
||||||
|
// simpleViewHolder.actionLayout.setVisibility(View.VISIBLE);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case MotionEvent.ACTION_UP:
|
||||||
|
// simpleViewHolder.isSwiping = false;
|
||||||
|
// if (simpleViewHolder.contentLayout.getTranslationX() < -simpleViewHolder.actionLayout.getWidth() / 2) {
|
||||||
|
// // 保持按钮显示
|
||||||
|
// simpleViewHolder.contentLayout.setTranslationX(-actionLayout.getWidth());
|
||||||
|
// } else {
|
||||||
|
// // 恢复原状
|
||||||
|
// simpleViewHolder.contentLayout.animate().translationX(0).setDuration(200).start();
|
||||||
|
// simpleViewHolder.actionLayout.setVisibility(View.INVISIBLE);
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
} else if (holder instanceof EditViewHolder) {
|
||||||
|
final EditViewHolder editViewHolder = (EditViewHolder) holder;
|
||||||
|
editViewHolder.editText.setText(model.getRuleText());
|
||||||
|
editViewHolder.checkBoxAllow.setChecked(model.isAllowConnection());
|
||||||
|
editViewHolder.checkBoxEnable.setChecked(model.isEnable());
|
||||||
|
editViewHolder.buttonConfirm.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
model.setRuleText(editViewHolder.editText.getText().toString());
|
||||||
|
model.setIsAllowConnection(editViewHolder.checkBoxAllow.isChecked());
|
||||||
|
model.setIsEnable(editViewHolder.checkBoxEnable.isChecked());
|
||||||
|
model.setIsSimpleView(true);
|
||||||
|
Rules.getInstance(context).saveRules();
|
||||||
|
notifyItemChanged(position);
|
||||||
|
Toast.makeText(context, "保存成功", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return ruleList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
PhoneConnectRuleModel model = ruleList.get(position);
|
||||||
|
// 这里可以根据模型的状态来决定视图类型,简单起见,假设点击按钮后进入编辑视图
|
||||||
|
return model.isSimpleView() ? VIEW_TYPE_SIMPLE : VIEW_TYPE_EDIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class SimpleViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
private final LeftScrollView scrollView;
|
||||||
|
private final TextView tvRuleText;
|
||||||
|
|
||||||
|
|
||||||
|
public SimpleViewHolder(@NonNull ViewGroup parent, @NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
scrollView = itemView.findViewById(R.id.scrollView);
|
||||||
|
//tvRuleText = itemView.findViewById(R.id.ruletext_tv);
|
||||||
|
tvRuleText = new TextView(itemView.getContext());
|
||||||
|
scrollView.setContentWidth(parent.getWidth());
|
||||||
|
//scrollView.setContentWidth(600);
|
||||||
|
scrollView.addContentLayout(tvRuleText);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static class EditViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
EditText editText;
|
||||||
|
CheckBox checkBoxAllow;
|
||||||
|
CheckBox checkBoxEnable;
|
||||||
|
Button buttonConfirm;
|
||||||
|
|
||||||
|
public EditViewHolder(@NonNull ViewGroup parent, @NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
editText = itemView.findViewById(R.id.edit_text);
|
||||||
|
checkBoxAllow = itemView.findViewById(R.id.checkbox_allow);
|
||||||
|
checkBoxEnable = itemView.findViewById(R.id.checkbox_enable);
|
||||||
|
buttonConfirm = itemView.findViewById(R.id.button_confirm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
package cc.winboll.studio.contacts.beans;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/02/26 13:10:57
|
||||||
|
* @Describe CallLogModel
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class CallLogModel {
|
||||||
|
public static final String TAG = "CallLogModel";
|
||||||
|
|
||||||
|
private String phoneNumber;
|
||||||
|
private String callStatus;
|
||||||
|
private Date callDate;
|
||||||
|
|
||||||
|
public CallLogModel(String phoneNumber, String callStatus, Date callDate) {
|
||||||
|
this.phoneNumber = phoneNumber.replaceAll("\\s", "");
|
||||||
|
this.callStatus = callStatus;
|
||||||
|
this.callDate = callDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneNumber() {
|
||||||
|
return phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCallStatus() {
|
||||||
|
return callStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCallDate() {
|
||||||
|
return callDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
package cc.winboll.studio.contacts.beans;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/02/26 13:37:00
|
||||||
|
* @Describe ContactModel
|
||||||
|
*/
|
||||||
|
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||||
|
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
|
||||||
|
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||||
|
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||||
|
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||||
|
|
||||||
|
public class ContactModel {
|
||||||
|
|
||||||
|
public static final String TAG = "ContactModel";
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String number;
|
||||||
|
private String pinyin;
|
||||||
|
|
||||||
|
public ContactModel(String name, String number) {
|
||||||
|
this.name = name;
|
||||||
|
this.number = number.replaceAll("\\s", "");
|
||||||
|
this.pinyin = convertToPinyin(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String convertToPinyin(String chinese) {
|
||||||
|
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
|
||||||
|
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||||
|
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||||
|
|
||||||
|
StringBuilder pinyin = new StringBuilder();
|
||||||
|
for (int i = 0; i < chinese.length(); i++) {
|
||||||
|
char ch = chinese.charAt(i);
|
||||||
|
if (Character.toString(ch).matches("[\\u4e00-\\u9fa5]")) {
|
||||||
|
try {
|
||||||
|
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(ch, format);
|
||||||
|
if (pinyinArray != null) {
|
||||||
|
pinyin.append(pinyinArray[0]);
|
||||||
|
}
|
||||||
|
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pinyin.append(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pinyin.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPinyin() {
|
||||||
|
return pinyin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,21 +10,35 @@ import android.util.JsonWriter;
|
|||||||
import cc.winboll.studio.libappbase.BaseBean;
|
import cc.winboll.studio.libappbase.BaseBean;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PhoneBlackRuleBean extends BaseBean {
|
public class PhoneConnectRuleModel extends BaseBean {
|
||||||
|
|
||||||
public static final String TAG = "PhoneBlackRuleBean";
|
public static final String TAG = "PhoneConnectRuleModel";
|
||||||
|
|
||||||
String ruleText;
|
String ruleText;
|
||||||
|
boolean isAllowConnection;
|
||||||
boolean isEnable;
|
boolean isEnable;
|
||||||
|
boolean isSimpleView;
|
||||||
public PhoneBlackRuleBean() {
|
|
||||||
|
public PhoneConnectRuleModel() {
|
||||||
this.ruleText = "";
|
this.ruleText = "";
|
||||||
|
this.isAllowConnection = false;
|
||||||
this.isEnable = false;
|
this.isEnable = false;
|
||||||
|
this.isSimpleView = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhoneBlackRuleBean(String ruleText, boolean isEnable) {
|
public PhoneConnectRuleModel(String ruleText, boolean isAllowConnection, boolean isEnable) {
|
||||||
this.ruleText = ruleText;
|
this.ruleText = ruleText;
|
||||||
|
this.isAllowConnection = isAllowConnection;
|
||||||
this.isEnable = isEnable;
|
this.isEnable = isEnable;
|
||||||
|
this.isSimpleView = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSimpleView(boolean isSimpleView) {
|
||||||
|
this.isSimpleView = isSimpleView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSimpleView() {
|
||||||
|
return isSimpleView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRuleText(String ruleText) {
|
public void setRuleText(String ruleText) {
|
||||||
@ -35,6 +49,14 @@ public class PhoneBlackRuleBean extends BaseBean {
|
|||||||
return ruleText;
|
return ruleText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsAllowConnection(boolean isAllowConnection) {
|
||||||
|
this.isAllowConnection = isAllowConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAllowConnection() {
|
||||||
|
return isAllowConnection;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIsEnable(boolean isEnable) {
|
public void setIsEnable(boolean isEnable) {
|
||||||
this.isEnable = isEnable;
|
this.isEnable = isEnable;
|
||||||
}
|
}
|
||||||
@ -43,17 +65,19 @@ public class PhoneBlackRuleBean extends BaseBean {
|
|||||||
return isEnable;
|
return isEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return PhoneBlackRuleBean.class.getName();
|
return PhoneConnectRuleModel.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||||
super.writeThisToJsonWriter(jsonWriter);
|
super.writeThisToJsonWriter(jsonWriter);
|
||||||
jsonWriter.name("ruleText").value(getRuleText());
|
jsonWriter.name("ruleText").value(getRuleText());
|
||||||
|
jsonWriter.name("isAllowConnection").value(isAllowConnection());
|
||||||
jsonWriter.name("isEnable").value(isEnable());
|
jsonWriter.name("isEnable").value(isEnable());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,6 +85,8 @@ public class PhoneBlackRuleBean extends BaseBean {
|
|||||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||||
if (name.equals("ruleText")) {
|
if (name.equals("ruleText")) {
|
||||||
setRuleText(jsonReader.nextString());
|
setRuleText(jsonReader.nextString());
|
||||||
|
} else if (name.equals("isAllowConnection")) {
|
||||||
|
setIsAllowConnection(jsonReader.nextBoolean());
|
||||||
} else if (name.equals("isEnable")) {
|
} else if (name.equals("isEnable")) {
|
||||||
setIsEnable(jsonReader.nextBoolean());
|
setIsEnable(jsonReader.nextBoolean());
|
||||||
} else {
|
} else {
|
||||||
@ -83,6 +109,6 @@ public class PhoneBlackRuleBean extends BaseBean {
|
|||||||
jsonReader.endObject();
|
jsonReader.endObject();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user