Remove some uses of color resources

This commit is contained in:
arkon
2023-07-22 18:56:45 -04:00
parent 7b2764e8f7
commit ee26d6dffd
50 changed files with 83 additions and 113 deletions

View File

@@ -936,18 +936,20 @@ class ReaderActivity : BaseActivity() {
}
}
private val grayBackgroundColor = Color.rgb(0x20, 0x21, 0x25)
/**
* Initializes the reader subscriptions.
*/
init {
readerPreferences.readerTheme().changes()
.onEach { theme ->
binding.readerContainer.setBackgroundResource(
binding.readerContainer.setBackgroundColor(
when (theme) {
0 -> R.color.md_white_1000
2 -> R.color.reader_background_dark
0 -> Color.WHITE
2 -> grayBackgroundColor
3 -> automaticBackgroundColor()
else -> R.color.md_black_1000
else -> Color.BLACK
},
)
}
@@ -1000,9 +1002,9 @@ class ReaderActivity : BaseActivity() {
*/
private fun automaticBackgroundColor(): Int {
return if (baseContext.isNightMode()) {
R.color.reader_background_dark
grayBackgroundColor
} else {
R.color.md_white_1000
Color.WHITE
}
}

View File

@@ -66,7 +66,7 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet)
// Scale rect from 1f,1f to screen width and height
canvas.withScale(width.toFloat(), height.toFloat()) {
regionPaint.color = context.getColor(region.type.colorRes)
regionPaint.color = region.type.color
drawRect(rect, regionPaint)
}

View File

@@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.ui.reader.viewer
import android.graphics.Color
import android.graphics.PointF
import android.graphics.RectF
import androidx.annotation.StringRes
@@ -9,12 +10,12 @@ import eu.kanade.tachiyomi.util.lang.invert
abstract class ViewerNavigation {
sealed class NavigationRegion(@StringRes val nameRes: Int, val colorRes: Int) {
data object MENU : NavigationRegion(R.string.action_menu, R.color.navigation_menu)
data object PREV : NavigationRegion(R.string.nav_zone_prev, R.color.navigation_prev)
data object NEXT : NavigationRegion(R.string.nav_zone_next, R.color.navigation_next)
data object LEFT : NavigationRegion(R.string.nav_zone_left, R.color.navigation_left)
data object RIGHT : NavigationRegion(R.string.nav_zone_right, R.color.navigation_right)
sealed class NavigationRegion(@StringRes val nameRes: Int, val color: Int) {
data object MENU : NavigationRegion(R.string.action_menu, Color.argb(0xCC, 0x95, 0x81, 0x8D))
data object PREV : NavigationRegion(R.string.nav_zone_prev, Color.argb(0xCC, 0xFF, 0x77, 0x33))
data object NEXT : NavigationRegion(R.string.nav_zone_next, Color.argb(0xCC, 0x84, 0xE2, 0x96))
data object LEFT : NavigationRegion(R.string.nav_zone_left, Color.argb(0xCC, 0x7D, 0x11, 0x28))
data object RIGHT : NavigationRegion(R.string.nav_zone_right, Color.argb(0xCC, 0xA6, 0xCF, 0xD5))
}
data class Region(