diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt index f5bc0d066..1dc284747 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt @@ -21,6 +21,7 @@ import com.topjohnwu.magisk.model.navigation.Navigation import com.topjohnwu.magisk.ui.base.BaseUIActivity import com.topjohnwu.magisk.ui.base.CompatNavigationDelegate import com.topjohnwu.magisk.ui.home.HomeFragment +import com.topjohnwu.magisk.ui.log.LogFragment import com.topjohnwu.magisk.ui.module.ModuleFragment import com.topjohnwu.magisk.ui.superuser.SuperuserFragment import com.topjohnwu.magisk.utils.HideBottomViewOnScrollBehavior @@ -43,7 +44,8 @@ open class MainActivity : BaseUIActivity( override val baseFragments: List> = listOf( HomeFragment::class, ModuleFragment::class, - SuperuserFragment::class + SuperuserFragment::class, + LogFragment::class ) //This temporarily fixes unwanted feature of BottomNavigationView - where the view applies @@ -81,6 +83,7 @@ open class MainActivity : BaseUIActivity( R.id.homeFragment -> Navigation.home() R.id.modulesFragment -> Navigation.modules() R.id.superuserFragment -> Navigation.superuser() + R.id.logFragment -> Navigation.log() else -> throw NotImplementedError("Id ${it.itemId} is not defined as selectable") }.dispatchOnSelf() true diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogFragment.kt index 0f772c2fb..e36d725ac 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogFragment.kt @@ -23,7 +23,7 @@ class LogFragment : BaseUIFragment() { get() = binding.logFilter.isVisible set(value) { MotionRevealHelper.withViews(binding.logFilter, binding.logFilterToggle, value) - actionSave?.isVisible = value + actionSave?.isVisible = !value (activity as MainActivity).invalidateToolbar() } @@ -45,7 +45,7 @@ class LogFragment : BaseUIFragment() { super.onCreateOptionsMenu(menu, inflater) inflater.inflate(R.menu.menu_log_md2, menu) actionSave = menu.findItem(R.id.action_save)?.also { - it.isVisible = isMagiskLogVisible + it.isVisible = !isMagiskLogVisible } } @@ -53,7 +53,7 @@ class LogFragment : BaseUIFragment() { when (item.itemId) { R.id.action_save -> viewModel.saveMagiskLog() R.id.action_clear -> - if (isMagiskLogVisible) viewModel.clearMagiskLog() + if (!isMagiskLogVisible) viewModel.clearMagiskLog() else viewModel.clearLog() } return super.onOptionsItemSelected(item) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserFragment.kt index 8491125ed..6789babba 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserFragment.kt @@ -1,11 +1,7 @@ package com.topjohnwu.magisk.ui.superuser -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentSuperuserMd2Binding -import com.topjohnwu.magisk.model.navigation.Navigation import com.topjohnwu.magisk.ui.base.BaseUIFragment import org.koin.androidx.viewmodel.ext.android.viewModel @@ -17,16 +13,6 @@ class SuperuserFragment : BaseUIFragment Navigation.log().dispatchOnSelf() - else -> null - }?.let { true } ?: super.onOptionsItemSelected(item) - } diff --git a/app/src/main/res/layout/fragment_log_md2.xml b/app/src/main/res/layout/fragment_log_md2.xml index daebc548c..2b46b86fd 100644 --- a/app/src/main/res/layout/fragment_log_md2.xml +++ b/app/src/main/res/layout/fragment_log_md2.xml @@ -15,20 +15,12 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - + android:layout_height="match_parent" /> - - - - - - diff --git a/app/src/main/res/layout/include_log_superuser.xml b/app/src/main/res/layout/include_log_superuser.xml new file mode 100644 index 000000000..a447326a4 --- /dev/null +++ b/app/src/main/res/layout/include_log_superuser.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/menu_bottom_nav.xml b/app/src/main/res/menu/menu_bottom_nav.xml index cd00503a5..06d1937f1 100644 --- a/app/src/main/res/menu/menu_bottom_nav.xml +++ b/app/src/main/res/menu/menu_bottom_nav.xml @@ -14,6 +14,12 @@ android:title="@string/superuser" tools:showAsAction="always" /> + +