Add "Continue" FAB to navigation rail
parent
f42f244443
commit
a2b8cfe512
@ -1,24 +0,0 @@
|
||||
package org.koitharu.kotatsu.main.ui
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.OnApplyWindowInsetsListener
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import java.lang.ref.WeakReference
|
||||
import com.google.android.material.R as materialR
|
||||
|
||||
class NavigationViewInsetsListener : OnApplyWindowInsetsListener {
|
||||
|
||||
private var menuViewRef: WeakReference<View>? = null
|
||||
|
||||
override fun onApplyWindowInsets(v: View, insets: WindowInsetsCompat): WindowInsetsCompat {
|
||||
val menuView = menuViewRef?.get() ?: v.findViewById<View>(materialR.id.design_navigation_view).also {
|
||||
menuViewRef = WeakReference(it)
|
||||
}
|
||||
val systemWindowInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.updatePadding(top = systemWindowInsets.top)
|
||||
// NavigationView doesn't dispatch insets to the menu view, so pad the bottom here.
|
||||
menuView.updatePadding(bottom = systemWindowInsets.bottom)
|
||||
return WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/railFab"
|
||||
android:theme="@style/ThemeOverlay.Material3.FloatingActionButton.Tertiary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/ic_read" />
|
||||
Loading…
Reference in New Issue