diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt index 01c0e8f7d1..4a9882796c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt @@ -303,7 +303,7 @@ class CatalogueController : NucleusController(), (RouterTransaction.with(controller)).popChangeHandler( SettingsSourcesFadeChangeHandler() ).pushChangeHandler(FadeChangeHandler()) - ) + ) } R.id.action_dismiss -> { ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED 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 ba3ca0b721..7feac35703 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 @@ -52,6 +52,7 @@ import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationProcedureConfig import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.launchUI +import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.applyWindowInsetsForRootController import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener import eu.kanade.tachiyomi.util.view.snack @@ -194,11 +195,7 @@ open class LibraryController( when (it) { SortFilterBottomSheet.ACTION_REFRESH -> onRefresh() SortFilterBottomSheet.ACTION_FILTER -> onFilterChanged() - SortFilterBottomSheet.ACTION_SORT -> onSortChanged() - SortFilterBottomSheet.ACTION_DISPLAY -> reattachAdapter() - SortFilterBottomSheet.ACTION_DOWNLOAD_BADGE -> presenter.requestDownloadBadgesUpdate() - SortFilterBottomSheet.ACTION_UNREAD_BADGE -> presenter.requestUnreadBadgesUpdate() - SortFilterBottomSheet.ACTION_CAT_SORT -> onCatSortChanged() + SortFilterBottomSheet.ACTION_HIDE_FILTER_TIP -> activity?.toast(R.string.hide_filters_tip) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt index 89bf65e746..aa78084568 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt @@ -186,6 +186,15 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), } return } + if (event.actionMasked == MotionEvent.ACTION_UP) { + recycler_layout.post { + if (!flinging) { + resetScrollingValues() + resetRecyclerY(true) + } + } + return + } if (startPosX != null && startPosY != null && (sheetRect.contains(startPosX!!.toInt(), startPosY!!.toInt()) || !recyclerRect.contains(startPosX!!.toInt(), startPosY!!.toInt()))) { @@ -239,14 +248,6 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), } } } - else if (event.actionMasked == MotionEvent.ACTION_UP) { - recycler_layout.post { - if (!flinging) { - resetScrollingValues() - resetRecyclerY(true) - } - } - } } private fun resetScrollingValues() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt index 12e3391480..be34970acc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt @@ -115,9 +115,6 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A else shadow.alpha = 1f pager?.updatePaddingRelative(bottom = sheetBehavior?.peekHeight ?: 0) -// snackbarLayout.updatePaddingRelative(bottom = sheetBehavior?.peekHeight ?: 0) - if (!phoneLandscape) - preferences.hideFiltersAtStart().set(false) } if (state == BottomSheetBehavior.STATE_EXPANDED) { top_bar.alpha = 0f @@ -129,8 +126,6 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A shadow.alpha = 0f pager?.updatePaddingRelative(bottom = 0) // snackbarLayout.updatePaddingRelative(bottom = 0) - if (!phoneLandscape) - preferences.hideFiltersAtStart().set(true) } //top_bar.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED //top_bar.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED @@ -147,6 +142,12 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A if (phoneLandscape && shadow2.visibility != View.GONE) { shadow2.gone() } + hide_filters.isChecked = preferences.hideFiltersAtStart().getOrDefault() + hide_filters.setOnCheckedChangeListener { _, isChecked -> + preferences.hideFiltersAtStart().set(isChecked) + if (isChecked) + onGroupClicked(ACTION_HIDE_FILTER_TIP) + } createTags() clearButton.setOnClickListener { clearFilters() } } @@ -305,11 +306,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A companion object { const val ACTION_REFRESH = 0 - const val ACTION_SORT = 1 - const val ACTION_FILTER = 2 - const val ACTION_DISPLAY = 3 - const val ACTION_DOWNLOAD_BADGE = 4 - const val ACTION_UNREAD_BADGE = 5 - const val ACTION_CAT_SORT = 6 + const val ACTION_FILTER = 1 + const val ACTION_HIDE_FILTER_TIP = 2 } } \ No newline at end of file diff --git a/app/src/main/res/layout/filter_bottom_sheet.xml b/app/src/main/res/layout/filter_bottom_sheet.xml index f6feb3077d..214d34ed4f 100644 --- a/app/src/main/res/layout/filter_bottom_sheet.xml +++ b/app/src/main/res/layout/filter_bottom_sheet.xml @@ -1,71 +1,71 @@ - + + - - - - - - - - - + android:layout_marginTop="2dp" + android:clipToPadding="false" + android:paddingStart="20dp" + android:paddingTop="8dp" + android:paddingEnd="20dp" + android:paddingBottom="6dp" + android:scrollbars="none"> + + + + + + + + - - + android:layout_marginEnd="20dp" + android:text="@string/action_start_filters_hidden" /> + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 389966fdb2..b58c10bc90 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,6 +54,7 @@ Tracked Not tracked Hide categories + Hide filters on startup Hiding categories Manga only Manhwa only @@ -468,7 +469,8 @@ Hide unread badges Show unread badges Show unread count - + You can show filters by again tapping the Library tab when + hidden Search filters