From 4f8873fcf927b7e5076b3da9aa5836c5fa577062 Mon Sep 17 00:00:00 2001 From: MartinKay Date: Thu, 12 Sep 2024 11:14:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=92=8C=E7=BD=91=E7=BB=9C=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=AF=AF=E5=B7=AE=E5=88=A4=E6=96=AD=E3=80=82=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=89=93=E5=8D=A1=E6=94=AF=E6=8C=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 4 +- .../autocheckinplugin/MainActivity.kt | 61 +++++++++++++- .../autocheckinplugin/SharePrefHelper.kt | 2 + .../weixin/MessagePageProcessor.java | 84 ++++++++++++++++++- app/src/main/res/layout/activity_main.xml | 16 ++++ app/src/main/res/layout/setting_dialog.xml | 7 ++ app/src/main/res/values/strings.xml | 1 + 7 files changed, 170 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 22e38fe..7b934e5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "cn.martinkay.autocheckinplugin" minSdk = 24 targetSdk = 34 - versionCode = 2 - versionName = "2.0" + versionCode = 22 + versionName = "2.2" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/cn/martinkay/autocheckinplugin/MainActivity.kt b/app/src/main/java/cn/martinkay/autocheckinplugin/MainActivity.kt index b251ef4..4178f29 100644 --- a/app/src/main/java/cn/martinkay/autocheckinplugin/MainActivity.kt +++ b/app/src/main/java/cn/martinkay/autocheckinplugin/MainActivity.kt @@ -6,7 +6,6 @@ import android.app.TimePickerDialog import android.content.Context import android.content.DialogInterface import android.content.Intent -import android.content.SharedPreferences import android.content.pm.PackageManager import android.net.Uri import android.os.Build @@ -43,9 +42,13 @@ import com.alibaba.fastjson.JSON import com.haibin.calendarview.Calendar import com.haibin.calendarview.CalendarView import com.topjohnwu.superuser.Shell +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import rikka.shizuku.Shizuku import rikka.shizuku.Shizuku.OnRequestPermissionResultListener +import java.net.URL @SuppressLint("SetTextI18n") class MainActivity : AppCompatActivity(R.layout.activity_main) { @@ -111,6 +114,8 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) { override fun onOptionsItemSelected(item: MenuItem): Boolean { val enableSmartRecognitionJump: Boolean = SharePrefHelper.getBoolean(ENABLE_SMART_RECOGNITION_JUMP, false) + val enableStartQuickSign: Boolean = + SharePrefHelper.getBoolean(ENABLE_START_QUICK_SIGN, false) when (item.itemId) { R.id.action_settings -> { @@ -118,7 +123,7 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) { val builder = AlertDialog.Builder(this) builder.setTitle("设置") - // 显示Toast + // 开启智能识别跳转 val enableSmartRecognitionJumpSwitch = inflate.findViewById(R.id.smart_recognition_jump) enableSmartRecognitionJumpSwitch.isChecked = enableSmartRecognitionJump @@ -133,6 +138,22 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) { Toast.LENGTH_SHORT ).show() } + + val enableStartQuickSignSwitch = + inflate.findViewById(R.id.start_quick_sign) + enableStartQuickSignSwitch.isChecked = enableStartQuickSign + enableStartQuickSignSwitch.setOnClickListener { + SharePrefHelper.putBoolean( + ENABLE_START_QUICK_SIGN, + enableStartQuickSignSwitch.isChecked + ) + Toast.makeText( + this, + "已${if (enableStartQuickSignSwitch.isChecked) "开启" else "关闭"}兼容快捷打卡", + Toast.LENGTH_SHORT + ).show() + } + val saveBtn = inflate.findViewById