Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address spotless lint errors #1138

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

- name: Build app and run unit tests
run: ./gradlew assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest
run: ./gradlew spotlessCheck assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest

- name: Upload APK
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

- name: Build app and run unit tests
run: ./gradlew assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest
run: ./gradlew spotlessCheck assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest

- name: Upload APK
uses: actions/upload-artifact@v4
Expand Down
9 changes: 4 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (gradle.startParameter.taskRequests.toString().contains("Standard")) {

shortcutHelper.setFilePath("./shortcuts.xml")

val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
val supportedAbis = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")

android {
namespace = "eu.kanade.tachiyomi"
Expand All @@ -35,7 +35,7 @@ android {
buildConfigField("boolean", "PREVIEW", "false")

ndk {
abiFilters += SUPPORTED_ABIS
abiFilters += supportedAbis
}

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -45,7 +45,7 @@ android {
abi {
isEnable = true
reset()
include(*SUPPORTED_ABIS.toTypedArray())
include(*supportedAbis.toTypedArray())
isUniversalApk = true
}
}
Expand Down Expand Up @@ -158,7 +158,7 @@ dependencies {
implementation(compose.ui.tooling.preview)
implementation(compose.ui.util)
implementation(compose.accompanist.systemuicontroller)

implementation(androidx.interpolator)

implementation(androidx.paging.runtime)
Expand Down Expand Up @@ -236,7 +236,6 @@ dependencies {
implementation(libs.compose.webview)
implementation(libs.compose.grid)


// Logging
implementation(libs.logcat)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ class SyncChaptersWithSource(
if (shouldUpdateDbChapter.await(dbChapter, chapter)) {
val shouldRenameChapter = downloadProvider.isChapterDirNameChanged(dbChapter, chapter) &&
downloadManager.isChapterDownloaded(
dbChapter.name, dbChapter.scanlator, manga.title, manga.source,
dbChapter.name,
dbChapter.scanlator,
manga.title,
manga.source,
)

if (shouldRenameChapter) {
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class UiPreferences(

fun appTheme() = preferenceStore.getEnum(
"pref_app_theme",
if (DeviceUtil.isDynamicColorAvailable) { AppTheme.MONET } else { AppTheme.DEFAULT },
if (DeviceUtil.isDynamicColorAvailable) {
AppTheme.MONET
} else {
AppTheme.DEFAULT
},
)

fun themeDarkAmoled() = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private fun DetailsHeader(
Extension name: ${extension.name} (lang: ${extension.lang}; package: ${extension.pkgName})
Extension version: ${extension.versionName} (lib: ${extension.libVersion}; version code: ${extension.versionCode})
NSFW: ${extension.isNsfw}
""".trimIndent()
""".trimIndent(),
)

if (extension is Extension.Installed) {
Expand All @@ -242,8 +242,8 @@ private fun DetailsHeader(
Update available: ${extension.hasUpdate}
Obsolete: ${extension.isObsolete}
Shared: ${extension.isShared}
Repository: ${extension.repoUrl}
""".trimIndent()
Repository: ${extension.repoUrl}
""".trimIndent(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ private fun ExtensionContent(
when (it) {
is Extension.Available -> onInstallExtension(it)
is Extension.Installed -> onOpenExtension(it)
is Extension.Untrusted -> { trustState = it }
is Extension.Untrusted -> {
trustState = it
}
}
},
onLongClickItem = onLongClickItem,
Expand All @@ -241,7 +243,9 @@ private fun ExtensionContent(
onOpenExtension(it)
}
}
is Extension.Untrusted -> { trustState = it }
is Extension.Untrusted -> {
trustState = it
}
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import tachiyomi.domain.source.model.Pin
import tachiyomi.domain.source.model.Source
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.components.material.SECONDARY_ALPHA
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
Expand Down Expand Up @@ -148,7 +148,7 @@ private fun SourcePinButton(
MaterialTheme.colorScheme.primary
} else {
MaterialTheme.colorScheme.onBackground.copy(
alpha = SecondaryItemAlpha,
alpha = SECONDARY_ALPHA,
)
}
val description = if (isPinned) MR.strings.action_unpin else MR.strings.action_pin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fun TabbedDialog(
modifier = Modifier.animateContentSize(),
state = pagerState,
verticalAlignment = Alignment.Top,
pageContent = { page -> content(page) }
pageContent = { page -> content(page) },
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private val ContinueReadingButtonIconSizeLarge = 20.dp
private val ContinueReadingButtonGridPadding = 6.dp
private val ContinueReadingButtonListSpacing = 8.dp

private const val GridSelectedCoverAlpha = 0.76f
private const val GRID_SELECTED_COVER_ALPHA = 0.76f

/**
* Layout of grid list item with title overlaying the cover.
Expand Down Expand Up @@ -90,7 +90,7 @@ fun MangaCompactGridItem(
MangaCover.Book(
modifier = Modifier
.fillMaxWidth()
.alpha(if (isSelected) GridSelectedCoverAlpha else coverAlpha),
.alpha(if (isSelected) GRID_SELECTED_COVER_ALPHA else coverAlpha),
data = coverData,
)
},
Expand Down Expand Up @@ -197,7 +197,7 @@ fun MangaComfortableGridItem(
MangaCover.Book(
modifier = Modifier
.fillMaxWidth()
.alpha(if (isSelected) GridSelectedCoverAlpha else coverAlpha),
.alpha(if (isSelected) GRID_SELECTED_COVER_ALPHA else coverAlpha),
data = coverData,
)
},
Expand Down Expand Up @@ -371,7 +371,7 @@ fun MangaListItem(
size = ContinueReadingButtonSizeSmall,
iconSize = ContinueReadingButtonIconSizeSmall,
onClick = onClickContinueReading,
modifier = Modifier.padding(start = ContinueReadingButtonListSpacing)
modifier = Modifier.padding(start = ContinueReadingButtonListSpacing),
)
}
}
Expand All @@ -392,7 +392,7 @@ private fun ContinueReadingButton(
containerColor = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.9f),
contentColor = contentColorFor(MaterialTheme.colorScheme.primaryContainer),
),
modifier = Modifier.size(size)
modifier = Modifier.size(size),
) {
Icon(
imageVector = Icons.Filled.PlayArrow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.components.material.SECONDARY_ALPHA
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
Expand Down Expand Up @@ -60,6 +60,6 @@ private fun MissingChaptersWarning(count: Int) {
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.error.copy(alpha = SecondaryItemAlpha),
color = MaterialTheme.colorScheme.error.copy(alpha = SECONDARY_ALPHA),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import eu.kanade.tachiyomi.data.download.model.Download
import me.saket.swipe.SwipeableActionsBox
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.ReadItemAlpha
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.components.material.DISABLED_ALPHA
import tachiyomi.presentation.core.components.material.SECONDARY_ALPHA
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.selectedBackground

Expand Down Expand Up @@ -132,15 +132,15 @@ fun MangaChapterListItem(
maxLines = 1,
overflow = TextOverflow.Ellipsis,
onTextLayout = { textHeight = it.size.height },
color = LocalContentColor.current.copy(alpha = if (read) ReadItemAlpha else 1f),
color = LocalContentColor.current.copy(alpha = if (read) DISABLED_ALPHA else 1f),
)
}

Row {
val subtitleStyle = MaterialTheme.typography.bodySmall
.merge(
color = LocalContentColor.current
.copy(alpha = if (read) ReadItemAlpha else SecondaryItemAlpha)
.copy(alpha = if (read) DISABLED_ALPHA else SECONDARY_ALPHA),
)
ProvideTextStyle(value = subtitleStyle) {
if (date != null) {
Expand All @@ -156,7 +156,7 @@ fun MangaChapterListItem(
text = readProgress,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = LocalContentColor.current.copy(alpha = ReadItemAlpha),
color = LocalContentColor.current.copy(alpha = DISABLED_ALPHA),
)
if (scanlator != null) DotSeparatorText()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.system.copyToClipboard
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.DISABLED_ALPHA
import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.pluralStringResource
Expand Down Expand Up @@ -177,7 +178,7 @@ fun MangaActionRow(
onEditCategory: (() -> Unit)?,
modifier: Modifier = Modifier,
) {
val defaultActionButtonColor = MaterialTheme.colorScheme.onSurface.copy(alpha = .38f)
val defaultActionButtonColor = MaterialTheme.colorScheme.onSurface.copy(alpha = DISABLED_ALPHA)

// TODO: show something better when using custom interval
val nextUpdateDays = remember(nextUpdate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private fun NewUpdateScreenPreview() {
changelogInfo = """
## Yay
Foobar
### More info
- Hello
- World
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ object SettingsAdvancedScreen : SearchableSettings {
chooseColorProfile.launch(arrayOf("*/*"))
},
),
)
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OpenSourceLicensesScreen : Screen() {
name = it.name,
website = it.website,
license = it.licenses.firstOrNull()?.htmlReadyLicenseContent.orEmpty(),
)
),
)
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import tachiyomi.presentation.core.i18n.stringResource
class BackupSchemaScreen : Screen() {

companion object {
const val title = "Backup file schema"
const val TITLE = "Backup file schema"
}

@Composable
Expand All @@ -41,7 +41,7 @@ class BackupSchemaScreen : Screen() {
Scaffold(
topBar = {
AppBar(
title = title,
title = TITLE,
navigateUp = navigator::pop,
actions = {
AppBarActions(
Expand All @@ -50,7 +50,7 @@ class BackupSchemaScreen : Screen() {
title = stringResource(MR.strings.action_copy_to_clipboard),
icon = Icons.Default.ContentCopy,
onClick = {
context.copyToClipboard(title, schema)
context.copyToClipboard(TITLE, schema)
},
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class DebugInfoScreen : Screen() {
itemsProvider = {
listOf(
Preference.PreferenceItem.TextPreference(
title = WorkerInfoScreen.title,
title = WorkerInfoScreen.TITLE,
onClick = { navigator.push(WorkerInfoScreen()) },
),
Preference.PreferenceItem.TextPreference(
title = BackupSchemaScreen.title,
title = BackupSchemaScreen.TITLE,
onClick = { navigator.push(BackupSchemaScreen()) },
),
getAppInfoGroup(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import java.time.ZoneId
class WorkerInfoScreen : Screen() {

companion object {
const val title = "Worker info"
const val TITLE = "Worker info"
}

@Composable
Expand All @@ -65,7 +65,7 @@ class WorkerInfoScreen : Screen() {
Scaffold(
topBar = {
AppBar(
title = title,
title = TITLE,
navigateUp = navigator::pop,
actions = {
AppBarActions(
Expand All @@ -74,7 +74,7 @@ class WorkerInfoScreen : Screen() {
title = stringResource(MR.strings.action_copy_to_clipboard),
icon = Icons.Default.ContentCopy,
onClick = {
context.copyToClipboard(title, enqueued + finished + running)
context.copyToClipboard(TITLE, enqueued + finished + running)
},
),
),
Expand Down Expand Up @@ -159,7 +159,7 @@ class WorkerInfoScreen : Screen() {
Injekt.get<UiPreferences>().dateFormat().get(),
),
)
appendLine("Next scheduled run: $timestamp",)
appendLine("Next scheduled run: $timestamp")
appendLine("Attempt #${workInfo.runAttemptCount + 1}")
}
appendLine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource

private enum class State {
CHECKED, INVERSED, UNCHECKED
CHECKED,
INVERSED,
UNCHECKED,
}

@Composable
Expand Down
Loading