Automatic Lint

This commit is contained in:
Syer10
2022-11-10 18:20:47 +00:00
parent f3e455b007
commit 5542a3b97f
5 changed files with 38 additions and 38 deletions

View File

@@ -164,7 +164,7 @@ fun SettingsAppearanceScreenContent(
WindowInsets.navigationBars.only(
WindowInsetsSides.Bottom
)
).asPaddingValues(),
).asPaddingValues()
) {
item {
ChoicePreference(
@@ -187,18 +187,18 @@ fun SettingsAppearanceScreenContent(
.animateContentSize()
.padding(vertical = 8.dp),
contentPadding = PaddingValues(horizontal = 8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
items(themesForCurrentMode) { theme ->
Column(
modifier = Modifier
.width(114.dp)
.padding(top = 8.dp),
.padding(top = 8.dp)
) {
val isSelected = (isLight && currentLightTheme == theme.id) ||
(!isLight && currentDarkTheme == theme.id)
(!isLight && currentDarkTheme == theme.id)
MaterialTheme(
colors = if (isSelected) customColors else theme.colors,
colors = if (isSelected) customColors else theme.colors
) {
ExtraColors.WithExtraColors(
if (isSelected) customExtraColors else theme.extraColors
@@ -210,7 +210,7 @@ fun SettingsAppearanceScreenContent(
activeColors.primaryStateFlow.value = theme.colors.primary
activeColors.secondaryStateFlow.value = theme.colors.secondary
activeColors.tertiaryStateFlow.value = theme.extraColors.tertiary
},
}
)
}
}
@@ -224,7 +224,7 @@ fun SettingsAppearanceScreenContent(
color = MaterialTheme.colors.onSurface,
textAlign = TextAlign.Center,
maxLines = 2,
style = MaterialTheme.typography.body2,
style = MaterialTheme.typography.body2
)
}
}
@@ -284,7 +284,7 @@ fun SettingsAppearanceScreenContent(
@Composable
fun AppThemePreviewItem(
selected: Boolean,
onClick: () -> Unit,
onClick: () -> Unit
) {
val dividerColor = MaterialTheme.colors.onSurface.copy(alpha = 0.2F)
Column(
@@ -298,12 +298,12 @@ fun AppThemePreviewItem(
} else {
dividerColor
},
shape = RoundedCornerShape(17.dp),
shape = RoundedCornerShape(17.dp)
)
.padding(4.dp)
.clip(RoundedCornerShape(13.dp))
.background(MaterialTheme.colors.background)
.clickable(onClick = onClick),
.clickable(onClick = onClick)
) {
// App Bar
Row(
@@ -311,7 +311,7 @@ fun AppThemePreviewItem(
.fillMaxWidth()
.height(40.dp)
.padding(8.dp),
verticalAlignment = Alignment.CenterVertically,
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
@@ -320,19 +320,19 @@ fun AppThemePreviewItem(
.padding(end = 4.dp)
.background(
color = MaterialTheme.colors.onSurface,
shape = MaterialTheme.shapes.small,
),
shape = MaterialTheme.shapes.small
)
)
Box(
modifier = Modifier.weight(0.3f),
contentAlignment = Alignment.CenterEnd,
contentAlignment = Alignment.CenterEnd
) {
if (selected) {
Icon(
imageVector = Icons.Filled.CheckCircle,
contentDescription = null,
tint = MaterialTheme.colors.primary,
tint = MaterialTheme.colors.primary
)
}
}
@@ -344,28 +344,28 @@ fun AppThemePreviewItem(
.padding(start = 8.dp, top = 2.dp)
.background(
color = dividerColor,
shape = MaterialTheme.shapes.small,
shape = MaterialTheme.shapes.small
)
.fillMaxWidth(0.5f)
.aspectRatio(mangaAspectRatio),
.aspectRatio(mangaAspectRatio)
) {
Row(
modifier = Modifier
.padding(4.dp)
.size(width = 24.dp, height = 16.dp)
.clip(RoundedCornerShape(5.dp)),
.clip(RoundedCornerShape(5.dp))
) {
Box(
modifier = Modifier
.fillMaxHeight()
.width(12.dp)
.background(MaterialTheme.extraColors.tertiary),
.background(MaterialTheme.extraColors.tertiary)
)
Box(
modifier = Modifier
.fillMaxHeight()
.width(12.dp)
.background(MaterialTheme.colors.secondary),
.background(MaterialTheme.colors.secondary)
)
}
}
@@ -375,10 +375,10 @@ fun AppThemePreviewItem(
modifier = Modifier
.fillMaxWidth()
.weight(1f),
contentAlignment = Alignment.BottomCenter,
contentAlignment = Alignment.BottomCenter
) {
Surface(
elevation = 3.dp,
elevation = 3.dp
) {
Row(
modifier = Modifier
@@ -386,15 +386,15 @@ fun AppThemePreviewItem(
.fillMaxWidth()
.background(MaterialTheme.colors.primarySurface)
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically,
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
.size(17.dp)
.background(
color = MaterialTheme.colors.primary,
shape = CircleShape,
),
shape = CircleShape
)
)
Box(
modifier = Modifier
@@ -404,11 +404,11 @@ fun AppThemePreviewItem(
.weight(1f)
.background(
color = MaterialTheme.colors.onSurface,
shape = MaterialTheme.shapes.small,
),
shape = MaterialTheme.shapes.small
)
)
}
}
}
}
}
}

View File

@@ -18,4 +18,4 @@ val verticalPadding = vertical
val topPaddingValues = PaddingValues(top = vertical)
const val ReadItemAlpha = .38f
const val SecondaryItemAlpha = .78f
const val SecondaryItemAlpha = .78f

View File

@@ -22,4 +22,4 @@ fun Modifier.selectedBackground(isSelected: Boolean): Modifier = composed {
}
}
fun Modifier.secondaryItemAlpha(): Modifier = this.alpha(SecondaryItemAlpha)
fun Modifier.secondaryItemAlpha(): Modifier = this.alpha(SecondaryItemAlpha)

View File

@@ -20,7 +20,7 @@ import androidx.compose.ui.graphics.Color
@Stable
class ExtraColors(
tertiary: Color,
onTertiary: Color,
onTertiary: Color
) {
var tertiary by mutableStateOf(tertiary, structuralEqualityPolicy())
internal set
@@ -29,17 +29,17 @@ class ExtraColors(
fun copy(
tertiary: Color = this.tertiary,
onTertiary: Color = this.onTertiary,
onTertiary: Color = this.onTertiary
): ExtraColors = ExtraColors(
tertiary,
onTertiary,
onTertiary
)
override fun toString(): String {
return "ExtraColors(" +
"tertiary=$tertiary, " +
"onTertiary=$onTertiary, " +
")"
"tertiary=$tertiary, " +
"onTertiary=$onTertiary, " +
")"
}
companion object {
@@ -59,4 +59,4 @@ val MaterialTheme.extraColors: ExtraColors
private val LocalExtraColors = staticCompositionLocalOf<ExtraColors> {
error("The AppColors composable must be called before usage")
}
}

View File

@@ -78,7 +78,7 @@ fun tachiyomiDarkColors(
fun extraColors(
tertiary: Color = Color(0xFF006E17),
onTertiary: Color = Color.White,
onTertiary: Color = Color.White
) = ExtraColors(
tertiary = tertiary,
onTertiary = onTertiary