mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-13 13:28:24 -08:00
Added navigation endpoints
This commit is contained in:
@@ -1,4 +1,34 @@
|
||||
package com.topjohnwu.magisk.model.navigation
|
||||
|
||||
import com.skoumal.teanity.viewevents.NavigationEvent
|
||||
import com.topjohnwu.magisk.R
|
||||
|
||||
object Navigation
|
||||
|
||||
object Navigation {
|
||||
|
||||
fun home() = NavigationEvent {
|
||||
navDirections { destination = R.id.magiskFragment }
|
||||
navOptions { popUpTo = R.id.magiskFragment }
|
||||
}
|
||||
|
||||
fun superuser() = NavigationEvent {
|
||||
navDirections { destination = R.id.superuserFragment }
|
||||
}
|
||||
|
||||
fun modules() = NavigationEvent {
|
||||
navDirections { destination = R.id.modulesFragment }
|
||||
}
|
||||
|
||||
fun repos() = NavigationEvent {
|
||||
navDirections { destination = R.id.reposFragment }
|
||||
}
|
||||
|
||||
fun hide() = NavigationEvent {
|
||||
navDirections { destination = R.id.magiskHideFragment }
|
||||
}
|
||||
|
||||
fun log() = NavigationEvent {
|
||||
navDirections { destination = R.id.logFragment }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ open class MainActivity : MagiskActivity<MainViewModel, ActivityMainBinding>(),
|
||||
menu.findItem(R.id.superuser).isVisible = Utils.showSuperUser()
|
||||
}
|
||||
|
||||
@Deprecated("Will be replaced by navigation components")
|
||||
fun navigate(item: String?) {
|
||||
var itemId = R.id.magisk
|
||||
if (item != null) {
|
||||
@@ -130,6 +131,7 @@ open class MainActivity : MagiskActivity<MainViewModel, ActivityMainBinding>(),
|
||||
navigate(itemId)
|
||||
}
|
||||
|
||||
@Deprecated("Will be replaced by navigation components")
|
||||
fun navigate(itemId: Int) {
|
||||
mDrawerItem = itemId
|
||||
binding.navView.setCheckedItem(itemId)
|
||||
|
||||
Reference in New Issue
Block a user