mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
Fix reboot menu
This commit is contained in:
parent
b693d13b93
commit
bc51ce7c7b
@ -29,10 +29,10 @@ object RebootEvent {
|
|||||||
fun inflateMenu(activity: BaseActivity): PopupMenu {
|
fun inflateMenu(activity: BaseActivity): PopupMenu {
|
||||||
val themeWrapper = ContextThemeWrapper(activity, R.style.Foundation_PopupMenu)
|
val themeWrapper = ContextThemeWrapper(activity, R.style.Foundation_PopupMenu)
|
||||||
val menu = PopupMenu(themeWrapper, activity.findViewById(R.id.action_reboot))
|
val menu = PopupMenu(themeWrapper, activity.findViewById(R.id.action_reboot))
|
||||||
|
activity.menuInflater.inflate(R.menu.menu_reboot, menu.menu)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
|
||||||
activity.getSystemService<PowerManager>()?.isRebootingUserspaceSupported == true)
|
activity.getSystemService<PowerManager>()?.isRebootingUserspaceSupported == true)
|
||||||
menu.menu.getItem(R.id.action_reboot_userspace).isVisible = true
|
menu.menu.findItem(R.id.action_reboot_userspace).isVisible = true
|
||||||
activity.menuInflater.inflate(R.menu.menu_reboot, menu.menu)
|
|
||||||
menu.setOnMenuItemClickListener(::reboot)
|
menu.setOnMenuItemClickListener(::reboot)
|
||||||
return menu
|
return menu
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user