Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/546_apply_the…
Browse files Browse the repository at this point in the history
…_correct_icon_for_floormap
  • Loading branch information
shinya-tan committed Aug 17, 2023
2 parents 1746efc + c27309e commit f2f9314
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 5 deletions.
4 changes: 4 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ gradlePlugin {
id = "droidkaigi.primitive.kmp.android.hilt"
implementationClass = "io.github.droidkaigi.confsched2023.primitive.KmpAndroidHiltPlugin"
}
register("kotlinMppAndroidShowkase") {
id = "droidkaigi.primitive.kmp.android.showkase"
implementationClass = "io.github.droidkaigi.confsched2023.primitive.KmpAndroidShowkasePlugin"
}
register("kotlinMppKotlinSerialization") {
id = "droidkaigi.primitive.kmp.serialization"
implementationClass = "io.github.droidkaigi.confsched2023.primitive.KotlinSerializationPlugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.github.droidkaigi.confsched2023.primitive

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.get

@Suppress("unused")
class KmpAndroidShowkasePlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply(libs.findPlugin("kspGradlePlugin").get().get().pluginId)
}
kotlin {
sourceSets.getByName("androidMain") {
dependencies {
implementation(libs.findLibrary("showkaseRuntime").get())
}
}
}
dependencies {
this.add("kspAndroid", libs.findLibrary("showkaseProcessor").get())
}
}
}
}
2 changes: 1 addition & 1 deletion core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import io.github.droidkaigi.confsched2023.primitive.implementation
import io.github.droidkaigi.confsched2023.primitive.libs

plugins {
Expand All @@ -8,6 +7,7 @@ plugins {
id("droidkaigi.primitive.kmp.compose")
id("droidkaigi.primitive.kmp.android.hilt")
id("droidkaigi.primitive.spotless")
id("droidkaigi.primitive.kmp.android.showkase")
}

android.namespace = "io.github.droidkaigi.confsched2023.core.designsystem"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.github.droidkaigi.confsched2023.about.AboutStrings
import io.github.droidkaigi.confsched2023.designsystem.preview.MultiLanguagePreviews
import io.github.droidkaigi.confsched2023.designsystem.preview.MultiThemePreviews
import io.github.droidkaigi.confsched2023.designsystem.theme.KaigiTheme

@Composable
Expand Down Expand Up @@ -72,8 +74,8 @@ fun AboutContentColumn(
}
}

@Preview(locale = "en", uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(locale = "ja", uiMode = Configuration.UI_MODE_NIGHT_NO)
@MultiThemePreviews
@MultiLanguagePreviews
@Composable
fun AboutContentColumnPreview() {
KaigiTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sealed class SessionsStrings : Strings<SessionsStrings>(Bindings) {
data object WatchVideo : SessionsStrings()
data object Speaker : SessionsStrings()
data object TargetAudience : SessionsStrings()
data object ReadMore : SessionsStrings()
private object Bindings : StringsBindings<SessionsStrings>(
Lang.Japanese to { item, _ ->
when (item) {
Expand Down Expand Up @@ -62,6 +63,7 @@ sealed class SessionsStrings : Strings<SessionsStrings>(Bindings) {
TargetAudience -> "対象者"
WatchVideo -> "動画を見る"
Speaker -> "スピーカー"
ReadMore -> "続きを読む"
}
},
Lang.English to { item, bindings ->
Expand Down Expand Up @@ -93,6 +95,7 @@ sealed class SessionsStrings : Strings<SessionsStrings>(Bindings) {
WatchVideo -> "Watch Video"
Speaker -> "Speaker"
TargetAudience -> "Target Audience"
ReadMore -> "Read More"
}
},
default = Lang.Japanese,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import io.github.droidkaigi.confsched2023.designsystem.preview.MultiLanguagePreviews
import io.github.droidkaigi.confsched2023.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched2023.designsystem.theme.md_theme_light_outline
import io.github.droidkaigi.confsched2023.model.TimetableItem
import io.github.droidkaigi.confsched2023.model.TimetableItem.Session
Expand Down Expand Up @@ -68,14 +75,27 @@ fun TimetableItemDetailContent(
}

@Composable
private fun DescriptionSection(description: String, modifier: Modifier = Modifier) {
private fun DescriptionSection(
description: String,
modifier: Modifier = Modifier,
) {
var isExpanded by rememberSaveable { mutableStateOf(false) }

Column(modifier = modifier) {
Text(
text = description,
fontSize = 16.sp,
color = MaterialTheme.colorScheme.onSurface,
maxLines = if (isExpanded) Int.MAX_VALUE else 5,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(start = 16.dp, end = 16.dp),
)
if (!isExpanded) {
ReadMoreOutlinedButton(
onClick = { isExpanded = !isExpanded },
modifier = Modifier.padding(top = 16.dp, start = 16.dp, end = 16.dp),
)
}
BorderLine(modifier = Modifier.padding(top = 24.dp))
}
}
Expand Down Expand Up @@ -256,3 +276,35 @@ private fun BorderLine(modifier: Modifier = Modifier) {
.background(MaterialTheme.colorScheme.outlineVariant),
)
}

@Composable
private fun ReadMoreOutlinedButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Surface(
modifier = modifier.fillMaxWidth(),
shape = RoundedCornerShape(100.dp),
border = BorderStroke(
width = 1.dp,
color = MaterialTheme.colorScheme.outline,
),
onClick = onClick,
) {
Text(
modifier = Modifier.padding(vertical = 10.dp),
text = SessionsStrings.ReadMore.asString(),
fontSize = 14.sp,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.primary,
)
}
}

@MultiLanguagePreviews
@Composable
fun ReadMoreOutlinedButtonPreview() {
KaigiTheme {
ReadMoreOutlinedButton(onClick = {})
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ktlint = "0.49.1"
kotlinxSerialization = "1.5.1"
ktor = "2.3.3"
roborazzi = "1.6.0-alpha-3"
showkase = "1.0.0-beta17"
showkase = "1.0.0-beta18"
ksp = "1.9.0-1.0.13"
multiplatformFirebaseAuth = "1.8.1"
kermit = "1.2.2"
Expand Down

0 comments on commit f2f9314

Please sign in to comment.