mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Fixed shortcuts
This has been broken due to recent transition to navigation components
This commit is contained in:
parent
ee3028e67d
commit
d9cf33d1ba
@ -10,6 +10,7 @@ import androidx.core.graphics.Insets
|
||||
import androidx.core.view.forEach
|
||||
import androidx.core.view.setPadding
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.navigation.NavDirections
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import com.topjohnwu.magisk.MainDirections
|
||||
import com.topjohnwu.magisk.R
|
||||
@ -100,10 +101,14 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
|
||||
binding.mainNavigation.viewTreeObserver.addOnGlobalLayoutListener(navObserver)
|
||||
|
||||
if (intent.getBooleanExtra(Const.Key.OPEN_SETTINGS, false)) {
|
||||
HomeFragmentDirections.actionHomeFragmentToSettingsFragment().navigate()
|
||||
when {
|
||||
intent.hasExtra(Const.Key.OPEN_SECTION) ->
|
||||
getScreen(intent.getStringExtra(Const.Key.OPEN_SECTION))?.navigate()
|
||||
intent.getBooleanExtra(Const.Key.OPEN_SETTINGS, false) ->
|
||||
HomeFragmentDirections.actionHomeFragmentToSettingsFragment().navigate()
|
||||
}
|
||||
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
if (!isRoot) {
|
||||
requestNavigationHidden()
|
||||
@ -165,4 +170,14 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
binding.mainToolbar.invalidate()
|
||||
}
|
||||
|
||||
private fun getScreen(name: String?): NavDirections? {
|
||||
return when (name) {
|
||||
"superuser" -> HomeFragmentDirections.actionSuperuserFragment()
|
||||
"magiskhide" -> HomeFragmentDirections.actionHideFragment()
|
||||
"modules" -> HomeFragmentDirections.actionModuleFragment()
|
||||
null -> null
|
||||
else -> TODO("Implement screen shortcut \"$name\"")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -182,4 +182,14 @@
|
||||
app:popUpTo="@id/installFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_hideFragment"
|
||||
app:destination="@id/hideFragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/superuserFragment"
|
||||
app:popUpToInclusive="false" />
|
||||
|
||||
</navigation>
|
Loading…
Reference in New Issue
Block a user