Added a fake shadow when downloads is expanded

so it is as it was before
This commit is contained in:
Jays2Kings 2021-04-10 21:48:22 -04:00
parent dbf227f18e
commit e53bae4413
2 changed files with 26 additions and 1 deletions

View File

@ -137,6 +137,9 @@ class RecentsController(bundle: Bundle? = null) :
includeTabView = true,
afterInsets = {
headerHeight = it.systemWindowInsetTop + appBarHeight + 48.dpToPx
binding.fakeAppBar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = it.systemWindowInsetTop + appBarHeight
}
binding.recycler.updatePaddingRelative(
bottom = activityBinding?.bottomNav?.height ?: 0
)
@ -152,13 +155,23 @@ class RecentsController(bundle: Bundle? = null) :
setBottomPadding()
}
)
binding.recycler.addOnScrollListener(
object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
binding.fakeAppBar.y = activityBinding?.appBar?.y ?: 0f
}
}
)
activityBinding?.bottomNav?.post {
binding.recycler.updatePaddingRelative(bottom = activityBinding?.bottomNav?.height ?: 0)
binding.downloadBottomSheet.dlRecycler.updatePaddingRelative(
bottom = activityBinding?.bottomNav?.height ?: 0
)
activityBinding?.tabsFrameLayout?.isVisible = !binding.downloadBottomSheet.root.sheetBehavior.isExpanded()
activityBinding?.tabsFrameLayout?.isVisible =
!binding.downloadBottomSheet.root.sheetBehavior.isExpanded()
binding.fakeAppBar.alpha =
if (binding.downloadBottomSheet.root.sheetBehavior.isExpanded()) 1f else 0f
}
presenter.onCreate()
@ -188,11 +201,13 @@ class RecentsController(bundle: Bundle? = null) :
(1f - progress / cap) * 15f,
if (binding.recycler.canScrollVertically(-1)) 15f else 0f
).coerceIn(0f, 15f)
binding.fakeAppBar.alpha = max(0f, (progress - cap) / (1f - cap))
binding.downloadBottomSheet.sheetLayout.alpha = 1 - max(0f, progress / cap)
activityBinding?.appBar?.y = max(
activityBinding!!.appBar.y,
-headerHeight * (1 - progress)
)
binding.fakeAppBar.y = activityBinding?.appBar?.y ?: 0f
activityBinding?.tabsFrameLayout?.let { tabs ->
tabs.alpha = 1 - max(0f, progress / cap)
if (tabs.alpha <= 0 && tabs.isVisible) {

View File

@ -48,6 +48,16 @@
<include layout="@layout/download_bottom_sheet"
android:id="@+id/download_bottom_sheet"/>
<View
android:id="@+id/fake_app_bar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:alpha="0"
android:background="?android:attr/colorBackground"
android:orientation="vertical"
android:elevation="5dp"
android:layout_gravity="top|center"/>
<View
android:id="@+id/shadow2"
android:layout_width="match_parent"