diff --git a/contacts/build.properties b/contacts/build.properties index 78cce53..6edebb5 100644 --- a/contacts/build.properties +++ b/contacts/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat Jul 18 20:10:18 CST 2026 +#Sun Jul 19 04:13:23 CST 2026 stageCount=11 libraryProject= baseVersion=15.20 publishVersion=15.20.10 -buildCount=7 +buildCount=12 baseBetaVersion=15.20.11 diff --git a/contacts/src/main/java/cc/winboll/studio/contacts/views/DebugToolButtonsView.java b/contacts/src/main/java/cc/winboll/studio/contacts/views/DebugToolButtonsView.java index 30208fc..e7adc30 100644 --- a/contacts/src/main/java/cc/winboll/studio/contacts/views/DebugToolButtonsView.java +++ b/contacts/src/main/java/cc/winboll/studio/contacts/views/DebugToolButtonsView.java @@ -1,23 +1,14 @@ package cc.winboll.studio.contacts.views; -import android.app.Application; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; -import android.widget.Toast; import cc.winboll.studio.contacts.R; -import cc.winboll.studio.contacts.services.MainService; import cc.winboll.studio.libappbase.LogUtils; -import cc.winboll.studio.libappbase.ToastUtils; -import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils; -import cc.winboll.studio.libappbase.CrashActivity; -import java.io.PrintWriter; -import java.io.StringWriter; /** * @Author ZhanGSKen @@ -55,28 +46,9 @@ public class DebugToolButtonsView extends LinearLayout { } private void initButtons() { - Button btnClearData = (Button) findViewById(R.id.btn_debug_clear_data); - Button btnShowSp = (Button) findViewById(R.id.btn_debug_show_sp); Button btnCrash = (Button) findViewById(R.id.btn_debug_crash); - Button btnShowLog = (Button) findViewById(R.id.btn_debug_show_log); - Button btnRestartService = (Button) findViewById(R.id.btn_debug_restart_service); - Button btnAppInfo = (Button) findViewById(R.id.btn_debug_app_info); Button btnLayoutPreview = (Button) findViewById(R.id.btn_debug_layout_preview); - btnClearData.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - onClearData(); - } - }); - - btnShowSp.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - onShowSp(); - } - }); - btnCrash.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { @@ -84,27 +56,6 @@ public class DebugToolButtonsView extends LinearLayout { } }); - btnShowLog.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - onShowLog(); - } - }); - - btnRestartService.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - onRestartService(); - } - }); - - btnAppInfo.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - onShowAppInfo(); - } - }); - btnLayoutPreview.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { @@ -113,97 +64,10 @@ public class DebugToolButtonsView extends LinearLayout { }); } - private void onClearData() { - LogUtils.d(TAG, "onClearData: 清除应用数据"); - try { - mContext.deleteDatabase("contacts.db"); - SharedPreferences sp = mContext.getSharedPreferences("WinBoLL_SP_CONFIG", Context.MODE_PRIVATE); - sp.edit().clear().apply(); - ToastUtils.show("应用数据已清除"); - LogUtils.d(TAG, "onClearData: 数据清除完成"); - } catch (Exception e) { - LogUtils.e(TAG, "onClearData: 清除数据失败", e); - ToastUtils.show("清除失败: " + e.getMessage()); - } - } - - private void onShowSp() { - LogUtils.d(TAG, "onShowSp: 查看SharedPreferences"); - try { - SharedPreferences sp = mContext.getSharedPreferences("WinBoLL_SP_CONFIG", Context.MODE_PRIVATE); - java.util.Map allEntries = sp.getAll(); - StringBuilder sb = new StringBuilder(); - sb.append("WinBoLL_SP_CONFIG:\n"); - for (java.util.Map.Entry entry : allEntries.entrySet()) { - sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n"); - } - if (allEntries.isEmpty()) { - sb.append("(空)"); - } - ToastUtils.show(sb.toString()); - LogUtils.d(TAG, "onShowSp: SP内容已显示,共" + allEntries.size() + "条"); - } catch (Exception e) { - LogUtils.e(TAG, "onShowSp: 读取SP失败", e); - ToastUtils.show("读取失败: " + e.getMessage()); - } - } - private void onTestCrash() { LogUtils.d(TAG, "onTestCrash: 触发测试崩溃"); - try { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - pw.close(); - String stackTraceStr = sw.toString(); - CrashHandleNotifyUtils.handleUncaughtException( - (Application) mContext.getApplicationContext(), - mContext.getPackageName(), - "DebugToolButtonsView - 手动触发测试崩溃\n" + stackTraceStr, - CrashActivity.class - ); - } catch (Exception e) { - LogUtils.e(TAG, "onTestCrash: 触发崩溃失败", e); - throw new RuntimeException("DebugToolButtonsView 测试崩溃"); - } - } - - private void onShowLog() { - LogUtils.d(TAG, "onShowLog: 跳转日志页面"); - try { - Intent intent = new Intent(); - intent.setClassName(mContext, "cc.winboll.studio.libappbase.LogActivity"); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mContext.startActivity(intent); - } catch (Exception e) { - LogUtils.e(TAG, "onShowLog: 跳转日志页面失败", e); - ToastUtils.show("跳转失败: " + e.getMessage()); - } - } - - private void onRestartService() { - LogUtils.d(TAG, "onRestartService: 重启主服务"); - try { - MainService.restartMainService(mContext); - ToastUtils.show("主服务已重启"); - LogUtils.d(TAG, "onRestartService: 主服务重启完成"); - } catch (Exception e) { - LogUtils.e(TAG, "onRestartService: 重启服务失败", e); - ToastUtils.show("重启失败: " + e.getMessage()); - } - } - - private void onShowAppInfo() { - LogUtils.d(TAG, "onShowAppInfo: 显示应用信息"); - try { - String pkgName = mContext.getPackageName(); - int versionCode = mContext.getPackageManager().getPackageInfo(pkgName, 0).versionCode; - String versionName = mContext.getPackageManager().getPackageInfo(pkgName, 0).versionName; - String info = "包名: " + pkgName + "\n版本: " + versionName + " (" + versionCode + ")"; - ToastUtils.show(info); - LogUtils.d(TAG, "onShowAppInfo: " + info); - } catch (Exception e) { - LogUtils.e(TAG, "onShowAppInfo: 获取应用信息失败", e); - ToastUtils.show("获取信息失败: " + e.getMessage()); + for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; i++) { + ((android.app.Activity) mContext).getString(i); } } @@ -217,7 +81,6 @@ public class DebugToolButtonsView extends LinearLayout { LogUtils.d(TAG, "onOpenLayoutPreview: 跳转成功"); } catch (Exception e) { LogUtils.e(TAG, "onOpenLayoutPreview: 跳转失败", e); - ToastUtils.show("跳转失败: " + e.getMessage()); } } } diff --git a/contacts/src/main/res/layout/view_debug_tool_buttons.xml b/contacts/src/main/res/layout/view_debug_tool_buttons.xml index 0eff66c..b866266 100644 --- a/contacts/src/main/res/layout/view_debug_tool_buttons.xml +++ b/contacts/src/main/res/layout/view_debug_tool_buttons.xml @@ -24,22 +24,6 @@ android:layout_height="wrap_content" android:gravity="right"> -