Remove toolbar snapping
(cherry picked from commit d981245723dfb5b4feab5f6b8e2d656726ffe48b)
This commit is contained in:
parent
885c251fb4
commit
936997b52e
@ -123,15 +123,7 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||||
binding.appbar.applyInsetter {
|
binding.appbar.applyInsetter {
|
||||||
type(navigationBars = true, statusBars = true) {
|
type(navigationBars = true, statusBars = true) {
|
||||||
padding(left = true, right = true)
|
padding(left = true, top = true, right = true)
|
||||||
}
|
|
||||||
type(statusBars = true) {
|
|
||||||
margin(top = true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
binding.bottomNav.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.rootFab.applyInsetter {
|
binding.rootFab.applyInsetter {
|
||||||
@ -139,6 +131,11 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
margin()
|
margin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.bottomNav.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure navigation bar is on bottom before we modify it
|
// Make sure navigation bar is on bottom before we modify it
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
|
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
|
||||||
@ -149,7 +146,7 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
Color.TRANSPARENT
|
Color.TRANSPARENT
|
||||||
} else {
|
} else {
|
||||||
// Set navbar scrim 70% of navigationBarColor
|
// Set navbar scrim 70% of navigationBarColor
|
||||||
getResourceColor(android.R.attr.navigationBarColor, .7F)
|
getResourceColor(android.R.attr.navigationBarColor, 0.7F)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
insets
|
insets
|
||||||
|
@ -4,15 +4,6 @@ import android.content.Context
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
|
|
||||||
object InternalResourceHelper {
|
object InternalResourceHelper {
|
||||||
/**
|
|
||||||
* Get resource id from system resources
|
|
||||||
* @param resName resource name to get
|
|
||||||
* @param type resource type of [resName] to get
|
|
||||||
* @return 0 if not available
|
|
||||||
*/
|
|
||||||
private fun getResourceId(resName: String, type: String): Int {
|
|
||||||
return Resources.getSystem().getIdentifier(resName, type, "android")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getBoolean(context: Context, resName: String, defaultValue: Boolean): Boolean {
|
fun getBoolean(context: Context, resName: String, defaultValue: Boolean): Boolean {
|
||||||
val id = getResourceId(resName, "bool")
|
val id = getResourceId(resName, "bool")
|
||||||
@ -22,4 +13,14 @@ object InternalResourceHelper {
|
|||||||
defaultValue
|
defaultValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get resource id from system resources
|
||||||
|
* @param resName resource name to get
|
||||||
|
* @param type resource type of [resName] to get
|
||||||
|
* @return 0 if not available
|
||||||
|
*/
|
||||||
|
private fun getResourceId(resName: String, type: String): Int {
|
||||||
|
return Resources.getSystem().getIdentifier(resName, type, "android")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:theme="?attr/actionBarTheme"
|
android:theme="?attr/actionBarTheme"
|
||||||
app:layout_scrollFlags="scroll|enterAlways|snap" />
|
app:layout_scrollFlags="scroll|enterAlways" />
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/tabs"
|
android:id="@+id/tabs"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user