mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Lighter weight method of rounding cover art and removed rounded covers option
(cherry picked from commit dabca5f09e)
			
			
This commit is contained in:
		| @@ -221,7 +221,5 @@ object PreferenceKeys { | ||||
|  | ||||
|     const val eh_hl_useHighQualityThumbs = "eh_hl_hq_thumbs" | ||||
|  | ||||
|     const val eh_library_rounded_corners = "eh_library_corners" | ||||
|  | ||||
|     const val eh_preload_size = "eh_preload_size" | ||||
| } | ||||
|   | ||||
| @@ -356,7 +356,5 @@ class PreferencesHelper(val context: Context) { | ||||
|  | ||||
|     fun eh_hl_useHighQualityThumbs() = rxPrefs.getBoolean(Keys.eh_hl_useHighQualityThumbs, false) | ||||
|  | ||||
|     fun eh_library_corner_radius() = rxPrefs.getInteger(Keys.eh_library_rounded_corners, 4) | ||||
|  | ||||
|     fun eh_preload_size() = rxPrefs.getInteger(Keys.eh_preload_size, 4) | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| package eu.kanade.tachiyomi.ui.browse.source.browse | ||||
|  | ||||
| import android.util.TypedValue | ||||
| import android.view.View | ||||
| import com.bumptech.glide.load.engine.DiskCacheStrategy | ||||
| import eu.davidea.flexibleadapter.FlexibleAdapter | ||||
| @@ -8,9 +7,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| import eu.kanade.tachiyomi.data.glide.GlideApp | ||||
| import eu.kanade.tachiyomi.data.glide.toMangaThumbnail | ||||
| import eu.kanade.tachiyomi.data.preference.PreferencesHelper | ||||
| import eu.kanade.tachiyomi.data.preference.getOrDefault | ||||
| import eu.kanade.tachiyomi.widget.StateImageViewTarget | ||||
| import kotlinx.android.synthetic.main.source_grid_item.card | ||||
| import kotlinx.android.synthetic.main.source_grid_item.progress | ||||
| import kotlinx.android.synthetic.main.source_grid_item.thumbnail | ||||
| import kotlinx.android.synthetic.main.source_grid_item.title | ||||
| @@ -47,12 +44,6 @@ class SourceGridHolder(private val view: View, private val adapter: FlexibleAdap | ||||
|         // Set manga title | ||||
|         title.text = manga.title | ||||
|  | ||||
|         card.radius = TypedValue.applyDimension( | ||||
|             TypedValue.COMPLEX_UNIT_DIP, | ||||
|             preferences.eh_library_corner_radius().getOrDefault().toFloat(), | ||||
|             view.context.resources.displayMetrics | ||||
|         ) | ||||
|  | ||||
|         GlideApp.with(view.context).clear(thumbnail) | ||||
|         if (!manga.thumbnail_url.isNullOrEmpty()) { | ||||
|             GlideApp.with(view.context) | ||||
|   | ||||
| @@ -34,6 +34,9 @@ class SourceItem(val manga: Manga, private val catalogueAsList: Preference<Boole | ||||
|         val parent = adapter.recyclerView | ||||
|         return if (parent is AutofitRecyclerView) { | ||||
|             view.apply { | ||||
|                 // Setting this via XML doesn't work | ||||
|                 card.clipToOutline = true | ||||
|  | ||||
|                 card.layoutParams = FrameLayout.LayoutParams( | ||||
|                     MATCH_PARENT, parent.itemWidth / 3 * 4 | ||||
|                 ) | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| package eu.kanade.tachiyomi.ui.library | ||||
|  | ||||
| import android.util.TypedValue | ||||
| import android.view.View | ||||
| import androidx.recyclerview.widget.RecyclerView | ||||
| import com.bumptech.glide.load.engine.DiskCacheStrategy | ||||
| @@ -9,10 +8,8 @@ import eu.davidea.flexibleadapter.items.IFlexible | ||||
| import eu.kanade.tachiyomi.data.glide.GlideApp | ||||
| import eu.kanade.tachiyomi.data.glide.toMangaThumbnail | ||||
| import eu.kanade.tachiyomi.data.preference.PreferencesHelper | ||||
| import eu.kanade.tachiyomi.data.preference.getOrDefault | ||||
| import eu.kanade.tachiyomi.source.LocalSource | ||||
| import eu.kanade.tachiyomi.util.view.visibleIf | ||||
| import kotlinx.android.synthetic.main.source_grid_item.card | ||||
| import kotlinx.android.synthetic.main.source_grid_item.download_text | ||||
| import kotlinx.android.synthetic.main.source_grid_item.local_text | ||||
| import kotlinx.android.synthetic.main.source_grid_item.thumbnail | ||||
| @@ -58,12 +55,6 @@ class LibraryGridHolder( | ||||
|         // set local visibility if its local manga | ||||
|         local_text.visibleIf { item.manga.source == LocalSource.ID } | ||||
|  | ||||
|         card.radius = TypedValue.applyDimension( | ||||
|             TypedValue.COMPLEX_UNIT_DIP, | ||||
|             preferences.eh_library_corner_radius().getOrDefault().toFloat(), | ||||
|             view.context.resources.displayMetrics | ||||
|         ) | ||||
|  | ||||
|         // Update the cover. | ||||
|         GlideApp.with(view.context).clear(thumbnail) | ||||
|         GlideApp.with(view.context) | ||||
|   | ||||
| @@ -38,6 +38,9 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference | ||||
|         val parent = adapter.recyclerView | ||||
|         return if (parent is AutofitRecyclerView) { | ||||
|             view.apply { | ||||
|                 // Setting this via XML doesn't work | ||||
|                 card.clipToOutline = true | ||||
|  | ||||
|                 val coverHeight = parent.itemWidth / 3 * 4 | ||||
|                 card.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight) | ||||
|                 gradient.layoutParams = FrameLayout.LayoutParams( | ||||
|   | ||||
| @@ -4,7 +4,6 @@ import android.content.Context | ||||
| import android.content.Intent | ||||
| import android.os.Bundle | ||||
| import android.text.TextUtils | ||||
| import android.util.TypedValue | ||||
| import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| @@ -115,6 +114,9 @@ class MangaInfoController(private val fromSource: Boolean = false) : | ||||
|     override fun onViewCreated(view: View) { | ||||
|         super.onViewCreated(view) | ||||
|  | ||||
|         // Setting this via XML doesn't work | ||||
|         binding.mangaCover.clipToOutline = true | ||||
|  | ||||
|         binding.btnFavorite.clicks() | ||||
|             .onEach { onFavoriteClick() } | ||||
|             .launchIn(scope) | ||||
| @@ -364,12 +366,6 @@ class MangaInfoController(private val fromSource: Boolean = false) : | ||||
|             thumbnailUrl = manga.thumbnail_url | ||||
|             val mangaThumbnail = manga.toMangaThumbnail() | ||||
|  | ||||
|             binding.mangaCoverCard.radius = TypedValue.applyDimension( | ||||
|                 TypedValue.COMPLEX_UNIT_DIP, | ||||
|                 preferences.eh_library_corner_radius().getOrDefault().toFloat(), | ||||
|                 view.context.resources.displayMetrics | ||||
|             ) | ||||
|  | ||||
|             GlideApp.with(view.context) | ||||
|                 .load(mangaThumbnail) | ||||
|                 .diskCacheStrategy(DiskCacheStrategy.RESOURCE) | ||||
|   | ||||
| @@ -72,19 +72,6 @@ class SettingsLibraryController : SettingsController() { | ||||
|                             "${context.getString(R.string.landscape)}: $landscape" | ||||
|                     } | ||||
|             } | ||||
|             intListPreference { | ||||
|                 key = Keys.eh_library_rounded_corners | ||||
|                 title = "Rounded Corner Radius" | ||||
|                 entriesRes = arrayOf( | ||||
|                     R.string.eh_rounded_corner_0, R.string.eh_rounded_corner_1, | ||||
|                     R.string.eh_rounded_corner_2, R.string.eh_rounded_corner_3, R.string.eh_rounded_corner_4, | ||||
|                     R.string.eh_rounded_corner_5, R.string.eh_rounded_corner_6, R.string.eh_rounded_corner_7, | ||||
|                     R.string.eh_rounded_corner_8, R.string.eh_rounded_corner_9, R.string.eh_rounded_corner_10 | ||||
|                 ) | ||||
|                 entryValues = arrayOf("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10") | ||||
|                 defaultValue = "4" | ||||
|                 summaryRes = R.string.eh_rounded_corners_desc | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         val dbCategories = db.getCategories().executeAsBlocking() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user