Add navigation bar scrim (closes #4836)
This commit is contained in:
parent
126e1e2d9d
commit
2a69d1b051
@ -24,6 +24,7 @@ import com.bluelinelabs.conductor.Router
|
|||||||
import com.bluelinelabs.conductor.RouterTransaction
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior
|
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior
|
||||||
|
import dev.chrisbanes.insetter.Insetter
|
||||||
import dev.chrisbanes.insetter.applyInsetter
|
import dev.chrisbanes.insetter.applyInsetter
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.Migrations
|
import eu.kanade.tachiyomi.Migrations
|
||||||
@ -102,16 +103,26 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
margin(top = true)
|
margin(top = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.bottomNav.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
binding.rootFab.applyInsetter {
|
binding.rootFab.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
margin()
|
margin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.bottomNav.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Insetter.builder()
|
||||||
|
.consume(Insetter.CONSUME_ALL)
|
||||||
|
.setOnApplyInsetsListener { view, insets, _ ->
|
||||||
|
val systemInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||||
|
view.isVisible = systemInsets.bottom > 0
|
||||||
|
view.updateLayoutParams<ViewGroup.LayoutParams> {
|
||||||
|
height = systemInsets.bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.applyToView(binding.navigationScrim)
|
||||||
|
|
||||||
// Make sure navigation bar is on bottom when making it transparent
|
// Make sure navigation bar is on bottom when making it transparent
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
|
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
|
||||||
|
@ -91,4 +91,17 @@
|
|||||||
app:layout_insetEdge="bottom"
|
app:layout_insetEdge="bottom"
|
||||||
app:menu="@menu/bottom_nav" />
|
app:menu="@menu/bottom_nav" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/navigation_scrim"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:alpha="0.5"
|
||||||
|
android:background="?android:attr/navigationBarColor"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:layout_height="?attr/actionBarSize"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user