Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0.0 QA] Home + Our Rule + 룸메이트 성향 카드 #328

Merged
merged 11 commits into from
Mar 17, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ import hous.release.designsystem.theme.HousTheme

@Composable
fun RuleEmptyContent(
modifier: Modifier = Modifier.fillMaxWidth().padding(top = 88.dp)
text: String = stringResource(id = R.string.hous_empty_our_rules),
modifier: Modifier = Modifier
.fillMaxWidth()
.padding(top = 88.dp)
) {
Column(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(id = R.string.hous_empty_our_rules),
text = text,
color = HousG5,
style = HousTheme.typography.b2
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package hous.release.android.presentation.our_rules.component.dialog

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogProperties
import hous.release.android.R
import hous.release.designsystem.component.HousLimitDialog

Expand All @@ -12,6 +13,10 @@ fun AddRuleLimitedDialog(
HousLimitDialog(
title = stringResource(R.string.our_rule_limit_title),
content = stringResource(R.string.our_rule_limit_content),
onDismissRequest = onDismissRequest
onDismissRequest = onDismissRequest,
properties = DialogProperties(
dismissOnBackPress = false,
dismissOnClickOutside = false
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fun DetailRuleBottomSheetContent(
Spacer(modifier = Modifier.height(7.dp))
if (detailRule.description.isEmpty()) {
Text(
text = detailRule.description,
text = "설명 없음",
style = HousTheme.typography.b2,
color = HousG4
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import hous.release.feature.todo.R

@Composable
fun MainRuleContent(
mainRules: List<Rule> = emptyList(),
filteredRules: List<Rule> = emptyList(),
originRules: List<Rule> = emptyList(),
searchQuery: String = "",
onSearch: (String) -> Unit = {},
onOpenDetailRule: (Int) -> Unit = {},
Expand Down Expand Up @@ -75,7 +76,8 @@ fun MainRuleContent(
)
)
MainRuleList(
mainRules = mainRules,
originRules = originRules,
filteredRules = filteredRules,
onNavigateToDetailRule = onOpenDetailRule
)
}
Expand All @@ -87,7 +89,7 @@ fun MainRuleContent(
private fun MainRuleScreenPreView2() {
HousTheme {
MainRuleContent(
mainRules = listOf(
filteredRules = listOf(
Rule().copy(id = 1, name = "test1", isNew = true),
Rule().copy(id = 2, name = "test2", isNew = false),
Rule().copy(id = 3, name = "test3", isNew = true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import hous.release.android.R
import hous.release.android.presentation.our_rules.component.RuleEmptyContent
import hous.release.designsystem.component.HousDot
import hous.release.designsystem.component.HousDotType
Expand All @@ -25,18 +27,25 @@ import hous.release.domain.entity.rule.Rule
@Composable
fun MainRuleList(
onNavigateToDetailRule: (Int) -> Unit = {},
mainRules: List<Rule> = emptyList()
originRules: List<Rule> = emptyList(),
filteredRules: List<Rule> = emptyList()
) {
if (mainRules.isEmpty()) {
RuleEmptyContent()
} else {
Spacer(modifier = Modifier.height(16.dp))
LazyColumn {
itemsIndexed(mainRules, key = { _, rule -> rule.id }) { _, rule ->
MainRuleItem(
onClick = { onNavigateToDetailRule(rule.id) },
mainRule = rule
)
when {
originRules.isEmpty() -> {
RuleEmptyContent(text = stringResource(id = R.string.hous_empty_our_rules))
}
filteredRules.isEmpty() -> {
RuleEmptyContent(text = stringResource(id = R.string.hous_filterd_empty_our_rules))
}
else -> {
Spacer(modifier = Modifier.height(16.dp))
LazyColumn {
itemsIndexed(filteredRules, key = { _, rule -> rule.id }) { _, rule ->
MainRuleItem(
onClick = { onNavigateToDetailRule(rule.id) },
mainRule = rule
)
}
}
}
}
Expand Down Expand Up @@ -72,7 +81,7 @@ private fun MainRuleItem(
)
}

@Preview(name = "empty content", showBackground = true)
@Preview(name = "empty origin rules content", showBackground = true)
@Composable
private fun EmptyContentPreview() {
HousTheme {
Expand All @@ -82,12 +91,22 @@ private fun EmptyContentPreview() {
}
}

@Preview(name = "empty filtered Rules", showBackground = true)
@Composable
private fun EmptyContentPreview2() {
HousTheme {
Surface {
MainRuleList(originRules = listOf(Rule().copy(id = 1, name = "test1")))
}
}
}

@Preview(name = "MainRuleContent", showBackground = true)
@Composable
private fun MainRuleContentPreview() {
HousTheme {
MainRuleList(
mainRules = listOf(
filteredRules = listOf(
Rule().copy(id = 1, name = "test1", isNew = true),
Rule().copy(id = 2, name = "test2", isNew = false),
Rule().copy(id = 3, name = "test3", isNew = true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ import kotlinx.coroutines.launch

// https://github.com/android/snippets/blob/5ae1f7852164d98d055b3cc6b463705989cff231/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt#L93-L103

private val titleList = listOf(
"우리집 Rules란?",
"대표 Rules 선택하기",
"대표 Rules 선택 시 주의!"
)

private val descriptionList = listOf(
"Rules는 우리 호미들이 꼭 지켜야 하는 규칙이에요!",
"우리 집 대표 Rules를 선택하면 홈에서 바로 확인할 수 있어요!",
"대표 Rules는 딱 3개까지만 고정할 수 있어요!"
)
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun RuleGuideBottomSheetContent() {
Expand All @@ -55,21 +66,17 @@ fun RuleGuideBottomSheetContent() {
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = "룰스 고정하기",
text = titleList[page],
color = HousBlack,
textAlign = TextAlign.Center,
style = HousTheme.typography.b1
)
Spacer(Modifier.height(13.dp))
Text(
text = "Page: $page",
textAlign = TextAlign.Center
)
RuleGuideLottie(idx = page)
Spacer(Modifier.height(20.dp))

Text(
text = "룰스 고정 어쩌구 저쩌구",
text = descriptionList[page],
color = HousG6,
textAlign = TextAlign.Center,
style = HousTheme.typography.description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fun BasicUpdateRuleScreen(
textFielddMode = HousTextFieldMode.RIGHT_LIMITED,
text = ruleName,
onTextChange = changeName,
limitTextCount = 10,
limitTextCount = 20,
keyboardOptions = KeyboardOptions.Default.copy(
imeAction = ImeAction.Next
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ private fun NavGraphBuilder.mainRuleScreen(

MainRuleScreen(
detailRule = uiState.value.detailRule,
mainRules = uiState.value.filteredRules,
filteredRules = uiState.value.filteredRules,
originRules = uiState.value.originRules,
searchQuery = uiState.value.searchQuery,
fetchDetailRuleById = viewModel::fetchDetailRule,
onSearch = viewModel::searchRule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import kotlinx.coroutines.launch
@Composable
fun MainRuleScreen(
detailRule: DetailRuleUiModel = DetailRuleUiModel(),
mainRules: List<Rule> = emptyList(),
filteredRules: List<Rule> = emptyList(),
originRules: List<Rule> = emptyList(),
searchQuery: String = "",
fetchDetailRuleById: (Int) -> Unit = {},
deleteRule: () -> Unit = {},
Expand Down Expand Up @@ -107,7 +108,8 @@ fun MainRuleScreen(
sheetBackgroundColor = HousWhite
) {
MainRuleContent(
mainRules = mainRules,
filteredRules = filteredRules,
originRules = originRules,
searchQuery = searchQuery,
onSearch = onSearch,
onOpenDetailRule = { id ->
Expand Down Expand Up @@ -135,7 +137,7 @@ fun MainRuleScreen(
private fun MainRuleScreenPreView2() {
HousTheme {
MainRuleScreen(
mainRules = listOf(
filteredRules = listOf(
Rule().copy(id = 1, name = "test1", isNew = true),
Rule().copy(id = 2, name = "test2", isNew = false),
Rule().copy(id = 3, name = "test3", isNew = true),
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_homie_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="48dp"
android:layout_marginTop="20dp"
android:background="@color/hous_g_0"
app:layout_constraintTop_toBottomOf="@id/iv_homie_profile_representation_image_empty" />
app:layout_constraintTop_toBottomOf="@id/tv_homie_profile_representation" />

<FrameLayout
android:id="@+id/fl_homie_profile_personality"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="47dp"
android:layout_marginTop="28dp"
android:background="@color/hous_g_0"
app:layout_constraintTop_toBottomOf="@id/tv_profile_introduction" />

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@
<string name="hous_our_rules">Our Rules</string>
<string name="hous_our_rules_img_desc">btn_of_our_rules</string>
<string name="hous_empty_our_rules">아직 우리 집 Rules가 없어요!</string>
<string name="hous_filterd_empty_our_rules">해당되는 Rules가 없어요!</string>
<string name="hous_empty_our_rules_add">다른 Rule도 추가해보세요!</string>
<string name="our_rule_duplicate_rule">똑같은 이름의 Rule이 있어요!</string>
<string name="our_rule_limit_photo_count">사진은 5개 까지만 추가할 수 있어요!</string>
<string name="our_rule_limit_represent_rules_count">대표 rule 은 3개 까지만 추가할 수 있어요!</string>
<string name="our_rule_limit_title">Rules 개수 초과</string>
<string name="our_rule_limit_content">우리 집 rule이 너무 많아요!\n필요하지 않은 rule을 삭제하고\n다시 시도해주세요~</string>
<string name="our_rule_limit_content">우리 집 Rules가 너무 많아요!\n필요하지 않은 rule을 삭제하고\n다시 시도해 주세요~</string>
<string name="our_rule_empty_description">아직 우리 집 Rules가 없어요!</string>
<string name="our_rule_add_new_rule_title">Rules 추가</string>
<string name="our_rule_edit_rule_title">Rules 수정</string>
Expand Down Expand Up @@ -188,7 +189,7 @@
<string name="edit_hous_name_back_img_desc">back button</string>
<string name="edit_hous_name_done">저장</string>
<string name="edit_hous_name_title">우리 집 별명 바꾸기</string>
<string name="edit_hous_name_description">멤버들이 확인할 수 있도록 방 이름을 설정해주세요.</string>
<string name="edit_hous_name_description">다른 호미들이 확인할 수 있도록 방 이름을 설정해주세요.</string>
<string name="edit_hous_name_count">%d/8</string>

<!-- To-Do -->
Expand Down
2 changes: 1 addition & 1 deletion feature/todo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<string name="todo_filter_homy">호미</string>
<string name="filter_search_result">검색 결과</string>
<string name="filter_search_result_postfix">개</string>
<string name="todo_detail_textfield_hint">검색하기</string>
<string name="todo_detail_textfield_hint">Rules 검색하기</string>
<string name="todo_detail_empty">아직 우리집 to-do가 없어요!</string>
<string name="todo_filter_empty">해당되는 to-do가 없어요!</string>
<string name="todo_delete_title">안녕, to-do...</string>
Expand Down
Loading