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.floatingActionButton?.isVisible = value
it.toolbar.isVisible = !value it.toolbar.isVisible = !value
val layoutParams = it.searchCardView?.layoutParams as AppBarLayout.LayoutParams
if (value) { if (value) {
it.appBar?.setBackgroundResource(R.color.transparent) 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 { } else {
it.appBar?.setBackgroundResource(R.color.colorPrimary) it.appBar?.setBackgroundResource(R.color.colorPrimary)
layoutParams.scrollFlags = 0
} }
it.searchCardView?.layoutParams = layoutParams
} }
} }

View File

@ -48,6 +48,7 @@
android:background="@color/transparent" android:background="@color/transparent"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar" android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="enterAlwaysCollapsed|noScroll"
app:popupTheme="@style/appActionBarPopupMenu" /> app:popupTheme="@style/appActionBarPopupMenu" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
@ -57,7 +58,7 @@
android:id="@+id/controller_container" android:id="@+id/controller_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton" android:id="@+id/floatingActionButton"

View File

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