mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-13 16:22:05 +01:00
Add ktlint, reformat files
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import org.jetbrains.compose.compose
|
import org.jetbrains.compose.compose
|
||||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
import org.jmailen.gradle.kotlinter.tasks.FormatTask
|
||||||
|
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.4.32"
|
kotlin("jvm") version "1.4.32"
|
||||||
@@ -8,6 +10,7 @@ plugins {
|
|||||||
kotlin("plugin.serialization") version "1.4.32"
|
kotlin("plugin.serialization") version "1.4.32"
|
||||||
id("org.jetbrains.compose") version "0.4.0-build184"
|
id("org.jetbrains.compose") version "0.4.0-build184"
|
||||||
id("de.fuerstenau.buildconfig") version "1.1.8"
|
id("de.fuerstenau.buildconfig") version "1.1.8"
|
||||||
|
id("org.jmailen.kotlinter") version "3.4.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "ca.gosyer"
|
group = "ca.gosyer"
|
||||||
@@ -82,6 +85,19 @@ tasks {
|
|||||||
test {
|
test {
|
||||||
useJUnit()
|
useJUnit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
withType<LintTask> {
|
||||||
|
source(files("src"))
|
||||||
|
reports.set(mapOf(
|
||||||
|
"plain" to file("build/lint-report.txt"),
|
||||||
|
"json" to file("build/lint-report.json")
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<FormatTask> {
|
||||||
|
source(files("src"))
|
||||||
|
report.set(file("build/format-report.txt"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -124,3 +140,8 @@ buildConfig {
|
|||||||
|
|
||||||
buildConfigField("boolean", "DEBUG", project.hasProperty("debugApp").toString())
|
buildConfigField("boolean", "DEBUG", project.hasProperty("debugApp").toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlinter {
|
||||||
|
experimentalRules = true
|
||||||
|
disabledRules = arrayOf("experimental:argument-list-wrapping")
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
org.gradle.jvmargs=-Xmx2048m
|
||||||
@@ -27,5 +27,4 @@ object AppScope : Scope by KTP.openRootScope() {
|
|||||||
inline fun <reified T> getInstance(): T {
|
inline fun <reified T> getInstance(): T {
|
||||||
return getInstance(T::class.java)
|
return getInstance(T::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -50,5 +50,4 @@ class DataUriStringSource(private val data: String) : Source {
|
|||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package ca.gosyer.common.io
|
package ca.gosyer.common.io
|
||||||
|
|
||||||
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import okio.BufferedSink
|
import okio.BufferedSink
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package ca.gosyer.common.prefs
|
package ca.gosyer.common.prefs
|
||||||
|
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
@@ -57,5 +56,4 @@ interface Preference<T> {
|
|||||||
* current value and receive preference updates.
|
* current value and receive preference updates.
|
||||||
*/
|
*/
|
||||||
fun stateIn(scope: CoroutineScope): StateFlow<T>
|
fun stateIn(scope: CoroutineScope): StateFlow<T>
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,6 @@ interface PreferenceStore {
|
|||||||
deserializer: (String) -> T
|
deserializer: (String) -> T
|
||||||
): Preference<T>
|
): Preference<T>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns preference of type [T] for this [key]. The [serializer] must be provided.
|
* Returns preference of type [T] for this [key]. The [serializer] must be provided.
|
||||||
*/
|
*/
|
||||||
@@ -67,7 +66,6 @@ interface PreferenceStore {
|
|||||||
serializer: KSerializer<T>,
|
serializer: KSerializer<T>,
|
||||||
serializersModule: SerializersModule = EmptySerializersModule
|
serializersModule: SerializersModule = EmptySerializersModule
|
||||||
): Preference<T>
|
): Preference<T>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,11 +75,16 @@ inline fun <reified T : Enum<T>> PreferenceStore.getEnum(
|
|||||||
key: String,
|
key: String,
|
||||||
defaultValue: T
|
defaultValue: T
|
||||||
): Preference<T> {
|
): Preference<T> {
|
||||||
return getObject(key, defaultValue, { it.name }, {
|
return getObject(
|
||||||
|
key,
|
||||||
|
defaultValue,
|
||||||
|
{ it.name },
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
enumValueOf(it)
|
enumValueOf(it)
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (e: IllegalArgumentException) {
|
||||||
defaultValue
|
defaultValue
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,5 +95,4 @@ internal class JvmPreference<T>(
|
|||||||
override fun stateIn(scope: CoroutineScope): StateFlow<T> {
|
override fun stateIn(scope: CoroutineScope): StateFlow<T> {
|
||||||
return changes().stateIn(scope, SharingStarted.Eagerly, get())
|
return changes().stateIn(scope, SharingStarted.Eagerly, get())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,6 @@ internal class ObjectAdapter<T>(
|
|||||||
override fun set(key: String, value: T, editor: ObservableSettings) {
|
override fun set(key: String, value: T, editor: ObservableSettings) {
|
||||||
editor.putString(key, serializer(value))
|
editor.putString(key, serializer(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class JsonObjectAdapter<T>(
|
internal class JsonObjectAdapter<T>(
|
||||||
@@ -103,5 +102,4 @@ internal class JsonObjectAdapter<T>(
|
|||||||
override fun set(key: String, value: T, editor: ObservableSettings) {
|
override fun set(key: String, value: T, editor: ObservableSettings) {
|
||||||
editor.encodeValue(serializer, key, value, serializersModule)
|
editor.encodeValue(serializer, key, value, serializersModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -82,5 +82,4 @@ class JvmPreferenceStore(private val preferences: ObservableSettings) : Preferen
|
|||||||
val adapter = JsonObjectAdapter(defaultValue, serializer, serializersModule)
|
val adapter = JsonObjectAdapter(defaultValue, serializer, serializersModule)
|
||||||
return JvmPreference(preferences, key, defaultValue, adapter)
|
return JvmPreference(preferences, key, defaultValue, adapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,12 +13,12 @@ import java.util.prefs.Preferences
|
|||||||
class PreferenceStoreFactory {
|
class PreferenceStoreFactory {
|
||||||
|
|
||||||
fun create(name: String? = null): PreferenceStore {
|
fun create(name: String? = null): PreferenceStore {
|
||||||
|
val userPreferences: Preferences = Preferences.userRoot()
|
||||||
val jvmPreferences = if (!name.isNullOrBlank()) {
|
val jvmPreferences = if (!name.isNullOrBlank()) {
|
||||||
JvmPreferencesSettings(Preferences.userRoot().node(name))
|
JvmPreferencesSettings(userPreferences.node(name))
|
||||||
} else {
|
} else {
|
||||||
JvmPreferencesSettings(Preferences.userRoot())
|
JvmPreferencesSettings(userPreferences)
|
||||||
}
|
}
|
||||||
return JvmPreferenceStore(jvmPreferences)
|
return JvmPreferenceStore(jvmPreferences)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -69,9 +69,11 @@ class ServerService @Inject constructor(
|
|||||||
process = runtime.exec("""$javaExePath -jar "${jarFile.absolutePath}"""").also {
|
process = runtime.exec("""$javaExePath -jar "${jarFile.absolutePath}"""").also {
|
||||||
reader = it.inputStream.bufferedReader()
|
reader = it.inputStream.bufferedReader()
|
||||||
}
|
}
|
||||||
runtime.addShutdownHook(thread(start = false) {
|
runtime.addShutdownHook(
|
||||||
|
thread(start = false) {
|
||||||
process?.destroy()
|
process?.destroy()
|
||||||
})
|
}
|
||||||
|
)
|
||||||
logger.info { "Server started successfully" }
|
logger.info { "Server started successfully" }
|
||||||
var line: String?
|
var line: String?
|
||||||
while (reader.readLine().also { line = it } != null) {
|
while (reader.readLine().also { line = it } != null) {
|
||||||
@@ -87,7 +89,6 @@ class ServerService @Inject constructor(
|
|||||||
logger.info { "Server closed" }
|
logger.info { "Server closed" }
|
||||||
val exitVal = process?.waitFor()
|
val exitVal = process?.waitFor()
|
||||||
logger.info { "Process exitValue: $exitVal" }
|
logger.info { "Process exitValue: $exitVal" }
|
||||||
|
|
||||||
}
|
}
|
||||||
}.launchIn(GlobalScope)
|
}.launchIn(GlobalScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,4 @@ class MangaInteractionHandler @Inject constructor(
|
|||||||
serverUrl + mangaThumbnailQuery(mangaId)
|
serverUrl + mangaThumbnailQuery(mangaId)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,8 @@ class SourceInteractionHandler @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getPopularManga(source: Source, pageNum: Int) = getPopularManga(
|
suspend fun getPopularManga(source: Source, pageNum: Int) = getPopularManga(
|
||||||
source.id, pageNum
|
source.id,
|
||||||
|
pageNum
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun getLatestManga(sourceId: Long, pageNum: Int) = withContext(Dispatchers.IO) {
|
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(
|
suspend fun getLatestManga(source: Source, pageNum: Int) = getLatestManga(
|
||||||
source.id, pageNum
|
source.id,
|
||||||
|
pageNum
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: 2021-03-14
|
// TODO: 2021-03-14
|
||||||
@@ -75,7 +77,9 @@ class SourceInteractionHandler @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getSearchResults(source: Source, searchTerm: String, pageNum: Int) = getSearchResults(
|
suspend fun getSearchResults(source: Source, searchTerm: String, pageNum: Int) = getSearchResults(
|
||||||
source.id, searchTerm, pageNum
|
source.id,
|
||||||
|
searchTerm,
|
||||||
|
pageNum
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: 2021-03-14
|
// TODO: 2021-03-14
|
||||||
|
|||||||
@@ -56,5 +56,4 @@ class UiPreferences(private val preferenceStore: PreferenceStore) {
|
|||||||
fun dateFormat(): Preference<String> {
|
fun dateFormat(): Preference<String> {
|
||||||
return preferenceStore.getString("date_format", "")
|
return preferenceStore.getString("date_format", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ import kotlinx.serialization.Serializable
|
|||||||
@Serializable
|
@Serializable
|
||||||
enum class StartScreen {
|
enum class StartScreen {
|
||||||
Library,
|
Library,
|
||||||
|
|
||||||
// Updates,
|
// Updates,
|
||||||
// History,
|
// History,
|
||||||
Sources,
|
Sources,
|
||||||
|
|||||||
@@ -99,16 +99,20 @@ fun ColorPickerDialog(
|
|||||||
val showPresetsState by showPresets.collectAsState()
|
val showPresetsState by showPresets.collectAsState()
|
||||||
val currentColorState by currentColor.collectAsState()
|
val currentColorState by currentColor.collectAsState()
|
||||||
Row(Modifier.fillMaxWidth().padding(8.dp)) {
|
Row(Modifier.fillMaxWidth().padding(8.dp)) {
|
||||||
TextButton(onClick = {
|
TextButton(
|
||||||
|
onClick = {
|
||||||
showPresets.value = !showPresetsState
|
showPresets.value = !showPresetsState
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
Text(if (showPresetsState) "Custom" else "Presets")
|
Text(if (showPresetsState) "Custom" else "Presets")
|
||||||
}
|
}
|
||||||
Spacer(Modifier.weight(1f))
|
Spacer(Modifier.weight(1f))
|
||||||
TextButton(onClick = {
|
TextButton(
|
||||||
|
onClick = {
|
||||||
onSelected(currentColorState)
|
onSelected(currentColorState)
|
||||||
it.close()
|
it.close()
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
Text("Select")
|
Text("Select")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -181,7 +185,8 @@ private fun ColorPresetItem(
|
|||||||
onClick: () -> Unit
|
onClick: () -> Unit
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
contentAlignment = Alignment.Center, modifier = Modifier
|
contentAlignment = Alignment.Center,
|
||||||
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
@@ -241,13 +246,15 @@ fun ColorPalette(
|
|||||||
val saturationGradient = remember(hue, matrixSize) {
|
val saturationGradient = remember(hue, matrixSize) {
|
||||||
Brush.linearGradient(
|
Brush.linearGradient(
|
||||||
colors = listOf(Color.White, hueToColor(hue)),
|
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) {
|
val valueGradient = remember(matrixSize) {
|
||||||
Brush.linearGradient(
|
Brush.linearGradient(
|
||||||
colors = listOf(Color.White, Color.Black),
|
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,7 +277,8 @@ fun ColorPalette(
|
|||||||
Column {
|
Column {
|
||||||
Text("") // TODO workaround: without this text, the color picker doesn't render correctly
|
Text("") // TODO workaround: without this text, the color picker doesn't render correctly
|
||||||
Row(Modifier.height(IntrinsicSize.Max)) {
|
Row(Modifier.height(IntrinsicSize.Max)) {
|
||||||
Box(Modifier
|
Box(
|
||||||
|
Modifier
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.onSizeChanged {
|
.onSizeChanged {
|
||||||
@@ -308,7 +316,8 @@ fun ColorPalette(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Box(Modifier
|
Box(
|
||||||
|
Modifier
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.requiredWidth(48.dp)
|
.requiredWidth(48.dp)
|
||||||
.padding(start = 8.dp)
|
.padding(start = 8.dp)
|
||||||
@@ -451,4 +460,3 @@ private val presetColors = listOf(
|
|||||||
Color(0xFF607D8B), // BLUE GREY 500
|
Color(0xFF607D8B), // BLUE GREY 500
|
||||||
Color(0xFF9E9E9E), // GREY 500
|
Color(0xFF9E9E9E), // GREY 500
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -139,9 +139,12 @@ fun EditTextPreference(
|
|||||||
preference.value = editText.text
|
preference.value = editText.text
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
OutlinedTextField(editText, onValueChange = {
|
OutlinedTextField(
|
||||||
|
editText,
|
||||||
|
onValueChange = {
|
||||||
editText = it
|
editText = it
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -179,7 +182,11 @@ private fun <T> ChoiceDialog(
|
|||||||
title: String,
|
title: String,
|
||||||
buttons: @Composable (AppWindow) -> Unit = { }
|
buttons: @Composable (AppWindow) -> Unit = { }
|
||||||
) {
|
) {
|
||||||
WindowDialog(onDismissRequest = onDismissRequest, buttons = buttons, title = title, content = {
|
WindowDialog(
|
||||||
|
onDismissRequest = onDismissRequest,
|
||||||
|
buttons = buttons,
|
||||||
|
title = title,
|
||||||
|
content = {
|
||||||
LazyColumn {
|
LazyColumn {
|
||||||
items(items) { (value, text) ->
|
items(items) { (value, text) ->
|
||||||
Row(
|
Row(
|
||||||
@@ -187,7 +194,8 @@ private fun <T> ChoiceDialog(
|
|||||||
onClick = {
|
onClick = {
|
||||||
onSelected(value)
|
onSelected(value)
|
||||||
it.close()
|
it.close()
|
||||||
}),
|
}
|
||||||
|
),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
RadioButton(
|
RadioButton(
|
||||||
@@ -201,7 +209,8 @@ private fun <T> ChoiceDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
@@ -19,11 +19,13 @@ data class Theme(
|
|||||||
val themes = listOf(
|
val themes = listOf(
|
||||||
// Pure white
|
// Pure white
|
||||||
Theme(
|
Theme(
|
||||||
1, lightColors()
|
1,
|
||||||
|
lightColors()
|
||||||
),
|
),
|
||||||
// Tachiyomi 0.x default colors
|
// Tachiyomi 0.x default colors
|
||||||
Theme(
|
Theme(
|
||||||
2, lightColors(
|
2,
|
||||||
|
lightColors(
|
||||||
primary = Color(0xFF2979FF),
|
primary = Color(0xFF2979FF),
|
||||||
primaryVariant = Color(0xFF2979FF),
|
primaryVariant = Color(0xFF2979FF),
|
||||||
onPrimary = Color.White,
|
onPrimary = Color.White,
|
||||||
@@ -34,11 +36,13 @@ val themes = listOf(
|
|||||||
),
|
),
|
||||||
// Tachiyomi 0.x dark theme
|
// Tachiyomi 0.x dark theme
|
||||||
Theme(
|
Theme(
|
||||||
3, darkColors()
|
3,
|
||||||
|
darkColors()
|
||||||
),
|
),
|
||||||
// AMOLED theme
|
// AMOLED theme
|
||||||
Theme(
|
Theme(
|
||||||
4, darkColors(
|
4,
|
||||||
|
darkColors(
|
||||||
primary = Color.Black,
|
primary = Color.Black,
|
||||||
onPrimary = Color.White,
|
onPrimary = Color.White,
|
||||||
background = Color.Black
|
background = Color.Black
|
||||||
|
|||||||
@@ -142,12 +142,16 @@ private fun CategoryRow(
|
|||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
IconButton(onClick = onRename) {
|
IconButton(onClick = onRename) {
|
||||||
Icon(imageVector = Icons.Default.Edit,
|
Icon(
|
||||||
contentDescription = null)
|
imageVector = Icons.Default.Edit,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
IconButton(onClick = onDelete) {
|
IconButton(onClick = onDelete) {
|
||||||
Icon(imageVector = Icons.Default.Delete,
|
Icon(
|
||||||
contentDescription = null)
|
imageVector = Icons.Default.Delete,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ fun ExtensionItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Button(
|
Button(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class ExtensionsMenuViewModel @Inject constructor(
|
|||||||
private val _isLoading = MutableStateFlow(true)
|
private val _isLoading = MutableStateFlow(true)
|
||||||
val isLoading = _isLoading.asStateFlow()
|
val isLoading = _isLoading.asStateFlow()
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
getExtensions()
|
getExtensions()
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ fun LibraryScreen(onClickManga: (Long) -> Unit = { openMangaMenu(it) }) {
|
|||||||
if (categories.isEmpty()) {
|
if (categories.isEmpty()) {
|
||||||
LoadingScreen(isLoading)
|
LoadingScreen(isLoading)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/*ModalBottomSheetLayout(
|
/*ModalBottomSheetLayout(
|
||||||
sheetState = sheetState,
|
sheetState = sheetState,
|
||||||
sheetContent = { *//*LibrarySheet()*//* }
|
sheetContent = { *//*LibrarySheet()*//* }
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ class LibraryScreenViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setSelectedPage(page: Int) {
|
fun setSelectedPage(page: Int) {
|
||||||
_selectedCategoryIndex.value = page
|
_selectedCategoryIndex.value = page
|
||||||
}
|
}
|
||||||
@@ -91,5 +90,3 @@ class LibraryScreenViewModel @Inject constructor(
|
|||||||
val defaultCategory = Category(0, 0, "Default", true)
|
val defaultCategory = Category(0, 0, "Default", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ private fun LibraryMangaCompactGridItem(
|
|||||||
TextStyle(letterSpacing = 0.sp, fontFamily = FontFamily.SansSerif, fontSize = 14.sp)
|
TextStyle(letterSpacing = 0.sp, fontFamily = FontFamily.SansSerif, fontSize = 14.sp)
|
||||||
)
|
)
|
||||||
|
|
||||||
Box(modifier = Modifier.padding(4.dp)
|
Box(
|
||||||
|
modifier = Modifier.padding(4.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.aspectRatio(3f / 4f)
|
.aspectRatio(3f / 4f)
|
||||||
.clip(MaterialTheme.shapes.medium)
|
.clip(MaterialTheme.shapes.medium)
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ import compose.icons.fontawesomeicons.regular.Map
|
|||||||
fun MainMenu() {
|
fun MainMenu() {
|
||||||
val vm = viewModel<MainViewModel>()
|
val vm = viewModel<MainViewModel>()
|
||||||
Surface {
|
Surface {
|
||||||
|
|
||||||
Router<Route>("TopLevel", Route.Library) { backStack ->
|
Router<Route>("TopLevel", Route.Library) { backStack ->
|
||||||
Row {
|
Row {
|
||||||
Surface(elevation = 2.dp) {
|
Surface(elevation = 2.dp) {
|
||||||
@@ -124,7 +123,6 @@ fun MainMenu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,11 +165,13 @@ sealed class Route {
|
|||||||
object SettingsAppearance : Route()
|
object SettingsAppearance : Route()
|
||||||
object SettingsLibrary : Route()
|
object SettingsLibrary : Route()
|
||||||
object SettingsReader : Route()
|
object SettingsReader : Route()
|
||||||
|
|
||||||
/*object SettingsDownloads : Route()
|
/*object SettingsDownloads : Route()
|
||||||
object SettingsTracking : Route()*/
|
object SettingsTracking : Route()*/
|
||||||
object SettingsBrowse : Route()
|
object SettingsBrowse : Route()
|
||||||
object SettingsBackup : Route()
|
object SettingsBackup : Route()
|
||||||
object SettingsServer : Route()
|
object SettingsServer : Route()
|
||||||
|
|
||||||
/*object SettingsSecurity : Route()
|
/*object SettingsSecurity : Route()
|
||||||
object SettingsParentalControls : Route()*/
|
object SettingsParentalControls : Route()*/
|
||||||
object SettingsAdvanced : Route()
|
object SettingsAdvanced : Route()
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ class MangaMenuViewModel @Inject constructor(
|
|||||||
refreshMangaAsync(it.id).await()
|
refreshMangaAsync(it.id).await()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDateFormat(format: String): DateFormat = when (format) {
|
private fun getDateFormat(format: String): DateFormat = when (format) {
|
||||||
|
|||||||
@@ -94,24 +94,29 @@ fun SettingsAppearance(navController: BackStack<Route>) {
|
|||||||
)
|
)
|
||||||
LazyRow(modifier = Modifier.padding(horizontal = 8.dp)) {
|
LazyRow(modifier = Modifier.padding(horizontal = 8.dp)) {
|
||||||
items(themesForCurrentMode) { theme ->
|
items(themesForCurrentMode) { theme ->
|
||||||
ThemeItem(theme, onClick = {
|
ThemeItem(
|
||||||
|
theme,
|
||||||
|
onClick = {
|
||||||
(if (isLight) vm.lightTheme else vm.darkTheme).value = it.id
|
(if (isLight) vm.lightTheme else vm.darkTheme).value = it.id
|
||||||
activeColors.primaryStateFlow.value = it.colors.primary
|
activeColors.primaryStateFlow.value = it.colors.primary
|
||||||
activeColors.secondaryStateFlow.value = it.colors.secondary
|
activeColors.secondaryStateFlow.value = it.colors.secondary
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
ColorPreference(
|
ColorPreference(
|
||||||
preference = activeColors.primaryStateFlow, title = "Color primary",
|
preference = activeColors.primaryStateFlow,
|
||||||
|
title = "Color primary",
|
||||||
subtitle = "Displayed most frequently across your app",
|
subtitle = "Displayed most frequently across your app",
|
||||||
unsetColor = MaterialTheme.colors.primary
|
unsetColor = MaterialTheme.colors.primary
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
ColorPreference(
|
ColorPreference(
|
||||||
preference = activeColors.secondaryStateFlow, title = "Color secondary",
|
preference = activeColors.secondaryStateFlow,
|
||||||
|
title = "Color secondary",
|
||||||
subtitle = "Accents select parts of the UI",
|
subtitle = "Accents select parts of the UI",
|
||||||
unsetColor = MaterialTheme.colors.secondary
|
unsetColor = MaterialTheme.colors.secondary
|
||||||
)
|
)
|
||||||
@@ -132,7 +137,9 @@ private fun ThemeItem(
|
|||||||
Color.White.copy(alpha = 0.15f)
|
Color.White.copy(alpha = 0.15f)
|
||||||
}
|
}
|
||||||
Surface(
|
Surface(
|
||||||
elevation = 4.dp, color = theme.colors.background, shape = borders,
|
elevation = 4.dp,
|
||||||
|
color = theme.colors.background,
|
||||||
|
shape = borders,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(100.dp, 160.dp)
|
.size(100.dp, 160.dp)
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
@@ -159,7 +166,8 @@ private fun ThemeItem(
|
|||||||
disabledBackgroundColor = theme.colors.primary
|
disabledBackgroundColor = theme.colors.primary
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Surface(Modifier
|
Surface(
|
||||||
|
Modifier
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
.align(Alignment.BottomEnd),
|
.align(Alignment.BottomEnd),
|
||||||
shape = MaterialTheme.shapes.small.copy(CornerSize(percent = 50)),
|
shape = MaterialTheme.shapes.small.copy(CornerSize(percent = 50)),
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ fun SourcesMenu(bundle: Bundle, onMangaClick: (Long) -> Unit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val selectedSource: Source? = selectedSourceTab
|
val selectedSource: Source? = selectedSourceTab
|
||||||
BundleScope("Sources") {
|
BundleScope("Sources") {
|
||||||
if (selectedSource != null) {
|
if (selectedSource != null) {
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ fun SourceCategory(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SourceItem(
|
fun SourceItem(
|
||||||
source: Source,
|
source: Source,
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ private fun MangaTable(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LazyVerticalGrid(GridCells.Adaptive(160.dp)) {
|
LazyVerticalGrid(GridCells.Adaptive(160.dp)) {
|
||||||
items(mangas) { manga ->
|
items(mangas) { manga ->
|
||||||
MangaGridItem(
|
MangaGridItem(
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import kotlin.test.Test
|
|||||||
|
|
||||||
class ExtensionInteractionTest {
|
class ExtensionInteractionTest {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Install a extension`() {
|
fun `Install a extension`() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user