Update Tachidesk, improve genre view with Chips

This commit is contained in:
Syer10
2021-09-04 17:51:53 -04:00
parent a5ee823062
commit 2efd283e3b
4 changed files with 26 additions and 5 deletions

View File

@@ -34,6 +34,7 @@ dependencies {
implementation(compose("org.jetbrains.compose.ui:ui-util"))
implementation("ca.gosyer:compose-router:0.24.2-jetbrains-2")
implementation("ca.gosyer:accompanist-pager:0.14.0")
implementation("ca.gosyer:accompanist-flowlayout:0.14.0")
// UI (Swing)
implementation("com.github.weisj:darklaf-core:2.7.2")

View File

@@ -3,9 +3,9 @@ import org.gradle.api.JavaVersion
object Config {
const val tachideskVersion = "v0.4.9"
// Match this to the Tachidesk-Server commit count
const val serverCode = 875
const val serverCode = 878
const val preview = true
const val previewCommit = "b05b817aebdb512b73765940645b4db7763a8909"
const val previewCommit = "90be30bddbcb27eaf9a925bb6e8e025f43459ebb"
val jvmTarget = JavaVersion.VERSION_15
}

View File

@@ -19,7 +19,7 @@ data class Manga(
val artist: String?,
val author: String?,
val description: String?,
val genre: String?,
val genre: List<String>,
val status: String,
val inLibrary: Boolean,
val source: Source?,

View File

@@ -27,6 +27,7 @@ import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.Button
import androidx.compose.material.Card
import androidx.compose.material.Checkbox
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
@@ -42,6 +43,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.util.fastForEach
import ca.gosyer.build.BuildConfig
import ca.gosyer.data.models.Category
import ca.gosyer.data.models.Manga
@@ -58,6 +60,7 @@ import ca.gosyer.ui.base.vm.viewModel
import ca.gosyer.ui.reader.openReaderMenu
import ca.gosyer.util.compose.ThemedWindow
import ca.gosyer.util.lang.launchApplication
import com.google.accompanist.flowlayout.FlowRow
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.collect
@@ -215,13 +218,30 @@ private fun MangaInfo(manga: Manga, modifier: Modifier = Modifier) {
if (!manga.description.isNullOrEmpty()) {
Text(manga.description)
}
if (!manga.genre.isNullOrEmpty()) {
Text(manga.genre)
if (manga.genre.isNotEmpty()) {
FlowRow {
manga.genre.fastForEach {
Chip(it)
}
}
// Text(manga.genre.joinToString())
}
}
}
}
@Composable
private fun Chip(text: String) {
Box(Modifier.padding(horizontal = 4.dp, vertical = 2.dp)) {
Card(
shape = RoundedCornerShape(50),
elevation = 4.dp
) {
Text(text, Modifier.align(Alignment.Center).padding(8.dp))
}
}
}
fun openCategorySelectDialog(
categories: List<Category>,
oldCategories: List<Category>,