From 0777006bef6a43d58e5a1955b3089d6995711336 Mon Sep 17 00:00:00 2001 From: mingzhixian Date: Mon, 22 Jan 2024 22:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0V1.3.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复激活bug --- easycontrol/app/build.gradle | 4 ++-- .../java/top/saymzx/easycontrol/app/ActiveActivity.java | 2 ++ .../java/top/saymzx/easycontrol/app/MainActivity.java | 2 +- .../java/top/saymzx/easycontrol/app/entity/Setting.java | 9 +++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/easycontrol/app/build.gradle b/easycontrol/app/build.gradle index 4c39cfc4..9288403d 100644 --- a/easycontrol/app/build.gradle +++ b/easycontrol/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "top.saymzx.easycontrol.app" minSdk 21 targetSdk 34 - versionCode 10306 - versionName "1.3.6" + versionCode 10307 + versionName "1.3.7" ndk { abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64" } diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/ActiveActivity.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/ActiveActivity.java index 1767efd4..d43d07cd 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/ActiveActivity.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/ActiveActivity.java @@ -19,6 +19,7 @@ protected void onCreate(Bundle savedInstanceState) { PublicTools.setLocale(this); activeActivity = ActivityActiveBinding.inflate(this.getLayoutInflater()); setContentView(activeActivity.getRoot()); + AppData.setting.setIsActive(false); setButtonListener(); // 绘制UI drawUi(); @@ -39,6 +40,7 @@ private void setButtonListener() { AppData.uiHandler.post(() -> { if (isOk) { finish(); + AppData.setting.setIsActive(true); Toast.makeText(this, getString(R.string.active_button_success), Toast.LENGTH_SHORT).show(); PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/HOW_TO_USE.md"); } else Toast.makeText(this, getString(R.string.active_button_error), Toast.LENGTH_SHORT).show(); diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/MainActivity.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/MainActivity.java index 120bfda3..1b6365c4 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/MainActivity.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/MainActivity.java @@ -68,7 +68,7 @@ protected void onDestroy() { // 检测激活 private void checkActive() { - if (AppData.setting.getActiveKey().equals("")) startActivity(new Intent(this, ActiveActivity.class)); + if (!AppData.setting.getIsActive()) startActivity(new Intent(this, ActiveActivity.class)); } // 检查权限 diff --git a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Setting.java b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Setting.java index aef9df11..fcdb9ccf 100644 --- a/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Setting.java +++ b/easycontrol/app/src/main/java/top/saymzx/easycontrol/app/entity/Setting.java @@ -9,6 +9,15 @@ public final class Setting { private final SharedPreferences.Editor editor; + public boolean getIsActive() { + return sharedPreferences.getBoolean("isActive", false); + } + + public void setIsActive(boolean value) { + editor.putBoolean("isActive", value); + editor.apply(); + } + public String getActiveKey() { return sharedPreferences.getString("activeKey", ""); }