Use FAB for catalogue filter

This commit is contained in:
arkon 2020-04-10 14:43:13 -04:00
parent c38b457ba0
commit 9a28cbc1e4
5 changed files with 15 additions and 23 deletions

View file

@ -125,7 +125,12 @@ open class BrowseCatalogueController(bundle: Bundle) :
setupRecycler(view)
// Prepare filter sheet
initFilterSheet()
if (presenter.sourceFilters.isNotEmpty()) {
initFilterSheet()
binding.fabFilter.setOnClickListener { filterSheet?.show() }
binding.fabFilter.visible()
}
binding.progress.visible()
}
@ -245,18 +250,6 @@ open class BrowseCatalogueController(bundle: Bundle) :
}
)
// Setup filters button
menu.findItem(R.id.action_set_filter).apply {
icon.mutate()
if (presenter.sourceFilters.isEmpty()) {
isEnabled = false
icon.alpha = 128
} else {
isEnabled = true
icon.alpha = 255
}
}
// Show next display mode
menu.findItem(R.id.action_display_mode).apply {
val icon = if (presenter.isListMode)
@ -278,7 +271,6 @@ open class BrowseCatalogueController(bundle: Bundle) :
when (item.itemId) {
R.id.action_search -> expandActionViewFromInteraction = true
R.id.action_display_mode -> swapDisplayMode()
R.id.action_set_filter -> filterSheet?.show()
R.id.action_open_in_web_view -> openInWebView()
}
return super.onOptionsItemSelected(item)

View file

@ -23,6 +23,5 @@ class LatestUpdatesController(bundle: Bundle) : BrowseCatalogueController(bundle
override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu)
menu.findItem(R.id.action_search).isVisible = false
menu.findItem(R.id.action_set_filter).isVisible = false
}
}

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -26,6 +27,14 @@
</LinearLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_filter"
style="@style/Theme.Widget.FAB"
android:text="@string/action_filter"
android:visibility="gone"
app:icon="@drawable/ic_filter_list_24dp"
app:layout_anchor="@id/catalogue_view" />
<eu.kanade.tachiyomi.widget.EmptyView
android:id="@+id/empty_view"
android:layout_width="match_parent"

View file

@ -11,13 +11,6 @@
app:iconTint="?attr/colorOnPrimary"
app:showAsAction="collapseActionView|ifRoom" />
<item
android:id="@+id/action_set_filter"
android:icon="@drawable/ic_filter_list_24dp"
android:title="@string/action_set_filter"
app:iconTint="?attr/colorOnPrimary"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_display_mode"
android:title="@string/action_display_mode"

View file

@ -85,7 +85,6 @@
<string name="action_display_list">List</string>
<string name="action_display_download_badge">Download badges</string>
<string name="action_hide">Hide</string>
<string name="action_set_filter">Set filter</string>
<string name="action_cancel">Cancel</string>
<string name="action_cancel_all">Cancel all</string>
<string name="action_sort">Sort</string>