Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ fun AppNavigation(
}
entry<RecommendationKey> {
RecommendationScreen(
onNavigateBack = { backStack.popBack() },
onSelectRecommendation = { title ->
recommendation = ScheduleRecommendation.selected(backStack, title)
backStack.popBack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ internal fun MainContent(
IconButton(onClick = onNavigateToSettings, modifier = Modifier.size(56.dp)) {
Icon(
Icons.Outlined.Settings,
contentDescription = "설정",
contentDescription = stringResource(R.string.share_code_settings_description),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(30.dp),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.example.slowclock.feature.main.R
import com.example.slowclock.ui.mvi.ObserveSignal

/** 공유 코드 입력 화면(stateful). 저장이 끝나면 [onReturn] 으로 돌아간다. */
Expand All @@ -37,14 +42,15 @@ fun SettingsScreenShareCode(
onIntent = viewModel::onIntent,
) { onReturn() }

ShareCodeContent(state = state, onIntent = viewModel::onIntent, modifier = modifier)
ShareCodeContent(state = state, onIntent = viewModel::onIntent, onReturn = onReturn, modifier = modifier)
}

/** 공유 코드 입력 화면(stateless). */
@Composable
internal fun ShareCodeContent(
state: ShareCodeUiState,
onIntent: (ShareCodeIntent) -> Unit,
onReturn: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
Expand Down Expand Up @@ -86,6 +92,13 @@ internal fun ShareCodeContent(
},
)
}
Spacer(modifier = Modifier.height(12.dp))
OutlinedButton(
onClick = onReturn,
modifier = Modifier.fillMaxWidth().heightIn(min = 56.dp),
) {
Text(stringResource(R.string.share_code_back_without_saving), textAlign = TextAlign.Center)
}
// 등록이 곧 읽기 권한이라, 실패를 알리지 않으면 가족 일정이 왜 비어 있는지 알 수 없다(#174).
if (state.saveError != null) {
Spacer(modifier = Modifier.height(16.dp))
Expand Down
4 changes: 4 additions & 0 deletions feature/main/src/main/res/values/navigation_strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<string name="share_code_settings_description">공유 코드 설정</string>
<string name="share_code_back_without_saving">저장하지 않고 돌아가기</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.example.slowclock.ui.theme.SlowClockTheme
@Composable
internal fun ShareCodeClearScreenshot() {
SlowClockTheme(darkTheme = false) {
ShareCodeContent(state = ShareCodeUiState(hasRegisteredCode = true), onIntent = {})
ShareCodeContent(state = ShareCodeUiState(hasRegisteredCode = true), onIntent = {}, onReturn = {})
}
}

Expand All @@ -26,6 +26,7 @@ internal fun ShareCodeClearFailedScreenshot() {
saveError = "공유 설정을 해제하지 못했습니다. 기존 코드는 유지됩니다. 인터넷에 연결한 뒤 다시 눌러 주세요.",
),
onIntent = {},
onReturn = {},
)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@ package com.example.slowclock.ui.recommendation

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.FilterChip
import androidx.compose.material3.FilterChipDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
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.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.example.slowclock.data.model.Recommendation
import com.example.slowclock.feature.recommendation.R
import com.example.slowclock.ui.common.components.ScreenHeader
import com.example.slowclock.ui.recommendation.components.RecommendationList

Expand Down Expand Up @@ -63,6 +67,7 @@ private val allRecommendations =
@Composable
fun RecommendationScreen(
onSelectRecommendation: (String) -> Unit,
onNavigateBack: () -> Unit,
modifier: Modifier = Modifier,
) {
var group by rememberSaveable { mutableStateOf(RecommendationGroup.ELDERLY) }
Expand All @@ -76,9 +81,17 @@ fun RecommendationScreen(
) {
ScreenHeader(title = "추천 일정", subtitle = "고르면 일정 제목으로 들어갑니다")

Row(
OutlinedButton(
onClick = onNavigateBack,
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp).heightIn(min = 56.dp),
) {
Text(stringResource(R.string.recommendation_back_without_selection), textAlign = TextAlign.Center)
}

FlowRow(
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
RecommendationGroup.entries.forEach { entry ->
FilterChip(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="recommendation_back_without_selection">고르지 않고 돌아가기</string>
</resources>
Loading