mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 13:17:38 +00:00
Added navigation endpoints
This commit is contained in:
parent
2d58c725e0
commit
94ba7cb0c5
@ -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)
|
||||
|
@ -10,5 +10,30 @@
|
||||
android:name="com.topjohnwu.magisk.ui.home.MagiskFragment"
|
||||
android:label="fragment_magisk"
|
||||
tools:layout="@layout/fragment_magisk" />
|
||||
<fragment
|
||||
android:id="@+id/superuserFragment"
|
||||
android:name="com.topjohnwu.magisk.ui.superuser.SuperuserFragment"
|
||||
android:label="fragment_superuser"
|
||||
tools:layout="@layout/fragment_superuser" />
|
||||
<fragment
|
||||
android:id="@+id/modulesFragment"
|
||||
android:name="com.topjohnwu.magisk.ui.module.ModulesFragment"
|
||||
android:label="fragment_modules"
|
||||
tools:layout="@layout/fragment_modules" />
|
||||
<fragment
|
||||
android:id="@+id/reposFragment"
|
||||
android:name="com.topjohnwu.magisk.ui.module.ReposFragment"
|
||||
android:label="fragment_repos"
|
||||
tools:layout="@layout/fragment_repos" />
|
||||
<fragment
|
||||
android:id="@+id/magiskHideFragment"
|
||||
android:name="com.topjohnwu.magisk.ui.hide.MagiskHideFragment"
|
||||
android:label="fragment_magisk_hide"
|
||||
tools:layout="@layout/fragment_magisk_hide" />
|
||||
<fragment
|
||||
android:id="@+id/logFragment"
|
||||
android:name="com.topjohnwu.magisk.ui.log.LogFragment"
|
||||
android:label="fragment_log"
|
||||
tools:layout="@layout/fragment_log" />
|
||||
|
||||
</navigation>
|
||||
|
Loading…
x
Reference in New Issue
Block a user