mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Implement long click global search for tags
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user