完善应用介绍页UI风格
This commit is contained in:
parent
81d538589f
commit
b1e2a018d8
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sat Mar 29 09:33:15 GMT 2025
|
||||
#Sat Mar 29 16:59:59 GMT 2025
|
||||
stageCount=2
|
||||
libraryProject=libaes
|
||||
baseVersion=15.2
|
||||
publishVersion=15.2.1
|
||||
buildCount=16
|
||||
buildCount=25
|
||||
baseBetaVersion=15.2.2
|
||||
|
@ -5,23 +5,25 @@ package cc.winboll.studio.aes;
|
||||
* @Date 2025/03/24 23:52:29
|
||||
* @Describe AES应用介绍窗口
|
||||
*/
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import cc.winboll.studio.libaes.winboll.APPInfo;
|
||||
import cc.winboll.studio.libaes.winboll.AboutView;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import android.app.Activity;
|
||||
|
||||
public class AboutActivity extends AppCompatActivity implements IWinBollActivity {
|
||||
public class AboutActivity extends WinBollActivity implements IWinBollActivity {
|
||||
|
||||
public static final String TAG = "AboutActivity";
|
||||
|
||||
Context mContext;
|
||||
|
||||
Toolbar mToolbar;
|
||||
|
||||
@Override
|
||||
public Activity getActivity() {
|
||||
return this;
|
||||
@ -36,17 +38,31 @@ public class AboutActivity extends AppCompatActivity implements IWinBollActivity
|
||||
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);
|
||||
// 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
|
||||
);
|
||||
addContentView(aboutView, params);
|
||||
layout.addView(aboutView, params);
|
||||
|
||||
GlobalApplication.getWinBollActivityManager().add(this);
|
||||
}
|
||||
|
50
aes/src/main/java/cc/winboll/studio/aes/WinBollActivity.java
Normal file
50
aes/src/main/java/cc/winboll/studio/aes/WinBollActivity.java
Normal file
@ -0,0 +1,50 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* @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()));
|
||||
}
|
||||
}
|
22
aes/src/main/res/layout/activity_about.xml
Normal file
22
aes/src/main/res/layout/activity_about.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?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">
|
||||
|
||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/toolbar"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0"
|
||||
android:id="@+id/aboutviewroot_ll"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sat Mar 29 09:33:15 GMT 2025
|
||||
#Sat Mar 29 16:59:59 GMT 2025
|
||||
stageCount=2
|
||||
libraryProject=libaes
|
||||
baseVersion=15.2
|
||||
publishVersion=15.2.1
|
||||
buildCount=16
|
||||
buildCount=25
|
||||
baseBetaVersion=15.2.2
|
||||
|
@ -8,6 +8,8 @@ package cc.winboll.studio.libaes.winboll;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import java.io.IOException;
|
||||
import okhttp3.Authenticator;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Credentials;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
@ -42,6 +44,7 @@ public class WinBollServerConnectionTestThread extends Thread {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LogUtils.d(TAG, String.format("run() url %s\nusername %s\npassword %s", url, username, password));
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.connectTimeout(connectTimeout, java.util.concurrent.TimeUnit.MILLISECONDS)
|
||||
.readTimeout(readTimeout, java.util.concurrent.TimeUnit.MILLISECONDS)
|
||||
@ -58,44 +61,80 @@ public class WinBollServerConnectionTestThread extends Thread {
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
int retryCount = 0;
|
||||
while (!testComplete && retryCount <= maxRetries) {
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
if (response.isSuccessful()) {
|
||||
String responseBody = response.body().string();
|
||||
if ("OK".equalsIgnoreCase(responseBody.trim())) {
|
||||
LogUtils.d(TAG, "[" + new java.util.Date() + "] 测试成功,服务器返回OK");
|
||||
testComplete = true;
|
||||
} else {
|
||||
LogUtils.d(TAG, "[" + new java.util.Date() + "] 响应内容不符合预期:" + responseBody);
|
||||
}
|
||||
} else {
|
||||
LogUtils.d(TAG, "[" + new java.util.Date() + "] 请求失败,状态码:" + response.code());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LogUtils.d(TAG, "[" + new java.util.Date() + "] 连接异常:" + e.getMessage());
|
||||
}
|
||||
|
||||
if (!testComplete) {
|
||||
try {
|
||||
Thread.sleep(2000); // 等待2秒后重试
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
LogUtils.d(TAG, "测试线程被中断");
|
||||
return;
|
||||
}
|
||||
retryCount++;
|
||||
LogUtils.d(TAG, "[" + new java.util.Date() + "] 第" + retryCount + "次重试...");
|
||||
}
|
||||
}
|
||||
|
||||
if (testComplete) {
|
||||
|
||||
} else {
|
||||
LogUtils.d(TAG, "[" + new java.util.Date() + "] 达到最大重试次数,测试失败");
|
||||
}
|
||||
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.d(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());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// int retryCount = 0;
|
||||
// while (!testComplete && retryCount <= maxRetries) {
|
||||
// LogUtils.d(TAG, "while (!testComplete && retryCount <= maxRetries) {");
|
||||
// try {
|
||||
// Response response = client.newCall(request).execute();
|
||||
// if (response.isSuccessful()) {
|
||||
// String responseBody = response.body().string();
|
||||
// if ("OK".equalsIgnoreCase(responseBody.trim())) {
|
||||
// LogUtils.d(TAG, "[" + new java.util.Date() + "] 测试成功,服务器返回OK");
|
||||
// testComplete = true;
|
||||
// } else {
|
||||
// LogUtils.d(TAG, "[" + new java.util.Date() + "] 响应内容不符合预期:" + responseBody);
|
||||
// }
|
||||
// } else {
|
||||
// LogUtils.d(TAG, "[" + new java.util.Date() + "] 请求失败,状态码:" + response.code());
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// LogUtils.d(TAG, "[" + new java.util.Date() + "] 连接异常:" + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// if (!testComplete) {
|
||||
// try {
|
||||
// Thread.sleep(2000); // 等待2秒后重试
|
||||
// } catch (InterruptedException e) {
|
||||
// Thread.currentThread().interrupt();
|
||||
// LogUtils.d(TAG, "测试线程被中断");
|
||||
// return;
|
||||
// }
|
||||
// retryCount++;
|
||||
// LogUtils.d(TAG, "[" + new java.util.Date() + "] 第" + retryCount + "次重试...");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (testComplete) {
|
||||
//
|
||||
// } else {
|
||||
// LogUtils.d(TAG, "[" + new java.util.Date() + "] 达到最大重试次数,测试失败");
|
||||
// }
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user