mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-13 03:41:19 +08:00
新增重启系统对话框
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.lt2333.simplicitytools.activity
|
package com.lt2333.simplicitytools.activity
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.DialogInterface
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -49,8 +50,16 @@ class SettingsActivity : AppCompatActivity() {
|
|||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.reboot -> {
|
R.id.reboot -> {
|
||||||
|
AlertDialog.Builder(this)
|
||||||
|
.setMessage("确定重启?")
|
||||||
|
.setPositiveButton(
|
||||||
|
"是",
|
||||||
|
DialogInterface.OnClickListener { dialogInterface, i ->
|
||||||
val commad = arrayOf("reboot")
|
val commad = arrayOf("reboot")
|
||||||
ShellUtils.execCommand(commad, true)
|
ShellUtils.execCommand(commad, true)
|
||||||
|
})
|
||||||
|
.setNegativeButton("否", null)
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
R.id.reboot_ui -> {
|
R.id.reboot_ui -> {
|
||||||
val commad = arrayOf("killall com.android.systemui")
|
val commad = arrayOf("killall com.android.systemui")
|
||||||
|
|||||||
Reference in New Issue
Block a user