Skip to content

Commit

Permalink
Address more spotless lint errors from KMK & SY
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong-tran committed Aug 22, 2024
1 parent c43ff3c commit ef268d9
Show file tree
Hide file tree
Showing 118 changed files with 634 additions and 379 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TrustExtension(
) {

suspend fun isTrusted(pkgInfo: PackageInfo, fingerprints: List<String>): Boolean {
// KMK -->
// KMK -->
if (fingerprints.contains(CreateExtensionRepo.OFFICIAL_REPO_SIGNATURE)) return true
// KMK <--
val trustedFingerprints = extensionRepoRepository.getAll().map { it.signingKeyFingerprint }.toHashSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ class GetEnabledSources(
) { a, b, c -> Triple(a, b, c) },
// SY <--
repository.getSources(),
) { pinnedSourceIds,
(enabledLanguages, disabledSources, lastUsedSource),
(excludedFromDataSaver, sourcesInCategories, sourceCategoriesFilter),
sources,
) {
pinnedSourceIds,
(enabledLanguages, disabledSources, lastUsedSource),
(excludedFromDataSaver, sourcesInCategories, sourceCategoriesFilter),
sources,
->

val sourcesAndCategories = sourcesInCategories.map {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/eu/kanade/domain/sync/SyncPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SyncPreferences(

// SY -->
customInfo = preferenceStore.getBoolean("customInfo", true).get(),
readEntries = preferenceStore.getBoolean("readEntries", true).get()
readEntries = preferenceStore.getBoolean("readEntries", true).get(),
// SY <--
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ data class SyncSettings(

// SY -->
val customInfo: Boolean = true,
val readEntries: Boolean = true
val readEntries: Boolean = true,
// SY <--
)
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private fun ExtensionFilterContent(
contentPadding = contentPadding,
// KMK -->
modifier = Modifier
.padding(start = MaterialTheme.padding.small)
.padding(start = MaterialTheme.padding.small),
// KMK <--
) {
items(state.languages) { language ->
Expand All @@ -87,7 +87,7 @@ private fun ExtensionFilterContent(
contentDescription = language,
modifier = Modifier
.width(48.dp)
.height(32.dp)
.height(32.dp),
)
// KMK <--
SwitchPreferenceWidget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ private fun ExtensionItemContent(
contentDescription = extension.lang ?: "",
modifier = Modifier
.width(18.dp)
.height(12.dp)
.height(12.dp),
)
// KMK <--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ internal fun GlobalSearchContent(
"",
"",
supportsLatest = false,
isStub = false
isStub = false,
)
// KMK <--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private fun MigrateSourceItem(
contentDescription = lang,
modifier = Modifier
.width(18.dp)
.height(12.dp)
.height(12.dp),
)
// KMK <--
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ fun SourceFeedToolbar(
AppBarActions(
actions = persistentListOf(
bulkSelectionButton(toggleSelectionMode),
)
),
)
persistentListOf(
if (sourceId != LocalSource.ID) {
IconButton(
onClick = onWebViewClick
onClick = onWebViewClick,
) {
Icon(
imageVector = Icons.Outlined.Public,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ fun SourcesSearch(
),
contentPadding = PaddingValues(12.dp),
)
}
},
)
}

Expand Down Expand Up @@ -474,7 +474,8 @@ fun SourceOptionsDialog(
}
// SY <--
// KMK -->
if (onClickSettings != null && source.installedExtension !== null &&
if (onClickSettings != null &&
source.installedExtension !== null &&
source.id !in listOf(LocalSource.ID, EH_SOURCE_ID, EXH_SOURCE_ID)
) {
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private val defaultContent: @Composable RowScope.(
contentDescription = lang,
modifier = Modifier
.width(18.dp)
.height(12.dp)
.height(12.dp),
)

// Won't look good but it's not like we can ellipsize overflowing content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fun GlobalSearchToolbar(
AppBarActions(
actions = persistentListOf(
bulkSelectionButton(toggleSelectionMode),
)
),
)
},
// KMK <--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import tachiyomi.source.local.LocalSource
@Composable
fun SourceSettingsButton(
id: Long,
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier,
) {
// Create a fake source
val source = Source(id, "", "", supportsLatest = false, isStub = false)
Expand All @@ -30,7 +30,7 @@ fun SourceSettingsButton(
@Composable
fun SourceSettingsButton(
source: Source,
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier,
) {
// Avoid E-Hentai & ExHentai which is built-in & not actually installed extensions
if (source.id == LocalSource.ID || source.id == EH_SOURCE_ID || source.id == EXH_SOURCE_ID) return
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ private fun MangaScreenSmallImpl(
style = HazeStyle(
tint = HazeDefaults.tint(fullCoverBackground),
blurRadius = 10.dp,
)
),
),
// KMK <--
) { contentPadding ->
Expand Down Expand Up @@ -928,7 +928,7 @@ private fun MangaScreenLargeImpl(
style = HazeStyle(
tint = HazeDefaults.tint(fullCoverBackground),
blurRadius = 10.dp,
)
),
),
// KMK <--
) { contentPadding ->
Expand Down Expand Up @@ -1214,7 +1214,9 @@ private fun LazyListScope.sharedChapterItems(
// SY <--
},
readProgress = item.chapter.lastPageRead
.takeIf { /* SY --> */(!item.chapter.read || alwaysShowReadingProgress)/* SY <-- */ && it > 0L }
.takeIf {
/* SY --> */(!item.chapter.read || alwaysShowReadingProgress)/* SY <-- */ && it > 0L
}
?.let {
stringResource(
MR.strings.chapter_progress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ fun MangaChapterListItem(
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
if (readProgress != null || scanlator != null/* SY --> */ || sourceName != null/* SY <-- */) DotSeparatorText()
if (readProgress != null ||
scanlator != null/* SY --> */ ||
sourceName != null/* SY <-- */
) {
DotSeparatorText()
}
}
if (readProgress != null) {
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ enum class MangaCover(val ratio: Float) {
// KMK -->
loading = {
Box(
modifier = modifierColored
modifier = modifierColored,
) {
CircularProgressIndicator(
color = tint?.let { Color(it) } ?: CoverPlaceholderOnBgColor,
Expand All @@ -96,7 +96,7 @@ enum class MangaCover(val ratio: Float) {
Size.Big -> 16.dp
Size.Medium -> 24.dp
else -> 32.dp
}
},
)
.align(Alignment.Center),
strokeWidth = when (size) {
Expand All @@ -108,7 +108,7 @@ enum class MangaCover(val ratio: Float) {
},
error = {
Box(
modifier = modifierColored
modifier = modifierColored,
) {
Image(
imageVector = ImageVector.vectorResource(R.drawable.cover_error_vector),
Expand All @@ -119,11 +119,11 @@ enum class MangaCover(val ratio: Float) {
Size.Big -> 16.dp
Size.Medium -> 24.dp
else -> 32.dp
}
},
)
.align(Alignment.Center),
colorFilter = ColorFilter.tint(
tint?.let { Color(it) } ?: CoverPlaceholderOnBgColor
tint?.let { Color(it) } ?: CoverPlaceholderOnBgColor,
),
)
}
Expand Down Expand Up @@ -178,7 +178,7 @@ enum class MangaCoverHide(private val ratio: Float) {
)

Box(
modifier = modifierColored
modifier = modifierColored,
) {
Image(
imageVector = ImageVector.vectorResource(R.drawable.ic_baseline_menu_book_24),
Expand All @@ -187,7 +187,7 @@ enum class MangaCoverHide(private val ratio: Float) {
.size(32.dp)
.align(Alignment.Center),
colorFilter = ColorFilter.tint(
tint?.let { Color(it) } ?: CoverPlaceholderOnBgColor
tint?.let { Color(it) } ?: CoverPlaceholderOnBgColor,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ fun MangaToolbar(
}
// KMK -->
if (isHomeEnabled && navigator != null) {
if (navigator.size >= 2 && navigator.items[navigator.size - 2] is MangaScreen ||
if (navigator.size >= 2 &&
navigator.items[navigator.size - 2] is MangaScreen ||
navigator.size >= 5
) {
IconButton(onClick = { onHomeClicked() }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ fun OutlinedButtonWithArrow(
vertical = MaterialTheme.padding.small,
),
colors = ButtonDefaults.outlinedButtonColors(),
shape = RoundedCornerShape(8.dp)
shape = RoundedCornerShape(8.dp),
) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = text,
)
Spacer(modifier = Modifier.width(4.dp))
Icon(
imageVector = icon,
contentDescription = "Arrow"
contentDescription = "Arrow",
)
}
}
Expand All @@ -62,6 +62,6 @@ fun OutlinedButtonWithArrow(
fun OutlinedButtonWithArrowPreview() {
OutlinedButtonWithArrow(
text = "Click Me",
onClick = { /* Do nothing */ }
onClick = { /* Do nothing */ },
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import tachiyomi.presentation.core.i18n.stringResource

@Composable
private fun PagePreviewLoading(
setMaxWidth: (Dp) -> Unit
setMaxWidth: (Dp) -> Unit,
) {
val density = LocalDensity.current
Box(
Expand All @@ -63,7 +63,7 @@ private fun PagePreviewLoading(
@Composable
private fun PagePreviewRow(
onOpenPage: (Int) -> Unit,
items: ImmutableList<PagePreview>
items: ImmutableList<PagePreview>,
) {
Row(
modifier = Modifier
Expand All @@ -88,7 +88,7 @@ private fun PagePreviewMore(
) {
Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center
contentAlignment = Alignment.Center,
) {
TextButton(onClick = onMorePreviewsClicked) {
Text(stringResource(SYMR.strings.more_previews))
Expand Down Expand Up @@ -116,7 +116,7 @@ fun PagePreviews(
pagePreviewState.pagePreviews.take(rowCount * itemPerRowCount).chunked(itemPerRowCount).forEach {
PagePreviewRow(
onOpenPage = onOpenPage,
items = remember(it) { it.toImmutableList() }
items = remember(it) { it.toImmutableList() },
)
}

Expand Down Expand Up @@ -153,7 +153,7 @@ fun LazyListScope.PagePreviewItems(
) {
PagePreviewRow(
onOpenPage = onOpenPage,
items = remember(it) { it.toImmutableList() }
items = remember(it) { it.toImmutableList() },
)
}
item(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ fun RelatedMangasRow(
)
}

else -> { EmptyResultItem() }
else -> {
EmptyResultItem()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private fun ComingUpdatesScreenPreview() {
changelogInfo = """
## Yay
Foobar
### More info
[komikku-app/[email protected]](https://github.com/komikku-app/komikku/compare/23d862d17...48fb4a2e6)
- Hello ([@cuong-tran](@https://github.com/cuong-tran))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private fun WhatsNewScreenPreview() {
changelogInfo = """
## Yay
Foobar
### More info
[komikku-app/[email protected]](https://github.com/komikku-app/komikku/compare/23d862d17...48fb4a2e6)
- Hello ([@cuong-tran](@https://github.com/cuong-tran))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,15 @@ object SettingsAppearanceScreen : SearchableSettings {
Preference.PreferenceItem.SliderPreference(
value = previewsRowCount,
title = stringResource(SYMR.strings.pref_previews_row_count),
subtitle = if (previewsRowCount > 0) pluralStringResource(
SYMR.plurals.row_count,
previewsRowCount,
previewsRowCount,
) else stringResource(MR.strings.disabled),
subtitle = if (previewsRowCount > 0) {
pluralStringResource(
SYMR.plurals.row_count,
previewsRowCount,
previewsRowCount,
)
} else {
stringResource(MR.strings.disabled)
},
min = 0,
max = 10,
onValueChanged = {
Expand Down
Loading

0 comments on commit ef268d9

Please sign in to comment.