Fixed filter sheet not hidden in landscape

This commit is contained in:
Jay 2020-02-10 02:13:02 -08:00
parent d781a71425
commit d2dae05ab2
4 changed files with 27 additions and 2 deletions

View File

@ -215,6 +215,13 @@ class LibraryController(
fab.setOnClickListener { fab.setOnClickListener {
router.pushController(DownloadController().withFadeTransaction()) router.pushController(DownloadController().withFadeTransaction())
} }
if (presenter.isDownloading()) {
fab.scaleY = 1f
fab.scaleX = 1f
fab.isClickable = true
fab.isFocusable = true
}
presenter.onRestore() presenter.onRestore()
val library = presenter.getAllManga() val library = presenter.getAllManga()
if (library != null) onNextLibraryUpdate(presenter.categories, library) if (library != null) onNextLibraryUpdate(presenter.categories, library)

View File

@ -84,6 +84,8 @@ class LibraryPresenter(
var currentLibrary:Library? = null var currentLibrary:Library? = null
} }
fun isDownloading() = downloadManager.hasQueue()
fun onDestroy() { fun onDestroy() {
if (currentMangaMap != null) if (currentMangaMap != null)
currentLibrary = Library(categories, currentMangaMap!!) currentLibrary = Library(categories, currentMangaMap!!)

View File

@ -152,7 +152,8 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
if (phoneLandscape && shadow2.visibility != View.GONE) { if (phoneLandscape && shadow2.visibility != View.GONE) {
shadow2.gone() shadow2.gone()
} }
sheetBehavior?.peekHeight = peekHeight if (phoneLandscape)
sheetBehavior?.peekHeight = 0
top_bar.viewTreeObserver.addOnGlobalLayoutListener { top_bar.viewTreeObserver.addOnGlobalLayoutListener {
val peekingHeight = if (phoneLandscape) 0 val peekingHeight = if (phoneLandscape) 0
else if (!title.text.isNullOrBlank()) top_bar.height 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.peekHeight = state.getInt("peek")
this.startingTitle = state.getString("title") ?: "" this.startingTitle = state.getString("title") ?: ""
val sheet = BottomSheetBehavior.from(this) val sheet = BottomSheetBehavior.from(this)
sheet.peekHeight = peekHeight if (isLandscape() && !isTablet())
sheet.peekHeight = 0
else
sheet.peekHeight = peekHeight
title.text = startingTitle title.text = startingTitle
super.onRestoreInstanceState( state.getParcelable("superState")) super.onRestoreInstanceState( state.getParcelable("superState"))
top_bar.alpha = top_bar.alpha =

View File

@ -212,6 +212,17 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/pill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/draggable_pill"
android:alpha="0.15"
android:contentDescription="@string/drag_handle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/title_icon" android:id="@+id/title_icon"
@ -219,6 +230,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:src="@drawable/ic_sort_white_24dp" android:src="@drawable/ic_sort_white_24dp"
android:contentDescription="@string/sorting_mode"
app:layout_constraintBottom_toBottomOf="@+id/title" app:layout_constraintBottom_toBottomOf="@+id/title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/title" /> app:layout_constraintTop_toTopOf="@+id/title" />