From 99b46096a46ce4a56f4461d7ad7c7a24b0cf510b Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 12 Apr 2021 17:28:14 -0400 Subject: [PATCH] Fully expand source filter sheet on show (closes #4455) --- .../browse/source/browse/SourceFilterSheet.kt | 24 +++++++++++++++---- .../main/res/drawable/ic_drag_pill_24dp.xml | 9 ------- .../main/res/layout/source_filter_sheet.xml | 14 ----------- 3 files changed, 19 insertions(+), 28 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_drag_pill_24dp.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterSheet.kt index 923e5c9649..632f3ec0d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterSheet.kt @@ -5,6 +5,7 @@ import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater import android.view.ViewGroup +import com.google.android.material.bottomsheet.BottomSheetBehavior import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.IFlexible import eu.kanade.tachiyomi.databinding.SourceFilterSheetBinding @@ -17,10 +18,10 @@ class SourceFilterSheet( onResetClicked: () -> Unit ) : BaseBottomSheetDialog(activity) { - private var filterNavView: FilterNavigationView + private var filterNavView: FilterNavigationView = FilterNavigationView(activity) + private val sheetBehavior: BottomSheetBehavior<*> init { - filterNavView = FilterNavigationView(activity) filterNavView.onFilterClicked = { onFilterClicked() this.dismiss() @@ -28,13 +29,23 @@ class SourceFilterSheet( filterNavView.onResetClicked = onResetClicked setContentView(filterNavView) + + sheetBehavior = BottomSheetBehavior.from(filterNavView.parent as ViewGroup) + } + + override fun show() { + super.show() + sheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED } fun setFilters(items: List>) { filterNavView.adapter.updateDataSet(items) } - class FilterNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : + class FilterNavigationView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null + ) : SimpleNavigationView(context, attrs) { var onFilterClicked = {} @@ -42,9 +53,12 @@ class SourceFilterSheet( val adapter: FlexibleAdapter> = FlexibleAdapter>(null) .setDisplayHeadersAtStartUp(true) - .setStickyHeaders(true) - private val binding = SourceFilterSheetBinding.inflate(LayoutInflater.from(context), null, false) + private val binding = SourceFilterSheetBinding.inflate( + LayoutInflater.from(context), + null, + false + ) init { recycler.adapter = adapter diff --git a/app/src/main/res/drawable/ic_drag_pill_24dp.xml b/app/src/main/res/drawable/ic_drag_pill_24dp.xml deleted file mode 100644 index da568f0df6..0000000000 --- a/app/src/main/res/drawable/ic_drag_pill_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/layout/source_filter_sheet.xml b/app/src/main/res/layout/source_filter_sheet.xml index 213f43d61e..2bef6300c8 100644 --- a/app/src/main/res/layout/source_filter_sheet.xml +++ b/app/src/main/res/layout/source_filter_sheet.xml @@ -1,7 +1,6 @@ @@ -15,19 +14,6 @@ android:paddingStart="?attr/listPreferredItemPaddingStart" android:paddingEnd="?attr/listPreferredItemPaddingEnd"> - -