Skip to content

Commit

Permalink
Merge branch 'main' of github.com:droidknights/DroidKnights2023_App i…
Browse files Browse the repository at this point in the history
…nto media3
  • Loading branch information
workspace committed Aug 31, 2023
2 parents 145707a + 7060fa3 commit 8fde836
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ fun KnightsTheme(
SideEffect {
val window = (view.context as Activity).window
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
WindowCompat.getInsetsController(window, view).isAppearanceLightNavigationBars = !darkTheme
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/designsystem/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

<style name="Theme.DroidKnights2023" parent="Theme.AppCompat.DayNight.NoActionBar" />

<style name="Theme.DroidKnights2023.NoStatusBar">
<style name="Theme.DroidKnights2023.TransparentSystemBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>

</resources>
2 changes: 1 addition & 1 deletion feature/main/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:name=".MainActivity"
android:exported="true"
android:configChanges="uiMode"
android:theme="@style/Theme.DroidKnights2023.NoStatusBar">
android:theme="@style/Theme.DroidKnights2023.TransparentSystemBar">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ private fun SessionCardContent(

// 트랙
Spacer(modifier = Modifier.height(12.dp))
SessionChips(session = session)
Row {
TrackChip(room = session.room)
Spacer(modifier = Modifier.width(8.dp))
TimeChip(dateTime = session.startTime)
}

// 발표자
Spacer(modifier = Modifier.height(12.dp))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
package com.droidknights.app2023.feature.session

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.droidknights.app2023.core.designsystem.component.TextChip
import com.droidknights.app2023.core.model.Room
import com.droidknights.app2023.core.model.Session
import com.droidknights.app2023.core.ui.textRes
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.toJavaLocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter

@Composable
internal fun SessionChips(session: Session) {
Row {
TrackChip(room = session.room)
Spacer(modifier = Modifier.width(8.dp))
TimeChip(session.startTime.toJavaLocalDateTime().toLocalTime())
}
}

@Composable
private fun TrackChip(room: Room) {
internal fun TrackChip(room: Room) {
TextChip(
text = stringResource(id = room.textRes),
containerColor = MaterialTheme.colorScheme.secondaryContainer,
Expand All @@ -36,9 +21,11 @@ private fun TrackChip(room: Room) {
}

@Composable
private fun TimeChip(time: LocalTime) {
internal fun TimeChip(dateTime: LocalDateTime) {
val pattern = stringResource(id = R.string.session_time_fmt)
val formatter = remember { DateTimeFormatter.ofPattern(pattern) }
val time = remember { dateTime.toJavaLocalDateTime().toLocalTime() }

TextChip(
text = formatter.format(time),
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.droidknights.app2023.feature.session

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -15,6 +17,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Divider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconToggleButton
import androidx.compose.material3.MaterialTheme
Expand All @@ -38,8 +41,11 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.droidknights.app2023.core.designsystem.component.KnightsTopAppBar
import com.droidknights.app2023.core.designsystem.component.NetworkImage
import com.droidknights.app2023.core.designsystem.component.TextChip
import com.droidknights.app2023.core.designsystem.component.TopAppBarNavigationType
import com.droidknights.app2023.core.designsystem.theme.DarkGray
import com.droidknights.app2023.core.designsystem.theme.KnightsTheme
import com.droidknights.app2023.core.designsystem.theme.LightGray
import com.droidknights.app2023.core.designsystem.theme.surfaceDim
import com.droidknights.app2023.core.model.Level
import com.droidknights.app2023.core.model.Room
Expand Down Expand Up @@ -149,14 +155,16 @@ private fun SessionDetailContent(
SessionDetailTitle(title = session.title, modifier = Modifier.padding(top = 8.dp))
Spacer(modifier = Modifier.height(8.dp))
SessionChips(session = session)

if (session.content.isNotEmpty()) {
Spacer(modifier = Modifier.height(16.dp))
SessionOverview(content = session.content)
Spacer(modifier = Modifier.height(56.dp))
} else {
Spacer(modifier = Modifier.height(40.dp))
}
SessionDetailSpeaker(session.speakers.toPersistentList())
Spacer(modifier = Modifier.height(40.dp))
Divider(thickness = 1.dp, color = MaterialTheme.colorScheme.outline)
Spacer(modifier = Modifier.height(40.dp))

SessionDetailSpeaker(session.speakers.first())
Button(
modifier = Modifier
.padding(top = 16.dp)
Expand All @@ -171,6 +179,34 @@ private fun SessionDetailContent(
}
}

@Composable
private fun SessionChips(session: Session) {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
TrackChip(room = session.room)
TimeChip(dateTime = session.startTime)
TagChips(tags = session.tags.toPersistentList())
}
}

@Composable
private fun TagChips(tags: PersistentList<Tag>) {
tags.forEach { tag ->
TagChip(tag = tag)
}
}

@Composable
private fun TagChip(tag: Tag) {
TextChip(
text = tag.name,
containerColor = DarkGray,
labelColor = LightGray,
)
}

@Composable
private fun SessionDetailTitle(
title: String,
Expand All @@ -180,36 +216,44 @@ private fun SessionDetailTitle(
modifier = modifier.padding(end = 64.dp),
text = title,
style = KnightsTheme.typography.headlineMediumB,
color = MaterialTheme.colorScheme.onSurface,
color = MaterialTheme.colorScheme.onSecondaryContainer,
)
}

@Composable
private fun SessionDetailSpeaker(
speakers: PersistentList<Speaker>,
speaker: Speaker,
modifier: Modifier = Modifier,
) {
Column(modifier = modifier) {
Text(
text = stringResource(id = R.string.session_detail_speaker),
style = KnightsTheme.typography.labelSmallM,
color = MaterialTheme.colorScheme.onSurface,
)
speakers.forEach { speaker ->
Text(
text = speaker.name,
style = KnightsTheme.typography.titleMediumB,
color = MaterialTheme.colorScheme.onSurface,
)
}
Spacer(Modifier.height(8.dp))
NetworkImage(
imageUrl = speakers.firstOrNull()?.imageUrl ?: "",
imageUrl = speaker.imageUrl,
modifier = Modifier
.size(108.dp)
.clip(CircleShape),
placeholder = painterResource(id = com.droidknights.app2023.core.ui.R.drawable.placeholder_speaker)
)

Spacer(Modifier.height(16.dp))

Text(
text = stringResource(id = R.string.session_detail_speaker),
style = KnightsTheme.typography.labelSmallM,
color = MaterialTheme.colorScheme.onSecondaryContainer,
)
Text(
text = speaker.name,
style = KnightsTheme.typography.titleMediumB,
color = MaterialTheme.colorScheme.onSecondaryContainer,
)

Spacer(Modifier.height(16.dp))

Text(
text = speaker.introduction,
style = KnightsTheme.typography.titleSmallR140,
color = MaterialTheme.colorScheme.onSecondaryContainer,
)
}
}

Expand All @@ -218,7 +262,7 @@ private fun SessionOverview(content: String) {
Text(
text = content,
style = KnightsTheme.typography.titleSmallR140,
color = MaterialTheme.colorScheme.onSurface
color = MaterialTheme.colorScheme.onSecondaryContainer
)
}

Expand Down Expand Up @@ -248,8 +292,11 @@ private val SampleSessionHasContent = Session(
title = "세션 제목은 세션 제목 - 개요, 영상 있음",
content = "세션에 대한 소개와 세션에서의 장단점과 세션을 실제로 사용한 사례와 세션 내용에 대한 QnA 진행",
speakers = listOf(
Speaker(name = "스피커1", introduction = "", "https://raw.githubusercontent.com/droidknights/DroidKnights2023_App/main/storage/speaker/차영호.png"),
Speaker(name = "스피커2", introduction = "", "https://raw.githubusercontent.com/droidknights/DroidKnights2023_App/main/storage/speaker/차영호.png")
Speaker(
name = "스피커1",
introduction = "스피커1 에 대한 소개",
imageUrl = "",
),
),
level = Level.ADVANCED,
tags = listOf(Tag("Dev Environment")),
Expand All @@ -264,8 +311,11 @@ private val SampleSessionNoContent = Session(
title = "세션 제목은 세션 제목 - 개요, 영상 없음",
content = "",
speakers = listOf(
Speaker(name = "스피커1", introduction = "", "https://raw.githubusercontent.com/droidknights/DroidKnights2023_App/main/storage/speaker/차영호.png"),
Speaker(name = "스피커2", introduction = "", "https://raw.githubusercontent.com/droidknights/DroidKnights2023_App/main/storage/speaker/차영호.png")
Speaker(
name = "스피커1",
introduction = "스피커1 에 대한 소개",
imageUrl = "",
),
),
level = Level.ADVANCED,
tags = listOf(Tag("Dev Environment")),
Expand Down Expand Up @@ -318,7 +368,7 @@ private fun SessionDetailTitlePreview() {
@Composable
private fun SessionDetailSpeakerPreview() {
KnightsTheme {
SessionDetailSpeaker(SampleSessionHasContent.speakers.toPersistentList())
SessionDetailSpeaker(SampleSessionHasContent.speakers.first())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ internal fun SettingScreen(
val scrollState = rememberScrollState()
Column(
Modifier
.verticalScroll(scrollState)
.padding(padding)
.padding(8.dp)
.verticalScroll(scrollState),
.padding(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
OpenSourceCard(
Expand Down

0 comments on commit 8fde836

Please sign in to comment.