Compare commits
14 Commits
apputils-v
...
apputils-v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abb5d750c1 | ||
|
|
dc000567cd | ||
|
|
c3ccfd3c23 | ||
|
|
d2c649fe65 | ||
|
|
3b61a93402 | ||
|
|
a9aee97e41 | ||
|
|
6f2bfa66eb | ||
|
|
0f5eac2a01 | ||
|
|
eaf83a931e | ||
|
|
3d287757a1 | ||
|
|
f9f6ec746a | ||
|
|
cf7bdebbb3 | ||
|
|
737150da8d | ||
|
|
ac02880344 |
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Mon Mar 24 14:42:07 HKT 2025
|
||||
stageCount=13
|
||||
#Tue Mar 25 03:48:30 HKT 2025
|
||||
stageCount=18
|
||||
libraryProject=libapputils
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.12
|
||||
publishVersion=15.0.17
|
||||
buildCount=0
|
||||
baseBetaVersion=15.0.13
|
||||
baseBetaVersion=15.0.18
|
||||
|
||||
@@ -7,10 +7,7 @@ package cc.winboll.studio.apputils;
|
||||
*/
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libapputils.bean.DebugBean;
|
||||
|
||||
public class App extends GlobalApplication {
|
||||
|
||||
@@ -49,37 +46,5 @@ public class App extends GlobalApplication {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// 应用环境初始化, 基本调试环境
|
||||
//
|
||||
// 初始化日志模块
|
||||
//LogUtils.init(this);
|
||||
|
||||
try {
|
||||
// 初始化 Toast 框架
|
||||
// ToastUtils.init(this);
|
||||
// // 设置 Toast 布局样式
|
||||
// //ToastUtils.setView(R.layout.view_toast);
|
||||
// ToastUtils.setStyle(new WhiteToastStyle());
|
||||
// ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
|
||||
// 设置应用调试标志
|
||||
DebugBean debugBean = DebugBean.loadBean(this, DebugBean.class);
|
||||
if (debugBean == null) {
|
||||
//ToastUtils.show("debugBean == null");
|
||||
setIsDebug(false);
|
||||
} else {
|
||||
//ToastUtils.show("saveDebugStatus(" + String.valueOf(debugBean.isDebuging()) + ")");
|
||||
setIsDebug(debugBean.isDebuging());
|
||||
}
|
||||
// 应用窗口管理模块参数设置
|
||||
//
|
||||
//mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks();
|
||||
//registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
|
||||
// 设置默认 WinBoll 应用 UI 类型
|
||||
//WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Service);
|
||||
//ToastUtils.show("WinBollUI_TYPE " + getWinBollUI_TYPE());
|
||||
} catch (Exception e) {
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cc.winboll.studio.apputils;
|
||||
|
||||
import cc.winboll.studio.apputils.R;
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
@@ -13,15 +12,13 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Toolbar;
|
||||
import cc.winboll.studio.apputils.R;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.LogView;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.libapputils.activities.AssetsHtmlActivity;
|
||||
import cc.winboll.studio.libapputils.activities.LogActivity;
|
||||
import cc.winboll.studio.libapputils.activities.QRCodeDecodeActivity;
|
||||
import cc.winboll.studio.libapputils.app.AboutActivityFactory;
|
||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||
import cc.winboll.studio.libapputils.view.AboutView;
|
||||
import cc.winboll.studio.libapputils.view.YesNoAlertDialog;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -40,25 +37,7 @@ final public class MainActivity extends Activity {
|
||||
// return this;
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public APPInfo getAppInfo() {
|
||||
// String szBranchName = "apputils";
|
||||
//
|
||||
// APPInfo appInfo = AboutActivityFactory.buildDefaultAPPInfo();
|
||||
// appInfo.setAppName("APPUtils");
|
||||
// appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll);
|
||||
// appInfo.setAppDescription("APPUtils Description");
|
||||
// appInfo.setAppGitName("APP");
|
||||
// appInfo.setAppGitOwner("Studio");
|
||||
// appInfo.setAppGitAPPBranch(szBranchName);
|
||||
// appInfo.setAppGitAPPSubProjectFolder(szBranchName);
|
||||
// appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=APP");
|
||||
// appInfo.setAppAPKName("APPUtils");
|
||||
// appInfo.setAppAPKFolderName("APPUtils");
|
||||
// return appInfo;
|
||||
// //return null;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -100,11 +79,11 @@ final public class MainActivity extends Activity {
|
||||
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());
|
||||
|
||||
}
|
||||
// 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 {
|
||||
@@ -242,9 +221,6 @@ final public class MainActivity extends Activity {
|
||||
if (item.getItemId() == R.id.item_exit) {
|
||||
exit();
|
||||
return true;
|
||||
// } else if (item.getItemId() == R.id.item_about) {
|
||||
// AboutActivityFactory.showAboutActivity(this, getAppInfo());
|
||||
// return true;
|
||||
} else if (item.getItemId() == R.id.item_teststringtoqrcodeview) {
|
||||
Intent intent = new Intent(this, TestStringToQRCodeViewActivity.class);
|
||||
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
|
||||
@@ -270,12 +246,6 @@ final public class MainActivity extends Activity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
void about() {
|
||||
// Intent intent = new Intent(this, AboutActivity.class);
|
||||
// intent.putExtra(AboutActivity.EXTRA_APPINFO, AboutActivityFactory.buildAPPBranchInfo(this));
|
||||
// WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AboutActivity.class);
|
||||
}
|
||||
|
||||
void exit() {
|
||||
YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
|
||||
|
||||
@@ -302,10 +272,7 @@ final public class MainActivity extends Activity {
|
||||
// }
|
||||
}
|
||||
|
||||
public void onTestAboutActivity(View view) {
|
||||
about();
|
||||
}
|
||||
|
||||
|
||||
public void onTestAssetsHtmlActivity(View view) {
|
||||
Intent intent = new Intent(this, AssetsHtmlActivity.class);
|
||||
intent.putExtra(AssetsHtmlActivity.EXTRA_HTMLFILENAME, "javascript_test.html");
|
||||
|
||||
@@ -27,16 +27,13 @@ dependencies {
|
||||
api 'com.journeyapps:zxing-android-embedded:3.6.0'
|
||||
|
||||
// 网络连接类库
|
||||
//api 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||
|
||||
// Html 解析
|
||||
//api 'org.jsoup:jsoup:1.13.1'
|
||||
api 'org.jsoup:jsoup:1.13.1'
|
||||
|
||||
// SSH
|
||||
//api 'com.jcraft:jsch:0.1.55'
|
||||
|
||||
// 应用介绍页类库
|
||||
//api 'io.github.medyo:android-about-page:2.0.0'
|
||||
|
||||
api 'cc.winboll.studio:libappbase:15.0.5'
|
||||
api 'cc.winboll.studio:libappbase:15.0.10'
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Mon Mar 24 14:42:07 HKT 2025
|
||||
stageCount=13
|
||||
#Tue Mar 25 03:48:30 HKT 2025
|
||||
stageCount=18
|
||||
libraryProject=libapputils
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.12
|
||||
publishVersion=15.0.17
|
||||
buildCount=0
|
||||
baseBetaVersion=15.0.13
|
||||
baseBetaVersion=15.0.18
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.activities;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/07/14 13:20:33
|
||||
* @Describe 应用介绍页
|
||||
*/
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.LinearLayout;
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||
import cc.winboll.studio.libapputils.view.AboutView;
|
||||
|
||||
final public class AboutActivity extends Activity {
|
||||
|
||||
public static final String TAG = "AboutActivity";
|
||||
|
||||
public static final String EXTRA_APPINFO = "EXTRA_APPINFO";
|
||||
|
||||
APPInfo mAPPInfo;
|
||||
|
||||
@Override
|
||||
public Context getApplicationContext() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_about);
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
mAPPInfo = (APPInfo)intent.getSerializableExtra(EXTRA_APPINFO);
|
||||
}
|
||||
if (mAPPInfo == null) {
|
||||
mAPPInfo = new APPInfo();
|
||||
}
|
||||
|
||||
AboutView aboutView = new AboutView(this, mAPPInfo);
|
||||
LinearLayout llMain = findViewById(R.id.activityaboutLinearLayout1);
|
||||
llMain.addView(aboutView);
|
||||
|
||||
//ToastUtils.show(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.toolbar_winboll_shared_about, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// if (item.getItemId() == R.id.item_help) {
|
||||
// WinBollActivityManager.getInstance(this).startWinBollActivity(this, AssetsHtmlActivity.class);
|
||||
// }
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ package cc.winboll.studio.libapputils.activities;
|
||||
* @Date 2025/01/03 11:02:49
|
||||
* @Describe 一个可以浏览随 APP 附带的 Html 文档的窗口
|
||||
*/
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -15,7 +14,7 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toolbar;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
import cc.winboll.studio.libapputils.view.SimpleWebView;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -5,13 +5,11 @@ package cc.winboll.studio.libapputils.activities;
|
||||
* @Date 2025/03/08 00:19:39
|
||||
* @Describe LogActivity
|
||||
*/
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toolbar;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.LogView;
|
||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
|
||||
public class LogActivity extends Activity {
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.app;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2025/02/06 08:45:23
|
||||
* @Describe 关于活动窗口的介绍窗口工厂
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import cc.winboll.studio.libapputils.activities.AboutActivity;
|
||||
import cc.winboll.studio.libapputils.app.AboutActivityFactory;
|
||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||
|
||||
public class AboutActivityFactory {
|
||||
|
||||
public static final String TAG = "AboutActivityFactory";
|
||||
|
||||
public static APPInfo buildDefaultAPPInfo() {
|
||||
String szBranchName = "";
|
||||
|
||||
APPInfo appInfo = new APPInfo();
|
||||
appInfo.setAppName("APP");
|
||||
appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll);
|
||||
appInfo.setAppDescription("APP Description");
|
||||
appInfo.setAppGitName("APP");
|
||||
appInfo.setAppGitOwner("Studio");
|
||||
appInfo.setAppGitAPPBranch(szBranchName);
|
||||
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
|
||||
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=APP");
|
||||
appInfo.setAppAPKName("APP");
|
||||
appInfo.setAppAPKFolderName("APP");
|
||||
return appInfo;
|
||||
}
|
||||
|
||||
public static void showAboutActivity(Context context, APPInfo appInfo) {
|
||||
/*String szPN = ((IWinBollActivity)context).getActivityPackageName();
|
||||
//String szPN = context.getPackageName();
|
||||
String szBranchName = "";
|
||||
if (szPN != null) {
|
||||
//String szPN = "cc.winboll.studio.apputils.beta";
|
||||
String regex = "cc\\.winboll\\.studio\\.([^.]+)\\.*";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(szPN);
|
||||
if (matcher.find()) {
|
||||
szBranchName = matcher.group(1);
|
||||
}
|
||||
}*/
|
||||
//ToastUtils.show(szPN);
|
||||
|
||||
Intent intent = new Intent(context, AboutActivity.class);
|
||||
intent.putExtra(AboutActivity.EXTRA_APPINFO, (appInfo == null) ? AboutActivityFactory.buildDefaultAPPInfo():appInfo);
|
||||
//WinBollActivityManager.getInstance(context).startWinBollActivity(context, intent, AboutActivity.class);
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.bean;
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2025/01/20 14:19:02
|
||||
* @Describe 应用信息类
|
||||
*/
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class APPInfo implements Serializable {
|
||||
|
||||
public static final String TAG = "APPInfo";
|
||||
|
||||
// 应用名称
|
||||
String appName;
|
||||
// 应用图标
|
||||
int appIcon;
|
||||
// 应用描述
|
||||
String appDescription;
|
||||
// 应用Git仓库地址
|
||||
String appGitName;
|
||||
// 应用Git仓库拥有者
|
||||
String appGitOwner;
|
||||
// 应用Git仓库分支
|
||||
String appGitAPPBranch;
|
||||
// 应用Git仓库子项目文件夹
|
||||
String appGitAPPSubProjectFolder;
|
||||
// 应用主页
|
||||
String appHomePage;
|
||||
// 应用包名称
|
||||
String appAPKName;
|
||||
// 应用包存储文件夹名称
|
||||
String appAPKFolderName;
|
||||
|
||||
public APPInfo(String appName, int appIcon, String appDescription, String appGitName, String appGitOwner, String appGitAPPBranch, String appGitAPPSubProjectFolder, String appHomePage, String appAPKName, String appAPKFolderName) {
|
||||
this.appName = appName;
|
||||
this.appIcon = appIcon;
|
||||
this.appDescription = appDescription;
|
||||
this.appGitName = appGitName;
|
||||
this.appGitOwner = appGitOwner;
|
||||
this.appGitAPPBranch = appGitAPPBranch;
|
||||
this.appGitAPPSubProjectFolder = appGitAPPSubProjectFolder;
|
||||
this.appHomePage = appHomePage;
|
||||
this.appAPKName = appAPKName;
|
||||
this.appAPKFolderName = appAPKFolderName;
|
||||
}
|
||||
|
||||
public APPInfo() {
|
||||
this.appName = "WinBoll-APP";
|
||||
this.appIcon = R.drawable.ic_launcher;
|
||||
this.appDescription = "WinBoll APP";
|
||||
this.appGitName = "APP";
|
||||
this.appGitOwner = "Studio";
|
||||
this.appGitAPPBranch = "app";
|
||||
this.appGitAPPSubProjectFolder = "app";
|
||||
this.appHomePage = "https://www.winboll.cc/studio/details.php?app=APP";
|
||||
this.appAPKName = "APP";
|
||||
this.appAPKFolderName = "APP";
|
||||
}
|
||||
|
||||
public void setAppGitOwner(String appGitOwner) {
|
||||
this.appGitOwner = appGitOwner;
|
||||
}
|
||||
|
||||
public String getAppGitOwner() {
|
||||
return appGitOwner;
|
||||
}
|
||||
|
||||
public void setAppGitAPPBranch(String appGitAPPBranch) {
|
||||
this.appGitAPPBranch = appGitAPPBranch;
|
||||
}
|
||||
|
||||
public String getAppGitAPPBranch() {
|
||||
return appGitAPPBranch;
|
||||
}
|
||||
|
||||
public void setAppGitAPPSubProjectFolder(String appGitAPPSubProjectFolder) {
|
||||
this.appGitAPPSubProjectFolder = appGitAPPSubProjectFolder;
|
||||
}
|
||||
|
||||
public String getAppGitAPPSubProjectFolder() {
|
||||
return appGitAPPSubProjectFolder;
|
||||
}
|
||||
|
||||
public void setAppIcon(int appIcon) {
|
||||
this.appIcon = appIcon;
|
||||
}
|
||||
|
||||
public int getAppIcon() {
|
||||
return appIcon;
|
||||
}
|
||||
|
||||
public void setAppDescription(String appDescription) {
|
||||
this.appDescription = appDescription;
|
||||
}
|
||||
|
||||
public String getAppDescription() {
|
||||
return appDescription;
|
||||
}
|
||||
|
||||
public void setAppAPKFolderName(String appAPKFolderName) {
|
||||
this.appAPKFolderName = appAPKFolderName;
|
||||
}
|
||||
|
||||
public String getAppAPKFolderName() {
|
||||
return appAPKFolderName;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public void setAppGitName(String appGitName) {
|
||||
this.appGitName = appGitName;
|
||||
}
|
||||
|
||||
public String getAppGitName() {
|
||||
return appGitName;
|
||||
}
|
||||
|
||||
public void setAppHomePage(String appHomePage) {
|
||||
this.appHomePage = appHomePage;
|
||||
}
|
||||
|
||||
public String getAppHomePage() {
|
||||
return appHomePage;
|
||||
}
|
||||
|
||||
public void setAppAPKName(String appAPKName) {
|
||||
this.appAPKName = appAPKName;
|
||||
}
|
||||
|
||||
public String getAppAPKName() {
|
||||
return appAPKName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.bean;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/25 12:38:07
|
||||
* @Describe 应用调试配置类
|
||||
*/
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
|
||||
public class DebugBean extends BaseBean {
|
||||
|
||||
public static final String TAG = "DebugBean";
|
||||
|
||||
// 应用是否处于正在调试状态
|
||||
//
|
||||
boolean isDebuging = false;
|
||||
|
||||
public DebugBean() {
|
||||
this.isDebuging = false;
|
||||
}
|
||||
|
||||
public DebugBean(boolean isDebuging) {
|
||||
this.isDebuging = isDebuging;
|
||||
}
|
||||
|
||||
public void setIsDebuging(boolean isDebuging) {
|
||||
this.isDebuging = isDebuging;
|
||||
}
|
||||
|
||||
public boolean isDebuging() {
|
||||
return isDebuging;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return DebugBean.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
DebugBean bean = this;
|
||||
jsonWriter.name("isDebuging").value(bean.isDebuging());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("isDebuging")) {
|
||||
setIsDebuging(jsonReader.nextBoolean());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.intent;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2025/01/17 19:42:21
|
||||
* @Describe 应用活动类型汇总
|
||||
*/
|
||||
public class action {
|
||||
|
||||
static final String _PRE = cc.winboll.studio.libapputils.intent.action.class.getName();
|
||||
|
||||
public static final String DEBUGVIEW = _PRE + ".DEBUGVIEW";
|
||||
|
||||
}
|
||||
@@ -1,388 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.view;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/08/12 14:38:03
|
||||
* @Describe AboutView
|
||||
*/
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.TypedArray;
|
||||
import android.net.Uri;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.libapputils.app.AppVersionUtils;
|
||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||
import cc.winboll.studio.libapputils.bean.DebugBean;
|
||||
import cc.winboll.studio.libapputils.util.PrefUtils;
|
||||
import java.io.IOException;
|
||||
//import okhttp3.Call;
|
||||
//import okhttp3.Callback;
|
||||
//import okhttp3.Credentials;
|
||||
//import okhttp3.OkHttpClient;
|
||||
//import okhttp3.Request;
|
||||
//import okhttp3.Response;
|
||||
|
||||
public class AboutView extends LinearLayout {
|
||||
|
||||
public static final String TAG = "AboutView";
|
||||
|
||||
public static final int MSG_APPUPDATE_CHECKED = 0;
|
||||
|
||||
Context mContext;
|
||||
APPInfo mAPPInfo;
|
||||
|
||||
WinBollServiceStatusView mWinBollServiceStatusView;
|
||||
//OnRequestDevUserInfoAutofillListener mOnRequestDevUserInfoAutofillListener;
|
||||
String mszAppName = "";
|
||||
String mszAppAPKFolderName = "";
|
||||
String mszAppAPKName = "";
|
||||
String mszAppGitName = "";
|
||||
String mszAppVersionName = "";
|
||||
String mszCurrentAppPackageName = "";
|
||||
volatile String mszNewestAppPackageName = "";
|
||||
String mszAppDescription = "";
|
||||
String mszHomePage = "";
|
||||
String mszGitea = "";
|
||||
int mnAppIcon = 0;
|
||||
String mszWinBollServerHost;
|
||||
//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);
|
||||
}
|
||||
|
||||
public void setAPPInfo(APPInfo appInfo) {
|
||||
mAPPInfo = appInfo;
|
||||
}
|
||||
|
||||
APPInfo createAppInfo(Context context, AttributeSet attrs) {
|
||||
APPInfo appInfo = new APPInfo();
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.AboutView);
|
||||
appInfo.setAppName(typedArray.getString(R.styleable.AboutView_app_name));
|
||||
appInfo.setAppAPKFolderName(typedArray.getString(R.styleable.AboutView_app_apkfoldername));
|
||||
appInfo.setAppAPKName(typedArray.getString(R.styleable.AboutView_app_apkname));
|
||||
appInfo.setAppGitName(typedArray.getString(R.styleable.AboutView_app_gitname));
|
||||
appInfo.setAppGitOwner(typedArray.getString(R.styleable.AboutView_app_gitowner));
|
||||
appInfo.setAppGitAPPBranch(typedArray.getString(R.styleable.AboutView_app_gitappbranch));
|
||||
appInfo.setAppGitAPPSubProjectFolder(typedArray.getString(R.styleable.AboutView_app_gitappsubprojectfolder));
|
||||
appInfo.setAppDescription(typedArray.getString(R.styleable.AboutView_appdescription));
|
||||
appInfo.setAppIcon(typedArray.getResourceId(R.styleable.AboutView_appicon, R.drawable.ic_winboll));
|
||||
// 返回一个绑定资源结束的信号给资源
|
||||
typedArray.recycle();
|
||||
return appInfo;
|
||||
}
|
||||
void initView(Context context) {}
|
||||
|
||||
// void initView(Context context) {
|
||||
// mszAppName = mAPPInfo.getAppName();
|
||||
// mszAppAPKFolderName = mAPPInfo.getAppAPKFolderName();
|
||||
// mszAppAPKName = mAPPInfo.getAppAPKName();
|
||||
// mszAppGitName = mAPPInfo.getAppGitName();
|
||||
// mszAppDescription = mAPPInfo.getAppDescription();
|
||||
// mnAppIcon = mAPPInfo.getAppIcon();
|
||||
//
|
||||
// mszWinBollServerHost = GlobalApplication.isDebuging() ? "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 = mszAppAPKName + "_" + mszAppVersionName + ".apk";
|
||||
// mszHomePage = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName;
|
||||
// if(mAPPInfo.getAppGitAPPBranch().equals("")) {
|
||||
// mszGitea = "https://gitea.winboll.cc/" + mAPPInfo.getAppGitOwner() + "/" + mszAppGitName;
|
||||
// } else {
|
||||
// mszGitea = "https://gitea.winboll.cc/" + mAPPInfo.getAppGitOwner() + "/" + mszAppGitName + "/src/branch/" + mAPPInfo.getAppGitAPPBranch() + "/" + mAPPInfo.getAppGitAPPSubProjectFolder();
|
||||
//}
|
||||
//
|
||||
// if (GlobalApplication.isDebuging()) {
|
||||
// LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
// View addedView = inflater.inflate(R.layout.view_about_dev, this, false);
|
||||
// LinearLayout llMain = addedView.findViewById(R.id.viewaboutdevLinearLayout1);
|
||||
// metDevUserName = addedView.findViewById(R.id.viewaboutdevEditText1);
|
||||
// metDevUserPassword = addedView.findViewById(R.id.viewaboutdevEditText2);
|
||||
// metDevUserName.setText(PrefUtils.getString(mContext, "metDevUserName", ""));
|
||||
// metDevUserPassword.setText(PrefUtils.getString(mContext, "metDevUserPassword", ""));
|
||||
// //mDevelopHostConnectionStatusView = new DevelopHostConnectionStatusView(context);
|
||||
// mWinBollServiceStatusView = addedView.findViewById(R.id.viewaboutdevWinBollServiceStatusView1);
|
||||
// mWinBollServiceStatusView.setServerHost(mszWinBollServerHost);
|
||||
// mWinBollServiceStatusView.setAuthInfo(metDevUserName.getText().toString(), metDevUserPassword.getText().toString());
|
||||
// //llMain.addView(mDevelopHostConnectionStatusView);
|
||||
// llMain.addView(createAboutPage());
|
||||
// addView(addedView);
|
||||
// } else {
|
||||
// LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
// View addedView = inflater.inflate(R.layout.view_about_www, this, false);
|
||||
// LinearLayout llMain = addedView.findViewById(R.id.viewaboutwwwLinearLayout1);
|
||||
// //mDevelopHostConnectionStatusView = new DevelopHostConnectionStatusView(context);
|
||||
// mWinBollServiceStatusView = addedView.findViewById(R.id.viewaboutwwwWinBollServiceStatusView1);
|
||||
// mWinBollServiceStatusView.setServerHost(mszWinBollServerHost);
|
||||
// mWinBollServiceStatusView.setAuthInfo("", "");
|
||||
// //llMain.addView(mDevelopHostConnectionStatusView);
|
||||
// llMain.addView(createAboutPage());
|
||||
// addView(addedView);
|
||||
// }
|
||||
|
||||
// 初始化标题栏
|
||||
//setSubtitle(getContext().getString(R.string.text_about));
|
||||
//LinearLayout llMain = findViewById(R.id.viewaboutLinearLayout1);
|
||||
//llMain.addView(createAboutPage());
|
||||
|
||||
// 就读取正式版应用包版本号,设置 Release 应用包文件名
|
||||
// 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) {
|
||||
mAPPInfo = createAppInfo(context, attrs);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
// public static String subBetaSuffix(String input) {
|
||||
// if (input.endsWith(".beta")) {
|
||||
// return input.substring(0, input.length() - ".beta".length());
|
||||
// }
|
||||
// return input;
|
||||
// }
|
||||
//
|
||||
// android.os.Handler mHandler = new android.os.Handler() {
|
||||
// @Override
|
||||
// public void handleMessage(Message msg) {
|
||||
// super.handleMessage(msg);
|
||||
// switch (msg.what) {
|
||||
// case MSG_APPUPDATE_CHECKED : {
|
||||
// /*//检查当前应用包文件名是否是测试版,如果是就忽略检查
|
||||
// if(mszCurrentAppPackageName.matches(".*_\\d+\\.\\d+\\.\\d+-beta.*\\.apk")) {
|
||||
// ToastUtils.show("APP is the beta Version. Version check ignore.");
|
||||
// return;
|
||||
// }*/
|
||||
//
|
||||
//// if (!AppVersionUtils.isHasNewStageReleaseVersion(mszReleaseAPKName, mszNewestAppPackageName)) {
|
||||
//// ToastUtils.delayedShow("Current app is the newest.", 5000);
|
||||
//// }
|
||||
// if (!AppVersionUtils.isHasNewVersion2(mszCurrentAppPackageName, mszNewestAppPackageName)) {
|
||||
// ToastUtils.show("Current app is the newest.");
|
||||
// } else {
|
||||
// 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);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
// protected View createAboutPage() {
|
||||
// // 定义应用调试按钮
|
||||
// //
|
||||
// Element elementAppMode;
|
||||
// if (GlobalApplication.isDebuging()) {
|
||||
// elementAppMode = new Element(mContext.getString(R.string.app_normal), R.drawable.ic_winboll);
|
||||
// elementAppMode.setOnClickListener(mAppNormalOnClickListener);
|
||||
// } else {
|
||||
// elementAppMode = new Element(mContext.getString(R.string.app_debug), R.drawable.ic_winboll);
|
||||
// elementAppMode.setOnClickListener(mAppDebugOnClickListener);
|
||||
// }
|
||||
// // 定义 GitWeb 按钮
|
||||
// //
|
||||
// Element elementGitWeb = new Element(mContext.getString(R.string.gitea_home), R.drawable.ic_winboll);
|
||||
// elementGitWeb.setOnClickListener(mGitWebOnClickListener);
|
||||
// // 定义检查更新按钮
|
||||
// //
|
||||
// Element elementAppUpdate = new Element(mContext.getString(R.string.app_update), R.drawable.ic_winboll);
|
||||
// elementAppUpdate.setOnClickListener(mAppUpdateOnClickListener);
|
||||
//
|
||||
// String szAppInfo = "";
|
||||
// try {
|
||||
// szAppInfo = mszAppName + " "
|
||||
// + mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName
|
||||
// + "\n" + mszAppDescription;
|
||||
// } catch (PackageManager.NameNotFoundException e) {
|
||||
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
// }
|
||||
// View aboutPage = new AboutPage(mContext)
|
||||
// .setDescription(szAppInfo)
|
||||
// //.isRTL(false)
|
||||
// //.setCustomFont(String) // or Typeface
|
||||
// .setImage(mnAppIcon)
|
||||
// //.addItem(versionElement)
|
||||
// //.addItem(adsElement)
|
||||
// //.addGroup("Connect with us")
|
||||
// .addEmail("ZhanGSKen@AliYun.Com")
|
||||
// .addWebsite(mszHomePage)
|
||||
// .addItem(elementAppMode)
|
||||
// .addItem(elementGitWeb)
|
||||
// .addItem(elementAppUpdate)
|
||||
// //.addFacebook("the.medy")
|
||||
// //.addTwitter("medyo80")
|
||||
// //.addYoutube("UCdPQtdWIsg7_pi4mrRu46vA")
|
||||
// //.addPlayStore("com.ideashower.readitlater.pro")
|
||||
// //.addGitHub("medyo")
|
||||
// //.addInstagram("medyo80")
|
||||
// .create();
|
||||
// return aboutPage;
|
||||
// }
|
||||
|
||||
// View.OnClickListener mAppDebugOnClickListener = new View.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// setApp2DebugMode(mContext);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// View.OnClickListener mAppNormalOnClickListener = new View.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// setApp2NormalMode(mContext);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// public static void setApp2DebugMode(Context context) {
|
||||
// Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
|
||||
// if (intent != null) {
|
||||
// intent.setAction(cc.winboll.studio.libapputils.intent.action.DEBUGVIEW);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// GlobalApplication.setIsDebuging(context, true);
|
||||
// DebugBean.saveBean(context, new DebugBean(true));
|
||||
//
|
||||
// WinBollActivityManager.getInstance(context).finishAll();
|
||||
// context.startActivity(intent);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void setApp2NormalMode(Context context) {
|
||||
// Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
|
||||
// if (intent != null) {
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// GlobalApplication.setIsDebuging(context, false);
|
||||
// DebugBean.saveBean(context, new DebugBean(false));
|
||||
//
|
||||
// WinBollActivityManager.getInstance(context).finishAll();
|
||||
// context.startActivity(intent);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// View.OnClickListener mGitWebOnClickListener = new View.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mszGitea));
|
||||
// mContext.startActivity(browserIntent);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// View.OnClickListener mAppUpdateOnClickListener = new View.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// ToastUtils.show("Start app update checking.");
|
||||
// new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// String szUrl = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName;
|
||||
// // 构建包含认证信息的请求
|
||||
// String credential = "";
|
||||
// if (GlobalApplication.isDebuging()) {
|
||||
// credential = Credentials.basic(metDevUserName.getText().toString(), metDevUserPassword.getText().toString());
|
||||
// PrefUtils.saveString(mContext, "metDevUserName", metDevUserName.getText().toString());
|
||||
// PrefUtils.saveString(mContext, "metDevUserPassword", metDevUserPassword.getText().toString());
|
||||
// }
|
||||
// OkHttpClient client = new OkHttpClient();
|
||||
// Request request = new Request.Builder()
|
||||
// .url(szUrl)
|
||||
// .header("Accept", "text/plain") // 设置正确的Content-Type头
|
||||
// .header("Authorization", credential)
|
||||
// .build();
|
||||
// Call call = client.newCall(request);
|
||||
// call.enqueue(new Callback() {
|
||||
// @Override
|
||||
// public void onFailure(Call call, IOException e) {
|
||||
// // 处理网络请求失败
|
||||
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onResponse(Call call, Response response) throws IOException {
|
||||
// if (!response.isSuccessful()) {
|
||||
// LogUtils.d(TAG, "Unexpected code " + response, Thread.currentThread().getStackTrace());
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// // 读取响应体作为字符串,注意这里可能需要解码
|
||||
// String text = response.body().string();
|
||||
// org.jsoup.nodes.Document doc = org.jsoup.Jsoup.parse(text);
|
||||
// LogUtils.v(TAG, doc.text());
|
||||
//
|
||||
// // 使用id选择器找到具有特定id的元素
|
||||
// org.jsoup.nodes.Element elementWithId = doc.select("#LastRelease").first(); // 获取第一个匹配的元素
|
||||
//
|
||||
// // 提取并打印元素的文本内容
|
||||
// mszNewestAppPackageName = elementWithId.text();
|
||||
// //ToastUtils.delayedShow(text + "\n" + mszNewestAppPackageName, 5000);
|
||||
//
|
||||
// mHandler.sendMessage(mHandler.obtainMessage(MSG_APPUPDATE_CHECKED));
|
||||
// } catch (Exception e) {
|
||||
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }).start();
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// YesNoAlertDialog.OnDialogResultListener mIsDownlaodUpdateListener = new YesNoAlertDialog.OnDialogResultListener() {
|
||||
// @Override
|
||||
// public void onYes() {
|
||||
// String szUrl = mszWinBollServerHost + "/studio/download.php?appname=" + mszAppAPKFolderName + "&apkname=" + mszNewestAppPackageName;
|
||||
// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(szUrl));
|
||||
// mContext.startActivity(browserIntent);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNo() {
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// public interface OnRequestDevUserInfoAutofillListener {
|
||||
// void requestAutofill(EditText etDevUserName, EditText etDevUserPassword);
|
||||
// }
|
||||
//
|
||||
// public void setOnRequestDevUserInfoAutofillListener(OnRequestDevUserInfoAutofillListener l) {
|
||||
// mOnRequestDevUserInfoAutofillListener = l;
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user