Implement long click global search for tags
This commit is contained in:
parent
d4659ffaae
commit
46478546a8
@ -395,8 +395,8 @@ class MangaInfoController(private val fromSource: Boolean = false) :
|
|||||||
|
|
||||||
// Update genres list
|
// Update genres list
|
||||||
if (!manga.genre.isNullOrBlank()) {
|
if (!manga.genre.isNullOrBlank()) {
|
||||||
binding.mangaGenresTagsCompactChips.setChips(manga.getGenres(), this::performSearch)
|
binding.mangaGenresTagsCompactChips.setChips(manga.getGenres(), this::performSearch, this::performGlobalSearch)
|
||||||
binding.mangaGenresTagsFullChips.setChips(manga.getGenres(), this::performSearch)
|
binding.mangaGenresTagsFullChips.setChips(manga.getGenres(), this::performSearch, this::performGlobalSearch)
|
||||||
} else {
|
} else {
|
||||||
binding.mangaGenresTagsWrapper.gone()
|
binding.mangaGenresTagsWrapper.gone()
|
||||||
}
|
}
|
||||||
|
@ -104,13 +104,17 @@ fun ExtendedFloatingActionButton.shrinkOnScroll(recycler: RecyclerView) {
|
|||||||
* @param items List of strings that are shown as individual chips.
|
* @param items List of strings that are shown as individual chips.
|
||||||
* @param onClick Optional on click listener for each chip.
|
* @param onClick Optional on click listener for each chip.
|
||||||
*/
|
*/
|
||||||
fun ChipGroup.setChips(items: List<String>?, onClick: (item: String) -> Unit = {}) {
|
fun ChipGroup.setChips(items: List<String>?, onClick: (item: String) -> Unit = {}, onLongClick: (item: String) -> Unit = {}) {
|
||||||
removeAllViews()
|
removeAllViews()
|
||||||
|
|
||||||
items?.forEach { item ->
|
items?.forEach { item ->
|
||||||
val chip = Chip(context).apply {
|
val chip = Chip(context).apply {
|
||||||
text = item
|
text = item
|
||||||
setOnClickListener { onClick(item) }
|
setOnClickListener { onClick(item) }
|
||||||
|
setOnLongClickListener {
|
||||||
|
onLongClick(item)
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addView(chip)
|
addView(chip)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user