Automatic Lint

This commit is contained in:
Syer10
2022-11-07 02:13:22 +00:00
parent 1ad0c8f3eb
commit a3fdf4286a
21 changed files with 109 additions and 97 deletions

View File

@@ -36,4 +36,4 @@ class BatchChapterDownload @Inject constructor(private val downloadRepository: D
companion object {
private val log = logging()
}
}
}

View File

@@ -48,7 +48,7 @@ import kotlinx.coroutines.flow.asStateFlow
@Stable
data class ChapterDownloadItem(
val manga: Manga?,
val chapter: Chapter,
val chapter: Chapter
) {
private val _isSelected = MutableStateFlow(false)
val isSelected = _isSelected.asStateFlow()

View File

@@ -120,7 +120,7 @@ fun ActionMenu(
DropdownMenu(
expanded = menuVisible.value,
onDismissRequest = { menuVisible.value = false },
offset = DpOffset(8.dp, (-56).dp),
offset = DpOffset(8.dp, (-56).dp)
) {
overflowActions.fastForEach { item ->
key(item.hashCode()) {
@@ -144,7 +144,7 @@ fun ActionMenu(
DropdownMenu(
openGroup != null,
onDismissRequest = { openGroup = null },
offset = DpOffset(8.dp, (-56).dp),
offset = DpOffset(8.dp, (-56).dp)
) {
openGroup?.actions?.fastForEach { item ->
key(item.hashCode()) {

View File

@@ -192,7 +192,7 @@ private fun WideToolbar(
TextActionIcon(
onClick = onClose,
text = stringResource(MR.strings.action_close),
icon = if (closeIcon === ToolbarDefault) Icons.Rounded.Close else closeIcon,
icon = if (closeIcon === ToolbarDefault) Icons.Rounded.Close else closeIcon
)
}
}

View File

@@ -130,8 +130,6 @@ class MangaScreenViewModel @Inject constructor(
refreshMangaAsync(params.mangaId).await() to refreshChaptersAsync(params.mangaId).await()
_isLoading.value = false
}
}
fun loadManga() {

View File

@@ -96,7 +96,7 @@ fun ChapterItem(
}
Row(
horizontalArrangement = Arrangement.SpaceBetween,
horizontalArrangement = Arrangement.SpaceBetween
) {
Column(
Modifier.padding(4.dp).width(this@BoxWithConstraints.maxWidth - 60.dp)
@@ -109,7 +109,7 @@ fun ChapterItem(
contentDescription = stringResource(MR.strings.action_filter_bookmarked),
modifier = Modifier
.sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }),
tint = MaterialTheme.colors.primary,
tint = MaterialTheme.colors.primary
)
Spacer(modifier = Modifier.width(2.dp))
}

View File

@@ -378,27 +378,27 @@ private fun getBottomActionItems(
BottomActionItem(
name = stringResource(MR.strings.action_bookmark),
icon = Icons.Rounded.BookmarkAdd,
onClick = { bookmarkChapter(selectedItems.first().chapter.index) },
onClick = { bookmarkChapter(selectedItems.first().chapter.index) }
).takeIf { selectedItems.fastAny { !it.chapter.bookmarked } && selectedItems.size == 1 },
BottomActionItem(
name = stringResource(MR.strings.action_remove_bookmark),
icon = Icons.Rounded.BookmarkRemove,
onClick = { unBookmarkChapter(selectedItems.first().chapter.index) },
onClick = { unBookmarkChapter(selectedItems.first().chapter.index) }
).takeIf { selectedItems.fastAny { it.chapter.bookmarked } && selectedItems.size == 1 },
BottomActionItem(
name = stringResource(MR.strings.action_mark_as_read),
icon = Icons.Rounded.DoneAll,
onClick = { markRead(selectedItems.first().chapter.index) },
onClick = { markRead(selectedItems.first().chapter.index) }
).takeIf { selectedItems.fastAny { !it.chapter.read } && selectedItems.size == 1 },
BottomActionItem(
name = stringResource(MR.strings.action_mark_as_unread),
icon = Icons.Rounded.RemoveDone,
onClick = { markUnread(selectedItems.first().chapter.index) },
onClick = { markUnread(selectedItems.first().chapter.index) }
).takeIf { selectedItems.fastAny { !it.chapter.read } && selectedItems.size == 1 },
BottomActionItem(
name = stringResource(MR.strings.action_mark_previous_read),
icon = JuiAssets.DonePrev,
onClick = { markPreviousAsRead(selectedItems.first().chapter.index) },
onClick = { markPreviousAsRead(selectedItems.first().chapter.index) }
).takeIf { selectedItems.size == 1 },
BottomActionItem(
name = stringResource(MR.strings.action_download),

View File

@@ -60,6 +60,6 @@ private fun getContextItems(
if (unBookmarkChapter != null) ContextMenuItem(stringResource(MR.strings.action_remove_bookmark), unBookmarkChapter) else null,
if (markRead != null) ContextMenuItem(stringResource(MR.strings.action_mark_as_read), markRead) else null,
if (markUnread != null) ContextMenuItem(stringResource(MR.strings.action_mark_as_unread), markUnread) else null,
ContextMenuItem(stringResource(MR.strings.action_mark_previous_read), markPreviousAsRead),
ContextMenuItem(stringResource(MR.strings.action_mark_previous_read), markPreviousAsRead)
)
}

View File

@@ -15,12 +15,12 @@ import androidx.compose.ui.composed
actual fun Modifier.buttonModifier(
onClick: () -> Unit,
onHintClick: () -> Unit,
onHintClick: () -> Unit
): Modifier = composed {
combinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false),
onLongClick = onHintClick,
onClick = onClick,
onClick = onClick
)
}
}

View File

@@ -60,18 +60,18 @@ data class BottomActionItem(
fun BottomActionMenu(
visible: Boolean,
modifier: Modifier = Modifier,
items: ImmutableList<BottomActionItem>,
items: ImmutableList<BottomActionItem>
) {
AnimatedVisibility(
visible = visible,
enter = expandVertically(expandFrom = Alignment.Bottom),
exit = shrinkVertically(shrinkTowards = Alignment.Bottom),
exit = shrinkVertically(shrinkTowards = Alignment.Bottom)
) {
val scope = rememberCoroutineScope()
Surface(
modifier = modifier,
shape = MaterialTheme.shapes.large.copy(bottomEnd = ZeroCornerSize, bottomStart = ZeroCornerSize),
elevation = 3.dp,
elevation = 3.dp
) {
val haptic = LocalHapticFeedback.current
var confirm by remember { mutableStateOf<Int?>(null) }
@@ -88,7 +88,7 @@ fun BottomActionMenu(
Row(
modifier = Modifier
.padding(WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues())
.padding(horizontal = 8.dp, vertical = 12.dp),
.padding(horizontal = 8.dp, vertical = 12.dp)
) {
items.forEachIndexed { index, item ->
Button(
@@ -96,7 +96,7 @@ fun BottomActionMenu(
icon = item.icon,
toConfirm = confirm == index,
onLongClick = { onLongClickItem(index) },
onClick = item.onClick,
onClick = item.onClick
)
}
}
@@ -106,7 +106,7 @@ fun BottomActionMenu(
expect fun Modifier.buttonModifier(
onClick: () -> Unit,
onHintClick: () -> Unit,
onHintClick: () -> Unit
): Modifier
@Composable
@@ -116,7 +116,7 @@ private fun RowScope.Button(
toConfirm: Boolean,
onLongClick: () -> Unit,
onClick: () -> Unit,
content: (@Composable () -> Unit)? = null,
content: (@Composable () -> Unit)? = null
) {
val animatedWeight by animateFloatAsState(if (toConfirm) 2f else 1f)
Column(
@@ -125,27 +125,27 @@ private fun RowScope.Button(
.weight(animatedWeight)
.buttonModifier(
onHintClick = onLongClick,
onClick = onClick,
onClick = onClick
),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
imageVector = icon,
contentDescription = title,
contentDescription = title
)
AnimatedVisibility(
visible = toConfirm,
enter = expandVertically(expandFrom = Alignment.Top) + fadeIn(),
exit = shrinkVertically(shrinkTowards = Alignment.Top) + fadeOut(),
exit = shrinkVertically(shrinkTowards = Alignment.Top) + fadeOut()
) {
Text(
text = title,
overflow = TextOverflow.Visible,
maxLines = 1,
style = MaterialTheme.typography.overline,
style = MaterialTheme.typography.overline
)
}
content?.invoke()
}
}
}

View File

@@ -19,4 +19,4 @@ fun Modifier.selectedBackground(isSelected: Boolean): Modifier = composed {
} else {
this
}
}
}

View File

@@ -11,10 +11,10 @@ public object JuiAssets
private var __AllAssets: ____KtList<ImageVector>? = null
public val JuiAssets.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets = Ca.AllAssets + listOf(DonePrev)
return __AllAssets!!
}
__AllAssets= Ca.AllAssets + listOf(DonePrev)
return __AllAssets!!
}

View File

@@ -1,12 +1,9 @@
package ca.gosyer.jui.uicore.icons.juiassets
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
@@ -19,11 +16,22 @@ public val JuiAssets.DonePrev: ImageVector
if (_donePrev != null) {
return _donePrev!!
}
_donePrev = Builder(name = "DonePrev", 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,
pathFillType = NonZero) {
_donePrev = Builder(
name = "DonePrev",
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,
pathFillType = NonZero
) {
moveTo(9.0f, 16.2f)
lineTo(4.8f, 12.0f)
lineToRelative(-1.4f, 1.4f)
@@ -33,9 +41,15 @@ public val JuiAssets.DonePrev: ImageVector
lineTo(9.0f, 16.2f)
close()
}
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
path(
fill = SolidColor(Color(0xFF000000)),
stroke = null,
strokeLineWidth = 0.0f,
strokeLineCap = Butt,
strokeLineJoin = Miter,
strokeLineMiter = 4.0f,
pathFillType = NonZero
) {
moveTo(22.0f, 18.0f)
lineToRelative(-3.0f, 0.0f)
lineToRelative(0.0f, -4.0f)
@@ -46,7 +60,7 @@ public val JuiAssets.DonePrev: ImageVector
close()
}
}
.build()
.build()
return _donePrev!!
}

View File

@@ -9,15 +9,15 @@ import kotlin.collections.List as ____KtList
public object CaGroup
public val JuiAssets.Ca: CaGroup
get() = CaGroup
get() = CaGroup
private var __AllAssets: ____KtList<ImageVector>? = null
public val CaGroup.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets = Gosyer.AllAssets + listOf()
return __AllAssets!!
}
__AllAssets= Gosyer.AllAssets + listOf()
return __AllAssets!!
}

View File

@@ -9,15 +9,15 @@ import kotlin.collections.List as ____KtList
public object GosyerGroup
public val CaGroup.Gosyer: GosyerGroup
get() = GosyerGroup
get() = GosyerGroup
private var __AllAssets: ____KtList<ImageVector>? = null
public val GosyerGroup.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets = Jui.AllAssets + listOf()
return __AllAssets!!
}
__AllAssets= Jui.AllAssets + listOf()
return __AllAssets!!
}

View File

@@ -9,15 +9,15 @@ import kotlin.collections.List as ____KtList
public object JuiGroup
public val GosyerGroup.Jui: JuiGroup
get() = JuiGroup
get() = JuiGroup
private var __AllAssets: ____KtList<ImageVector>? = null
public val JuiGroup.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets = Uicore.AllAssets + listOf()
return __AllAssets!!
}
__AllAssets= Uicore.AllAssets + listOf()
return __AllAssets!!
}

View File

@@ -9,15 +9,15 @@ import kotlin.collections.List as ____KtList
public object UicoreGroup
public val JuiGroup.Uicore: UicoreGroup
get() = UicoreGroup
get() = UicoreGroup
private var __AllAssets: ____KtList<ImageVector>? = null
public val UicoreGroup.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets = Icons.AllAssets + listOf()
return __AllAssets!!
}
__AllAssets= Icons.AllAssets + listOf()
return __AllAssets!!
}

View File

@@ -9,15 +9,15 @@ import kotlin.collections.List as ____KtList
public object IconsGroup
public val UicoreGroup.Icons: IconsGroup
get() = IconsGroup
get() = IconsGroup
private var __AllAssets: ____KtList<ImageVector>? = null
public val IconsGroup.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets = Juiassets.AllAssets + listOf()
return __AllAssets!!
}
__AllAssets= Juiassets.AllAssets + listOf()
return __AllAssets!!
}

View File

@@ -7,15 +7,15 @@ import kotlin.collections.List as ____KtList
public object JuiassetsGroup
public val IconsGroup.Juiassets: JuiassetsGroup
get() = JuiassetsGroup
get() = JuiassetsGroup
private var __AllAssets: ____KtList<ImageVector>? = null
public val JuiassetsGroup.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets = listOf()
return __AllAssets!!
}
__AllAssets= listOf()
return __AllAssets!!
}

View File

@@ -22,7 +22,7 @@ import kotlin.time.Duration.Companion.seconds
actual fun Modifier.buttonModifier(
onClick: () -> Unit,
onHintClick: () -> Unit,
onHintClick: () -> Unit
): Modifier = composed {
val interactionSource = remember { MutableInteractionSource() }
LaunchedEffect(interactionSource) {
@@ -39,4 +39,4 @@ actual fun Modifier.buttonModifier(
interactionSource.interactions
onClick(onClick = onClick)
.hoverable(interactionSource)
}
}

View File

@@ -15,12 +15,12 @@ import androidx.compose.ui.composed
actual fun Modifier.buttonModifier(
onClick: () -> Unit,
onHintClick: () -> Unit,
onHintClick: () -> Unit
): Modifier = composed {
combinedClickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false),
onLongClick = onHintClick,
onClick = onClick,
onClick = onClick
)
}
}