mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Replace some old color attribute usages
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| package eu.kanade.tachiyomi.ui.manga.chapter | ||||
|  | ||||
| import android.content.Context | ||||
| import androidx.core.content.ContextCompat | ||||
| import eu.davidea.flexibleadapter.FlexibleAdapter | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.preference.PreferencesHelper | ||||
| @@ -20,9 +21,8 @@ class ChaptersAdapter( | ||||
|  | ||||
|     var items: List<ChapterItem> = emptyList() | ||||
|  | ||||
|     val readColor = context.getResourceColor(android.R.attr.textColorHint) | ||||
|  | ||||
|     val unreadColor = context.getResourceColor(android.R.attr.textColorPrimary) | ||||
|     val readColor = ContextCompat.getColor(context, R.color.material_on_surface_disabled) | ||||
|     val unreadColor = context.getResourceColor(R.attr.colorOnSurface) | ||||
|  | ||||
|     val bookmarkedColor = context.getResourceColor(R.attr.colorAccent) | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package eu.kanade.tachiyomi.ui.recent.updates | ||||
|  | ||||
| import android.view.View | ||||
| import androidx.core.content.ContextCompat | ||||
| import com.bumptech.glide.load.engine.DiskCacheStrategy | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.download.model.Download | ||||
| @@ -25,15 +26,8 @@ import kotlinx.android.synthetic.main.updates_item.manga_title | ||||
| class UpdatesHolder(private val view: View, private val adapter: UpdatesAdapter) : | ||||
|         BaseFlexibleViewHolder(view, adapter) { | ||||
|  | ||||
|     /** | ||||
|      * Color of read chapter | ||||
|      */ | ||||
|     private var readColor = view.context.getResourceColor(android.R.attr.textColorHint) | ||||
|  | ||||
|     /** | ||||
|      * Color of unread chapter | ||||
|      */ | ||||
|     private var unreadColor = view.context.getResourceColor(android.R.attr.textColorPrimary) | ||||
|     private var readColor = ContextCompat.getColor(view.context, R.color.material_on_surface_disabled) | ||||
|     private var unreadColor = view.context.getResourceColor(R.attr.colorOnSurface) | ||||
|  | ||||
|     /** | ||||
|      * Currently bound item. | ||||
|   | ||||
| @@ -1,8 +1,10 @@ | ||||
| package eu.kanade.tachiyomi.ui.source.browse | ||||
|  | ||||
| import android.view.View | ||||
| import androidx.core.content.ContextCompat | ||||
| import com.bumptech.glide.load.engine.DiskCacheStrategy | ||||
| import eu.davidea.flexibleadapter.FlexibleAdapter | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| import eu.kanade.tachiyomi.data.glide.GlideApp | ||||
| import eu.kanade.tachiyomi.util.system.getResourceColor | ||||
| @@ -20,8 +22,8 @@ import kotlinx.android.synthetic.main.source_list_item.title | ||||
| class SourceListHolder(private val view: View, adapter: FlexibleAdapter<*>) : | ||||
|         SourceHolder(view, adapter) { | ||||
|  | ||||
|     private val favoriteColor = view.context.getResourceColor(android.R.attr.textColorHint) | ||||
|     private val unfavoriteColor = view.context.getResourceColor(android.R.attr.textColorPrimary) | ||||
|     private val favoriteColor = ContextCompat.getColor(view.context, R.color.material_on_surface_disabled) | ||||
|     private val unfavoriteColor = view.context.getResourceColor(R.attr.colorOnSurface) | ||||
|  | ||||
|     /** | ||||
|      * Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.source.filter | ||||
|  | ||||
| import android.view.View | ||||
| import android.widget.CheckedTextView | ||||
| import androidx.core.content.ContextCompat | ||||
| import androidx.recyclerview.widget.RecyclerView | ||||
| import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat | ||||
| import com.google.android.material.R | ||||
| @@ -39,11 +40,11 @@ open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem<TriS | ||||
|             else -> throw Exception("Unknown state") | ||||
|         }, null)?.apply { | ||||
|             val color = if (filter.state == Filter.TriState.STATE_INCLUDE) | ||||
|                 R.attr.colorAccent | ||||
|                 view.context.getResourceColor(R.attr.colorAccent) | ||||
|             else | ||||
|                 android.R.attr.textColorSecondary | ||||
|                 ContextCompat.getColor(view.context, R.color.material_on_background_disabled) | ||||
|  | ||||
|             setTint(view.context.getResourceColor(color)) | ||||
|             setTint(color) | ||||
|         } | ||||
|  | ||||
|         view.setCompoundDrawablesWithIntrinsicBounds(getIcon(), null, null, null) | ||||
|   | ||||
| @@ -4,11 +4,11 @@ import android.graphics.drawable.Drawable | ||||
| import android.view.View | ||||
| import android.widget.ImageView | ||||
| import android.widget.ImageView.ScaleType | ||||
| import androidx.core.content.ContextCompat | ||||
| import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat | ||||
| import com.bumptech.glide.request.target.ImageViewTarget | ||||
| import com.bumptech.glide.request.transition.Transition | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.util.system.getResourceColor | ||||
| import eu.kanade.tachiyomi.util.view.gone | ||||
| import eu.kanade.tachiyomi.util.view.visible | ||||
|  | ||||
| @@ -24,11 +24,9 @@ import eu.kanade.tachiyomi.util.view.visible | ||||
| class StateImageViewTarget( | ||||
|     view: ImageView, | ||||
|     val progress: View? = null, | ||||
|     val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp, | ||||
|     val errorScaleType: ScaleType = ScaleType.CENTER | ||||
| ) : | ||||
|  | ||||
|         ImageViewTarget<Drawable>(view) { | ||||
|     private val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp, | ||||
|     private val errorScaleType: ScaleType = ScaleType.CENTER | ||||
| ) : ImageViewTarget<Drawable>(view) { | ||||
|  | ||||
|     private var resource: Drawable? = null | ||||
|  | ||||
| @@ -48,7 +46,7 @@ class StateImageViewTarget( | ||||
|         view.scaleType = errorScaleType | ||||
|  | ||||
|         val vector = VectorDrawableCompat.create(view.context.resources, errorDrawableRes, null) | ||||
|         vector?.setTint(view.context.getResourceColor(android.R.attr.textColorSecondary)) | ||||
|         vector?.setTint(ContextCompat.getColor(view.context, com.google.android.material.R.color.material_on_background_disabled)) | ||||
|         view.setImageDrawable(vector) | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user