mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-13 20:01:17 +08:00
新增重启系统对话框
This commit is contained in:
@@ -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
|
||||
@@ -49,8 +50,16 @@ class SettingsActivity : AppCompatActivity() {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.reboot -> {
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user