From 91c93b5982bade22cc2eed066734faaf41d7fa06 Mon Sep 17 00:00:00 2001 From: Syer10 Date: Mon, 26 Apr 2021 20:16:35 -0400 Subject: [PATCH] Add ktlint, reformat files --- build.gradle.kts | 21 +++ gradle.properties | 1 + .../kotlin/ca/gosyer/common/di/AppScope.kt | 3 +- .../ca/gosyer/common/di/GenericsModule.kt | 2 +- .../ca/gosyer/common/di/ModuleExtensions.kt | 2 +- .../gosyer/common/io/DataUriStringSource.kt | 3 +- .../ca/gosyer/common/io/OkioExtensions.kt | 3 +- .../common/prefs/LazyPreferenceStore.kt | 2 +- .../ca/gosyer/common/prefs/Preference.kt | 4 +- .../ca/gosyer/common/prefs/PreferenceStore.kt | 19 +- .../kotlin/ca/gosyer/common/util/Codec.kt | 2 +- .../common/util/CollectionExtensions.kt | 2 +- .../kotlin/ca/gosyer/common/util/ImageUtil.kt | 2 +- .../ca/gosyer/core/prefs/JvmPreference.kt | 3 +- .../core/prefs/JvmPreferenceAdapters.kt | 4 +- .../gosyer/core/prefs/JvmPreferenceStore.kt | 3 +- .../core/prefs/PreferenceStoreProvider.kt | 8 +- .../gosyer/data/catalog/CatalogPreferences.kt | 2 +- .../data/extension/ExtensionPreferences.kt | 2 +- .../gosyer/data/library/LibraryPreferences.kt | 2 +- .../gosyer/data/library/model/DisplayMode.kt | 2 +- .../kotlin/ca/gosyer/data/models/Category.kt | 2 +- .../kotlin/ca/gosyer/data/models/Manga.kt | 2 +- .../ca/gosyer/data/server/HttpClient.kt | 2 +- .../gosyer/data/server/ServerPreferences.kt | 2 +- .../ca/gosyer/data/server/ServerService.kt | 15 +- .../interactions/BaseInteractionHandler.kt | 2 +- .../CategoryInteractionHandler.kt | 18 +- .../interactions/ChapterInteractionHandler.kt | 4 +- .../ExtensionInteractionHandler.kt | 4 +- .../interactions/LibraryInteractionHandler.kt | 4 +- .../interactions/MangaInteractionHandler.kt | 5 +- .../interactions/SourceInteractionHandler.kt | 14 +- .../gosyer/data/server/requests/Category.kt | 2 +- .../gosyer/data/server/requests/Chapters.kt | 2 +- .../gosyer/data/server/requests/Extensions.kt | 2 +- .../ca/gosyer/data/server/requests/Library.kt | 2 +- .../data/server/requests/RestRequests.kt | 2 +- .../ca/gosyer/data/server/requests/Sources.kt | 2 +- .../kotlin/ca/gosyer/data/ui/UiPreferences.kt | 3 +- .../ca/gosyer/data/ui/model/StartScreen.kt | 7 +- .../ca/gosyer/data/ui/model/ThemeMode.kt | 2 +- .../kotlin/ca/gosyer/ui/base/WindowDialog.kt | 2 +- .../ui/base/components/ColorPickerDialog.kt | 166 +++++++++--------- .../gosyer/ui/base/components/ErrorScreen.kt | 2 +- .../ca/gosyer/ui/base/components/KtorImage.kt | 2 +- .../ui/base/components/LoadingScreen.kt | 2 +- .../ca/gosyer/ui/base/components/Manga.kt | 2 +- .../ca/gosyer/ui/base/components/Pager.kt | 2 +- .../ca/gosyer/ui/base/components/Toolbar.kt | 6 +- .../ui/base/prefs/PreferencesUiBuilder.kt | 57 +++--- .../ca/gosyer/ui/base/theme/RandomColors.kt | 2 +- .../kotlin/ca/gosyer/ui/base/theme/Themes.kt | 12 +- .../ca/gosyer/ui/base/vm/ComposeViewModel.kt | 2 +- .../gosyer/ui/categories/CategoriesDialogs.kt | 2 +- .../ca/gosyer/ui/categories/CategoriesMenu.kt | 14 +- .../ui/categories/CategoriesMenuViewModel.kt | 2 +- .../ca/gosyer/ui/extensions/ExtensionsMenu.kt | 3 +- .../ui/extensions/ExtensionsMenuViewModel.kt | 5 +- .../gosyer/ui/library/LibraryMangaBadges.kt | 2 +- .../ca/gosyer/ui/library/LibraryScreen.kt | 7 +- .../ui/library/LibraryScreenViewModel.kt | 7 +- .../ca/gosyer/ui/library/MangaCompactGrid.kt | 13 +- src/main/kotlin/ca/gosyer/ui/main/MainMenu.kt | 10 +- .../kotlin/ca/gosyer/ui/main/MainViewModel.kt | 4 +- src/main/kotlin/ca/gosyer/ui/main/main.kt | 2 +- .../kotlin/ca/gosyer/ui/manga/MangaMenu.kt | 6 +- .../ca/gosyer/ui/manga/MangaMenuViewModel.kt | 3 +- .../ui/settings/SettingsAppearanceScreen.kt | 32 ++-- .../ui/settings/SettingsServerScreen.kt | 2 +- .../ca/gosyer/ui/sources/SourcesMenu.kt | 1 - .../gosyer/ui/sources/SourcesMenuViewModel.kt | 4 +- .../ui/sources/components/SourceHomeScreen.kt | 3 +- .../ui/sources/components/SourceScreen.kt | 3 +- .../components/SourceScreenViewModel.kt | 6 +- .../kotlin/ca/gosyer/util/compose/Color.kt | 2 +- .../kotlin/ca/gosyer/util/compose/Image.kt | 2 +- .../kotlin/ca/gosyer/util/compose/State.kt | 2 +- .../kotlin/ca/gosyer/util/compose/Theme.kt | 2 +- src/main/kotlin/ca/gosyer/util/system/File.kt | 2 +- src/main/kotlin/ca/gosyer/util/system/Flow.kt | 2 +- .../ca/gosyer/util/system/ProcessFile.kt | 4 +- .../data/server/ExtensionInteractionTest.kt | 4 +- 83 files changed, 320 insertions(+), 278 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0b72db9e..4c6bb1ad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,8 @@ import org.jetbrains.compose.compose import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jmailen.gradle.kotlinter.tasks.FormatTask +import org.jmailen.gradle.kotlinter.tasks.LintTask plugins { kotlin("jvm") version "1.4.32" @@ -8,6 +10,7 @@ plugins { kotlin("plugin.serialization") version "1.4.32" id("org.jetbrains.compose") version "0.4.0-build184" id("de.fuerstenau.buildconfig") version "1.1.8" + id("org.jmailen.kotlinter") version "3.4.0" } group = "ca.gosyer" @@ -82,6 +85,19 @@ tasks { test { useJUnit() } + + withType { + source(files("src")) + reports.set(mapOf( + "plain" to file("build/lint-report.txt"), + "json" to file("build/lint-report.json") + )) + } + + withType { + source(files("src")) + report.set(file("build/format-report.txt")) + } } @@ -123,4 +139,9 @@ buildConfig { packageName = project.group.toString() buildConfigField("boolean", "DEBUG", project.hasProperty("debugApp").toString()) +} + +kotlinter { + experimentalRules = true + disabledRules = arrayOf("experimental:argument-list-wrapping") } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7fc6f1ff..12add920 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ kotlin.code.style=official +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/src/main/kotlin/ca/gosyer/common/di/AppScope.kt b/src/main/kotlin/ca/gosyer/common/di/AppScope.kt index cf36804e..ce158c6d 100644 --- a/src/main/kotlin/ca/gosyer/common/di/AppScope.kt +++ b/src/main/kotlin/ca/gosyer/common/di/AppScope.kt @@ -27,5 +27,4 @@ object AppScope : Scope by KTP.openRootScope() { inline fun getInstance(): T { return getInstance(T::class.java) } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/di/GenericsModule.kt b/src/main/kotlin/ca/gosyer/common/di/GenericsModule.kt index 29399d41..3e0704c8 100644 --- a/src/main/kotlin/ca/gosyer/common/di/GenericsModule.kt +++ b/src/main/kotlin/ca/gosyer/common/di/GenericsModule.kt @@ -14,4 +14,4 @@ class GenericsProvider(private val cls: Class, val scope: Scope = AppScope override fun get(): T { return scope.getInstance(cls) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/di/ModuleExtensions.kt b/src/main/kotlin/ca/gosyer/common/di/ModuleExtensions.kt index b96685c5..9917a97b 100644 --- a/src/main/kotlin/ca/gosyer/common/di/ModuleExtensions.kt +++ b/src/main/kotlin/ca/gosyer/common/di/ModuleExtensions.kt @@ -13,4 +13,4 @@ import toothpick.config.Module */ inline fun Module.bindInstance(instance: B) { bind(B::class.java).toInstance(instance) -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/io/DataUriStringSource.kt b/src/main/kotlin/ca/gosyer/common/io/DataUriStringSource.kt index 23694c63..4da8d416 100644 --- a/src/main/kotlin/ca/gosyer/common/io/DataUriStringSource.kt +++ b/src/main/kotlin/ca/gosyer/common/io/DataUriStringSource.kt @@ -50,5 +50,4 @@ class DataUriStringSource(private val data: String) : Source { override fun close() { } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/io/OkioExtensions.kt b/src/main/kotlin/ca/gosyer/common/io/OkioExtensions.kt index 81c469ea..065cb15c 100644 --- a/src/main/kotlin/ca/gosyer/common/io/OkioExtensions.kt +++ b/src/main/kotlin/ca/gosyer/common/io/OkioExtensions.kt @@ -6,7 +6,6 @@ package ca.gosyer.common.io - import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import okio.BufferedSink @@ -29,4 +28,4 @@ suspend fun Source.copyTo(sink: BufferedSink) { sink.use { it.writeAll(source) } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/prefs/LazyPreferenceStore.kt b/src/main/kotlin/ca/gosyer/common/prefs/LazyPreferenceStore.kt index 7f8ac5ed..79a663d0 100644 --- a/src/main/kotlin/ca/gosyer/common/prefs/LazyPreferenceStore.kt +++ b/src/main/kotlin/ca/gosyer/common/prefs/LazyPreferenceStore.kt @@ -80,4 +80,4 @@ class LazyPreferenceStore( ): Preference { return lazyStore.value.getJsonObject(key, defaultValue, serializer) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/prefs/Preference.kt b/src/main/kotlin/ca/gosyer/common/prefs/Preference.kt index 25c489f4..bb678a29 100644 --- a/src/main/kotlin/ca/gosyer/common/prefs/Preference.kt +++ b/src/main/kotlin/ca/gosyer/common/prefs/Preference.kt @@ -6,7 +6,6 @@ package ca.gosyer.common.prefs - import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow @@ -57,5 +56,4 @@ interface Preference { * current value and receive preference updates. */ fun stateIn(scope: CoroutineScope): StateFlow - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/prefs/PreferenceStore.kt b/src/main/kotlin/ca/gosyer/common/prefs/PreferenceStore.kt index 9e972ebb..40e53d6f 100644 --- a/src/main/kotlin/ca/gosyer/common/prefs/PreferenceStore.kt +++ b/src/main/kotlin/ca/gosyer/common/prefs/PreferenceStore.kt @@ -57,7 +57,6 @@ interface PreferenceStore { deserializer: (String) -> T ): Preference - /** * Returns preference of type [T] for this [key]. The [serializer] must be provided. */ @@ -67,7 +66,6 @@ interface PreferenceStore { serializer: KSerializer, serializersModule: SerializersModule = EmptySerializersModule ): Preference - } /** @@ -77,11 +75,16 @@ inline fun > PreferenceStore.getEnum( key: String, defaultValue: T ): Preference { - return getObject(key, defaultValue, { it.name }, { - try { - enumValueOf(it) - } catch (e: IllegalArgumentException) { - defaultValue + return getObject( + key, + defaultValue, + { it.name }, + { + try { + enumValueOf(it) + } catch (e: IllegalArgumentException) { + defaultValue + } } - }) + ) } diff --git a/src/main/kotlin/ca/gosyer/common/util/Codec.kt b/src/main/kotlin/ca/gosyer/common/util/Codec.kt index 40a1b5d1..1bb9b160 100644 --- a/src/main/kotlin/ca/gosyer/common/util/Codec.kt +++ b/src/main/kotlin/ca/gosyer/common/util/Codec.kt @@ -11,4 +11,4 @@ import okio.ByteString.Companion.encode fun String.decodeBase64() = decodeBase64()!! -fun String.md5() = encode().md5().hex() \ No newline at end of file +fun String.md5() = encode().md5().hex() diff --git a/src/main/kotlin/ca/gosyer/common/util/CollectionExtensions.kt b/src/main/kotlin/ca/gosyer/common/util/CollectionExtensions.kt index bcf3b524..604c6927 100644 --- a/src/main/kotlin/ca/gosyer/common/util/CollectionExtensions.kt +++ b/src/main/kotlin/ca/gosyer/common/util/CollectionExtensions.kt @@ -41,4 +41,4 @@ inline fun MutableCollection.removeFirst(predicate: (T) -> Boolean): T? { } } return null -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/common/util/ImageUtil.kt b/src/main/kotlin/ca/gosyer/common/util/ImageUtil.kt index e08a95f0..e3a23aa3 100644 --- a/src/main/kotlin/ca/gosyer/common/util/ImageUtil.kt +++ b/src/main/kotlin/ca/gosyer/common/util/ImageUtil.kt @@ -40,4 +40,4 @@ object ImageUtil { GIF("image/gif", "gif"), WEBP("image/webp", "webp") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/core/prefs/JvmPreference.kt b/src/main/kotlin/ca/gosyer/core/prefs/JvmPreference.kt index a1634547..08ff20e4 100644 --- a/src/main/kotlin/ca/gosyer/core/prefs/JvmPreference.kt +++ b/src/main/kotlin/ca/gosyer/core/prefs/JvmPreference.kt @@ -95,5 +95,4 @@ internal class JvmPreference( override fun stateIn(scope: CoroutineScope): StateFlow { return changes().stateIn(scope, SharingStarted.Eagerly, get()) } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceAdapters.kt b/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceAdapters.kt index 9d6a0180..f0527bee 100644 --- a/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceAdapters.kt +++ b/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceAdapters.kt @@ -87,7 +87,6 @@ internal class ObjectAdapter( override fun set(key: String, value: T, editor: ObservableSettings) { editor.putString(key, serializer(value)) } - } internal class JsonObjectAdapter( @@ -103,5 +102,4 @@ internal class JsonObjectAdapter( override fun set(key: String, value: T, editor: ObservableSettings) { editor.encodeValue(serializer, key, value, serializersModule) } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceStore.kt b/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceStore.kt index 6561f422..69b2f377 100644 --- a/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceStore.kt +++ b/src/main/kotlin/ca/gosyer/core/prefs/JvmPreferenceStore.kt @@ -82,5 +82,4 @@ class JvmPreferenceStore(private val preferences: ObservableSettings) : Preferen val adapter = JsonObjectAdapter(defaultValue, serializer, serializersModule) return JvmPreference(preferences, key, defaultValue, adapter) } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/core/prefs/PreferenceStoreProvider.kt b/src/main/kotlin/ca/gosyer/core/prefs/PreferenceStoreProvider.kt index 7eea4447..04256b39 100644 --- a/src/main/kotlin/ca/gosyer/core/prefs/PreferenceStoreProvider.kt +++ b/src/main/kotlin/ca/gosyer/core/prefs/PreferenceStoreProvider.kt @@ -13,12 +13,12 @@ import java.util.prefs.Preferences class PreferenceStoreFactory { fun create(name: String? = null): PreferenceStore { + val userPreferences: Preferences = Preferences.userRoot() val jvmPreferences = if (!name.isNullOrBlank()) { - JvmPreferencesSettings(Preferences.userRoot().node(name)) + JvmPreferencesSettings(userPreferences.node(name)) } else { - JvmPreferencesSettings(Preferences.userRoot()) + JvmPreferencesSettings(userPreferences) } return JvmPreferenceStore(jvmPreferences) } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/catalog/CatalogPreferences.kt b/src/main/kotlin/ca/gosyer/data/catalog/CatalogPreferences.kt index 876c5149..2f14bf21 100644 --- a/src/main/kotlin/ca/gosyer/data/catalog/CatalogPreferences.kt +++ b/src/main/kotlin/ca/gosyer/data/catalog/CatalogPreferences.kt @@ -13,4 +13,4 @@ class CatalogPreferences(private val preferenceStore: PreferenceStore) { fun languages(): Preference> { return preferenceStore.getStringSet("enabled_langs", setOf("en")) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/extension/ExtensionPreferences.kt b/src/main/kotlin/ca/gosyer/data/extension/ExtensionPreferences.kt index ddeae81d..90d146dc 100644 --- a/src/main/kotlin/ca/gosyer/data/extension/ExtensionPreferences.kt +++ b/src/main/kotlin/ca/gosyer/data/extension/ExtensionPreferences.kt @@ -13,4 +13,4 @@ class ExtensionPreferences(private val preferenceStore: PreferenceStore) { fun languages(): Preference> { return preferenceStore.getStringSet("enabled_langs", setOf("all", "en")) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/library/LibraryPreferences.kt b/src/main/kotlin/ca/gosyer/data/library/LibraryPreferences.kt index 4517e373..8923afe5 100644 --- a/src/main/kotlin/ca/gosyer/data/library/LibraryPreferences.kt +++ b/src/main/kotlin/ca/gosyer/data/library/LibraryPreferences.kt @@ -19,4 +19,4 @@ class LibraryPreferences(private val preferenceStore: PreferenceStore) { fun showAllCategory(): Preference { return preferenceStore.getBoolean("show_all_category", false) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/library/model/DisplayMode.kt b/src/main/kotlin/ca/gosyer/data/library/model/DisplayMode.kt index ee8c1d85..d3c73cd5 100644 --- a/src/main/kotlin/ca/gosyer/data/library/model/DisplayMode.kt +++ b/src/main/kotlin/ca/gosyer/data/library/model/DisplayMode.kt @@ -17,4 +17,4 @@ enum class DisplayMode { companion object { val values = values() } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/models/Category.kt b/src/main/kotlin/ca/gosyer/data/models/Category.kt index 3259a4ec..bf9340ec 100644 --- a/src/main/kotlin/ca/gosyer/data/models/Category.kt +++ b/src/main/kotlin/ca/gosyer/data/models/Category.kt @@ -14,4 +14,4 @@ data class Category( val order: Int, val name: String, val landing: Boolean -) \ No newline at end of file +) diff --git a/src/main/kotlin/ca/gosyer/data/models/Manga.kt b/src/main/kotlin/ca/gosyer/data/models/Manga.kt index 9407dc16..782d9259 100644 --- a/src/main/kotlin/ca/gosyer/data/models/Manga.kt +++ b/src/main/kotlin/ca/gosyer/data/models/Manga.kt @@ -25,4 +25,4 @@ data class Manga( val source: Source? ) { fun cover(serverUrl: String) = thumbnailUrl?.let { serverUrl + it } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/HttpClient.kt b/src/main/kotlin/ca/gosyer/data/server/HttpClient.kt index 181faea5..9db81241 100644 --- a/src/main/kotlin/ca/gosyer/data/server/HttpClient.kt +++ b/src/main/kotlin/ca/gosyer/data/server/HttpClient.kt @@ -28,4 +28,4 @@ internal class HttpProvider @Inject constructor() : Provider { } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/ServerPreferences.kt b/src/main/kotlin/ca/gosyer/data/server/ServerPreferences.kt index 97c8bfd8..912622b6 100644 --- a/src/main/kotlin/ca/gosyer/data/server/ServerPreferences.kt +++ b/src/main/kotlin/ca/gosyer/data/server/ServerPreferences.kt @@ -18,4 +18,4 @@ class ServerPreferences(private val preferenceStore: PreferenceStore) { fun server(): Preference { return preferenceStore.getString("server_url", "http://localhost:4567") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/ServerService.kt b/src/main/kotlin/ca/gosyer/data/server/ServerService.kt index 29fb0259..c77bb110 100644 --- a/src/main/kotlin/ca/gosyer/data/server/ServerService.kt +++ b/src/main/kotlin/ca/gosyer/data/server/ServerService.kt @@ -45,7 +45,7 @@ class ServerService @Inject constructor( val logger = KotlinLogging.logger("Server") val runtime = Runtime.getRuntime() - val jarFile = File(userDataDir,"Tachidesk.jar") + val jarFile = File(userDataDir, "Tachidesk.jar") if (!jarFile.exists()) { logger.info { "Copying server to resources" } javaClass.getResourceAsStream("/Tachidesk.jar")?.buffered()?.use { input -> @@ -59,7 +59,7 @@ class ServerService @Inject constructor( val javaExeFile = File(javaLibraryPath, "java.exe") val javaUnixFile = File(javaLibraryPath, "java") val javaExePath = when { - javaExeFile.exists() ->'"' + javaExeFile.absolutePath + '"' + javaExeFile.exists() -> '"' + javaExeFile.absolutePath + '"' javaUnixFile.exists() -> '"' + javaUnixFile.absolutePath + '"' else -> "java" } @@ -69,9 +69,11 @@ class ServerService @Inject constructor( process = runtime.exec("""$javaExePath -jar "${jarFile.absolutePath}"""").also { reader = it.inputStream.bufferedReader() } - runtime.addShutdownHook(thread(start = false) { - process?.destroy() - }) + runtime.addShutdownHook( + thread(start = false) { + process?.destroy() + } + ) logger.info { "Server started successfully" } var line: String? while (reader.readLine().also { line = it } != null) { @@ -87,7 +89,6 @@ class ServerService @Inject constructor( logger.info { "Server closed" } val exitVal = process?.waitFor() logger.info { "Process exitValue: $exitVal" } - } }.launchIn(GlobalScope) } @@ -98,4 +99,4 @@ class ServerService @Inject constructor( STARTED, FAILED; } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/BaseInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/BaseInteractionHandler.kt index 687f843d..cad87234 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/BaseInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/BaseInteractionHandler.kt @@ -131,4 +131,4 @@ open class BaseInteractionHandler( } while (attempt <= 3) throw lastException } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt index 870e1ca1..46db157d 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/CategoryInteractionHandler.kt @@ -29,7 +29,7 @@ import javax.inject.Inject class CategoryInteractionHandler @Inject constructor( client: Http, serverPreferences: ServerPreferences -): BaseInteractionHandler(client, serverPreferences) { +) : BaseInteractionHandler(client, serverPreferences) { suspend fun getMangaCategories(mangaId: Long) = withContext(Dispatchers.IO) { client.getRepeat>( @@ -75,13 +75,13 @@ class CategoryInteractionHandler @Inject constructor( suspend fun modifyCategory(categoryId: Long, name: String? = null, isLanding: Boolean? = null) = withContext(Dispatchers.IO) { client.submitFormRepeat( serverUrl + categoryModifyRequest(categoryId), - formParameters = Parameters.build { - if (name != null) { - append("name", name) - } - if (isLanding != null) { - append("isLanding", isLanding.toString()) - } + formParameters = Parameters.build { + if (name != null) { + append("name", name) + } + if (isLanding != null) { + append("isLanding", isLanding.toString()) + } } ) { method = HttpMethod.Patch @@ -115,4 +115,4 @@ class CategoryInteractionHandler @Inject constructor( ) } suspend fun getMangaFromCategory(category: Category) = getMangaFromCategory(category.id) -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/ChapterInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/ChapterInteractionHandler.kt index 75f1af7e..a4b8505a 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/ChapterInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/ChapterInteractionHandler.kt @@ -20,7 +20,7 @@ import javax.inject.Inject class ChapterInteractionHandler @Inject constructor( client: Http, serverPreferences: ServerPreferences -): BaseInteractionHandler(client, serverPreferences) { +) : BaseInteractionHandler(client, serverPreferences) { suspend fun getChapters(mangaId: Long) = withContext(Dispatchers.IO) { client.getRepeat>( @@ -58,4 +58,4 @@ class ChapterInteractionHandler @Inject constructor( suspend fun getPage(manga: Manga, chapterId: Long, pageNum: Int) = getPage(manga.id, chapterId, pageNum) suspend fun getPage(manga: Manga, chapter: Chapter, pageNum: Int) = getPage(manga.id, chapter.id, pageNum) -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/ExtensionInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/ExtensionInteractionHandler.kt index 656a970e..fd181dba 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/ExtensionInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/ExtensionInteractionHandler.kt @@ -21,7 +21,7 @@ import javax.inject.Inject class ExtensionInteractionHandler @Inject constructor( client: Http, serverPreferences: ServerPreferences -): BaseInteractionHandler(client, serverPreferences) { +) : BaseInteractionHandler(client, serverPreferences) { suspend fun getExtensionList() = withContext(Dispatchers.IO) { client.getRepeat>( @@ -47,4 +47,4 @@ class ExtensionInteractionHandler @Inject constructor( serverUrl + apkIconQuery(extension.apkName) ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/LibraryInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/LibraryInteractionHandler.kt index 6df4b211..5a89eae8 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/LibraryInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/LibraryInteractionHandler.kt @@ -20,7 +20,7 @@ import javax.inject.Inject class LibraryInteractionHandler @Inject constructor( client: Http, serverPreferences: ServerPreferences -): BaseInteractionHandler(client, serverPreferences) { +) : BaseInteractionHandler(client, serverPreferences) { suspend fun getLibraryManga() = withContext(Dispatchers.IO) { client.getRepeat>( @@ -43,4 +43,4 @@ class LibraryInteractionHandler @Inject constructor( } suspend fun removeMangaFromLibrary(manga: Manga) = removeMangaFromLibrary(manga.id) -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/MangaInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/MangaInteractionHandler.kt index 2e350ef2..f4c343b4 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/MangaInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/MangaInteractionHandler.kt @@ -18,7 +18,7 @@ import javax.inject.Inject class MangaInteractionHandler @Inject constructor( client: Http, serverPreferences: ServerPreferences -): BaseInteractionHandler(client, serverPreferences) { +) : BaseInteractionHandler(client, serverPreferences) { suspend fun getManga(mangaId: Long) = withContext(Dispatchers.IO) { client.getRepeat( @@ -32,5 +32,4 @@ class MangaInteractionHandler @Inject constructor( serverUrl + mangaThumbnailQuery(mangaId) ) } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/interactions/SourceInteractionHandler.kt b/src/main/kotlin/ca/gosyer/data/server/interactions/SourceInteractionHandler.kt index 65162da4..45f20a47 100644 --- a/src/main/kotlin/ca/gosyer/data/server/interactions/SourceInteractionHandler.kt +++ b/src/main/kotlin/ca/gosyer/data/server/interactions/SourceInteractionHandler.kt @@ -25,7 +25,7 @@ import javax.inject.Inject class SourceInteractionHandler @Inject constructor( client: Http, serverPreferences: ServerPreferences -): BaseInteractionHandler(client, serverPreferences) { +) : BaseInteractionHandler(client, serverPreferences) { suspend fun getSourceList() = withContext(Dispatchers.IO) { client.getRepeat>( @@ -48,7 +48,8 @@ class SourceInteractionHandler @Inject constructor( } suspend fun getPopularManga(source: Source, pageNum: Int) = getPopularManga( - source.id, pageNum + source.id, + pageNum ) suspend fun getLatestManga(sourceId: Long, pageNum: Int) = withContext(Dispatchers.IO) { @@ -58,7 +59,8 @@ class SourceInteractionHandler @Inject constructor( } suspend fun getLatestManga(source: Source, pageNum: Int) = getLatestManga( - source.id, pageNum + source.id, + pageNum ) // TODO: 2021-03-14 @@ -75,7 +77,9 @@ class SourceInteractionHandler @Inject constructor( } suspend fun getSearchResults(source: Source, searchTerm: String, pageNum: Int) = getSearchResults( - source.id, searchTerm, pageNum + source.id, + searchTerm, + pageNum ) // TODO: 2021-03-14 @@ -86,4 +90,4 @@ class SourceInteractionHandler @Inject constructor( } suspend fun getFilterList(source: Source) = getFilterList(source.id) -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt b/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt index e8926875..af15d8a9 100644 --- a/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt +++ b/src/main/kotlin/ca/gosyer/data/server/requests/Category.kt @@ -43,4 +43,4 @@ fun categoryDeleteRequest(categoryId: Long) = @Get fun getMangaInCategoryQuery(categoryId: Long) = - "/api/v1/category/$categoryId" \ No newline at end of file + "/api/v1/category/$categoryId" diff --git a/src/main/kotlin/ca/gosyer/data/server/requests/Chapters.kt b/src/main/kotlin/ca/gosyer/data/server/requests/Chapters.kt index 7250ebbf..c8af9058 100644 --- a/src/main/kotlin/ca/gosyer/data/server/requests/Chapters.kt +++ b/src/main/kotlin/ca/gosyer/data/server/requests/Chapters.kt @@ -16,4 +16,4 @@ fun getChapterQuery(mangaId: Long, chapterId: Long) = @Get fun getPageQuery(mangaId: Long, chapterId: Long, index: Int) = - "/api/v1/manga/$mangaId/chapter/$chapterId/page/$index" \ No newline at end of file + "/api/v1/manga/$mangaId/chapter/$chapterId/page/$index" diff --git a/src/main/kotlin/ca/gosyer/data/server/requests/Extensions.kt b/src/main/kotlin/ca/gosyer/data/server/requests/Extensions.kt index 842cefa8..4eb41c4a 100644 --- a/src/main/kotlin/ca/gosyer/data/server/requests/Extensions.kt +++ b/src/main/kotlin/ca/gosyer/data/server/requests/Extensions.kt @@ -20,4 +20,4 @@ fun apkUninstallQuery(apkName: String) = @Get fun apkIconQuery(apkName: String) = - "/api/v1/extension/icon/$apkName" \ No newline at end of file + "/api/v1/extension/icon/$apkName" diff --git a/src/main/kotlin/ca/gosyer/data/server/requests/Library.kt b/src/main/kotlin/ca/gosyer/data/server/requests/Library.kt index 22bc1c90..f0af8484 100644 --- a/src/main/kotlin/ca/gosyer/data/server/requests/Library.kt +++ b/src/main/kotlin/ca/gosyer/data/server/requests/Library.kt @@ -16,4 +16,4 @@ fun removeMangaFromLibraryRequest(mangaId: Long) = @Get fun getLibraryQuery() = - "/api/v1/library/" \ No newline at end of file + "/api/v1/library/" diff --git a/src/main/kotlin/ca/gosyer/data/server/requests/RestRequests.kt b/src/main/kotlin/ca/gosyer/data/server/requests/RestRequests.kt index 1ee59f63..74e109d8 100644 --- a/src/main/kotlin/ca/gosyer/data/server/requests/RestRequests.kt +++ b/src/main/kotlin/ca/gosyer/data/server/requests/RestRequests.kt @@ -12,4 +12,4 @@ annotation class Post annotation class Delete -annotation class Patch \ No newline at end of file +annotation class Patch diff --git a/src/main/kotlin/ca/gosyer/data/server/requests/Sources.kt b/src/main/kotlin/ca/gosyer/data/server/requests/Sources.kt index b87961f3..2df5e15b 100644 --- a/src/main/kotlin/ca/gosyer/data/server/requests/Sources.kt +++ b/src/main/kotlin/ca/gosyer/data/server/requests/Sources.kt @@ -32,4 +32,4 @@ fun sourceSearchQuery(sourceId: Long, searchTerm: String, pageNum: Int) = @Get fun getFilterListQuery(sourceId: Long) = - "/api/v1/source/$sourceId/filters/" \ No newline at end of file + "/api/v1/source/$sourceId/filters/" diff --git a/src/main/kotlin/ca/gosyer/data/ui/UiPreferences.kt b/src/main/kotlin/ca/gosyer/data/ui/UiPreferences.kt index 52a692ce..54b8a59d 100644 --- a/src/main/kotlin/ca/gosyer/data/ui/UiPreferences.kt +++ b/src/main/kotlin/ca/gosyer/data/ui/UiPreferences.kt @@ -56,5 +56,4 @@ class UiPreferences(private val preferenceStore: PreferenceStore) { fun dateFormat(): Preference { return preferenceStore.getString("date_format", "") } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/data/ui/model/StartScreen.kt b/src/main/kotlin/ca/gosyer/data/ui/model/StartScreen.kt index 938866e2..7c299516 100644 --- a/src/main/kotlin/ca/gosyer/data/ui/model/StartScreen.kt +++ b/src/main/kotlin/ca/gosyer/data/ui/model/StartScreen.kt @@ -12,9 +12,10 @@ import kotlinx.serialization.Serializable @Serializable enum class StartScreen { - Library, + Library, + // Updates, // History, - Sources, - Extensions + Sources, + Extensions } diff --git a/src/main/kotlin/ca/gosyer/data/ui/model/ThemeMode.kt b/src/main/kotlin/ca/gosyer/data/ui/model/ThemeMode.kt index 51f9c8e2..59a50843 100644 --- a/src/main/kotlin/ca/gosyer/data/ui/model/ThemeMode.kt +++ b/src/main/kotlin/ca/gosyer/data/ui/model/ThemeMode.kt @@ -13,4 +13,4 @@ enum class ThemeMode { /*System,*/ Light, Dark, -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt b/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt index fcaa729d..884358d6 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt @@ -128,4 +128,4 @@ fun WindowDialog( } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt b/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt index 165cb3bc..fdc3fbeb 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt @@ -99,16 +99,20 @@ fun ColorPickerDialog( val showPresetsState by showPresets.collectAsState() val currentColorState by currentColor.collectAsState() Row(Modifier.fillMaxWidth().padding(8.dp)) { - TextButton(onClick = { - showPresets.value = !showPresetsState - }) { + TextButton( + onClick = { + showPresets.value = !showPresetsState + } + ) { Text(if (showPresetsState) "Custom" else "Presets") } Spacer(Modifier.weight(1f)) - TextButton(onClick = { - onSelected(currentColorState) - it.close() - }) { + TextButton( + onClick = { + onSelected(currentColorState) + it.close() + } + ) { Text("Select") } } @@ -181,7 +185,8 @@ private fun ColorPresetItem( onClick: () -> Unit ) { Box( - contentAlignment = Alignment.Center, modifier = Modifier + contentAlignment = Alignment.Center, + modifier = Modifier .fillMaxWidth() .padding(4.dp) .size(48.dp) @@ -241,13 +246,15 @@ fun ColorPalette( val saturationGradient = remember(hue, matrixSize) { Brush.linearGradient( colors = listOf(Color.White, hueToColor(hue)), - start = Offset(0f, 0f), end = Offset(matrixSize.width.toFloat(), 0f) + start = Offset(0f, 0f), + end = Offset(matrixSize.width.toFloat(), 0f) ) } val valueGradient = remember(matrixSize) { Brush.linearGradient( colors = listOf(Color.White, Color.Black), - start = Offset(0f, 0f), end = Offset(0f, matrixSize.height.toFloat()) + start = Offset(0f, 0f), + end = Offset(0f, matrixSize.height.toFloat()) ) } @@ -270,80 +277,82 @@ fun ColorPalette( Column { Text("") // TODO workaround: without this text, the color picker doesn't render correctly Row(Modifier.height(IntrinsicSize.Max)) { - Box(Modifier - .aspectRatio(1f) - .weight(1f) - .onSizeChanged { - matrixSize = it - val hsv = selectedColor.toHsv() - matrixCursor = satValToCoordinates(hsv[1], hsv[2], it) - hueCursor = hueToCoordinate(hue, it) - } - .drawWithContent { - drawRect(brush = valueGradient) - drawRect(brush = saturationGradient, blendMode = BlendMode.Multiply) - drawRect(Color.LightGray, size = size, style = borderStroke) - drawCircle( - Color.Black, - radius = 8f, - center = matrixCursor, - style = cursorStroke - ) - drawCircle( - Color.LightGray, - radius = 12f, - center = matrixCursor, - style = cursorStroke - ) - } - .pointerInput(Unit) { - detectMove { offset -> - val safeOffset = offset.copy( - x = offset.x.coerceIn(0f, matrixSize.width.toFloat()), - y = offset.y.coerceIn(0f, matrixSize.height.toFloat()) - ) - matrixCursor = safeOffset - val newColor = matrixCoordinatesToColor(hue, safeOffset, matrixSize) - setSelectedColor(newColor) + Box( + Modifier + .aspectRatio(1f) + .weight(1f) + .onSizeChanged { + matrixSize = it + val hsv = selectedColor.toHsv() + matrixCursor = satValToCoordinates(hsv[1], hsv[2], it) + hueCursor = hueToCoordinate(hue, it) } - } - ) - Box(Modifier - .fillMaxHeight() - .requiredWidth(48.dp) - .padding(start = 8.dp) - .drawWithCache { - var h = 360f - val colors = MutableList(size.height.toInt()) { - hueToColor(h).also { - h -= 360f / size.height - } - } - val cursorSize = Size(size.width, 10f) - val cursorTopLeft = Offset(0f, hueCursor - (cursorSize.height / 2)) - onDrawBehind { - colors.forEachIndexed { i, color -> - val pos = i.toFloat() - drawLine(color, Offset(0f, pos), Offset(size.width, pos)) - } + .drawWithContent { + drawRect(brush = valueGradient) + drawRect(brush = saturationGradient, blendMode = BlendMode.Multiply) drawRect(Color.LightGray, size = size, style = borderStroke) - drawRect( - cursorColor, - topLeft = cursorTopLeft, - size = cursorSize, + drawCircle( + Color.Black, + radius = 8f, + center = matrixCursor, + style = cursorStroke + ) + drawCircle( + Color.LightGray, + radius = 12f, + center = matrixCursor, style = cursorStroke ) } - } - .pointerInput(Unit) { - detectMove { offset -> - val safeY = offset.y.coerceIn(0f, matrixSize.height.toFloat()) - hueCursor = safeY - hue = hueCoordinatesToHue(safeY, matrixSize) - val newColor = matrixCoordinatesToColor(hue, matrixCursor, matrixSize) - setSelectedColor(newColor) + .pointerInput(Unit) { + detectMove { offset -> + val safeOffset = offset.copy( + x = offset.x.coerceIn(0f, matrixSize.width.toFloat()), + y = offset.y.coerceIn(0f, matrixSize.height.toFloat()) + ) + matrixCursor = safeOffset + val newColor = matrixCoordinatesToColor(hue, safeOffset, matrixSize) + setSelectedColor(newColor) + } + } + ) + Box( + Modifier + .fillMaxHeight() + .requiredWidth(48.dp) + .padding(start = 8.dp) + .drawWithCache { + var h = 360f + val colors = MutableList(size.height.toInt()) { + hueToColor(h).also { + h -= 360f / size.height + } + } + val cursorSize = Size(size.width, 10f) + val cursorTopLeft = Offset(0f, hueCursor - (cursorSize.height / 2)) + onDrawBehind { + colors.forEachIndexed { i, color -> + val pos = i.toFloat() + drawLine(color, Offset(0f, pos), Offset(size.width, pos)) + } + drawRect(Color.LightGray, size = size, style = borderStroke) + drawRect( + cursorColor, + topLeft = cursorTopLeft, + size = cursorSize, + style = cursorStroke + ) + } + } + .pointerInput(Unit) { + detectMove { offset -> + val safeY = offset.y.coerceIn(0f, matrixSize.height.toFloat()) + hueCursor = safeY + hue = hueCoordinatesToHue(safeY, matrixSize) + val newColor = matrixCoordinatesToColor(hue, matrixCursor, matrixSize) + setSelectedColor(newColor) + } } - } ) } Row(Modifier.padding(top = 8.dp), verticalAlignment = Alignment.Bottom) { @@ -451,4 +460,3 @@ private val presetColors = listOf( Color(0xFF607D8B), // BLUE GREY 500 Color(0xFF9E9E9E), // GREY 500 ) - diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/ErrorScreen.kt b/src/main/kotlin/ca/gosyer/ui/base/components/ErrorScreen.kt index 5515e28d..f69af1f2 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/ErrorScreen.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/ErrorScreen.kt @@ -51,4 +51,4 @@ private val ERROR_FACES = arrayOf( fun getRandomErrorFace(): String { return ERROR_FACES[Random.nextInt(ERROR_FACES.size)] -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/KtorImage.kt b/src/main/kotlin/ca/gosyer/ui/base/components/KtorImage.kt index eea7d9b0..17c97361 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/KtorImage.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/KtorImage.kt @@ -94,4 +94,4 @@ private suspend fun getImage(client: Http, imageUrl: String, retries: Int = 3): attempt++ } while (attempt <= retries) throw lastException -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/LoadingScreen.kt b/src/main/kotlin/ca/gosyer/ui/base/components/LoadingScreen.kt index cb274207..5ed708b5 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/LoadingScreen.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/LoadingScreen.kt @@ -35,4 +35,4 @@ fun LoadingScreen( } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/Manga.kt b/src/main/kotlin/ca/gosyer/ui/base/components/Manga.kt index f4a50893..0ea8dcd3 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/Manga.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/Manga.kt @@ -81,4 +81,4 @@ private val shadowGradient = Modifier.drawWithCache { onDrawBehind { drawRect(gradient) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/Pager.kt b/src/main/kotlin/ca/gosyer/ui/base/components/Pager.kt index 129bf49f..e30a2bd8 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/Pager.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/Pager.kt @@ -214,4 +214,4 @@ class PagerScope( */ val selectionState: PagerState.SelectionState get() = state.selectionState -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/Toolbar.kt b/src/main/kotlin/ca/gosyer/ui/base/components/Toolbar.kt index 7267ea61..933f38da 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/Toolbar.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/Toolbar.kt @@ -36,8 +36,8 @@ fun Toolbar( closable: Boolean, modifier: Modifier = Modifier, actions: @Composable RowScope.() -> Unit = {}, - backgroundColor: Color = MaterialTheme.colors.primary, //CustomColors.current.bars, - contentColor: Color = MaterialTheme.colors.onPrimary, //CustomColors.current.onBars, + backgroundColor: Color = MaterialTheme.colors.primary, // CustomColors.current.bars, + contentColor: Color = MaterialTheme.colors.onPrimary, // CustomColors.current.onBars, elevation: Dp = AppBarDefaults.TopAppBarElevation, search: ((String) -> Unit)? = null ) { @@ -86,4 +86,4 @@ fun Toolbar( } }*/ } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt b/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt index ac33d9a5..7c89b69d 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt @@ -139,9 +139,12 @@ fun EditTextPreference( preference.value = editText.text } ) { - OutlinedTextField(editText, onValueChange = { - editText = it - }) + OutlinedTextField( + editText, + onValueChange = { + editText = it + } + ) } } ) @@ -177,31 +180,37 @@ private fun ChoiceDialog( onDismissRequest: () -> Unit = {}, onSelected: (T) -> Unit, title: String, - buttons: @Composable (AppWindow) -> Unit = { } + buttons: @Composable (AppWindow) -> Unit = { } ) { - WindowDialog(onDismissRequest = onDismissRequest, buttons = buttons, title = title, content = { - LazyColumn { - items(items) { (value, text) -> - Row( - modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable( - onClick = { - onSelected(value) - it.close() - }), - verticalAlignment = Alignment.CenterVertically - ) { - RadioButton( - selected = value == selected, - onClick = { - onSelected(value) - it.close() - }, - ) - Text(text = text, modifier = Modifier.padding(start = 24.dp)) + WindowDialog( + onDismissRequest = onDismissRequest, + buttons = buttons, + title = title, + content = { + LazyColumn { + items(items) { (value, text) -> + Row( + modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable( + onClick = { + onSelected(value) + it.close() + } + ), + verticalAlignment = Alignment.CenterVertically + ) { + RadioButton( + selected = value == selected, + onClick = { + onSelected(value) + it.close() + }, + ) + Text(text = text, modifier = Modifier.padding(start = 24.dp)) + } } } } - }) + ) } @Composable diff --git a/src/main/kotlin/ca/gosyer/ui/base/theme/RandomColors.kt b/src/main/kotlin/ca/gosyer/ui/base/theme/RandomColors.kt index 42f58cf2..69390e10 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/theme/RandomColors.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/theme/RandomColors.kt @@ -38,4 +38,4 @@ object RandomColors { fun random(): Color { return colors[Random.nextInt(colors.size)] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/base/theme/Themes.kt b/src/main/kotlin/ca/gosyer/ui/base/theme/Themes.kt index d1511747..bc809fd6 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/theme/Themes.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/theme/Themes.kt @@ -19,11 +19,13 @@ data class Theme( val themes = listOf( // Pure white Theme( - 1, lightColors() + 1, + lightColors() ), // Tachiyomi 0.x default colors Theme( - 2, lightColors( + 2, + lightColors( primary = Color(0xFF2979FF), primaryVariant = Color(0xFF2979FF), onPrimary = Color.White, @@ -34,11 +36,13 @@ val themes = listOf( ), // Tachiyomi 0.x dark theme Theme( - 3, darkColors() + 3, + darkColors() ), // AMOLED theme Theme( - 4, darkColors( + 4, + darkColors( primary = Color.Black, onPrimary = Color.White, background = Color.Black diff --git a/src/main/kotlin/ca/gosyer/ui/base/vm/ComposeViewModel.kt b/src/main/kotlin/ca/gosyer/ui/base/vm/ComposeViewModel.kt index c9ab6311..2158e22f 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/vm/ComposeViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/vm/ComposeViewModel.kt @@ -49,4 +49,4 @@ inline fun viewModel( } } return viewModel -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesDialogs.kt b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesDialogs.kt index 824c3b00..3ba1fa97 100644 --- a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesDialogs.kt +++ b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesDialogs.kt @@ -77,4 +77,4 @@ fun openCreateDialog( } ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenu.kt b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenu.kt index 4139ecd7..08ecf3d3 100644 --- a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenu.kt +++ b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenu.kt @@ -142,15 +142,19 @@ private fun CategoryRow( } Spacer(modifier = Modifier.weight(1f)) IconButton(onClick = onRename) { - Icon(imageVector = Icons.Default.Edit, - contentDescription = null) + Icon( + imageVector = Icons.Default.Edit, + contentDescription = null + ) } IconButton(onClick = onDelete) { - Icon(imageVector = Icons.Default.Delete, - contentDescription = null) + Icon( + imageVector = Icons.Default.Delete, + contentDescription = null + ) } } } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt index 874ad1a0..69361d2b 100644 --- a/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/categories/CategoriesMenuViewModel.kt @@ -116,4 +116,4 @@ class CategoriesMenuViewModel @Inject constructor( fun Category.toMenuCategory() = MenuCategory(id, order, name, landing) data class MenuCategory(val id: Long? = null, var order: Int, val name: String, val landing: Boolean = false) -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenu.kt b/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenu.kt index 79d9280c..d7612607 100644 --- a/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenu.kt +++ b/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenu.kt @@ -123,7 +123,6 @@ fun ExtensionItem( } } } - } Button( { @@ -134,4 +133,4 @@ fun ExtensionItem( Text(if (extension.installed) "Uninstall" else "Install") } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenuViewModel.kt b/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenuViewModel.kt index 22ccdee0..6d7dff5c 100644 --- a/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenuViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/extensions/ExtensionsMenuViewModel.kt @@ -22,7 +22,7 @@ class ExtensionsMenuViewModel @Inject constructor( private val extensionHandler: ExtensionInteractionHandler, serverPreferences: ServerPreferences, private val extensionPreferences: ExtensionPreferences -): ViewModel() { +) : ViewModel() { private val logger = KotlinLogging.logger {} val serverUrl = serverPreferences.server().stateIn(scope) @@ -33,7 +33,6 @@ class ExtensionsMenuViewModel @Inject constructor( private val _isLoading = MutableStateFlow(true) val isLoading = _isLoading.asStateFlow() - init { scope.launch { getExtensions() @@ -76,4 +75,4 @@ class ExtensionsMenuViewModel @Inject constructor( getExtensions() } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/library/LibraryMangaBadges.kt b/src/main/kotlin/ca/gosyer/ui/library/LibraryMangaBadges.kt index b0ea5d34..cff96583 100644 --- a/src/main/kotlin/ca/gosyer/ui/library/LibraryMangaBadges.kt +++ b/src/main/kotlin/ca/gosyer/ui/library/LibraryMangaBadges.kt @@ -44,4 +44,4 @@ fun LibraryMangaBadges( } } -private val BadgesInnerPadding = Modifier.padding(horizontal = 3.dp, vertical = 1.dp) \ No newline at end of file +private val BadgesInnerPadding = Modifier.padding(horizontal = 3.dp, vertical = 1.dp) diff --git a/src/main/kotlin/ca/gosyer/ui/library/LibraryScreen.kt b/src/main/kotlin/ca/gosyer/ui/library/LibraryScreen.kt index 83dd05a5..29d78f93 100644 --- a/src/main/kotlin/ca/gosyer/ui/library/LibraryScreen.kt +++ b/src/main/kotlin/ca/gosyer/ui/library/LibraryScreen.kt @@ -50,12 +50,11 @@ fun LibraryScreen(onClickManga: (Long) -> Unit = { openMangaMenu(it) }) { val displayMode by vm.displayMode.collectAsState() val isLoading by vm.isLoading.collectAsState() val serverUrl by vm.serverUrl.collectAsState() - //val sheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden) + // val sheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden) if (categories.isEmpty()) { LoadingScreen(isLoading) } else { - /*ModalBottomSheetLayout( sheetState = sheetState, sheetContent = { *//*LibrarySheet()*//* } @@ -77,7 +76,7 @@ fun LibraryScreen(onClickManga: (Long) -> Unit = { openMangaMenu(it) }) { } )*/ LibraryTabs( - visible = true, //vm.showCategoryTabs, + visible = true, // vm.showCategoryTabs, categories = categories, selectedPage = selectedCategoryIndex, onPageChanged = vm::setSelectedPage @@ -171,4 +170,4 @@ private fun LibraryPager( else -> Box {} } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/library/LibraryScreenViewModel.kt b/src/main/kotlin/ca/gosyer/ui/library/LibraryScreenViewModel.kt index 5855195f..8f682e06 100644 --- a/src/main/kotlin/ca/gosyer/ui/library/LibraryScreenViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/library/LibraryScreenViewModel.kt @@ -35,7 +35,7 @@ class LibraryScreenViewModel @Inject constructor( private val categoryHandler: CategoryInteractionHandler, libraryPreferences: LibraryPreferences, serverPreferences: ServerPreferences, -): ViewModel() { +) : ViewModel() { val serverUrl = serverPreferences.server().stateIn(scope) private val library = Library(MutableStateFlow(emptyList()), mutableMapOf()) @@ -78,7 +78,6 @@ class LibraryScreenViewModel @Inject constructor( } } - fun setSelectedPage(page: Int) { _selectedCategoryIndex.value = page } @@ -88,8 +87,6 @@ class LibraryScreenViewModel @Inject constructor( } companion object { - val defaultCategory = Category(0, 0, "Default",true) + val defaultCategory = Category(0, 0, "Default", true) } } - - diff --git a/src/main/kotlin/ca/gosyer/ui/library/MangaCompactGrid.kt b/src/main/kotlin/ca/gosyer/ui/library/MangaCompactGrid.kt index cebbe1b8..b838b6e3 100644 --- a/src/main/kotlin/ca/gosyer/ui/library/MangaCompactGrid.kt +++ b/src/main/kotlin/ca/gosyer/ui/library/MangaCompactGrid.kt @@ -70,11 +70,12 @@ private fun LibraryMangaCompactGridItem( TextStyle(letterSpacing = 0.sp, fontFamily = FontFamily.SansSerif, fontSize = 14.sp) ) - Box(modifier = Modifier.padding(4.dp) - .fillMaxWidth() - .aspectRatio(3f / 4f) - .clip(MaterialTheme.shapes.medium) - .clickable(onClick = onClick) + Box( + modifier = Modifier.padding(4.dp) + .fillMaxWidth() + .aspectRatio(3f / 4f) + .clip(MaterialTheme.shapes.medium) + .clickable(onClick = onClick) ) { if (cover != null) { KtorImage(cover, contentScale = ContentScale.Crop) @@ -105,4 +106,4 @@ private val shadowGradient = Modifier.drawWithCache { onDrawBehind { drawRect(gradient) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/main/MainMenu.kt b/src/main/kotlin/ca/gosyer/ui/main/MainMenu.kt index 9e25f523..76084b54 100644 --- a/src/main/kotlin/ca/gosyer/ui/main/MainMenu.kt +++ b/src/main/kotlin/ca/gosyer/ui/main/MainMenu.kt @@ -58,7 +58,6 @@ import compose.icons.fontawesomeicons.regular.Map fun MainMenu() { val vm = viewModel() Surface { - Router("TopLevel", Route.Library) { backStack -> Row { Surface(elevation = 2.dp) { @@ -124,7 +123,6 @@ fun MainMenu() { } } } - } } @@ -135,7 +133,7 @@ fun MainMenuItem(menu: TopLevelMenus, selected: Boolean, onClick: (Route) -> Uni backgroundColor = if (!selected) { Color.Transparent } else { - MaterialTheme.colors.primary.copy(0.30F) + MaterialTheme.colors.primary.copy(0.30F) }, contentColor = Color.Transparent, elevation = 0.dp @@ -160,19 +158,21 @@ sealed class Route { object Library : Route() object Sources : Route() object Extensions : Route() - data class Manga(val mangaId: Long): Route() + data class Manga(val mangaId: Long) : Route() object Settings : Route() object SettingsGeneral : Route() object SettingsAppearance : Route() object SettingsLibrary : Route() object SettingsReader : Route() + /*object SettingsDownloads : Route() object SettingsTracking : Route()*/ object SettingsBrowse : Route() object SettingsBackup : Route() object SettingsServer : Route() + /*object SettingsSecurity : Route() object SettingsParentalControls : Route()*/ object SettingsAdvanced : Route() -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/main/MainViewModel.kt b/src/main/kotlin/ca/gosyer/ui/main/MainViewModel.kt index 0d1919ce..94e4c32e 100644 --- a/src/main/kotlin/ca/gosyer/ui/main/MainViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/main/MainViewModel.kt @@ -12,6 +12,6 @@ import javax.inject.Inject class MainViewModel @Inject constructor( uiPreferences: UiPreferences -): ViewModel() { +) : ViewModel() { val startScreen = uiPreferences.startScreen().get() -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/main/main.kt b/src/main/kotlin/ca/gosyer/ui/main/main.kt index b740c80a..2eabb408 100644 --- a/src/main/kotlin/ca/gosyer/ui/main/main.kt +++ b/src/main/kotlin/ca/gosyer/ui/main/main.kt @@ -79,4 +79,4 @@ fun main() { } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/manga/MangaMenu.kt b/src/main/kotlin/ca/gosyer/ui/manga/MangaMenu.kt index 62ed0e1c..4d64357f 100644 --- a/src/main/kotlin/ca/gosyer/ui/manga/MangaMenu.kt +++ b/src/main/kotlin/ca/gosyer/ui/manga/MangaMenu.kt @@ -153,9 +153,9 @@ private fun Cover(manga: Manga, serverUrl: String, modifier: Modifier = Modifier } sealed class MangaMenu { - data class MangaMenuManga(val manga: Manga): MangaMenu() + data class MangaMenuManga(val manga: Manga) : MangaMenu() - data class MangaMenuChapter(val chapter: Chapter): MangaMenu() + data class MangaMenuChapter(val chapter: Chapter) : MangaMenu() } @Composable @@ -195,4 +195,4 @@ fun ChapterItem(chapter: Chapter, format: (Date) -> String) { } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/manga/MangaMenuViewModel.kt b/src/main/kotlin/ca/gosyer/ui/manga/MangaMenuViewModel.kt index d0317d2c..54d36861 100644 --- a/src/main/kotlin/ca/gosyer/ui/manga/MangaMenuViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/manga/MangaMenuViewModel.kt @@ -91,7 +91,6 @@ class MangaMenuViewModel @Inject constructor( refreshMangaAsync(it.id).await() } } - } private fun getDateFormat(format: String): DateFormat = when (format) { @@ -100,4 +99,4 @@ class MangaMenuViewModel @Inject constructor( } data class Params(val mangaId: Long) -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/settings/SettingsAppearanceScreen.kt b/src/main/kotlin/ca/gosyer/ui/settings/SettingsAppearanceScreen.kt index 8b095cf1..ac927ff0 100644 --- a/src/main/kotlin/ca/gosyer/ui/settings/SettingsAppearanceScreen.kt +++ b/src/main/kotlin/ca/gosyer/ui/settings/SettingsAppearanceScreen.kt @@ -80,7 +80,7 @@ fun SettingsAppearance(navController: BackStack) { ChoicePreference( preference = vm.themeMode, choices = mapOf( - //ThemeMode.System to R.string.follow_system_settings, + // ThemeMode.System to R.string.follow_system_settings, ThemeMode.Light to "Light", ThemeMode.Dark to "Dark" ), @@ -94,24 +94,29 @@ fun SettingsAppearance(navController: BackStack) { ) LazyRow(modifier = Modifier.padding(horizontal = 8.dp)) { items(themesForCurrentMode) { theme -> - ThemeItem(theme, onClick = { - (if (isLight) vm.lightTheme else vm.darkTheme).value = it.id - activeColors.primaryStateFlow.value = it.colors.primary - activeColors.secondaryStateFlow.value = it.colors.secondary - }) + ThemeItem( + theme, + onClick = { + (if (isLight) vm.lightTheme else vm.darkTheme).value = it.id + activeColors.primaryStateFlow.value = it.colors.primary + activeColors.secondaryStateFlow.value = it.colors.secondary + } + ) } } } item { ColorPreference( - preference = activeColors.primaryStateFlow, title = "Color primary", + preference = activeColors.primaryStateFlow, + title = "Color primary", subtitle = "Displayed most frequently across your app", unsetColor = MaterialTheme.colors.primary ) } item { ColorPreference( - preference = activeColors.secondaryStateFlow, title = "Color secondary", + preference = activeColors.secondaryStateFlow, + title = "Color secondary", subtitle = "Accents select parts of the UI", unsetColor = MaterialTheme.colors.secondary ) @@ -132,7 +137,9 @@ private fun ThemeItem( Color.White.copy(alpha = 0.15f) } Surface( - elevation = 4.dp, color = theme.colors.background, shape = borders, + elevation = 4.dp, + color = theme.colors.background, + shape = borders, modifier = Modifier .size(100.dp, 160.dp) .padding(8.dp) @@ -159,9 +166,10 @@ private fun ThemeItem( disabledBackgroundColor = theme.colors.primary ) ) - Surface(Modifier - .size(24.dp) - .align(Alignment.BottomEnd), + Surface( + Modifier + .size(24.dp) + .align(Alignment.BottomEnd), shape = MaterialTheme.shapes.small.copy(CornerSize(percent = 50)), color = theme.colors.secondary, elevation = 6.dp, diff --git a/src/main/kotlin/ca/gosyer/ui/settings/SettingsServerScreen.kt b/src/main/kotlin/ca/gosyer/ui/settings/SettingsServerScreen.kt index 635a7ffc..128f4ee3 100644 --- a/src/main/kotlin/ca/gosyer/ui/settings/SettingsServerScreen.kt +++ b/src/main/kotlin/ca/gosyer/ui/settings/SettingsServerScreen.kt @@ -23,7 +23,7 @@ import javax.inject.Inject class SettingsServerViewModel @Inject constructor( private val serverPreferences: ServerPreferences -): ViewModel() { +) : ViewModel() { val host = serverPreferences.host().asStateIn(scope) val serverUrl = serverPreferences.server().asStateIn(scope) } diff --git a/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenu.kt b/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenu.kt index bd7b1bba..90fc6f24 100644 --- a/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenu.kt +++ b/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenu.kt @@ -86,7 +86,6 @@ fun SourcesMenu(bundle: Bundle, onMangaClick: (Long) -> Unit) { } } - val selectedSource: Source? = selectedSourceTab BundleScope("Sources") { if (selectedSource != null) { diff --git a/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenuViewModel.kt b/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenuViewModel.kt index 272f5bd4..02d321e1 100644 --- a/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenuViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/sources/SourcesMenuViewModel.kt @@ -27,7 +27,7 @@ class SourcesMenuViewModel @Inject constructor( private val sourceHandler: SourceInteractionHandler, serverPreferences: ServerPreferences, catalogPreferences: CatalogPreferences -): ViewModel() { +) : ViewModel() { private val logger = KotlinLogging.logger {} val serverUrl = serverPreferences.server().stateIn(scope) @@ -115,4 +115,4 @@ class SourcesMenuViewModel @Inject constructor( const val SOURCE_TABS_KEY = "source_tabs" const val SELECTED_SOURCE_TAB = "selected_tab" } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/sources/components/SourceHomeScreen.kt b/src/main/kotlin/ca/gosyer/ui/sources/components/SourceHomeScreen.kt index 4fce9e0a..9f8cf115 100644 --- a/src/main/kotlin/ca/gosyer/ui/sources/components/SourceHomeScreen.kt +++ b/src/main/kotlin/ca/gosyer/ui/sources/components/SourceHomeScreen.kt @@ -95,7 +95,6 @@ fun SourceCategory( } } - @Composable fun SourceItem( source: Source, @@ -113,4 +112,4 @@ fun SourceItem( Spacer(Modifier.height(4.dp)) Text("${source.name} (${source.lang})", color = MaterialTheme.colors.onBackground) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreen.kt b/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreen.kt index 92e2b173..b4fd8090 100644 --- a/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreen.kt +++ b/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreen.kt @@ -95,7 +95,6 @@ private fun MangaTable( } } - LazyVerticalGrid(GridCells.Adaptive(160.dp)) { items(mangas) { manga -> MangaGridItem( @@ -109,4 +108,4 @@ private fun MangaTable( } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreenViewModel.kt b/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreenViewModel.kt index e400716a..ece80ffb 100644 --- a/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreenViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/sources/components/SourceScreenViewModel.kt @@ -28,7 +28,7 @@ class SourceScreenViewModel @Inject constructor( private val sourceHandler: SourceInteractionHandler, private val mangaHandler: MangaInteractionHandler, serverPreferences: ServerPreferences -): ViewModel() { +) : ViewModel() { private lateinit var source: Source private lateinit var bundle: Bundle @@ -99,7 +99,7 @@ class SourceScreenViewModel @Inject constructor( } fun setMode(toLatest: Boolean) { - if (isLatest.value != toLatest){ + if (isLatest.value != toLatest) { _isLatest.value = toLatest bundle.remove(MANGAS_KEY) bundle.remove(NEXT_PAGE_KEY) @@ -123,4 +123,4 @@ class SourceScreenViewModel @Inject constructor( const val PAGE_NUM_KEY = "next_page" const val IS_LATEST_KEY = "is_latest" } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/util/compose/Color.kt b/src/main/kotlin/ca/gosyer/util/compose/Color.kt index f4ab2391..f7fdf066 100644 --- a/src/main/kotlin/ca/gosyer/util/compose/Color.kt +++ b/src/main/kotlin/ca/gosyer/util/compose/Color.kt @@ -8,4 +8,4 @@ package ca.gosyer.util.compose import androidx.compose.ui.graphics.Color -val Long.color get() = Color(this) \ No newline at end of file +val Long.color get() = Color(this) diff --git a/src/main/kotlin/ca/gosyer/util/compose/Image.kt b/src/main/kotlin/ca/gosyer/util/compose/Image.kt index 8cb53ba4..a68b9bc3 100644 --- a/src/main/kotlin/ca/gosyer/util/compose/Image.kt +++ b/src/main/kotlin/ca/gosyer/util/compose/Image.kt @@ -21,4 +21,4 @@ fun imageFromFile(file: File): ImageBitmap { suspend fun imageFromUrl(client: Http, url: String): ImageBitmap { return Image.makeFromEncoded(client.get(url).readBytes()).asImageBitmap() -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/util/compose/State.kt b/src/main/kotlin/ca/gosyer/util/compose/State.kt index c36ada3f..9920eb8f 100644 --- a/src/main/kotlin/ca/gosyer/util/compose/State.kt +++ b/src/main/kotlin/ca/gosyer/util/compose/State.kt @@ -13,4 +13,4 @@ import com.github.zsoltk.compose.savedinstancestate.LocalSavedInstanceState @Composable fun State.persistent(key: String) { val bundle = LocalSavedInstanceState.current -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/util/compose/Theme.kt b/src/main/kotlin/ca/gosyer/util/compose/Theme.kt index 64eb6e95..36895c8b 100644 --- a/src/main/kotlin/ca/gosyer/util/compose/Theme.kt +++ b/src/main/kotlin/ca/gosyer/util/compose/Theme.kt @@ -33,4 +33,4 @@ fun ThemedWindow( content() } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/util/system/File.kt b/src/main/kotlin/ca/gosyer/util/system/File.kt index 8851d6f6..68bae27c 100644 --- a/src/main/kotlin/ca/gosyer/util/system/File.kt +++ b/src/main/kotlin/ca/gosyer/util/system/File.kt @@ -18,4 +18,4 @@ val userDataDir: File by lazy { File(appDirs.getUserDataDir("TachideskJUI", null, null)).also { if (!it.exists()) it.mkdirs() } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/util/system/Flow.kt b/src/main/kotlin/ca/gosyer/util/system/Flow.kt index 3b228d8c..f8a65322 100644 --- a/src/main/kotlin/ca/gosyer/util/system/Flow.kt +++ b/src/main/kotlin/ca/gosyer/util/system/Flow.kt @@ -27,4 +27,4 @@ fun Flow.asStateFlow(defaultValue: T, scope: CoroutineScope, dropFirst: B } } return flow.asStateFlow() -} \ No newline at end of file +} diff --git a/src/main/kotlin/ca/gosyer/util/system/ProcessFile.kt b/src/main/kotlin/ca/gosyer/util/system/ProcessFile.kt index 4266cede..3f01ccf9 100644 --- a/src/main/kotlin/ca/gosyer/util/system/ProcessFile.kt +++ b/src/main/kotlin/ca/gosyer/util/system/ProcessFile.kt @@ -13,7 +13,7 @@ fun processFile() { val strTmp = System.getProperty("java.io.tmpdir") val file = File("$strTmp/TachideskJUI.pid") - //backup deletion + // backup deletion if (file.exists()) { file.delete() } @@ -21,4 +21,4 @@ fun processFile() { file.writeText(pidFile.toString()) file.deleteOnExit() -} \ No newline at end of file +} diff --git a/src/test/kotlin/ca/gosyer/data/server/ExtensionInteractionTest.kt b/src/test/kotlin/ca/gosyer/data/server/ExtensionInteractionTest.kt index c815a6e8..7d6408cd 100644 --- a/src/test/kotlin/ca/gosyer/data/server/ExtensionInteractionTest.kt +++ b/src/test/kotlin/ca/gosyer/data/server/ExtensionInteractionTest.kt @@ -4,9 +4,7 @@ import kotlin.test.Test class ExtensionInteractionTest { - @Test fun `Install a extension`() { - } -} \ No newline at end of file +}