mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Rounded library badges
This commit is contained in:
		| @@ -40,7 +40,7 @@ class SourceComfortableGridHolder(private val view: View, private val adapter: F | ||||
|     } | ||||
|  | ||||
|     override fun setImage(manga: Manga) { | ||||
|         // Setting this via XML doesn't work | ||||
|         // For rounded corners | ||||
|         card.clipToOutline = true | ||||
|  | ||||
|         GlideApp.with(view.context).clear(thumbnail) | ||||
|   | ||||
| @@ -40,7 +40,7 @@ open class SourceGridHolder(private val view: View, private val adapter: Flexibl | ||||
|     } | ||||
|  | ||||
|     override fun setImage(manga: Manga) { | ||||
|         // Setting this via XML doesn't work | ||||
|         // For rounded corners | ||||
|         card.clipToOutline = true | ||||
|  | ||||
|         GlideApp.with(view.context).clear(thumbnail) | ||||
|   | ||||
| @@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp | ||||
| import eu.kanade.tachiyomi.data.glide.toMangaThumbnail | ||||
| import eu.kanade.tachiyomi.util.isLocal | ||||
| import eu.kanade.tachiyomi.util.view.visibleIf | ||||
| import kotlinx.android.synthetic.main.source_comfortable_grid_item.badges | ||||
| import kotlinx.android.synthetic.main.source_comfortable_grid_item.card | ||||
| import kotlinx.android.synthetic.main.source_comfortable_grid_item.download_text | ||||
| import kotlinx.android.synthetic.main.source_comfortable_grid_item.local_text | ||||
| @@ -28,7 +29,7 @@ import kotlinx.android.synthetic.main.source_comfortable_grid_item.unread_text | ||||
| class LibraryComfortableGridHolder( | ||||
|     private val view: View, | ||||
|     adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>> | ||||
| ) : LibraryGridHolder(view, adapter) { | ||||
| ) : LibraryCompactGridHolder(view, adapter) { | ||||
|  | ||||
|     /** | ||||
|      * Method called from [LibraryCategoryAdapter.onBindViewHolder]. It updates the data for this | ||||
| @@ -40,6 +41,9 @@ class LibraryComfortableGridHolder( | ||||
|         // Update the title of the manga. | ||||
|         title.text = item.manga.title | ||||
|  | ||||
|         // For rounded corners | ||||
|         badges.clipToOutline = true | ||||
|  | ||||
|         // Update the unread count and its visibility. | ||||
|         with(unread_text) { | ||||
|             visibleIf { item.unreadCount > 0 } | ||||
| @@ -53,7 +57,7 @@ class LibraryComfortableGridHolder( | ||||
|         // set local visibility if its local manga | ||||
|         local_text.visibleIf { item.manga.isLocal() } | ||||
|  | ||||
|         // Setting this via XML doesn't work | ||||
|         // For rounded corners | ||||
|         card.clipToOutline = true | ||||
|  | ||||
|         // Update the cover. | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp | ||||
| import eu.kanade.tachiyomi.data.glide.toMangaThumbnail | ||||
| import eu.kanade.tachiyomi.util.isLocal | ||||
| import eu.kanade.tachiyomi.util.view.visibleIf | ||||
| import kotlinx.android.synthetic.main.source_compact_grid_item.badges | ||||
| import kotlinx.android.synthetic.main.source_compact_grid_item.card | ||||
| import kotlinx.android.synthetic.main.source_compact_grid_item.download_text | ||||
| import kotlinx.android.synthetic.main.source_compact_grid_item.local_text | ||||
| @@ -23,7 +24,7 @@ import kotlinx.android.synthetic.main.source_compact_grid_item.unread_text | ||||
|  * @param listener a listener to react to single tap and long tap events. | ||||
|  * @constructor creates a new library holder. | ||||
|  */ | ||||
| open class LibraryGridHolder( | ||||
| open class LibraryCompactGridHolder( | ||||
|     private val view: View, | ||||
|     private val adapter: FlexibleAdapter<*> | ||||
| ) : LibraryHolder(view, adapter) { | ||||
| @@ -38,6 +39,9 @@ open class LibraryGridHolder( | ||||
|         // Update the title of the manga. | ||||
|         title.text = item.manga.title | ||||
| 
 | ||||
|         // For rounded corners | ||||
|         badges.clipToOutline = true | ||||
| 
 | ||||
|         // Update the unread count and its visibility. | ||||
|         with(unread_text) { | ||||
|             visibleIf { item.unreadCount > 0 } | ||||
| @@ -51,7 +55,7 @@ open class LibraryGridHolder( | ||||
|         // set local visibility if its local manga | ||||
|         local_text.visibleIf { item.manga.isLocal() } | ||||
| 
 | ||||
|         // Setting this via XML doesn't work | ||||
|         // For rounded corners | ||||
|         card.clipToOutline = true | ||||
| 
 | ||||
|         // Update the cover. | ||||
| @@ -48,7 +48,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryDisplayMode: Prefe | ||||
|                         MATCH_PARENT, coverHeight / 2, Gravity.BOTTOM | ||||
|                     ) | ||||
|                 } | ||||
|                 LibraryGridHolder(view, adapter) | ||||
|                 LibraryCompactGridHolder(view, adapter) | ||||
|             } | ||||
|             DisplayMode.COMFORTABLE_GRID -> { | ||||
|                 val parent = adapter.recyclerView as AutofitRecyclerView | ||||
|   | ||||
| @@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp | ||||
| import eu.kanade.tachiyomi.data.glide.toMangaThumbnail | ||||
| import eu.kanade.tachiyomi.util.isLocal | ||||
| import eu.kanade.tachiyomi.util.view.visibleIf | ||||
| import kotlinx.android.synthetic.main.source_list_item.badges | ||||
| import kotlinx.android.synthetic.main.source_list_item.download_text | ||||
| import kotlinx.android.synthetic.main.source_list_item.local_text | ||||
| import kotlinx.android.synthetic.main.source_list_item.thumbnail | ||||
| @@ -42,6 +43,9 @@ class LibraryListHolder( | ||||
|         // Update the title of the manga. | ||||
|         title.text = item.manga.title | ||||
|  | ||||
|         // For rounded corners | ||||
|         badges.clipToOutline = true | ||||
|  | ||||
|         // Update the unread count and its visibility. | ||||
|         with(unread_text) { | ||||
|             visibleIf { item.unreadCount > 0 } | ||||
|   | ||||
| @@ -91,7 +91,7 @@ class MangaInfoController(private val fromSource: Boolean = false) : | ||||
|     override fun onViewCreated(view: View) { | ||||
|         super.onViewCreated(view) | ||||
|  | ||||
|         // Setting this via XML doesn't work | ||||
|         // For rounded corners | ||||
|         binding.mangaCover.clipToOutline = true | ||||
|  | ||||
|         binding.btnFavorite.clicks() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user