介绍页调试中

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
#Wed Jan 22 11:33:02 GMT 2025
#Wed Jan 22 13:10:40 GMT 2025
stageCount=3
libraryProject=libapputils
baseVersion=9.2
publishVersion=9.2.2
buildCount=8
buildCount=25
baseBetaVersion=9.2.3

View File

@ -160,18 +160,32 @@ final public class MainActivity extends WinBollActivity {
} else if (item.getItemId() == R.id.item_testqrcodedecodeactivity) {
Intent intent = new Intent(this, QRCodeDecodeActivity.class);
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
} else if(item.getItemId() == R.id.item_about) {
openAboutActivity();
return true;
}
return super.onOptionsItemSelected(item);
}
public void onTestAboutActivity(View view) {
void openAboutActivity() {
Intent intent = new Intent(this, AboutActivity.class);
APPInfo appInfo = new APPInfo();
appInfo.setAppName("APPUtils");
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);
WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AboutActivity.class);
}
public void onTestAboutActivity(View view) {
//ToastUtils.show("onTestAboutActivity");
openAboutActivity();
}
public void onTestJavascriptHtmlActivity(View view) {
Intent intent = new Intent(this, AssetsHtmlActivity.class);

View File

@ -1,8 +1,8 @@
#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
libraryProject=libapputils
baseVersion=9.2
publishVersion=9.2.2
buildCount=8
buildCount=25
baseBetaVersion=9.2.3

View File

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

View File

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

View File

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