@@ -156,9 +156,7 @@ internal fun PreferenceItem(
|
||||
.collectAsState()
|
||||
item.service.run {
|
||||
TrackingPreferenceWidget(
|
||||
title = item.title,
|
||||
logoRes = getLogo(),
|
||||
logoColor = getLogoColor(),
|
||||
service = this,
|
||||
checked = uName.isNotEmpty(),
|
||||
onClick = { if (isLogged) item.logout() else item.login() },
|
||||
)
|
||||
|
||||
@@ -96,7 +96,7 @@ sealed class Preference {
|
||||
v.map { e[it] }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?.joinToString()
|
||||
} ?: stringResource(id = R.string.none)
|
||||
} ?: stringResource(R.string.none)
|
||||
subtitle?.format(combined)
|
||||
},
|
||||
override val icon: ImageVector? = null,
|
||||
|
||||
@@ -23,7 +23,7 @@ fun PreferenceScaffold(
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(text = stringResource(id = titleRes)) },
|
||||
title = { Text(text = stringResource(titleRes)) },
|
||||
navigationIcon = {
|
||||
if (onBackPressed != null) {
|
||||
IconButton(onClick = onBackPressed) {
|
||||
|
||||
@@ -52,7 +52,7 @@ internal fun InfoWidget(text: String) {
|
||||
private fun InfoWidgetPreview() {
|
||||
TachiyomiTheme {
|
||||
Surface {
|
||||
InfoWidget(text = stringResource(id = R.string.download_ahead_info))
|
||||
InfoWidget(text = stringResource(R.string.download_ahead_info))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package eu.kanade.presentation.more.settings.widget
|
||||
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
@@ -19,18 +15,17 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.components.TrackLogoIcon
|
||||
import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
|
||||
@Composable
|
||||
fun TrackingPreferenceWidget(
|
||||
modifier: Modifier = Modifier,
|
||||
title: String,
|
||||
@DrawableRes logoRes: Int,
|
||||
@ColorInt logoColor: Int,
|
||||
service: TrackService,
|
||||
checked: Boolean,
|
||||
onClick: (() -> Unit)? = null,
|
||||
) {
|
||||
@@ -43,20 +38,9 @@ fun TrackingPreferenceWidget(
|
||||
.padding(horizontal = PrefsHorizontalPadding, vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.background(color = Color(logoColor), shape = MaterialTheme.shapes.small)
|
||||
.padding(4.dp),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = logoRes),
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
TrackLogoIcon(service)
|
||||
Text(
|
||||
text = title,
|
||||
text = stringResource(service.nameRes()),
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.padding(horizontal = 16.dp),
|
||||
|
||||
Reference in New Issue
Block a user