From 5790380fcd65500a6b32d74b62269756dd3831e1 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 18 May 2020 20:25:51 -0400 Subject: [PATCH] Always expose the front view a little bit even when backdrop is too tall Also hide the filter sheet when expanding backdrop Also also ignore the filter sheet when it comes to the layout of the backdrop --- .../tachiyomi/ui/library/LibraryController.kt | 1 + .../ui/library/category/CategoryRecyclerView.kt | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 76cfaf4dea..97c3edb292 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -757,6 +757,7 @@ class LibraryController( activity?.appbar?.y = 0f elevateFunc(false) activity?.dropdown?.setImageResource(R.drawable.ic_arrow_drop_up_24dp) + filter_bottom_sheet?.sheetBehavior?.hide() } else { val notAtTop = recycler.canScrollVertically(-1) if (notAtTop != elevate) elevateFunc(notAtTop) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt index 00d338da05..9c45c5e354 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.library.category import android.content.Context import android.util.AttributeSet +import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -11,7 +12,6 @@ import com.mikepenz.fastadapter.listeners.OnBindViewHolderListenerImpl import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.util.system.dpToPx -import eu.kanade.tachiyomi.util.view.marginBottom class CategoryRecyclerView @JvmOverloads constructor( context: Context, @@ -71,13 +71,15 @@ class CategoryRecyclerView @JvmOverloads constructor( } override fun onMeasure(widthSpec: Int, heightSpec: Int) { - val recyclerView = (parent.parent as ViewGroup).findViewById(R.id.recycler) + val recyclerView = (parent.parent as ViewGroup).findViewById(R.id.recycler) + val mainView = (parent.parent.parent.parent as ViewGroup) val top = recyclerView.paddingTop - val bottom = recyclerView.marginBottom - val parent = recyclerView.measuredHeight - top - bottom - val heightS = if (parent > 0) + val parent = mainView.measuredHeight - top - 50.dpToPx + val heightS = if (parent > 0) { MeasureSpec.makeMeasureSpec(parent, MeasureSpec.AT_MOST) - else heightSpec + } else { + heightSpec + } super.onMeasure(widthSpec, heightS) } }