Address spotless lint errors (#1138)

* Add spotless (with ktlint)

* Run spotlessApply

* screaming case screaming case screaming case

* Update PagerViewerAdapter.kt

* Update ReaderTransitionView.kt
This commit is contained in:
AntsyLich
2024-08-19 18:11:39 +06:00
committed by GitHub
parent 5ae8095ef1
commit d6252ab770
230 changed files with 580 additions and 467 deletions
@@ -32,7 +32,7 @@ import java.time.temporal.WeekFields
import java.util.Locale
private val FontSize = 16.sp
private const val DaysOfWeek = 7
private const val DAYS_OF_WEEK = 7
@Composable
fun Calendar(
@@ -54,7 +54,7 @@ fun Calendar(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = MaterialTheme.padding.small)
.padding(start = MaterialTheme.padding.medium)
.padding(start = MaterialTheme.padding.medium),
)
CalendarGrid(
selectedYearMonth = selectedYearMonth,
@@ -72,8 +72,8 @@ private fun CalendarGrid(
) {
val localeFirstDayOfWeek = WeekFields.of(Locale.getDefault()).firstDayOfWeek.value
val weekDays = remember {
(0 until DaysOfWeek)
.map { DayOfWeek.of((localeFirstDayOfWeek - 1 + it) % DaysOfWeek + 1) }
(0 until DAYS_OF_WEEK)
.map { DayOfWeek.of((localeFirstDayOfWeek - 1 + it) % DAYS_OF_WEEK + 1) }
.toImmutableList()
}
@@ -81,12 +81,12 @@ private fun CalendarGrid(
val daysInMonth = selectedYearMonth.lengthOfMonth()
VerticalGrid(
columns = SimpleGridCells.Fixed(DaysOfWeek),
columns = SimpleGridCells.Fixed(DAYS_OF_WEEK),
modifier = if (isMediumWidthWindow() && !isExpandedWidthWindow()) {
Modifier.widthIn(max = 360.dp)
} else {
Modifier
}
},
) {
weekDays.fastForEach { item ->
Text(
@@ -19,9 +19,10 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import tachiyomi.presentation.core.components.material.DISABLED_ALPHA
import java.time.LocalDate
private const val MaxEvents = 3
private const val MAX_EVENTS = 3
@Composable
fun CalendarDay(
@@ -39,7 +40,7 @@ fun CalendarDay(
Modifier.border(
border = BorderStroke(
width = 1.dp,
color = MaterialTheme.colorScheme.onBackground
color = MaterialTheme.colorScheme.onBackground,
),
shape = CircleShape,
)
@@ -57,14 +58,14 @@ fun CalendarDay(
textAlign = TextAlign.Center,
fontSize = 16.sp,
color = if (date.isBefore(today)) {
MaterialTheme.colorScheme.onBackground.copy(alpha = 0.38f)
MaterialTheme.colorScheme.onBackground.copy(alpha = DISABLED_ALPHA)
} else {
MaterialTheme.colorScheme.onBackground
},
fontWeight = FontWeight.SemiBold,
)
Row(Modifier.offset(y = 12.dp)) {
val size = events.coerceAtMost(MaxEvents)
val size = events.coerceAtMost(MAX_EVENTS)
for (index in 0 until size) {
CalendarIndicator(
index = index,
@@ -63,20 +63,20 @@ fun CalenderHeader(
}
}
private const val MonthYearChangeAnimationDuration = 200
private const val MONTH_YEAR_CHANGE_ANIMATION_DURATION = 200
private fun AnimatedContentTransitionScope<YearMonth>.getAnimation(): ContentTransform {
val movingForward = targetState > initialState
val enterTransition = slideInVertically(
animationSpec = tween(durationMillis = MonthYearChangeAnimationDuration),
animationSpec = tween(durationMillis = MONTH_YEAR_CHANGE_ANIMATION_DURATION),
) { height -> if (movingForward) height else -height } + fadeIn(
animationSpec = tween(durationMillis = MonthYearChangeAnimationDuration),
animationSpec = tween(durationMillis = MONTH_YEAR_CHANGE_ANIMATION_DURATION),
)
val exitTransition = slideOutVertically(
animationSpec = tween(durationMillis = MonthYearChangeAnimationDuration),
animationSpec = tween(durationMillis = MONTH_YEAR_CHANGE_ANIMATION_DURATION),
) { height -> if (movingForward) -height else height } + fadeOut(
animationSpec = tween(durationMillis = MonthYearChangeAnimationDuration),
animationSpec = tween(durationMillis = MONTH_YEAR_CHANGE_ANIMATION_DURATION),
)
return (enterTransition togetherWith exitTransition)
.using(SizeTransform(clip = false))
@@ -12,8 +12,8 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
private const val IndicatorScale = 12
private const val IndicatorAlphaMultiplier = 0.3f
private const val INDICATOR_SCALE = 12
private const val INDICATOR_ALPHA_MULTIPLIER = 0.3f
@Composable
fun CalendarIndicator(
@@ -26,7 +26,7 @@ fun CalendarIndicator(
modifier = modifier
.padding(horizontal = 1.dp)
.clip(shape = CircleShape)
.background(color = color.copy(alpha = (index + 1) * IndicatorAlphaMultiplier))
.size(size = size.div(IndicatorScale)),
.background(color = color.copy(alpha = (index + 1) * INDICATOR_ALPHA_MULTIPLIER))
.size(size = size.div(INDICATOR_SCALE)),
)
}