From d2dae05ab22e52bf97bf9fa78463a61ce8e564f2 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 10 Feb 2020 02:13:02 -0800 Subject: [PATCH] Fixed filter sheet not hidden in landscape --- .../kanade/tachiyomi/ui/library/LibraryController.kt | 7 +++++++ .../kanade/tachiyomi/ui/library/LibraryPresenter.kt | 2 ++ .../ui/library/filter/SortFilterBottomSheet.kt | 8 ++++++-- .../main/res/layout-sw600dp/filter_bottom_sheet.xml | 12 ++++++++++++ 4 files changed, 27 insertions(+), 2 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 906c7078bb..47eca91ffd 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 @@ -215,6 +215,13 @@ class LibraryController( fab.setOnClickListener { router.pushController(DownloadController().withFadeTransaction()) } + + if (presenter.isDownloading()) { + fab.scaleY = 1f + fab.scaleX = 1f + fab.isClickable = true + fab.isFocusable = true + } presenter.onRestore() val library = presenter.getAllManga() if (library != null) onNextLibraryUpdate(presenter.categories, library) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 0c919d6c06..16446563fb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -84,6 +84,8 @@ class LibraryPresenter( var currentLibrary:Library? = null } + fun isDownloading() = downloadManager.hasQueue() + fun onDestroy() { if (currentMangaMap != null) currentLibrary = Library(categories, currentMangaMap!!) 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 1440c197fc..ad21e12a17 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 @@ -152,7 +152,8 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A if (phoneLandscape && shadow2.visibility != View.GONE) { shadow2.gone() } - sheetBehavior?.peekHeight = peekHeight + if (phoneLandscape) + sheetBehavior?.peekHeight = 0 top_bar.viewTreeObserver.addOnGlobalLayoutListener { val peekingHeight = if (phoneLandscape) 0 else if (!title.text.isNullOrBlank()) top_bar.height @@ -204,7 +205,10 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A this.peekHeight = state.getInt("peek") this.startingTitle = state.getString("title") ?: "" val sheet = BottomSheetBehavior.from(this) - sheet.peekHeight = peekHeight + if (isLandscape() && !isTablet()) + sheet.peekHeight = 0 + else + sheet.peekHeight = peekHeight title.text = startingTitle super.onRestoreInstanceState( state.getParcelable("superState")) top_bar.alpha = diff --git a/app/src/main/res/layout-sw600dp/filter_bottom_sheet.xml b/app/src/main/res/layout-sw600dp/filter_bottom_sheet.xml index 7a670bdccb..70c07ccabf 100644 --- a/app/src/main/res/layout-sw600dp/filter_bottom_sheet.xml +++ b/app/src/main/res/layout-sw600dp/filter_bottom_sheet.xml @@ -212,6 +212,17 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> +