refactor(libappbase): 将 DebugSwitchImageView 重命名为 DebugSwitchInfoImageView 并添加调试 token 功能

- 类名 DebugSwitchImageView → DebugSwitchInfoImageView
- 更新 TAG 常量及所有构造方法名称
- 更新 AboutView.java 字段类型引用
- 更新 layout_about_view.xml 及 layout-night 布局文件中的自定义视图标签
- 新增静态变量 mDebugToken 及 getDebugToken() 方法
  - 首次调用时从 SharedPreferences 读取
  - 无存储值时自动生成 UUID 唯一 token 并持久化到 SP
This commit is contained in:
aBuild
2026-05-23 21:06:02 +08:00
parent da0fb646ab
commit 463585988d
7 changed files with 128 additions and 13 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed May 20 16:12:26 HKT 2026
#Sat May 23 21:03:59 HKT 2026
stageCount=21
libraryProject=libappbase
baseVersion=15.20
publishVersion=15.20.20
buildCount=0
buildCount=6
baseBetaVersion=15.20.21

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed May 20 16:12:13 HKT 2026
#Sat May 23 21:03:59 HKT 2026
stageCount=21
libraryProject=libappbase
baseVersion=15.20
publishVersion=15.20.20
buildCount=0
buildCount=6
baseBetaVersion=15.20.21

View File

@@ -74,7 +74,7 @@ public class AboutView extends LinearLayout {
private EditText metDevUserPassword;
// ===================================== 页面视图控件 =====================================
private DebugSwitchImageView ivAppIcon;
private DebugSwitchInfoImageView ivAppIcon;
private TextView tvAppNameVersion;
private TextView tvAppDesc;
private LinearLayout llFunctionContainer;

View File

@@ -1,10 +1,12 @@
package cc.winboll.studio.libappbase.views;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import java.util.UUID;
import cc.winboll.studio.libappbase.GlobalApplication;
/**
@@ -12,31 +14,51 @@ import cc.winboll.studio.libappbase.GlobalApplication;
* @Date 2026/04/06 19:32
* @Describe 具有调试模式切换功能的应用Logo控件连续点击10次弹出提示
*/
public class DebugSwitchImageView extends ImageView {
public class DebugSwitchInfoImageView extends ImageView {
public static final String TAG = "DebugSwitchImageView";
public static final String TAG = "DebugSwitchInfoImageView";
// 连续点击计数
private int mClickCount = 0;
// 目标点击次数
private static final int TARGET_CLICK_COUNT = 10;
public DebugSwitchImageView(Context context) {
private static String mDebugToken = null;
private static final String SP_DEBUG_TOKEN = "debug_token_prefs";
private static final String KEY_DEBUG_TOKEN = "debug_token";
public static String getDebugToken() {
if (mDebugToken != null) {
return mDebugToken;
}
Context context = GlobalApplication.getInstance();
if (context != null) {
SharedPreferences sp = context.getSharedPreferences(SP_DEBUG_TOKEN, Context.MODE_PRIVATE);
mDebugToken = sp.getString(KEY_DEBUG_TOKEN, null);
if (mDebugToken == null) {
mDebugToken = UUID.randomUUID().toString();
sp.edit().putString(KEY_DEBUG_TOKEN, mDebugToken).apply();
}
}
return mDebugToken;
}
public DebugSwitchInfoImageView(Context context) {
super(context);
init();
}
public DebugSwitchImageView(Context context, AttributeSet attrs) {
public DebugSwitchInfoImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public DebugSwitchImageView(Context context, AttributeSet attrs, int defStyleAttr) {
public DebugSwitchInfoImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public DebugSwitchImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
public DebugSwitchInfoImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}

View File

@@ -15,7 +15,7 @@
android:paddingRight="16dp"
android:paddingBottom="16dp">
<cc.winboll.studio.libappbase.views.DebugSwitchImageView
<cc.winboll.studio.libappbase.views.DebugSwitchInfoImageView
android:id="@+id/iv_app_icon"
android:layout_width="48dp"
android:layout_height="48dp"

View File

@@ -15,7 +15,7 @@
android:paddingRight="16dp"
android:paddingBottom="16dp">
<cc.winboll.studio.libappbase.views.DebugSwitchImageView
<cc.winboll.studio.libappbase.views.DebugSwitchInfoImageView
android:id="@+id/iv_app_icon"
android:layout_width="48dp"
android:layout_height="48dp"

View File

@@ -1,5 +1,98 @@
// AutoInstaller 项目编译设置
//include ':autoinstaller'
//rootProject.name = "autoinstaller"
// MJ 项目编译设置
//include ':mj'
//rootProject.name = "mj"
// PowerBell 项目编译设置
//include ':powerbell'
//rootProject.name = "powerbell"
// APPBase 项目编译设置
include ':appbase'
include ':libappbase'
rootProject.name = "appbase"
// APPUtils 项目编译设置
//include ':apputils'
//include ':libapputils'
//rootProject.name = "apputils"
// JC 项目编译设置
//include ':jc'
//include ':libjc'
//rootProject.name = "jc"
// AES 项目编译设置
//include ':aes'
//include ':libaes'
//rootProject.name = "aes"
// Contacts 项目编译设置
//include ':contacts'
//rootProject.name = "contacts"
// MyMessageManager 项目编译设置
//include ':mymessagemanager'
//rootProject.name = "mymessagemanager"
// TimeStamp 项目编译设置
//include ':timestamp'
//rootProject.name = "timestamp"
// AndroidDemo 项目编译设置
//include ':androiddemo'
//rootProject.name = "androiddemo"
// AndroidXDemo 项目编译设置
//include ':androidxdemo'
//rootProject.name = "androidxdemo"
// Ollama 项目编译设置
//include ':ollama'
//rootProject.name = "ollama"
// NumTable 项目编译设置
//include ':numtable'
//rootProject.name = "numtable"
// MidiPlayer 项目编译设置
//include ':midiplayer'
//rootProject.name = "midiplayer"
// WebPageSources 项目编译设置
//include ':webpagesources'
//rootProject.name = "webpagesources"
// Positions 项目编译设置
//include ':positions'
//rootProject.name = "positions"
// WinBoLL 项目编译设置
//include ':winboll'
//include ':libwinboll'
//rootProject.name = "winboll"
// RegExpUtils 项目编译设置
//include ':regexputils'
//rootProject.name = "regexputils"
// GPSRelaySentinel 项目编译设置
//include ':gpsrelaysentinel'
//include ':libgpsrelaysentinel'
//rootProject.name = "gpsrelaysentinel"
// Gallery 项目编译设置
//include ':gallery'
//rootProject.name = "gallery"
// DebugTemp 项目编译设置
//include ':debugtemp'
//include ':libdebugtemp'
//rootProject.name = "debugtemp"
// AutoNFC 项目编译设置
//include ':autonfc'
//rootProject.name = "autonfc"