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