mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Removed single-use reboot menu
This addition will be used in modules as soon as the homepage gets merged
This commit is contained in:
parent
f8bea66313
commit
97d24a7d4d
@ -0,0 +1,19 @@
|
||||
package com.topjohnwu.magisk.model.events
|
||||
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import com.topjohnwu.magisk.extensions.reboot as systemReboot
|
||||
|
||||
object RebootEvent {
|
||||
|
||||
@JvmStatic
|
||||
fun reboot(menuItemId: Int) = when (menuItemId) {
|
||||
R.id.action_reboot_normal -> systemReboot()
|
||||
R.id.action_reboot_bootloader -> systemReboot("bootloader")
|
||||
R.id.action_reboot_download -> systemReboot("download")
|
||||
R.id.action_reboot_edl -> systemReboot("edl")
|
||||
R.id.action_reboot_recovery -> Shell.su("/system/bin/reboot recovery").submit()
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
}
|
@ -136,15 +136,6 @@ class HomeViewModel(
|
||||
.subscribeK { Navigation.install().publish() }
|
||||
.add()
|
||||
|
||||
fun rebootPressed(menuItemId: Int) = when (menuItemId) {
|
||||
R.id.action_reboot_normal -> reboot()
|
||||
R.id.action_reboot_bootloader -> reboot("bootloader")
|
||||
R.id.action_reboot_download -> reboot("download")
|
||||
R.id.action_reboot_edl -> reboot("edl")
|
||||
R.id.action_reboot_recovery -> Shell.su("/system/bin/reboot recovery").submit()
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
fun toggle(kof: KObservableField<Boolean>) = kof.toggle()
|
||||
|
||||
fun hideNotice() {
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
<import type="com.topjohnwu.magisk.R" />
|
||||
|
||||
<import type="com.topjohnwu.magisk.model.events.RebootEvent" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
||||
@ -51,7 +53,7 @@
|
||||
style="@style/WidgetFoundation.Button.Text"
|
||||
invisibleUnless="@{XSUKt.hasRoot}"
|
||||
popupMenu="@{R.menu.menu_reboot}"
|
||||
popupMenuOnClickListener="@{(it) -> viewModel.rebootPressed(it)}"
|
||||
popupMenuOnClickListener="@{RebootEvent::reboot}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/l_50"
|
||||
|
Loading…
Reference in New Issue
Block a user