mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-25 10:37:51 +02:00
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:
@ -1,2 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest />
|
||||
<manifest />
|
||||
|
@ -152,7 +152,7 @@ fun AdaptiveSheet(
|
||||
Modifier.nestedScroll(
|
||||
remember(anchoredDraggableState) {
|
||||
anchoredDraggableState.preUpPostDownNestedScrollConnection(
|
||||
onFling = { scope.launch { anchoredDraggableState.settle(it) } }
|
||||
onFling = { scope.launch { anchoredDraggableState.settle(it) } },
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -202,7 +202,7 @@ fun AdaptiveSheet(
|
||||
}
|
||||
|
||||
private fun <T> AnchoredDraggableState<T>.preUpPostDownNestedScrollConnection(
|
||||
onFling: (velocity: Float) -> Unit
|
||||
onFling: (velocity: Float) -> Unit,
|
||||
) = object : NestedScrollConnection {
|
||||
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
||||
val delta = available.toFloat()
|
||||
|
@ -45,6 +45,7 @@ import dev.icerock.moko.resources.StringResource
|
||||
import tachiyomi.core.common.preference.Preference
|
||||
import tachiyomi.core.common.preference.TriState
|
||||
import tachiyomi.core.common.preference.toggle
|
||||
import tachiyomi.presentation.core.components.material.DISABLED_ALPHA
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
import tachiyomi.presentation.core.theme.header
|
||||
@ -55,8 +56,6 @@ object SettingsItemsPaddings {
|
||||
val Vertical = 10.dp
|
||||
}
|
||||
|
||||
private const val DisabledContentAlpha = 0.38f
|
||||
|
||||
@Composable
|
||||
fun HeadingItem(labelRes: StringResource) {
|
||||
HeadingItem(stringResource(labelRes))
|
||||
@ -279,7 +278,7 @@ fun TriStateItem(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.large),
|
||||
) {
|
||||
val stateAlpha = if (enabled && onClick != null) 1f else DisabledContentAlpha
|
||||
val stateAlpha = if (enabled && onClick != null) 1f else DISABLED_ALPHA
|
||||
|
||||
Icon(
|
||||
imageVector = when (state) {
|
||||
@ -292,7 +291,7 @@ fun TriStateItem(
|
||||
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = stateAlpha)
|
||||
} else {
|
||||
when (onClick) {
|
||||
null -> MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledContentAlpha)
|
||||
null -> MaterialTheme.colorScheme.onSurface.copy(alpha = DISABLED_ALPHA)
|
||||
else -> MaterialTheme.colorScheme.primary
|
||||
}
|
||||
},
|
||||
|
@ -200,8 +200,7 @@ private fun rememberColumnWidthSums(
|
||||
horizontalArrangement,
|
||||
contentPadding,
|
||||
) {
|
||||
{
|
||||
constraints ->
|
||||
{ constraints ->
|
||||
require(constraints.maxWidth != Constraints.Infinity) {
|
||||
"LazyVerticalGrid's width should be bound by parent"
|
||||
}
|
||||
|
@ -189,13 +189,13 @@ private fun <T> WheelPicker(
|
||||
}
|
||||
},
|
||||
state = lazyListState,
|
||||
contentPadding = PaddingValues(vertical = size.height / RowCount * ((RowCount - 1) / 2)),
|
||||
contentPadding = PaddingValues(vertical = size.height / ROW_COUNT * ((ROW_COUNT - 1) / 2)),
|
||||
flingBehavior = rememberSnapFlingBehavior(lazyListState = lazyListState),
|
||||
) {
|
||||
itemsIndexed(items) { index, item ->
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(size.height / RowCount)
|
||||
.height(size.height / ROW_COUNT)
|
||||
.width(size.width)
|
||||
.alpha(
|
||||
calculateAnimatedAlpha(
|
||||
@ -233,7 +233,7 @@ private fun calculateAnimatedAlpha(
|
||||
): Float {
|
||||
val distanceToIndexSnap = lazyListState.distanceToSnapForIndex(index).absoluteValue
|
||||
val viewPortHeight = lazyListState.layoutInfo.viewportSize.height.toFloat()
|
||||
val singleViewPortHeight = viewPortHeight / RowCount
|
||||
val singleViewPortHeight = viewPortHeight / ROW_COUNT
|
||||
return if (distanceToIndexSnap in 0..singleViewPortHeight.toInt()) {
|
||||
1.2f - (distanceToIndexSnap / singleViewPortHeight)
|
||||
} else {
|
||||
@ -252,7 +252,7 @@ object WheelPickerDefaults {
|
||||
fun Background(size: DpSize) {
|
||||
androidx.compose.material3.Surface(
|
||||
modifier = Modifier
|
||||
.size(size.width, size.height / RowCount),
|
||||
.size(size.width, size.height / ROW_COUNT),
|
||||
shape = RoundedCornerShape(MaterialTheme.padding.medium),
|
||||
color = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f),
|
||||
border = BorderStroke(1.dp, MaterialTheme.colorScheme.primary),
|
||||
@ -270,4 +270,4 @@ object WheelPickerDefaults {
|
||||
}
|
||||
}
|
||||
|
||||
private const val RowCount = 3
|
||||
private const val ROW_COUNT = 3
|
||||
|
@ -60,7 +60,7 @@ fun TextButton(
|
||||
containerColor = Color.Transparent,
|
||||
contentColor = MaterialTheme.colorScheme.primary,
|
||||
disabledContainerColor = Color.Transparent,
|
||||
disabledContentColor = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f),
|
||||
disabledContentColor = MaterialTheme.colorScheme.onSurface.copy(alpha = DISABLED_ALPHA),
|
||||
),
|
||||
contentPadding: PaddingValues = M3ButtonDefaults.TextButtonContentPadding,
|
||||
content: @Composable RowScope.() -> Unit,
|
||||
@ -145,7 +145,7 @@ object ButtonDefaults {
|
||||
containerColor: Color = MaterialTheme.colorScheme.primary,
|
||||
contentColor: Color = MaterialTheme.colorScheme.onPrimary,
|
||||
disabledContainerColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.12f),
|
||||
disabledContentColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f),
|
||||
disabledContentColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = DISABLED_ALPHA),
|
||||
): ButtonColors = ButtonColors(
|
||||
containerColor = containerColor,
|
||||
contentColor = contentColor,
|
||||
|
@ -6,8 +6,8 @@ import androidx.compose.ui.unit.dp
|
||||
|
||||
val topSmallPaddingValues = PaddingValues(top = MaterialTheme.padding.small)
|
||||
|
||||
const val ReadItemAlpha = .38f
|
||||
const val SecondaryItemAlpha = .78f
|
||||
const val DISABLED_ALPHA = .38f
|
||||
const val SECONDARY_ALPHA = .78f
|
||||
|
||||
class Padding {
|
||||
|
||||
|
@ -262,14 +262,13 @@ private fun ScaffoldLayout(
|
||||
val fabOffsetDp = fabOffsetFromBottom?.toDp() ?: 0.dp
|
||||
val bottomBarHeightPx = bottomBarHeight ?: 0
|
||||
val innerPadding = PaddingValues(
|
||||
top =
|
||||
if (topBarPlaceables.isEmpty()) {
|
||||
top = if (topBarPlaceables.isEmpty()) {
|
||||
insets.calculateTopPadding()
|
||||
} else {
|
||||
topBarHeight.toDp()
|
||||
},
|
||||
bottom = // Tachiyomi: Also take account of fab height when providing inner padding
|
||||
if (bottomBarPlaceables.isEmpty() || bottomBarHeightPx == 0) {
|
||||
// Tachiyomi: Also take account of fab height when providing inner padding
|
||||
bottom = if (bottomBarPlaceables.isEmpty() || bottomBarHeightPx == 0) {
|
||||
max(insets.calculateBottomPadding(), fabOffsetDp)
|
||||
} else {
|
||||
max(bottomBarHeightPx.toDp(), fabOffsetDp)
|
||||
|
@ -10,18 +10,26 @@ import androidx.compose.ui.graphics.vector.ImageVector.Builder
|
||||
import androidx.compose.ui.graphics.vector.path
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Suppress("UnusedReceiverParameter", "BooleanLiteralArgument")
|
||||
val CustomIcons.Discord: ImageVector
|
||||
get() {
|
||||
if (_discord != null) {
|
||||
return _discord!!
|
||||
}
|
||||
_discord = Builder(
|
||||
name = "Discord", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f, viewportHeight = 24.0f,
|
||||
name = "Discord",
|
||||
defaultWidth = 24.0.dp,
|
||||
defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f,
|
||||
viewportHeight = 24.0f,
|
||||
).apply {
|
||||
path(
|
||||
fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
|
||||
fill = SolidColor(Color(0xFF000000)),
|
||||
stroke = null,
|
||||
strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt,
|
||||
strokeLineJoin = Miter,
|
||||
strokeLineMiter = 4.0f,
|
||||
pathFillType = NonZero,
|
||||
) {
|
||||
moveTo(20.317f, 4.3698f)
|
||||
@ -74,4 +82,5 @@ val CustomIcons.Discord: ImageVector
|
||||
return _discord!!
|
||||
}
|
||||
|
||||
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
|
||||
private var _discord: ImageVector? = null
|
||||
|
@ -10,18 +10,26 @@ import androidx.compose.ui.graphics.vector.ImageVector.Builder
|
||||
import androidx.compose.ui.graphics.vector.path
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Suppress("UnusedReceiverParameter")
|
||||
val CustomIcons.Facebook: ImageVector
|
||||
get() {
|
||||
if (_facebook != null) {
|
||||
return _facebook!!
|
||||
}
|
||||
_facebook = Builder(
|
||||
name = "Facebook", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f, viewportHeight = 24.0f,
|
||||
name = "Facebook",
|
||||
defaultWidth = 24.0.dp,
|
||||
defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f,
|
||||
viewportHeight = 24.0f,
|
||||
).apply {
|
||||
path(
|
||||
fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
|
||||
fill = SolidColor(Color(0xFF000000)),
|
||||
stroke = null,
|
||||
strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt,
|
||||
strokeLineJoin = Miter,
|
||||
strokeLineMiter = 4.0f,
|
||||
pathFillType = NonZero,
|
||||
) {
|
||||
moveTo(24.0f, 12.073f)
|
||||
@ -51,4 +59,5 @@ val CustomIcons.Facebook: ImageVector
|
||||
return _facebook!!
|
||||
}
|
||||
|
||||
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
|
||||
private var _facebook: ImageVector? = null
|
||||
|
@ -10,18 +10,26 @@ import androidx.compose.ui.graphics.vector.ImageVector.Builder
|
||||
import androidx.compose.ui.graphics.vector.path
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Suppress("UnusedReceiverParameter")
|
||||
val CustomIcons.Github: ImageVector
|
||||
get() {
|
||||
if (_github != null) {
|
||||
return _github!!
|
||||
}
|
||||
_github = Builder(
|
||||
name = "Github", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f, viewportHeight = 24.0f,
|
||||
name = "Github",
|
||||
defaultWidth = 24.0.dp,
|
||||
defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f,
|
||||
viewportHeight = 24.0f,
|
||||
).apply {
|
||||
path(
|
||||
fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
|
||||
fill = SolidColor(Color(0xFF000000)),
|
||||
stroke = null,
|
||||
strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt,
|
||||
strokeLineJoin = Miter,
|
||||
strokeLineMiter = 4.0f,
|
||||
pathFillType = NonZero,
|
||||
) {
|
||||
moveTo(12.0f, 0.297f)
|
||||
@ -56,4 +64,5 @@ val CustomIcons.Github: ImageVector
|
||||
return _github!!
|
||||
}
|
||||
|
||||
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
|
||||
private var _github: ImageVector? = null
|
||||
|
@ -10,18 +10,26 @@ import androidx.compose.ui.graphics.vector.ImageVector.Builder
|
||||
import androidx.compose.ui.graphics.vector.path
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Suppress("UnusedReceiverParameter", "BooleanLiteralArgument")
|
||||
val CustomIcons.Reddit: ImageVector
|
||||
get() {
|
||||
if (_reddit != null) {
|
||||
return _reddit!!
|
||||
}
|
||||
_reddit = Builder(
|
||||
name = "Reddit", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f, viewportHeight = 24.0f,
|
||||
name = "Reddit",
|
||||
defaultWidth = 24.0.dp,
|
||||
defaultHeight = 24.0.dp,
|
||||
viewportWidth = 24.0f,
|
||||
viewportHeight = 24.0f,
|
||||
).apply {
|
||||
path(
|
||||
fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
|
||||
fill = SolidColor(Color(0xFF000000)),
|
||||
stroke = null,
|
||||
strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt,
|
||||
strokeLineJoin = Miter,
|
||||
strokeLineMiter = 4.0f,
|
||||
pathFillType = NonZero,
|
||||
) {
|
||||
moveTo(12.0f, 0.0f)
|
||||
@ -82,4 +90,5 @@ val CustomIcons.Reddit: ImageVector
|
||||
return _reddit!!
|
||||
}
|
||||
|
||||
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
|
||||
private var _reddit: ImageVector? = null
|
||||
|
@ -10,20 +10,27 @@ import androidx.compose.ui.graphics.vector.ImageVector.Builder
|
||||
import androidx.compose.ui.graphics.vector.path
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Suppress("UnusedReceiverParameter")
|
||||
val CustomIcons.X: ImageVector
|
||||
get() {
|
||||
if (_x != null) {
|
||||
return _x!!
|
||||
}
|
||||
_x = Builder(
|
||||
name = "X", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp,
|
||||
name = "X",
|
||||
defaultWidth = 24.0.dp,
|
||||
defaultHeight = 24.0.dp,
|
||||
viewportWidth =
|
||||
24.0f,
|
||||
viewportHeight = 24.0f,
|
||||
).apply {
|
||||
path(
|
||||
fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
|
||||
fill = SolidColor(Color(0xFF000000)),
|
||||
stroke = null,
|
||||
strokeLineWidth = 0.0f,
|
||||
strokeLineCap = Butt,
|
||||
strokeLineJoin = Miter,
|
||||
strokeLineMiter = 4.0f,
|
||||
pathFillType = NonZero,
|
||||
) {
|
||||
moveTo(18.901f, 1.153f)
|
||||
@ -50,4 +57,5 @@ val CustomIcons.X: ImageVector
|
||||
return _x!!
|
||||
}
|
||||
|
||||
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
|
||||
private var _x: ImageVector? = null
|
||||
|
@ -22,7 +22,7 @@ import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.input.key.key
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
|
||||
import tachiyomi.presentation.core.components.material.SECONDARY_ALPHA
|
||||
|
||||
fun Modifier.selectedBackground(isSelected: Boolean): Modifier = if (isSelected) {
|
||||
composed {
|
||||
@ -36,7 +36,7 @@ fun Modifier.selectedBackground(isSelected: Boolean): Modifier = if (isSelected)
|
||||
this
|
||||
}
|
||||
|
||||
fun Modifier.secondaryItemAlpha(): Modifier = this.alpha(SecondaryItemAlpha)
|
||||
fun Modifier.secondaryItemAlpha(): Modifier = this.alpha(SECONDARY_ALPHA)
|
||||
|
||||
fun Modifier.clickableNoIndication(
|
||||
onLongClick: (() -> Unit)? = null,
|
||||
|
@ -39,4 +39,4 @@
|
||||
<color name="midnightdusk_surfaceContainer">#281624</color>
|
||||
<color name="midnightdusk_surfaceContainerHigh">#2D1C2A</color>
|
||||
<color name="midnightdusk_surfaceContainerHighest">#2F1F2C</color>
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -38,4 +38,4 @@
|
||||
<color name="tidalwave_surfaceContainer">#082b4b</color>
|
||||
<color name="tidalwave_surfaceContainerHigh">#093257</color>
|
||||
<color name="tidalwave_surfaceContainerHighest">#0A3861</color>
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -39,4 +39,4 @@
|
||||
<color name="tidalwave_surfaceContainer">#e8eff5</color>
|
||||
<color name="tidalwave_surfaceContainerHigh">#edf4fA</color>
|
||||
<color name="tidalwave_surfaceContainerHighest">#f5faff</color>
|
||||
</resources>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user