mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:35:10 +01:00
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.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior
|
||||
import dev.chrisbanes.insetter.Insetter
|
||||
import dev.chrisbanes.insetter.applyInsetter
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.Migrations
|
||||
@ -102,16 +103,26 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
||||
margin(top = true)
|
||||
}
|
||||
}
|
||||
binding.bottomNav.applyInsetter {
|
||||
type(navigationBars = true) {
|
||||
padding()
|
||||
}
|
||||
}
|
||||
binding.rootFab.applyInsetter {
|
||||
type(navigationBars = true) {
|
||||
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
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
|
||||
|
@ -91,4 +91,17 @@
|
||||
app:layout_insetEdge="bottom"
|
||||
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>
|
||||
|
Loading…
Reference in New Issue
Block a user