菜单新增重启系统(2)

This commit is contained in:
LittleTurtle2333
2022-02-16 15:56:02 +08:00
parent 6632b4aa75
commit 183a3bd77d
5 changed files with 37 additions and 14 deletions

View File

@@ -10,8 +10,8 @@ android {
applicationId "com.lt2333.simplicitytools" applicationId "com.lt2333.simplicitytools"
minSdk 30 minSdk 30
targetSdk 32 targetSdk 32
versionCode 2 versionCode 3
versionName "1.0.1" versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@@ -48,6 +48,10 @@ class SettingsActivity : AppCompatActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.reboot -> {
val commad = arrayOf("reboot")
ShellUtils.execCommand(commad, true)
}
R.id.reboot_ui -> { R.id.reboot_ui -> {
val commad = arrayOf("killall com.android.systemui") val commad = arrayOf("killall com.android.systemui")
ShellUtils.execCommand(commad, true) ShellUtils.execCommand(commad, true)

View File

@@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/reboot_ui" android:title="@string/reboot_ui"/> <item
android:id="@+id/reboot"
android:title="@string/reboot" />
<item
android:id="@+id/reboot_ui"
android:title="@string/reboot_ui" />
</menu> </menu>

View File

@@ -39,5 +39,7 @@
<string name="issues">反馈/提议</string> <string name="issues">反馈/提议</string>
<string name="issues_url">点击查看GitHub Issues</string> <string name="issues_url">点击查看GitHub Issues</string>
<string name="xposeddescription">基于 MIUI13(Android 12) 适配的自定义工具</string> <string name="xposeddescription">基于 MIUI13(Android 12) 适配的自定义工具</string>
<string name="reboot">重启</string>
<string name="hide_hd_icon">隐藏 HD 图标</string>
</resources> </resources>

View File

@@ -57,6 +57,11 @@
app:key="hide_vpn_icon" app:key="hide_vpn_icon"
app:title="@string/hide_vpn_icon" /> app:title="@string/hide_vpn_icon" />
<SwitchPreference
app:iconSpaceReserved="false"
app:key="hide_hd_icon"
app:title="@string/hide_hd_icon" />
<SwitchPreference <SwitchPreference
app:iconSpaceReserved="false" app:iconSpaceReserved="false"
app:key="hide_sim_one_icon" app:key="hide_sim_one_icon"
@@ -112,6 +117,13 @@
app:title="@string/opensource"> app:title="@string/opensource">
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen
app:key="issues"
app:iconSpaceReserved="false"
app:summary="@string/issues_url"
app:title="@string/issues">
</PreferenceScreen>
<PreferenceScreen <PreferenceScreen
app:key="dev_coolapk" app:key="dev_coolapk"
app:iconSpaceReserved="false" app:iconSpaceReserved="false"