Fix scroll flags

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-01-28 13:12:10 +01:00
parent 47ad0038cc
commit d52ceff6d6
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0
3 changed files with 9 additions and 3 deletions

View File

@ -112,11 +112,17 @@ abstract class BaseController : ButterKnifeController(), ComponentCallbacks {
it.floatingActionButton?.isVisible = value
it.toolbar.isVisible = !value
val layoutParams = it.searchCardView?.layoutParams as AppBarLayout.LayoutParams
if (value) {
it.appBar?.setBackgroundResource(R.color.transparent)
layoutParams.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL or AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP or AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS
} else {
it.appBar?.setBackgroundResource(R.color.colorPrimary)
layoutParams.scrollFlags = 0
}
it.searchCardView?.layoutParams = layoutParams
}
}

View File

@ -48,6 +48,7 @@
android:background="@color/transparent"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="enterAlwaysCollapsed|noScroll"
app:popupTheme="@style/appActionBarPopupMenu" />
</com.google.android.material.appbar.AppBarLayout>

View File

@ -40,8 +40,7 @@
app:cardBackgroundColor="@color/transparent"
android:elevation="2dp"
app:cardElevation="2dp"
android:visibility="gone"
app:layout_scrollFlags="scroll|enterAlways|snap">
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"