mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:25:08 +01:00
Fixes to unread badge color
This commit is contained in:
parent
84f21ebacc
commit
074f41ca7e
@ -7,9 +7,9 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.UnreadDownloadBadgeBinding
|
||||
import eu.kanade.tachiyomi.util.system.contextCompatColor
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.isVisible
|
||||
import eu.kanade.tachiyomi.util.view.setTextColorRes
|
||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||
|
||||
@ -26,9 +26,9 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
fun setUnreadDownload(unread: Int, downloads: Int, showTotalChapters: Boolean) {
|
||||
// Update the unread count and its visibility.
|
||||
|
||||
val unreadBadgeBackground = context.contextCompatColor(
|
||||
if (showTotalChapters) R.color.total_badge else R.color.unread_badge
|
||||
)
|
||||
val unreadBadgeBackground = if (showTotalChapters) {
|
||||
context.contextCompatColor(R.color.total_badge)
|
||||
} else context.getResourceColor(R.attr.colorAccent)
|
||||
|
||||
with(binding.unreadText) {
|
||||
visibleIf(unread > 0 || unread == -1 || showTotalChapters)
|
||||
@ -36,12 +36,12 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
return@with
|
||||
}
|
||||
text = if (unread == -1) "0" else unread.toString()
|
||||
setTextColorRes(
|
||||
setTextColor(
|
||||
// hide the badge text when preference is only show badge
|
||||
when {
|
||||
unread == -1 && !showTotalChapters -> R.color.unread_badge
|
||||
showTotalChapters -> R.color.total_badge_text
|
||||
else -> R.color.unread_badge_text
|
||||
unread == -1 && !showTotalChapters -> context.getResourceColor(R.attr.colorAccent)
|
||||
showTotalChapters -> context.contextCompatColor(R.color.total_badge_text)
|
||||
else -> context.contextCompatColor(R.color.unread_badge_text)
|
||||
}
|
||||
)
|
||||
setBackgroundColor(unreadBadgeBackground)
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?colorAccent"/>
|
||||
</selector>
|
@ -3,5 +3,5 @@
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:bottomRightRadius="10dp" />
|
||||
<solid android:color="@color/unread_badge" />
|
||||
<solid android:color="?colorAccent" />
|
||||
</shape>
|
@ -8,8 +8,8 @@
|
||||
tools:background="@color/material_red_500">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/unread_badge"
|
||||
android:fillColor="?colorAccent"
|
||||
android:pathData="M0 20 L100 0 L100 20 Z"
|
||||
android:strokeColor="@color/unread_badge" />
|
||||
android:strokeColor="?colorAccent" />
|
||||
|
||||
</vector>
|
@ -49,7 +49,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardBackgroundColor="@color/unread_badge"
|
||||
app:cardBackgroundColor="?colorAccent"
|
||||
app:cardElevation="2dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
@ -52,7 +52,7 @@
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/unread_badge"
|
||||
android:background="?colorAccent"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="5dp"
|
||||
|
Loading…
Reference in New Issue
Block a user