Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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 @@ -64,10 +64,10 @@ fun ColumnScope.ContactCycleContent(
)
}

Spacer(modifier = Modifier.size(14.dp))

// 한번에 설정이 활성화되었을 때만 표시
if (isBulkSettingEnabled) {
Spacer(modifier = Modifier.size(12.dp))

Row(
modifier =
Modifier
Expand All @@ -85,7 +85,9 @@ fun ColumnScope.ContactCycleContent(
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = selectedCycle?.let { DateExtension.getCycleText(it) } ?: stringResource(R.string.friend_contact_cycle_weekly_format, DateExtension.getTodayDayOfWeekInKorean()),
text =
selectedCycle?.let { DateExtension.getCycleText(it) }
?: stringResource(R.string.friend_contact_cycle_weekly_format, DateExtension.getTodayDayOfWeekInKorean()),
style = NearTheme.typography.B2_14_MEDIUM,
color = NearTheme.colors.BLACK_1A1A1A,
)
Expand All @@ -101,7 +103,7 @@ fun ColumnScope.ContactCycleContent(

// 리스트가 있을 때만 밑에 리스트 표시
if (contacts.isNotEmpty()) {
Spacer(modifier = Modifier.size(16.dp))
Spacer(modifier = Modifier.size(24.dp))

LazyColumn(
modifier = Modifier.weight(1f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fun FriendListItem(
modifier = Modifier.weight(1f),
) {
Image(
painter = painterResource(R.drawable.img_100_character_default),
painter = painterResource(R.drawable.img_64_user_gray),
contentDescription = null,
modifier = Modifier.size(24.dp),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ package com.alarmy.near.presentation.feature.friendcontactcycle.components

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand All @@ -31,12 +26,12 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.alarmy.near.R
import com.alarmy.near.model.ReminderInterval
import com.alarmy.near.presentation.ui.component.bottomsheet.NearBottomSheet
import com.alarmy.near.presentation.ui.component.checkbox.NearCheckbox
import com.alarmy.near.presentation.ui.extension.onNoRippleClick
import com.alarmy.near.presentation.ui.theme.NearTheme
import com.alarmy.near.utils.extensions.DateExtension

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun CycleSettingBottomSheet(
isVisible: Boolean,
Expand All @@ -45,160 +40,160 @@ fun CycleSettingBottomSheet(
currentSelectedInterval: ReminderInterval? = null,
modifier: Modifier = Modifier,
) {
// 선택된 주기 상태 관리 (기존 선택값이 있으면 그것을 사용, 없으면 매주를 기본값으로)
var selectedInterval by remember(isVisible) {
mutableStateOf<ReminderInterval?>(currentSelectedInterval ?: ReminderInterval.EVERY_WEEK)
// 선택된 주기 상태 관리
var selectedInterval by remember(isVisible) {
mutableStateOf<ReminderInterval?>(currentSelectedInterval ?: ReminderInterval.EVERY_WEEK)
}

if (isVisible) {
val bottomSheetState =
rememberModalBottomSheetState(
skipPartiallyExpanded = true,
NearBottomSheet(
isVisible = isVisible,
onDismiss = onDismiss,
modifier = modifier,
) {
// 제목
Text(
text = stringResource(R.string.friend_contact_cycle_cycle_setting_text),
style = NearTheme.typography.B1_16_BOLD,
)

Spacer(modifier = Modifier.size(24.dp))

// 선택된 주기 미리보기
Row(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
modifier =
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(NearTheme.colors.BG02_F4F9FD)
.padding(vertical = 18.dp, horizontal = 20.dp),
) {
Text(
text =
buildAnnotatedString {
val interval = selectedInterval ?: ReminderInterval.EVERY_WEEK
val cycleText = DateExtension.getCycleText(interval)
val firstSpaceIndex = cycleText.indexOf(' ')

if (firstSpaceIndex != -1) {
withStyle(
style =
SpanStyle(
color = NearTheme.colors.BLACK_1A1A1A,
fontWeight = NearTheme.typography.B2_14_MEDIUM.fontWeight,
),
) {
append(cycleText.substring(0, firstSpaceIndex + 1))
}
withStyle(
style =
SpanStyle(
color = NearTheme.colors.BLUE01_5AA2E9,
fontWeight = NearTheme.typography.B2_14_BOLD.fontWeight,
),
) {
append(cycleText.substring(firstSpaceIndex + 1))
}
} else {
withStyle(
style =
SpanStyle(
color = NearTheme.colors.BLACK_1A1A1A,
fontWeight = NearTheme.typography.B2_14_MEDIUM.fontWeight,
),
) {
append(cycleText)
}
}
},
style = NearTheme.typography.B2_14_MEDIUM,
)

ModalBottomSheet(
onDismissRequest = onDismiss,
sheetState = bottomSheetState,
dragHandle = {
BottomSheetDefaults.DragHandle(
color = NearTheme.colors.BLACK_1A1A1A.copy(alpha = 0.1f),
width = 36.dp,
height = 5.dp,
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Spacer(modifier = Modifier.size(20.dp))

VerticalDivider(
modifier =
Modifier
.size(width = 1.dp, height = 28.dp),
color =
NearTheme.colors.BLACK_1A1A1A.copy(
alpha = 0.1f,
),
)
},
modifier = modifier,
containerColor = NearTheme.colors.WHITE_FFFFFF,
) {
Column(

Spacer(modifier = Modifier.size(20.dp))

Text(
text =
stringResource(R.string.friend_contact_cycle_next_cycle_prefix) + " " +
(
selectedInterval?.let { DateExtension.getNextCycleDate(it) }
?: DateExtension.getNextWeekSameDay()
),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

R.string.friend_contact_cycle_next_cycle_prefix 리소스 문자열("다음 주기 : ") 끝에 공백이 포함되어 있습니다. 코드에서 + " "를 사용하여 공백을 추가로 연결하고 있어, 결과적으로 "다음 주기 : "와 같이 두 개의 공백이 생기게 됩니다. 불필요한 공백을 제거하기 위해 코드에서 + " " 부분을 삭제하는 것이 좋겠습니다.

Suggested change
stringResource(R.string.friend_contact_cycle_next_cycle_prefix) + " " +
(
selectedInterval?.let { DateExtension.getNextCycleDate(it) }
?: DateExtension.getNextWeekSameDay()
),
stringResource(R.string.friend_contact_cycle_next_cycle_prefix) +
(
selectedInterval?.let { DateExtension.getNextCycleDate(it) }
?: DateExtension.getNextWeekSameDay()
),

Copy link
Contributor Author

@stopstone stopstone Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리소스 마지막 공백을 받아오지 못하고 있어 공백을 추가하였습니다
제가 알기론 Android의 XML 리소스 파서는 기본적으로 trailing whitespace(끝 공백)를 제거하여 공백을 별도로 추가했습니다

style = NearTheme.typography.B2_14_MEDIUM,
color = NearTheme.colors.GRAY01_888888,
)
}
}

Spacer(modifier = Modifier.size(8.dp))

// 주기 선택 옵션들
ReminderInterval.entries.forEach { interval ->
val isSelected = selectedInterval == interval

Row(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
modifier =
Modifier
.fillMaxWidth()
.padding(horizontal = 24.dp),
.onNoRippleClick {
if (!isSelected) {
selectedInterval = interval
}
}.padding(vertical = 15.dp),
) {
Text(
text = stringResource(R.string.friend_contact_cycle_cycle_setting_text),
style = NearTheme.typography.B1_16_BOLD,
text = stringResource(interval.labelRes),
style =
if (isSelected) {
NearTheme.typography.B1_16_BOLD
} else {
NearTheme.typography.B2_14_MEDIUM
},
)

Spacer(modifier = Modifier.size(24.dp))

Row(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
modifier =
modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(NearTheme.colors.BG02_F4F9FD)
.padding(vertical = 18.dp, horizontal = 20.dp),
) {
Text(
text =
buildAnnotatedString {
withStyle(
style =
SpanStyle(
color = NearTheme.colors.BLACK_1A1A1A,
fontWeight = NearTheme.typography.B2_14_MEDIUM.fontWeight,
),
) {
append(stringResource(R.string.friend_contact_cycle_weekly_prefix))
}
withStyle(
style =
SpanStyle(
color = NearTheme.colors.BLUE01_5AA2E9,
fontWeight = NearTheme.typography.B2_14_BOLD.fontWeight,
),
) {
append(DateExtension.getTodayDayOfWeekInKorean())
}
},
style = NearTheme.typography.B2_14_MEDIUM,
if (isSelected) {
NearCheckbox(
checked = true,
onCheckedChange = { checked ->
// 체크박스 클릭 시 해제되지 않도록 수정
// 체크된 상태를 유지
},
)

Row(
verticalAlignment = Alignment.CenterVertically,
) {
Spacer(modifier = Modifier.size(20.dp))

VerticalDivider(
modifier =
Modifier
.size(width = 1.dp, height = 28.dp),
color =
NearTheme.colors.BLACK_1A1A1A.copy(
alpha = 0.1f,
),
)

Spacer(modifier = Modifier.size(20.dp))

Text(
text = "다음 주기 : ${
selectedInterval?.let { DateExtension.getNextCycleDate(it) }
?: DateExtension.getNextWeekSameDay()
}",
style = NearTheme.typography.B2_14_MEDIUM,
color = NearTheme.colors.GRAY01_888888,
)
}
}

Spacer(modifier = Modifier.size(8.dp))

ReminderInterval.entries.forEach { interval ->
val isSelected = selectedInterval == interval

Row(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
modifier =
modifier
.fillMaxWidth()
.onNoRippleClick {
if (!isSelected) {
selectedInterval = interval
}
}.padding(vertical = 15.dp),
) {
Text(
text = stringResource(interval.labelRes),
style =
if (isSelected) {
NearTheme.typography.B1_16_BOLD
} else {
NearTheme.typography.B2_14_MEDIUM
},
)

if (isSelected) {
NearCheckbox(
checked = true,
onCheckedChange = { checked ->
// 체크박스 클릭 시 해제되지 않도록 수정
// 체크된 상태를 유지
},
)
}
}
}
Spacer(modifier = Modifier.size(24.dp))

ContactCycleButtons(
onLeftButtonClick = onDismiss,
onRightButtonClick = {
selectedInterval?.let { interval ->
onComplete(interval)
onDismiss()
}
},
leftButtonText = stringResource(R.string.friend_contact_cycle_cancel_button),
rightButtonText = stringResource(R.string.friend_contact_cycle_complete_button),
)
Spacer(modifier = Modifier.size(24.dp))
}
}
Spacer(modifier = Modifier.size(24.dp))

// 버튼들
ContactCycleButtons(
onLeftButtonClick = onDismiss,
onRightButtonClick = {
selectedInterval?.let { interval ->
onComplete(interval)
onDismiss()
}
},
leftButtonText = stringResource(R.string.friend_contact_cycle_cancel_button),
rightButtonText = stringResource(R.string.friend_contact_cycle_complete_button),
)
Spacer(modifier = Modifier.size(24.dp))
}
}

Expand Down
Loading