From e13a1ddf472558fb110630b99248a9a9975c743e Mon Sep 17 00:00:00 2001 From: LittleTurtle2333 <841474544@qq.com> Date: Thu, 17 Feb 2022 01:45:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=8D=E5=90=AF=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/SettingsActivity.kt | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt b/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt index fc421566..d2bf72de 100644 --- a/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt +++ b/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt @@ -1,6 +1,7 @@ package com.lt2333.simplicitytools.activity import android.annotation.SuppressLint +import android.content.DialogInterface import android.content.Intent import android.net.Uri import android.os.Bundle @@ -22,9 +23,9 @@ class SettingsActivity : AppCompatActivity() { setContentView(R.layout.settings_activity) if (savedInstanceState == null) { supportFragmentManager - .beginTransaction() - .replace(R.id.settings, SettingsFragment()) - .commit() + .beginTransaction() + .replace(R.id.settings, SettingsFragment()) + .commit() } supportActionBar?.setDisplayHomeAsUpEnabled(false) checkLSPosed() @@ -41,16 +42,24 @@ class SettingsActivity : AppCompatActivity() { getSharedPreferences("config", MODE_WORLD_READABLE) } catch (exception: SecurityException) { AlertDialog.Builder(this) - .setMessage("您似乎正在使用过时的 LSPosed 版本或 LSPosed 未激活,请更新 LSPosed 或者激活后再试。") - .show() + .setMessage("您似乎正在使用过时的 LSPosed 版本或 LSPosed 未激活,请更新 LSPosed 或者激活后再试。") + .show() } } override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.reboot -> { - val commad = arrayOf("reboot") - ShellUtils.execCommand(commad, true) + AlertDialog.Builder(this) + .setMessage("确定重启?") + .setPositiveButton( + "是", + DialogInterface.OnClickListener { dialogInterface, i -> + val commad = arrayOf("reboot") + ShellUtils.execCommand(commad, true) + }) + .setNegativeButton("否", null) + .show() } R.id.reboot_ui -> { val commad = arrayOf("killall com.android.systemui") @@ -65,7 +74,7 @@ class SettingsActivity : AppCompatActivity() { preferenceManager.sharedPreferencesName = "config" setPreferencesFromResource(R.xml.root_preferences, rootKey) findPreference("verison")!!.summary = - BuildConfig.VERSION_NAME + "(" + BuildConfig.BUILD_TYPE + ")" + BuildConfig.VERSION_NAME + "(" + BuildConfig.BUILD_TYPE + ")" } override fun onPreferenceTreeClick(preference: Preference): Boolean { @@ -74,7 +83,7 @@ class SettingsActivity : AppCompatActivity() { "opensource" -> { try { val uri = - Uri.parse("https://github.com/LittleTurtle2333/Simplicity_Tools_Xposed") + Uri.parse("https://github.com/LittleTurtle2333/Simplicity_Tools_Xposed") val intent = Intent(Intent.ACTION_VIEW, uri) startActivity(intent) } catch (e: Exception) { @@ -84,7 +93,7 @@ class SettingsActivity : AppCompatActivity() { "issues" -> { try { val uri = - Uri.parse("https://github.com/LittleTurtle2333/Simplicity_Tools_Xposed/issues") + Uri.parse("https://github.com/LittleTurtle2333/Simplicity_Tools_Xposed/issues") val intent = Intent(Intent.ACTION_VIEW, uri) startActivity(intent) } catch (e: Exception) { @@ -94,10 +103,10 @@ class SettingsActivity : AppCompatActivity() { "dev_coolapk" -> { try { startActivity( - Intent( - Intent.ACTION_VIEW, - Uri.parse("coolmarket://u/883441") - ) + Intent( + Intent.ACTION_VIEW, + Uri.parse("coolmarket://u/883441") + ) ) Toast.makeText(activity, "乌堆小透明:靓仔,点个关注吧!", Toast.LENGTH_SHORT).show() } catch (e: Exception) {