diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt index cdabd6a83..85a60f756 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt @@ -100,7 +100,7 @@ open class MainActivity : CompatActivity( fragment: Fragment?, transactionType: FragNavController.TransactionType ) = when (transactionType) { - FragNavController.TransactionType.PUSH -> setDisplayHomeAsUpEnabled(true) + FragNavController.TransactionType.PUSH -> setDisplayHomeAsUpEnabled(!navigation.isRoot) else -> Unit //dunno might be useful } diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatNavigationDelegate.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatNavigationDelegate.kt index 3fe6b5123..ec224af66 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatNavigationDelegate.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatNavigationDelegate.kt @@ -89,15 +89,15 @@ class CompatNavigationDelegate( } private fun navigateToFragment(event: MagiskNavigationEvent) { - val destination = event.navDirections.destination?.java ?: let { + val destination = event.navDirections.destination ?: let { Timber.e("Cannot navigate to null destination") return } source.baseFragments - .indexOfFirst { it.java.name == destination.name } - .takeIf { it > 0 } - ?.let { controller.switchTab(it) } ?: destination.newInstance() + .indexOfFirst { it == destination } + .takeIf { it >= 0 } + ?.let { controller.switchTab(it) } ?: destination.java.newInstance() .also { it.arguments = event.navDirections.args } .let { controller.pushFragment(it) } }