mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Change X for clear filters into a reg text button
Also remove vibration on long press of the full filter sheet button if theres no active filters
This commit is contained in:
parent
6361412069
commit
d70ce5f639
3 changed files with 18 additions and 23 deletions
|
@ -277,8 +277,7 @@ class SetCategoriesSheet(
|
|||
}.flatten()
|
||||
if (addCategories.isNotEmpty() || listManga.size == 1) {
|
||||
Category.lastCategoriesAddedTo =
|
||||
addCategories.mapNotNull { it.id }.toSet().takeIf { it.isNotEmpty() }
|
||||
?: setOf(0)
|
||||
addCategories.mapNotNull { it.id }.toSet().ifEmpty { setOf(0) }
|
||||
}
|
||||
db.setMangaCategories(mangaCategories, listManga)
|
||||
onMangaAdded()
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import android.os.Parcelable
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.annotation.StringRes
|
||||
|
@ -28,7 +29,6 @@ import eu.kanade.tachiyomi.util.system.withIOContext
|
|||
import eu.kanade.tachiyomi.util.system.withUIContext
|
||||
import eu.kanade.tachiyomi.util.view.activityBinding
|
||||
import eu.kanade.tachiyomi.util.view.collapse
|
||||
import eu.kanade.tachiyomi.util.view.compatToolTipText
|
||||
import eu.kanade.tachiyomi.util.view.hide
|
||||
import eu.kanade.tachiyomi.util.view.inflate
|
||||
import eu.kanade.tachiyomi.util.view.isCollapsed
|
||||
|
@ -85,7 +85,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
|||
|
||||
private var filterOrder = preferences.filterOrder().get()
|
||||
|
||||
private lateinit var clearButton: ImageView
|
||||
private lateinit var clearButton: Button
|
||||
private lateinit var fullFilterButton: ImageView
|
||||
|
||||
private val filterItems: MutableList<FilterTagGroup> by lazy {
|
||||
|
@ -112,7 +112,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
|||
}
|
||||
|
||||
fun onCreate(controller: LibraryController) {
|
||||
clearButton = binding.clearButton
|
||||
clearButton = binding.clearFiltersButton
|
||||
binding.filterLayout.removeView(clearButton)
|
||||
fullFilterButton = binding.filterButton
|
||||
sheetBehavior = BottomSheetBehavior.from(this)
|
||||
|
@ -194,14 +194,16 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
|||
createTags()
|
||||
clearButton.setOnClickListener { clearFilters() }
|
||||
fullFilterButton.setOnLongClickListener {
|
||||
clearFilters()
|
||||
true
|
||||
val hadFilters = hasActiveFilters()
|
||||
if (hadFilters) {
|
||||
clearFilters()
|
||||
}
|
||||
hadFilters
|
||||
}
|
||||
fullFilterButton.setOnClickListener { showFullFilterSheet() }
|
||||
|
||||
setExpandText(controller.canCollapseOrExpandCategory(), false)
|
||||
|
||||
clearButton.compatToolTipText = context.getString(R.string.clear_filters)
|
||||
preferences.filterOrder().asFlow()
|
||||
.drop(1)
|
||||
.onEach {
|
||||
|
|
|
@ -68,23 +68,17 @@
|
|||
android:contentDescription="@string/filter"
|
||||
android:focusable="true"
|
||||
android:padding="4dp"
|
||||
android:src="@drawable/ic_tune_24dp"
|
||||
app:tint="@color/gray_button" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/clear_button"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/round_clear_border"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/clear"
|
||||
android:focusable="true"
|
||||
android:padding="3dp"
|
||||
android:src="@drawable/ic_close_24dp"
|
||||
android:src="@drawable/ic_filter_list_24dp"
|
||||
app:tint="@color/gray_button" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/clear_filters_button"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="@string/clear_filters"
|
||||
android:textColor="?attr/colorSecondary" />
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue