Replace some old color attribute usages

This commit is contained in:
arkon 2020-04-19 11:13:04 -04:00
parent c88265ac04
commit 11e10f6eff
11 changed files with 40 additions and 53 deletions

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.manga.chapter package eu.kanade.tachiyomi.ui.manga.chapter
import android.content.Context import android.content.Context
import androidx.core.content.ContextCompat
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@ -20,9 +21,8 @@ class ChaptersAdapter(
var items: List<ChapterItem> = emptyList() var items: List<ChapterItem> = emptyList()
val readColor = context.getResourceColor(android.R.attr.textColorHint) val readColor = ContextCompat.getColor(context, R.color.material_on_surface_disabled)
val unreadColor = context.getResourceColor(R.attr.colorOnSurface)
val unreadColor = context.getResourceColor(android.R.attr.textColorPrimary)
val bookmarkedColor = context.getResourceColor(R.attr.colorAccent) val bookmarkedColor = context.getResourceColor(R.attr.colorAccent)

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.recent.updates package eu.kanade.tachiyomi.ui.recent.updates
import android.view.View import android.view.View
import androidx.core.content.ContextCompat
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download 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) : class UpdatesHolder(private val view: View, private val adapter: UpdatesAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
/** private var readColor = ContextCompat.getColor(view.context, R.color.material_on_surface_disabled)
* Color of read chapter private var unreadColor = view.context.getResourceColor(R.attr.colorOnSurface)
*/
private var readColor = view.context.getResourceColor(android.R.attr.textColorHint)
/**
* Color of unread chapter
*/
private var unreadColor = view.context.getResourceColor(android.R.attr.textColorPrimary)
/** /**
* Currently bound item. * Currently bound item.

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.source.browse package eu.kanade.tachiyomi.ui.source.browse
import android.view.View import android.view.View
import androidx.core.content.ContextCompat
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.util.system.getResourceColor 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<*>) : class SourceListHolder(private val view: View, adapter: FlexibleAdapter<*>) :
SourceHolder(view, adapter) { SourceHolder(view, adapter) {
private val favoriteColor = view.context.getResourceColor(android.R.attr.textColorHint) private val favoriteColor = ContextCompat.getColor(view.context, R.color.material_on_surface_disabled)
private val unfavoriteColor = view.context.getResourceColor(android.R.attr.textColorPrimary) private val unfavoriteColor = view.context.getResourceColor(R.attr.colorOnSurface)
/** /**
* Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this * Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import android.widget.CheckedTextView import android.widget.CheckedTextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import com.google.android.material.R import com.google.android.material.R
@ -39,11 +40,11 @@ open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem<TriS
else -> throw Exception("Unknown state") else -> throw Exception("Unknown state")
}, null)?.apply { }, null)?.apply {
val color = if (filter.state == Filter.TriState.STATE_INCLUDE) val color = if (filter.state == Filter.TriState.STATE_INCLUDE)
R.attr.colorAccent view.context.getResourceColor(R.attr.colorAccent)
else 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) view.setCompoundDrawablesWithIntrinsicBounds(getIcon(), null, null, null)

View File

@ -4,11 +4,11 @@ import android.graphics.drawable.Drawable
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.ImageView.ScaleType import android.widget.ImageView.ScaleType
import androidx.core.content.ContextCompat
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import com.bumptech.glide.request.target.ImageViewTarget import com.bumptech.glide.request.target.ImageViewTarget
import com.bumptech.glide.request.transition.Transition import com.bumptech.glide.request.transition.Transition
import eu.kanade.tachiyomi.R 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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
@ -24,11 +24,9 @@ import eu.kanade.tachiyomi.util.view.visible
class StateImageViewTarget( class StateImageViewTarget(
view: ImageView, view: ImageView,
val progress: View? = null, val progress: View? = null,
val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp, private val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp,
val errorScaleType: ScaleType = ScaleType.CENTER private val errorScaleType: ScaleType = ScaleType.CENTER
) : ) : ImageViewTarget<Drawable>(view) {
ImageViewTarget<Drawable>(view) {
private var resource: Drawable? = null private var resource: Drawable? = null
@ -48,7 +46,7 @@ class StateImageViewTarget(
view.scaleType = errorScaleType view.scaleType = errorScaleType
val vector = VectorDrawableCompat.create(view.context.resources, errorDrawableRes, null) 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) view.setImageDrawable(vector)
} }

View File

@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingTop="@dimen/material_component_lists_padding_above_list"> android:paddingTop="@dimen/material_component_lists_padding_above_list">
<ImageView <ImageView

View File

@ -209,7 +209,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Regular.SubHeading.Secondary" android:textAppearance="@style/TextAppearance.Regular.SubHeading.Secondary"
android:tint="?android:attr/textColorSecondary" android:tint="?attr/colorOnBackground"
app:layout_constraintBottom_toBottomOf="@id/brightness_seekbar" app:layout_constraintBottom_toBottomOf="@id/brightness_seekbar"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/brightness_seekbar" app:layout_constraintTop_toTopOf="@id/brightness_seekbar"

View File

@ -10,11 +10,12 @@
<TextView <TextView
android:id="@+id/section_text" android:id="@+id/section_text"
style="@style/TextAppearance.Regular.SubHeading.Light.Bold" style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:textColor="?attr/colorOnPrimary" /> android:textColor="?attr/colorOnPrimary"
android:textStyle="bold" />
</FrameLayout> </FrameLayout>

View File

@ -37,7 +37,7 @@
<TextView <TextView
android:id="@+id/unread_text" android:id="@+id/unread_text"
style="@style/TextAppearance.Regular.Caption.Light" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
@ -47,6 +47,7 @@
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toEndOf="@+id/download_text" app:layout_constraintStart_toEndOf="@+id/download_text"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -55,7 +56,7 @@
<TextView <TextView
android:id="@+id/download_text" android:id="@+id/download_text"
style="@style/TextAppearance.Regular.Caption.Light" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
@ -65,6 +66,7 @@
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toEndOf="@+id/local_text" app:layout_constraintStart_toEndOf="@+id/local_text"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -73,7 +75,7 @@
<TextView <TextView
android:id="@+id/local_text" android:id="@+id/local_text"
style="@style/TextAppearance.Regular.Caption.Light" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
@ -84,6 +86,7 @@
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:text="@string/local_source_badge" android:text="@string/local_source_badge"
android:textColor="@color/md_white_1000"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -93,7 +96,7 @@
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
style="@style/TextAppearance.Regular.Body1.Light" style="@style/TextAppearance.Regular.Body1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
@ -106,6 +109,7 @@
android:shadowDx="0" android:shadowDx="0"
android:shadowDy="0" android:shadowDy="0"
android:shadowRadius="4" android:shadowRadius="4"
android:textColor="@color/md_white_1000"
tools:text="Sample name" /> tools:text="Sample name" />
<ProgressBar <ProgressBar

View File

@ -43,7 +43,7 @@
<TextView <TextView
android:id="@+id/local_text" android:id="@+id/local_text"
style="@style/TextAppearance.Regular.Caption.Light" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
@ -57,6 +57,7 @@
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:text="@string/local_source_badge" android:text="@string/local_source_badge"
android:textColor="@color/md_white_1000"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/unread_text" app:layout_constraintEnd_toStartOf="@+id/unread_text"
@ -65,7 +66,7 @@
<TextView <TextView
android:id="@+id/unread_text" android:id="@+id/unread_text"
style="@style/TextAppearance.Regular.Caption.Light" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
@ -79,6 +80,7 @@
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -89,7 +91,7 @@
<TextView <TextView
android:id="@+id/download_text" android:id="@+id/download_text"
style="@style/TextAppearance.Regular.Caption.Light" style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
@ -103,6 +105,7 @@
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="@color/md_white_1000"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -59,10 +59,6 @@
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
</style> </style>
<style name="TextAppearance.Regular.Body1.Light">
<item name="android:textColor">@color/textColorPrimaryDark</item>
</style>
<style name="TextAppearance.Regular.Body1.Secondary"> <style name="TextAppearance.Regular.Body1.Secondary">
<item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:textColor">?android:attr/textColorSecondary</item>
</style> </style>
@ -71,12 +67,8 @@
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
</style> </style>
<style name="TextAppearance.Regular.Caption.Light">
<item name="android:textColor">@color/textColorPrimaryDark</item>
</style>
<style name="TextAppearance.Regular.Caption.Hint"> <style name="TextAppearance.Regular.Caption.Hint">
<item name="android:textColor">?android:attr/textColorHint</item> <item name="android:textColor">@color/material_on_surface_emphasis_medium</item>
</style> </style>
<style name="TextAppearance.Regular.SubHeading"> <style name="TextAppearance.Regular.SubHeading">
@ -91,14 +83,6 @@
<item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:textColor">?android:attr/textColorSecondary</item>
</style> </style>
<style name="TextAppearance.Regular.SubHeading.Light">
<item name="android:textColor">@color/textColorPrimaryDark</item>
</style>
<style name="TextAppearance.Regular.SubHeading.Light.Bold">
<item name="android:textStyle">bold</item>
</style>
<style name="TextAppearance.Medium"> <style name="TextAppearance.Medium">
<item name="android:fontFamily">sans-serif-medium</item> <item name="android:fontFamily">sans-serif-medium</item>
</style> </style>
@ -190,7 +174,8 @@
<style name="Theme.Widget.CheckBox" /> <style name="Theme.Widget.CheckBox" />
<style name="Theme.Widget.CheckBox.Light" parent="TextAppearance.Regular.Body1.Light"> <style name="Theme.Widget.CheckBox.Light" parent="TextAppearance.Regular.Body1">
<item name="android:textColor">@color/md_white_1000</item>
<item name="buttonTint">@color/md_white_1000</item> <item name="buttonTint">@color/md_white_1000</item>
</style> </style>