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 e41110683c..11ccfa88e4 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
@@ -425,23 +425,22 @@ class LibraryController(
}
private fun onRefresh() {
- activity?.invalidateOptionsMenu()
+ if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
presenter.requestFullUpdate()
}
/**
* Called when a filter is changed.
*/
- private fun onFilterChanged(item: ExtendedNavigationView.Item) {
- if (item is ExtendedNavigationView.Item.MultiStateGroup &&
- item.resTitle == R.string.action_hide_categories) {
- activity?.invalidateOptionsMenu()
+ private fun onFilterChanged(item: ExtendedNavigationView.Item?) {
+ if (item is ExtendedNavigationView.Item.MultiStateGroup && item.resTitle == R.string.categories) {
+ if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
presenter.requestFullUpdate()
return
}
presenter.requestFilterUpdate()
destroyActionModeIfNeeded()
- activity?.invalidateOptionsMenu()
+ if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
}
private fun onDownloadBadgeChanged() {
@@ -452,7 +451,7 @@ class LibraryController(
* Called when the sorting mode is changed.
*/
private fun onSortChanged() {
- activity?.invalidateOptionsMenu()
+ if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
presenter.requestSortUpdate()
}
@@ -503,7 +502,13 @@ class LibraryController(
!MainActivity.bottomNav
preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP &&
!preferences.hideCategories().getOrDefault()
- menu.findItem(R.id.action_filter).isVisible = !MainActivity.bottomNav
+
+ val config = resources?.configuration
+
+ val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE &&
+ (config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) <
+ Configuration.SCREENLAYOUT_SIZE_LARGE)
+ menu.findItem(R.id.action_library_filter).isVisible = !MainActivity.bottomNav || phoneLandscape
reorderMenuItem = reorganizeItem
enableReorderItems()
@@ -519,7 +524,7 @@ class LibraryController(
}
// Mutate the filter icon because it needs to be tinted and the resource is shared.
- menu.findItem(R.id.action_filter).icon.mutate()
+ menu.findItem(R.id.action_library_filter).icon.mutate()
searchViewSubscription?.unsubscribe()
searchViewSubscription = searchView.queryTextChanges()
@@ -549,7 +554,7 @@ class LibraryController(
override fun onPrepareOptionsMenu(menu: Menu) {
val navView = navView ?: return
- val filterItem = menu.findItem(R.id.action_filter)
+ val filterItem = menu.findItem(R.id.action_library_filter)
// Tint icon if there's a filter active
val filterColor = if (navView.hasActiveFilters()) Color.rgb(255, 238, 7)
@@ -560,8 +565,10 @@ class LibraryController(
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.action_search -> expandActionViewFromInteraction = true
- R.id.action_filter -> {
- navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
+ R.id.action_library_filter -> {
+ if (MainActivity.bottomNav) bottom_sheet.sheetBehavior?.state =
+ BottomSheetBehavior.STATE_EXPANDED
+ else navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
}
R.id.action_edit_categories -> {
router.pushController(CategoryController().withFadeTransaction())
diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt
index 8ae15900f2..3586ab9b50 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt
@@ -3,10 +3,9 @@ package eu.kanade.tachiyomi.widget
import android.animation.ObjectAnimator
import android.animation.StateListAnimator
import android.content.Context
-import android.os.Build
+import android.util.AttributeSet
import com.google.android.material.R
import com.google.android.material.appbar.AppBarLayout
-import android.util.AttributeSet
class ElevationAppBarLayout @JvmOverloads constructor(
context: Context,
diff --git a/app/src/main/res/layout/filter_bottom_sheet.xml b/app/src/main/res/layout/filter_bottom_sheet.xml
index 0675449787..1aaea2b132 100644
--- a/app/src/main/res/layout/filter_bottom_sheet.xml
+++ b/app/src/main/res/layout/filter_bottom_sheet.xml
@@ -16,15 +16,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
-
-