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
|
||||
if (!manga.genre.isNullOrBlank()) {
|
||||
binding.mangaGenresTagsCompactChips.setChips(manga.getGenres(), this::performSearch)
|
||||
binding.mangaGenresTagsFullChips.setChips(manga.getGenres(), this::performSearch)
|
||||
binding.mangaGenresTagsCompactChips.setChips(manga.getGenres(), this::performSearch, this::performGlobalSearch)
|
||||
binding.mangaGenresTagsFullChips.setChips(manga.getGenres(), this::performSearch, this::performGlobalSearch)
|
||||
} else {
|
||||
binding.mangaGenresTagsWrapper.gone()
|
||||
}
|
||||
|
@ -104,13 +104,17 @@ fun ExtendedFloatingActionButton.shrinkOnScroll(recycler: RecyclerView) {
|
||||
* @param items List of strings that are shown as individual chips.
|
||||
* @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()
|
||||
|
||||
items?.forEach { item ->
|
||||
val chip = Chip(context).apply {
|
||||
text = item
|
||||
setOnClickListener { onClick(item) }
|
||||
setOnLongClickListener {
|
||||
onLongClick(item)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
addView(chip)
|
||||
|
Loading…
x
Reference in New Issue
Block a user