mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 23:49:16 +01:00
Replace some old color attribute usages
This commit is contained in:
parent
c88265ac04
commit
11e10f6eff
@ -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)
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingTop="@dimen/material_component_lists_padding_above_list">
|
||||
|
||||
<ImageView
|
||||
|
@ -209,7 +209,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/brightness_seekbar"
|
||||
|
@ -10,11 +10,12 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/section_text"
|
||||
style="@style/TextAppearance.Regular.SubHeading.Light.Bold"
|
||||
style="@style/TextAppearance.Regular.SubHeading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/colorOnPrimary" />
|
||||
android:textColor="?attr/colorOnPrimary"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
@ -47,6 +47,7 @@
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/download_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -55,7 +56,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
@ -65,6 +66,7 @@
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/local_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -73,7 +75,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
@ -84,6 +86,7 @@
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/local_source_badge"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -93,7 +96,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
@ -106,6 +109,7 @@
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="0"
|
||||
android:shadowRadius="4"
|
||||
android:textColor="@color/md_white_1000"
|
||||
tools:text="Sample name" />
|
||||
|
||||
<ProgressBar
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
@ -57,6 +57,7 @@
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/local_source_badge"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/unread_text"
|
||||
@ -65,7 +66,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
@ -79,6 +80,7 @@
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -89,7 +91,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
@ -103,6 +105,7 @@
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -59,10 +59,6 @@
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Regular.Body1.Light">
|
||||
<item name="android:textColor">@color/textColorPrimaryDark</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Regular.Body1.Secondary">
|
||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||
</style>
|
||||
@ -71,12 +67,8 @@
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Regular.Caption.Light">
|
||||
<item name="android:textColor">@color/textColorPrimaryDark</item>
|
||||
</style>
|
||||
|
||||
<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 name="TextAppearance.Regular.SubHeading">
|
||||
@ -91,14 +83,6 @@
|
||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||
</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">
|
||||
<item name="android:fontFamily">sans-serif-medium</item>
|
||||
</style>
|
||||
@ -190,7 +174,8 @@
|
||||
|
||||
<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>
|
||||
</style>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user