Compare commits

...

5 Commits

Author SHA1 Message Date
AntsyLich
1b0bbb8440 Tweak detekt config 2024-02-17 04:25:41 +06:00
AntsyLich
95d4df9ca8 Cleanup [BaseColorScheme.getColorScheme] 2024-02-17 04:07:06 +06:00
AntsyLich
fb86c470f6 Update gradle.properties 2024-02-17 03:35:46 +06:00
AntsyLich
5aec8f8018 Small cleanup in WorkerInfoScreen 2024-02-17 03:29:15 +06:00
AntsyLich
e183cbb231 Revert a mishap in 7ff95e21ba 2024-02-17 03:28:48 +06:00
6 changed files with 33 additions and 53 deletions

View File

@@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import eu.kanade.domain.ui.UiPreferences
import eu.kanade.tachiyomi.util.lang.toRelativeSting
import eu.kanade.tachiyomi.util.lang.toRelativeString
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt
@@ -36,7 +36,7 @@ fun relativeDateText(
val relativeTime = remember { preferences.relativeTime().get() }
val dateFormat = remember { UiPreferences.dateFormat(preferences.dateFormat().get()) }
return localDate?.toRelativeSting(
return localDate?.toRelativeString(
context = context,
relative = relativeTime,
dateFormat = dateFormat,

View File

@@ -150,19 +150,16 @@ class WorkerInfoScreen : Screen() {
}
appendLine("State: ${workInfo.state}")
if (workInfo.state == WorkInfo.State.ENQUEUED) {
appendLine(
"Next scheduled run: ${
LocalDateTime.ofInstant(
Instant.ofEpochMilli(workInfo.nextScheduleTimeMillis),
ZoneId.systemDefault(),
)
.toDateTimestampString(
UiPreferences.dateFormat(
Injekt.get<UiPreferences>().dateFormat().get(),
),
)
}",
val timestamp = LocalDateTime.ofInstant(
Instant.ofEpochMilli(workInfo.nextScheduleTimeMillis),
ZoneId.systemDefault(),
)
.toDateTimestampString(
UiPreferences.dateFormat(
Injekt.get<UiPreferences>().dateFormat().get(),
),
)
appendLine("Next scheduled run: $timestamp",)
appendLine("Attempt #${workInfo.runAttemptCount + 1}")
}
appendLine()

View File

@@ -9,18 +9,15 @@ internal abstract class BaseColorScheme {
abstract val lightScheme: ColorScheme
fun getColorScheme(isDark: Boolean, isAmoled: Boolean): ColorScheme {
return (if (isDark) darkScheme else lightScheme)
.let {
if (isDark && isAmoled) {
it.copy(
background = Color.Black,
onBackground = Color.White,
surface = Color.Black,
onSurface = Color.White,
)
} else {
it
}
}
if (!isDark) return lightScheme
if (!isAmoled) return darkScheme
return darkScheme.copy(
background = Color.Black,
onBackground = Color.White,
surface = Color.Black,
onSurface = Color.White,
)
}
}

View File

@@ -38,7 +38,7 @@ fun Long.toLocalDate(): LocalDate {
return LocalDate.ofInstant(Instant.ofEpochMilli(this), ZoneId.systemDefault())
}
fun LocalDate.toRelativeSting(
fun LocalDate.toRelativeString(
context: Context,
relative: Boolean = true,
dateFormat: DateTimeFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT),

View File

@@ -6,9 +6,9 @@ naming:
constantPattern: '[A-Z][A-Za-z0-9]*'
complexity:
LongMethod:
ignoreAnnotated: [ 'Composable' ]
LongParameterList:
functionThreshold: 6
constructorThreshold: 7
ignoreDefaultParameters: true
ignoreAnnotated: [ 'Composable' ]
@@ -16,5 +16,7 @@ style:
MagicNumber:
ignorePropertyDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
ReturnCount:
excludeGuardClauses: true
UnusedPrivateMember:
ignoreAnnotated: [ 'Preview' ]

View File

@@ -1,26 +1,10 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx5120m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
org.gradle.caching=true
android.nonTransitiveRClass=false
android.useAndroidX=true
kotlin.code.style=official
kotlin.mpp.androidSourceSetLayoutVersion=2
android.useAndroidX=true
android.nonTransitiveRClass=false
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
org.gradle.parallel=true