介绍页调试中

This commit is contained in:
ZhanGSKen 2025-01-22 21:16:35 +08:00
parent a4d009f8fb
commit ae7fb2984a
6 changed files with 58 additions and 27 deletions

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Wed Jan 22 11:33:02 GMT 2025 #Wed Jan 22 13:10:40 GMT 2025
stageCount=3 stageCount=3
libraryProject=libapputils libraryProject=libapputils
baseVersion=9.2 baseVersion=9.2
publishVersion=9.2.2 publishVersion=9.2.2
buildCount=8 buildCount=25
baseBetaVersion=9.2.3 baseBetaVersion=9.2.3

View File

@ -160,19 +160,33 @@ final public class MainActivity extends WinBollActivity {
} 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_about) {
openAboutActivity();
return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
public void onTestAboutActivity(View view) { void openAboutActivity() {
Intent intent = new Intent(this, AboutActivity.class); Intent intent = new Intent(this, AboutActivity.class);
APPInfo appInfo = new APPInfo(); APPInfo appInfo = new APPInfo();
appInfo.setAppName("APPUtils");
appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll); appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll);
appInfo.setAppName("Test APP"); appInfo.setAppDescription("APPUtils Description");
appInfo.setAppGitName("APP");
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=APP");
appInfo.setAppAPKName("APPUtils");
appInfo.setAppAPKFolderName("APPUtils");
intent.putExtra(AboutActivity.EXTRA_APPINFO, appInfo); intent.putExtra(AboutActivity.EXTRA_APPINFO, appInfo);
WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AboutActivity.class); WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AboutActivity.class);
} }
public void onTestAboutActivity(View view) {
//ToastUtils.show("onTestAboutActivity");
openAboutActivity();
}
public void onTestJavascriptHtmlActivity(View view) { public void onTestJavascriptHtmlActivity(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");

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Wed Jan 22 11:33:02 GMT 2025 #Wed Jan 22 13:10:40 GMT 2025
stageCount=3 stageCount=3
libraryProject=libapputils libraryProject=libapputils
baseVersion=9.2 baseVersion=9.2
publishVersion=9.2.2 publishVersion=9.2.2
buildCount=8 buildCount=25
baseBetaVersion=9.2.3 baseBetaVersion=9.2.3

View File

@ -18,6 +18,9 @@
<!-- 拍摄照片和视频 --> <!-- 拍摄照片和视频 -->
<uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.CAMERA"/>
<!-- 拥有完全的网络访问权限 -->
<uses-permission android:name="android.permission.INTERNET"/>
<application android:networkSecurityConfig="@xml/network_security_config"> <application android:networkSecurityConfig="@xml/network_security_config">
<activity <activity

View File

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

View File

@ -58,18 +58,22 @@ public class AboutView extends LinearLayout {
String mszGitea = ""; String mszGitea = "";
int mnAppIcon = 0; int mnAppIcon = 0;
String mszWinBollServerHost; String mszWinBollServerHost;
String mszReleaseAPKName; //String mszReleaseAPKName;
EditText metDevUserName; EditText metDevUserName;
EditText metDevUserPassword; EditText metDevUserPassword;
public AboutView(Context context, APPInfo appInfo) { public AboutView(Context context, APPInfo appInfo) {
super(context); super(context);
mContext = context;
setAPPInfo(appInfo); setAPPInfo(appInfo);
initView(context); initView(context);
} }
public AboutView(Context context, AttributeSet attrs) { public AboutView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mContext = context;
initView(context, attrs); initView(context, attrs);
} }
@ -92,8 +96,6 @@ public class AboutView extends LinearLayout {
} }
void initView(Context context) { void initView(Context context) {
mContext = context;
mszAppName = mAPPInfo.getAppName(); mszAppName = mAPPInfo.getAppName();
mszAppAPKFolderName = mAPPInfo.getAppAPKFolderName(); mszAppAPKFolderName = mAPPInfo.getAppAPKFolderName();
mszAppAPKName = mAPPInfo.getAppAPKName(); mszAppAPKName = mAPPInfo.getAppAPKName();
@ -101,14 +103,14 @@ public class AboutView extends LinearLayout {
mszAppDescription = mAPPInfo.getAppDescription(); mszAppDescription = mAPPInfo.getAppDescription();
mnAppIcon = mAPPInfo.getAppIcon(); mnAppIcon = mAPPInfo.getAppIcon();
mszWinBollServerHost = WinBollUtils.isDebug() ? "http://10.8.0.13": "https://www.winboll.cc"; mszWinBollServerHost = WinBollUtils.isDebug() ? "https://dev.winboll.cc": "https://www.winboll.cc";
try { try {
mszAppVersionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName; mszAppVersionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
} }
mszCurrentAppPackageName = mszAppName + "_" + mszAppVersionName + ".apk"; mszCurrentAppPackageName = mszAppAPKName + "_" + mszAppVersionName + ".apk";
mszHomePage = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName; mszHomePage = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName;
mszGitea = "https://gitea.winboll.cc/Studio/" + mszAppGitName + ".git"; mszGitea = "https://gitea.winboll.cc/Studio/" + mszAppGitName + ".git";
@ -146,15 +148,16 @@ public class AboutView extends LinearLayout {
//llMain.addView(createAboutPage()); //llMain.addView(createAboutPage());
// 就读取正式版应用包版本号设置 Release 应用包文件名 // 就读取正式版应用包版本号设置 Release 应用包文件名
String szReleaseAppVersionName = ""; // String szReleaseAppVersionName = "";
try { // try {
szReleaseAppVersionName = mContext.getPackageManager().getPackageInfo(subBetaSuffix(mContext.getPackageName()), 0).versionName; // //LogUtils.d(TAG, String.format("mContext.getPackageName() %s", mContext.getPackageName()));
} catch (PackageManager.NameNotFoundException e) { // String szSubBetaSuffix = subBetaSuffix(mContext.getPackageName());
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); // //LogUtils.d(TAG, String.format("szSubBetaSuffix : %s", szSubBetaSuffix));
} // szReleaseAppVersionName = mContext.getPackageManager().getPackageInfo(szSubBetaSuffix, 0).versionName;
mszReleaseAPKName = mszAppAPKName + "_" + szReleaseAppVersionName + ".apk"; // } catch (PackageManager.NameNotFoundException e) {
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// }
// mszReleaseAPKName = mszAppAPKName + "_" + szReleaseAppVersionName + ".apk";
} }
void initView(Context context, AttributeSet attrs) { void initView(Context context, AttributeSet attrs) {
@ -181,10 +184,13 @@ public class AboutView extends LinearLayout {
return; return;
}*/ }*/
if (!AppVersionUtils.isHasNewStageReleaseVersion(mszReleaseAPKName, mszNewestAppPackageName)) { // if (!AppVersionUtils.isHasNewStageReleaseVersion(mszReleaseAPKName, mszNewestAppPackageName)) {
// ToastUtils.delayedShow("Current app is the newest.", 5000);
// }
if (!AppVersionUtils.isHasNewVersion2(mszCurrentAppPackageName, mszNewestAppPackageName)) {
ToastUtils.delayedShow("Current app is the newest.", 5000); ToastUtils.delayedShow("Current app is the newest.", 5000);
} else { } else {
String szMsg = "Current app is :\n[ " + mszReleaseAPKName String szMsg = "Current app is :\n[ " + mszCurrentAppPackageName
+ " ]\nThe last app is :\n[ " + mszNewestAppPackageName + " ]\nThe last app is :\n[ " + mszNewestAppPackageName
+ " ]\nIs download the last app?"; + " ]\nIs download the last app?";
YesNoAlertDialog.show(mContext, "Application Update Prompt", szMsg, mIsDownlaodUpdateListener); YesNoAlertDialog.show(mContext, "Application Update Prompt", szMsg, mIsDownlaodUpdateListener);