mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-03 10:35:40 +00:00
Fix SnackBar shows behind window insets
This commit is contained in:
parent
7ae3cd1c43
commit
2106751ea4
@ -20,6 +20,7 @@ abstract class BaseFragment<Binding : ViewDataBinding> : Fragment(), ViewModelHo
|
|||||||
protected abstract val layoutRes: Int
|
protected abstract val layoutRes: Int
|
||||||
|
|
||||||
private val navigation get() = activity?.navigation
|
private val navigation get() = activity?.navigation
|
||||||
|
open val snackbarView: View? get() = null
|
||||||
open val snackbarAnchorView: View? get() = null
|
open val snackbarAnchorView: View? get() = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -36,6 +36,11 @@ class MainActivity : BaseMainActivity<ActivityMainMd2Binding>() {
|
|||||||
override val layoutRes = R.layout.activity_main_md2
|
override val layoutRes = R.layout.activity_main_md2
|
||||||
override val viewModel by viewModel<MainViewModel>()
|
override val viewModel by viewModel<MainViewModel>()
|
||||||
override val navHostId: Int = R.id.main_nav_host
|
override val navHostId: Int = R.id.main_nav_host
|
||||||
|
override val snackbarView: View
|
||||||
|
get() {
|
||||||
|
val fragmentOverride = currentFragment?.snackbarView
|
||||||
|
return fragmentOverride ?: super.snackbarView
|
||||||
|
}
|
||||||
override val snackbarAnchorView: View?
|
override val snackbarAnchorView: View?
|
||||||
get() {
|
get() {
|
||||||
val fragmentAnchor = currentFragment?.snackbarAnchorView
|
val fragmentAnchor = currentFragment?.snackbarAnchorView
|
||||||
|
@ -20,6 +20,9 @@ class LogFragment : BaseFragment<FragmentLogMd2Binding>() {
|
|||||||
|
|
||||||
override val layoutRes = R.layout.fragment_log_md2
|
override val layoutRes = R.layout.fragment_log_md2
|
||||||
override val viewModel by viewModel<LogViewModel>()
|
override val viewModel by viewModel<LogViewModel>()
|
||||||
|
override val snackbarView: View?
|
||||||
|
get() = if (isMagiskLogVisible) binding.logFilterSuperuser.snackbarContainer
|
||||||
|
else super.snackbarView
|
||||||
override val snackbarAnchorView get() = binding.logFilterToggle
|
override val snackbarAnchorView get() = binding.logFilterToggle
|
||||||
|
|
||||||
private var actionSave: MenuItem? = null
|
private var actionSave: MenuItem? = null
|
||||||
|
@ -14,6 +14,7 @@ class SettingsFragment : BaseFragment<FragmentSettingsMd2Binding>() {
|
|||||||
|
|
||||||
override val layoutRes = R.layout.fragment_settings_md2
|
override val layoutRes = R.layout.fragment_settings_md2
|
||||||
override val viewModel by viewModel<SettingsViewModel>()
|
override val viewModel by viewModel<SettingsViewModel>()
|
||||||
|
override val snackbarView: View get() = binding.snackbarContainer
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
app:items="@{viewModel.items}"
|
app:items="@{viewModel.items}"
|
||||||
app:extraBindings="@{viewModel.extraBindings}"
|
app:extraBindings="@{viewModel.extraBindings}"
|
||||||
@ -29,4 +33,11 @@
|
|||||||
tools:listitem="@layout/item_settings"
|
tools:listitem="@layout/item_settings"
|
||||||
tools:paddingTop="@dimen/l1" />
|
tools:paddingTop="@dimen/l1" />
|
||||||
|
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/snackbar_container"
|
||||||
|
app:fitsSystemWindowsInsets="top|bottom"/>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -43,6 +43,12 @@
|
|||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/snackbar_container"
|
||||||
|
app:fitsSystemWindowsInsets="top|bottom"/>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user