refactor(ui): Update text and icon colors in metadata description adapters for delegated sources

This commit is contained in:
Cuong-Tran 2024-06-24 23:31:15 +07:00
parent e89f50c845
commit 06004de0f1
7 changed files with 21 additions and 18 deletions

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.view.LayoutInflater
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -31,8 +32,8 @@ fun EHentaiDescription(
) {
val context = LocalContext.current
// KMK -->
val textColor = MaterialTheme.colorScheme.secondary.toArgb()
val iconColor = MaterialTheme.colorScheme.primary.toArgb()
val textColor = LocalContentColor.current.toArgb()
val ratingBarSecondaryColor = MaterialTheme.colorScheme.outlineVariant.toArgb()
// KMK <--
AndroidView(
@ -107,7 +108,7 @@ fun EHentaiDescription(
binding.moreInfo.bindDrawable(context, R.drawable.ic_info_24dp, iconColor)
binding.moreInfo.text = context.stringResource(SYMR.strings.more_info)
binding.moreInfo.setTextColor(textColor)
binding.moreInfo.setTextColor(iconColor)
// KMK <--
listOf(

View file

@ -22,7 +22,7 @@ import tachiyomi.i18n.sy.SYMR
fun EightMusesDescription(state: State.Success, openMetadataViewer: () -> Unit) {
val context = LocalContext.current
// KMK -->
val textColor = MaterialTheme.colorScheme.secondary.toArgb()
val titleColor = MaterialTheme.colorScheme.primary.toArgb()
val iconColor = MaterialTheme.colorScheme.primary.toArgb()
// KMK <--
AndroidView(
@ -37,11 +37,11 @@ fun EightMusesDescription(state: State.Success, openMetadataViewer: () -> Unit)
binding.title.text = meta.title ?: context.stringResource(MR.strings.unknown)
// KMK -->
binding.title.setTextColor(textColor)
binding.title.setTextColor(titleColor)
binding.moreInfo.bindDrawable(context, R.drawable.ic_info_24dp, iconColor)
binding.moreInfo.text = context.stringResource(SYMR.strings.more_info)
binding.moreInfo.setTextColor(textColor)
binding.moreInfo.setTextColor(iconColor)
// KMK <--
binding.title.setOnLongClickListener {
@ -51,9 +51,6 @@ fun EightMusesDescription(state: State.Success, openMetadataViewer: () -> Unit)
)
true
}
// KMK -->
binding.title.setTextColor(textColor)
// KMK <--
binding.moreInfo.setOnClickListener {
openMetadataViewer()

View file

@ -2,6 +2,7 @@ package exh.ui.metadata.adapters
import android.view.LayoutInflater
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -22,8 +23,8 @@ import tachiyomi.i18n.sy.SYMR
fun HBrowseDescription(state: State.Success, openMetadataViewer: () -> Unit) {
val context = LocalContext.current
// KMK -->
val textColor = MaterialTheme.colorScheme.secondary.toArgb()
val iconColor = MaterialTheme.colorScheme.primary.toArgb()
val textColor = LocalContentColor.current.toArgb()
// KMK <--
AndroidView(
modifier = Modifier.fillMaxWidth(),
@ -42,7 +43,7 @@ fun HBrowseDescription(state: State.Success, openMetadataViewer: () -> Unit) {
binding.moreInfo.bindDrawable(context, R.drawable.ic_info_24dp, iconColor)
binding.moreInfo.text = context.stringResource(SYMR.strings.more_info)
binding.moreInfo.setTextColor(textColor)
binding.moreInfo.setTextColor(iconColor)
// KMK <--
binding.pages.setOnLongClickListener {

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.view.LayoutInflater
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -26,8 +27,8 @@ import kotlin.math.round
fun MangaDexDescription(state: State.Success, openMetadataViewer: () -> Unit) {
val context = LocalContext.current
// KMK -->
val textColor = MaterialTheme.colorScheme.secondary.toArgb()
val iconColor = MaterialTheme.colorScheme.primary.toArgb()
val textColor = LocalContentColor.current.toArgb()
val ratingBarSecondaryColor = MaterialTheme.colorScheme.outlineVariant.toArgb()
// KMK <--
AndroidView(
@ -54,7 +55,7 @@ fun MangaDexDescription(state: State.Success, openMetadataViewer: () -> Unit) {
binding.moreInfo.bindDrawable(context, R.drawable.ic_info_24dp, iconColor)
binding.moreInfo.text = context.stringResource(SYMR.strings.more_info)
binding.moreInfo.setTextColor(textColor)
binding.moreInfo.setTextColor(iconColor)
// KMK <--
binding.rating.setOnLongClickListener {

View file

@ -3,6 +3,7 @@ package exh.ui.metadata.adapters
import android.annotation.SuppressLint
import android.view.LayoutInflater
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -29,8 +30,8 @@ import java.time.ZonedDateTime
fun NHentaiDescription(state: State.Success, openMetadataViewer: () -> Unit) {
val context = LocalContext.current
// KMK -->
val textColor = MaterialTheme.colorScheme.secondary.toArgb()
val iconColor = MaterialTheme.colorScheme.primary.toArgb()
val textColor = LocalContentColor.current.toArgb()
// KMK <--
AndroidView(
modifier = Modifier.fillMaxWidth(),
@ -92,7 +93,7 @@ fun NHentaiDescription(state: State.Success, openMetadataViewer: () -> Unit) {
binding.moreInfo.bindDrawable(context, R.drawable.ic_info_24dp, iconColor)
binding.moreInfo.text = context.stringResource(SYMR.strings.more_info)
binding.moreInfo.setTextColor(textColor)
binding.moreInfo.setTextColor(iconColor)
// KMK <--
listOf(

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.view.LayoutInflater
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -27,8 +28,8 @@ import kotlin.math.round
fun PururinDescription(state: State.Success, openMetadataViewer: () -> Unit) {
val context = LocalContext.current
// KMK -->
val textColor = MaterialTheme.colorScheme.secondary.toArgb()
val iconColor = MaterialTheme.colorScheme.primary.toArgb()
val textColor = LocalContentColor.current.toArgb()
val ratingBarSecondaryColor = MaterialTheme.colorScheme.outlineVariant.toArgb()
// KMK <--
AndroidView(
@ -80,7 +81,7 @@ fun PururinDescription(state: State.Success, openMetadataViewer: () -> Unit) {
binding.moreInfo.bindDrawable(context, R.drawable.ic_info_24dp, iconColor)
binding.moreInfo.text = context.stringResource(SYMR.strings.more_info)
binding.moreInfo.setTextColor(textColor)
binding.moreInfo.setTextColor(iconColor)
// KMK <--
listOf(

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.view.LayoutInflater
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -28,8 +29,8 @@ import kotlin.math.round
fun TsuminoDescription(state: State.Success, openMetadataViewer: () -> Unit) {
val context = LocalContext.current
// KMK -->
val textColor = MaterialTheme.colorScheme.secondary.toArgb()
val iconColor = MaterialTheme.colorScheme.primary.toArgb()
val textColor = LocalContentColor.current.toArgb()
val ratingBarSecondaryColor = MaterialTheme.colorScheme.outlineVariant.toArgb()
// KMK <--
AndroidView(
@ -83,7 +84,7 @@ fun TsuminoDescription(state: State.Success, openMetadataViewer: () -> Unit) {
binding.moreInfo.bindDrawable(context, R.drawable.ic_info_24dp, iconColor)
binding.moreInfo.text = context.stringResource(SYMR.strings.more_info)
binding.moreInfo.setTextColor(textColor)
binding.moreInfo.setTextColor(iconColor)
// KMK <--
listOf(