diff --git a/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashActivity.kt b/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashActivity.kt index e41dadbaf..86d146f95 100644 --- a/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashActivity.kt @@ -9,14 +9,14 @@ import androidx.core.net.toUri import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.intent +import com.topjohnwu.magisk.core.view.Notifications import com.topjohnwu.magisk.databinding.ActivityFlashBinding import com.topjohnwu.magisk.extensions.snackbar -import com.topjohnwu.magisk.model.events.BackPressEvent import com.topjohnwu.magisk.model.events.PermissionEvent import com.topjohnwu.magisk.model.events.SnackbarEvent import com.topjohnwu.magisk.model.events.ViewEvent import com.topjohnwu.magisk.ui.base.BaseUIActivity -import com.topjohnwu.magisk.core.view.Notifications +import com.topjohnwu.magisk.ui.base.CompatNavigationDelegate import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.parameter.parametersOf import java.io.File @@ -24,7 +24,6 @@ import java.io.File open class FlashActivity : BaseUIActivity() { override val layoutRes: Int = R.layout.activity_flash - override val themeRes: Int = R.style.MagiskTheme_Flashing override val viewModel: FlashViewModel by viewModel { val uri = intent.data ?: let { finish(); Uri.EMPTY } val additionalUri = intent.getParcelableExtra(Const.Key.FLASH_DATA) ?: uri @@ -32,6 +31,9 @@ open class FlashActivity : BaseUIActivity( parametersOf(action, uri, additionalUri) } + override val navigation: CompatNavigationDelegate>? = + null + override fun onCreate(savedInstanceState: Bundle?) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR super.onCreate(savedInstanceState) @@ -49,7 +51,6 @@ open class FlashActivity : BaseUIActivity( super.onEventDispatched(event) when (event) { is SnackbarEvent -> snackbar(snackbarView, event.message(this), event.length, event.f) - is BackPressEvent -> onBackPressed() is PermissionEvent -> withPermissions(*event.permissions.toTypedArray()) { onSuccess { event.callback.onNext(true) } onFailure { diff --git a/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashViewModel.kt index 1c16b4751..eea72ac7e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/legacy/flash/FlashViewModel.kt @@ -13,7 +13,7 @@ import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.databinding.ComparableRvItem import com.topjohnwu.magisk.extensions.* -import com.topjohnwu.magisk.model.entity.recycler.ConsoleRvItem +import com.topjohnwu.magisk.model.entity.recycler.ConsoleItem import com.topjohnwu.magisk.model.events.SnackbarEvent import com.topjohnwu.magisk.model.flash.FlashResultListener import com.topjohnwu.magisk.model.flash.Flashing @@ -48,7 +48,7 @@ class FlashViewModel( private val logItems = Collections.synchronizedList(mutableListOf()) init { - outItems.sendUpdatesTo(items) { it.map { ConsoleRvItem(it) } } + outItems.sendUpdatesTo(items) { it.map { ConsoleItem(it) } } outItems.copyNewInputInto(logItems) state = State.LOADING diff --git a/app/src/main/java/com/topjohnwu/magisk/legacy/surequest/SuRequestActivity.kt b/app/src/main/java/com/topjohnwu/magisk/legacy/surequest/SuRequestActivity.kt index 337d26fe3..a1ced5143 100644 --- a/app/src/main/java/com/topjohnwu/magisk/legacy/surequest/SuRequestActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/legacy/surequest/SuRequestActivity.kt @@ -2,6 +2,7 @@ package com.topjohnwu.magisk.legacy.surequest import android.content.Intent import android.content.pm.ActivityInfo +import android.content.res.Resources import android.os.Build import android.os.Bundle import android.view.Window @@ -13,14 +14,17 @@ import com.topjohnwu.magisk.model.events.DieEvent import com.topjohnwu.magisk.model.events.ViewActionEvent import com.topjohnwu.magisk.model.events.ViewEvent import com.topjohnwu.magisk.ui.base.BaseUIActivity +import com.topjohnwu.magisk.ui.base.CompatNavigationDelegate import org.koin.androidx.viewmodel.ext.android.viewModel open class SuRequestActivity : BaseUIActivity() { override val layoutRes: Int = R.layout.activity_request - override val themeRes: Int = R.style.MagiskTheme_SU override val viewModel: SuRequestViewModel by viewModel() + override val navigation: CompatNavigationDelegate>? = + null + override fun onBackPressed() { viewModel.denyPressed() } @@ -58,6 +62,12 @@ open class SuRequestActivity : BaseUIActivity once everything is on board with it - val baseFragments: List> - -} diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt index a5a2e877d..438ffc174 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt @@ -1,24 +1,41 @@ package com.topjohnwu.magisk.ui.base +import android.content.Intent import android.os.Bundle +import android.view.View +import android.view.ViewGroup import androidx.appcompat.app.AppCompatDelegate +import androidx.core.graphics.Insets import androidx.databinding.DataBindingUtil +import androidx.databinding.OnRebindCallback import androidx.databinding.ViewDataBinding +import androidx.fragment.app.Fragment import com.topjohnwu.magisk.BR -import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.base.BaseActivity +import com.topjohnwu.magisk.extensions.snackbar +import com.topjohnwu.magisk.extensions.startAnimations import com.topjohnwu.magisk.model.events.EventHandler +import com.topjohnwu.magisk.model.events.SnackbarEvent +import com.topjohnwu.magisk.model.events.ViewEvent +import com.topjohnwu.magisk.ui.theme.Theme +import kotlin.reflect.KClass abstract class BaseUIActivity : - BaseActivity(), EventHandler { + BaseActivity(), CompatView, EventHandler { protected lateinit var binding: Binding protected abstract val layoutRes: Int - abstract val viewModel: ViewModel - protected open val themeRes: Int = R.style.MagiskTheme + protected open val themeRes: Int = Theme.selected.themeRes + override val viewRoot: View get() = binding.root + override val navigation by lazy { CompatNavigationDelegate(this) as CompatNavigationDelegate? } + + private val delegate by lazy { CompatDelegate(this) } + + open val navHost: Int = 0 open val snackbarView get() = binding.root + open val baseFragments = listOf>() init { val theme = Config.darkThemeExtended @@ -35,5 +52,49 @@ abstract class BaseUIActivity() { + override fun onPreBind(binding: Binding): Boolean { + (binding.root as? ViewGroup)?.startAnimations() + return super.onPreBind(binding) + } + }) + + delegate.onCreate() + navigation?.onCreate(savedInstanceState) } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + navigation?.onActivityResult(requestCode, resultCode, data) + } + + override fun onResume() { + super.onResume() + delegate.onResume() + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + navigation?.onSaveInstanceState(outState) + } + + override fun onEventDispatched(event: ViewEvent) { + delegate.onEventExecute(event, this) + when (event) { + is SnackbarEvent -> snackbar(snackbarView, event.message(this), event.length, event.f) + } + } + + override fun onBackPressed() { + if (navigation == null || navigation?.onBackPressed()?.not() == true) { + super.onBackPressed() + } + } + + override fun peekSystemWindowInsets(insets: Insets) { + viewModel.insets.value = insets + } + + protected fun ViewEvent.dispatchOnSelf() = onEventDispatched(this) } diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIFragment.kt index a6992d0a7..3dece6d58 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIFragment.kt @@ -4,20 +4,28 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.graphics.Insets import androidx.databinding.DataBindingUtil +import androidx.databinding.OnRebindCallback import androidx.databinding.ViewDataBinding import androidx.fragment.app.Fragment import com.topjohnwu.magisk.BR +import com.topjohnwu.magisk.extensions.startAnimations import com.topjohnwu.magisk.model.events.EventHandler import com.topjohnwu.magisk.model.events.ViewEvent abstract class BaseUIFragment : - Fragment(), EventHandler { + Fragment(), CompatView, EventHandler { protected val activity get() = requireActivity() as BaseUIActivity<*, *> protected lateinit var binding: Binding protected abstract val layoutRes: Int - abstract val viewModel: ViewModel + + override val viewRoot: View get() = binding.root + override val navigation by lazy { activity.navigation } + private val delegate by lazy { CompatDelegate(this) } + + override fun consumeSystemWindowInsets(insets: Insets) = insets override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -25,9 +33,9 @@ abstract class BaseUIFragment(inflater, layoutRes, container, false).apply { setVariable(BR.viewModel, viewModel) @@ -39,9 +47,35 @@ abstract class BaseUIFragment() { + override fun onPreBind(binding: Binding): Boolean { + this@BaseUIFragment.onPreBind(binding) + return true + } + }) + + delegate.onCreate() + } + + override fun onResume() { + super.onResume() + + delegate.onResume() + } + + protected open fun onPreBind(binding: Binding) { + (binding.root as? ViewGroup)?.startAnimations() + } + + protected fun ViewEvent.dispatchOnSelf() = delegate.onEventExecute(this, this@BaseUIFragment) + } diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatActivity.kt index 9e2e9e58c..08c543bad 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatActivity.kt @@ -1,84 +1,14 @@ package com.topjohnwu.magisk.ui.base import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.View -import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import androidx.core.content.getSystemService -import androidx.databinding.OnRebindCallback import androidx.databinding.ViewDataBinding -import androidx.fragment.app.Fragment -import com.topjohnwu.magisk.extensions.snackbar -import com.topjohnwu.magisk.extensions.startAnimations -import com.topjohnwu.magisk.model.events.SnackbarEvent -import com.topjohnwu.magisk.model.events.ViewEvent -import com.topjohnwu.magisk.model.navigation.Navigator -import com.topjohnwu.magisk.ui.theme.Theme -import kotlin.reflect.KClass // TODO (diareuse): Merge into BaseUIActivity after all legacy UI is migrated abstract class CompatActivity : - BaseUIActivity(), CompatView, Navigator { - - override val themeRes = Theme.selected.themeRes - override val viewRoot: View get() = binding.root - override val navigation: CompatNavigationDelegate>? by lazy { - CompatNavigationDelegate(this) - } - override val baseFragments = listOf>() - private val delegate by lazy { CompatDelegate(this) } - - internal abstract val navHost: Int - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - navigation?.onActivityResult(requestCode, resultCode, data) - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - binding.addOnRebindCallback(object : OnRebindCallback() { - override fun onPreBind(binding: Binding): Boolean { - (binding.root as? ViewGroup)?.startAnimations() - return super.onPreBind(binding) - } - }) - - delegate.onCreate() - navigation?.onCreate(savedInstanceState) - } - - override fun onResume() { - super.onResume() - - delegate.onResume() - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - navigation?.onSaveInstanceState(outState) - } - - override fun onEventDispatched(event: ViewEvent) { - delegate.onEventExecute(event, this) - when (event) { - is SnackbarEvent -> snackbar(snackbarView, event.message(this), event.length, event.f) - } - } - - override fun onBackPressed() { - if (navigation?.onBackPressed()?.not() == true) { - super.onBackPressed() - } - } - - protected fun ViewEvent.dispatchOnSelf() = onEventDispatched(this) - -} + BaseUIActivity() fun Activity.hideKeyboard() { val view = currentFocus ?: return diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatDelegate.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatDelegate.kt index 081eed217..97d1bc769 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatDelegate.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatDelegate.kt @@ -18,7 +18,6 @@ class CompatDelegate internal constructor( fun onCreate() { ensureInsets() - } fun onResume() { diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatFragment.kt index bdc1fcbfe..ed5cf626b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatFragment.kt @@ -1,56 +1,10 @@ package com.topjohnwu.magisk.ui.base -import android.os.Bundle -import android.view.View -import android.view.ViewGroup -import androidx.databinding.OnRebindCallback import androidx.databinding.ViewDataBinding import androidx.fragment.app.Fragment -import com.topjohnwu.magisk.extensions.startAnimations -import com.topjohnwu.magisk.model.events.ViewEvent - -// TODO (diareuse): Merge into BaseUIFragment after all legacy UI is migrated abstract class CompatFragment - : BaseUIFragment(), CompatView { - - override val viewRoot: View get() = binding.root - override val navigation by lazy { compatActivity.navigation } - - private val delegate by lazy { CompatDelegate(this) } - - protected val compatActivity get() = requireActivity() as CompatActivity<*, *> - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - - binding.addOnRebindCallback(object : OnRebindCallback() { - override fun onPreBind(binding: Binding): Boolean { - this@CompatFragment.onPreBind(binding) - return true - } - }) - - delegate.onCreate() - } - - override fun onResume() { - super.onResume() - - delegate.onResume() - } - - override fun onEventDispatched(event: ViewEvent) { - delegate.onEventExecute(event, this) - } - - protected open fun onPreBind(binding: Binding) { - (binding.root as? ViewGroup)?.startAnimations() - } - - protected fun ViewEvent.dispatchOnSelf() = delegate.onEventExecute(this, this@CompatFragment) - -} + : BaseUIFragment(), CompatView fun Fragment.hideKeyboard() { activity?.hideKeyboard() diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatNavigationDelegate.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatNavigationDelegate.kt index 990b20615..ee3120ae6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatNavigationDelegate.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/CompatNavigationDelegate.kt @@ -7,14 +7,13 @@ import com.ncapdevi.fragnav.FragNavTransactionOptions import com.topjohnwu.magisk.R import com.topjohnwu.magisk.model.navigation.MagiskAnimBuilder import com.topjohnwu.magisk.model.navigation.MagiskNavigationEvent -import com.topjohnwu.magisk.model.navigation.Navigator import com.topjohnwu.magisk.ui.ReselectionTarget import timber.log.Timber class CompatNavigationDelegate( private val source: Source, private val listener: FragNavController.TransactionListener? = null -) : FragNavController.RootFragmentListener where Source : CompatActivity<*, *>, Source : Navigator { +) : FragNavController.RootFragmentListener where Source : BaseUIActivity<*, *> { private val controller by lazy { check(source.navHost != 0) { "Did you forget to override \"navHostId\"?" } diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideFragment.kt index 5ef748129..ff9872272 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideFragment.kt @@ -6,7 +6,6 @@ import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View -import androidx.core.graphics.Insets import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -29,8 +28,6 @@ class HideFragment : CompatFragment() { MotionRevealHelper.withViews(binding.hideFilter, binding.hideFilterToggle, value) } - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onAttach(context: Context) { super.onAttach(context) activity.setTitle(R.string.magiskhide) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeFragment.kt index 825b9943f..1cb8b53d5 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeFragment.kt @@ -3,7 +3,6 @@ package com.topjohnwu.magisk.ui.home import android.view.Menu import android.view.MenuInflater import android.view.MenuItem -import androidx.core.graphics.Insets import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentHomeMd2Binding import com.topjohnwu.magisk.model.navigation.Navigation @@ -15,8 +14,6 @@ class HomeFragment : CompatFragment() { override val layoutRes = R.layout.fragment_home_md2 override val viewModel by viewModel() - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onStart() { super.onStart() activity.title = resources.getString(R.string.section_home) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallFragment.kt index 6cdfbb1e5..c57f9b002 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallFragment.kt @@ -1,7 +1,6 @@ package com.topjohnwu.magisk.ui.install import android.content.Intent -import androidx.core.graphics.Insets import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentInstallMd2Binding import com.topjohnwu.magisk.model.events.RequestFileEvent @@ -13,8 +12,6 @@ class InstallFragment : CompatFragment() - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) viewModel.data.value = RequestFileEvent.resolve(requestCode, resultCode, data) 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 c49292d90..af0b7b56e 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 @@ -5,7 +5,6 @@ import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View -import androidx.core.graphics.Insets import androidx.core.view.isVisible import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentLogMd2Binding @@ -28,8 +27,6 @@ class LogFragment : CompatFragment() { (activity as MainActivity).invalidateToolbar() } - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onStart() { super.onStart() setHasOptionsMenu(true) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleFragment.kt index dcefae0b3..3ef874572 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleFragment.kt @@ -6,7 +6,6 @@ import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View -import androidx.core.graphics.Insets import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.StaggeredGridLayoutManager @@ -39,8 +38,6 @@ class ModuleFragment : CompatFragment MotionRevealHelper.withViews(binding.moduleFilter, binding.moduleFilterToggle, value) } - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) InstallExternalModuleEvent.onActivityResult(requireContext(), requestCode, resultCode, data) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt index 99f78f966..a39aa32c4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt @@ -2,7 +2,6 @@ package com.topjohnwu.magisk.ui.settings import android.os.Bundle import android.view.View -import androidx.core.graphics.Insets import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentSettingsMd2Binding import com.topjohnwu.magisk.ui.base.CompatFragment @@ -14,8 +13,6 @@ class SettingsFragment : CompatFragment() - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onStart() { super.onStart() 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 bf076724e..9c5c76e8a 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 @@ -5,7 +5,6 @@ import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View -import androidx.core.graphics.Insets import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentSuperuserMd2Binding import com.topjohnwu.magisk.model.navigation.Navigation @@ -18,8 +17,6 @@ class SuperuserFragment : CompatFragment() - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onStart() { super.onStart() activity.title = resources.getString(R.string.superuser) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/theme/ThemeFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/theme/ThemeFragment.kt index 73bd2e1c4..cb50eb715 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/theme/ThemeFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/theme/ThemeFragment.kt @@ -1,6 +1,5 @@ package com.topjohnwu.magisk.ui.theme -import androidx.core.graphics.Insets import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.FragmentThemeMd2Binding import com.topjohnwu.magisk.ui.base.CompatFragment @@ -11,8 +10,6 @@ class ThemeFragment : CompatFragment() override val layoutRes = R.layout.fragment_theme_md2 override val viewModel by viewModel() - override fun consumeSystemWindowInsets(insets: Insets) = insets - override fun onStart() { super.onStart() diff --git a/app/src/main/res/layout/activity_flash.xml b/app/src/main/res/layout/activity_flash.xml index cecf04191..e9070fbbf 100644 --- a/app/src/main/res/layout/activity_flash.xml +++ b/app/src/main/res/layout/activity_flash.xml @@ -16,20 +16,27 @@ android:layout_height="match_parent"> + android:layout_height="wrap_content"> - + + + app:layout_scrollFlags="scroll|enterAlways"> + app:tint="?colorOnSurface" /> @@ -57,7 +64,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="monospace" - android:textColor="@android:color/white" + android:textColor="?colorOnSurface" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" @@ -78,74 +85,46 @@ android:layout_gravity="center" android:background="@android:color/transparent" app:srcCompat="@drawable/ic_save_compat" - app:tint="@android:color/white" /> + app:tint="?colorOnSurface" /> - + - + android:clipToPadding="false" + android:orientation="vertical" + android:paddingLeft="@{viewModel.insets.left}" + android:paddingRight="@{viewModel.insets.right}" + android:paddingBottom="@{viewModel.insets.bottom}" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + app:layout_behavior="@string/appbar_scrolling_view_behavior" + tools:listitem="@layout/item_console" /> - - - - - - - - - - - - - - - + diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index dc9b5763c..0d2c4cc40 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -1,17 +1,4 @@ - - \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a66eac8a4..06be0872e 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,65 +1,5 @@ - - - - - - - - - - - - - - + + \ No newline at end of file