Skip to content

Commit

Permalink
style: 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Feb 10, 2024
1 parent 8f9b61d commit d9caf1e
Show file tree
Hide file tree
Showing 33 changed files with 297 additions and 290 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ fun CameraView(
)
CameraCaptureButton(
onClick = {
if(isCapturing) return@CameraCaptureButton
if (isCapturing) return@CameraCaptureButton
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
coroutineScope.launch {
isCapturing = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -186,7 +185,10 @@ fun ReactionListDialog(
Box(
modifier = Modifier
.size(64.dp)
.background(MaterialTheme.bbibbiScheme.gray600, CircleShape),
.background(
MaterialTheme.bbibbiScheme.gray600,
CircleShape
),
contentAlignment = Alignment.Center,
) {
AsyncImage(
Expand All @@ -213,7 +215,10 @@ fun ReactionListDialog(
Box(
modifier = Modifier
.size(64.dp)
.background(MaterialTheme.bbibbiScheme.gray600, CircleShape),
.background(
MaterialTheme.bbibbiScheme.gray600,
CircleShape
),
contentAlignment = Alignment.Center,
) {
Image(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.no5ing.bbibbi.R
import com.no5ing.bbibbi.data.repository.Arguments
import com.no5ing.bbibbi.presentation.component.BBiBBiPreviewSurface
import com.no5ing.bbibbi.presentation.component.BBiBBiSurface
import com.no5ing.bbibbi.presentation.component.button.CTAButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ fun RegisterDayOfBirthPage(
if (number < 0 || number > 9999) return@DigitizedNumberInput
state.isInvalidYearState.value =
number > YearMonth.now().year || number < 1900 //TODO
if (it.length == 4 && (state.yearTextState.value.toIntOrNull() ?: 0) / 100 > 0) monthFocus.requestFocus()
if (it.length == 4 && (state.yearTextState.value.toIntOrNull()
?: 0) / 100 > 0
) monthFocus.requestFocus()
state.yearTextState.value = it
},
isInvalidInput = state.isInvalidInput(),
Expand All @@ -115,7 +117,9 @@ fun RegisterDayOfBirthPage(
}
if (number < 0 || number > 99) return@DigitizedNumberInput
state.isInvalidMonthState.value = number > 12
if (it.length == 2 && (state.monthTextState.value.toIntOrNull() ?: 0) < 10) dayFocus.requestFocus()
if (it.length == 2 && (state.monthTextState.value.toIntOrNull()
?: 0) < 10
) dayFocus.requestFocus()
state.monthTextState.value = it
},
isInvalidInput = state.isInvalidInput(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import androidx.compose.ui.draw.blur
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import coil.compose.AsyncImage
Expand Down Expand Up @@ -270,7 +269,10 @@ fun CalendarDetailPage(
) {
DisposableTopBar(
onDispose = onDispose,
title = formatYearMonth(currentYearMonth.year, currentYearMonth.month.value),
title = formatYearMonth(
currentYearMonth.year,
currentYearMonth.month.value
),
)
Spacer(modifier = Modifier.height(12.dp))
SelectableWeekCalendar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ fun CreateRealEmojiPage(
cameraState.value?.cameraControl?.enableTorch(torchState.value)
},
onClickCapture = {
if(isCapturing) return@CreateRealEmojiCameraBar
if (isCapturing) return@CreateRealEmojiCameraBar
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
coroutineScope.launch {
isCapturing = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.no5ing.bbibbi.presentation.component.MicroTextBubbleBox
import com.no5ing.bbibbi.presentation.component.MiniTextBubbleBox
import com.no5ing.bbibbi.presentation.theme.bbibbiScheme
import com.no5ing.bbibbi.presentation.theme.bbibbiTypo
import com.no5ing.bbibbi.util.asyncImagePainter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.AlertDialogDefaults
Expand All @@ -16,8 +15,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ fun PostUploadPageImagePreview(
.padding(horizontal = 10.dp, vertical = 8.dp)
) {
Row(
horizontalArrangement = Arrangement.spacedBy(5.dp, Alignment.CenterHorizontally),
horizontalArrangement = Arrangement.spacedBy(
5.dp,
Alignment.CenterHorizontally
),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fun ProfilePageMemberBar(
member = memberState.value.data,
size = 90.dp,
onTap = {
if(memberState.value.data.hasProfileImage()) {
if (memberState.value.data.hasProfileImage()) {
onTapProfileImage(memberState.value.data.imageUrl!!)
}
}
Expand Down Expand Up @@ -117,7 +117,10 @@ fun ProfilePageMemberBar(
if (viewerMemberId == memberState.value.data.memberId) {
Spacer(modifier = Modifier.height(12.dp))
Text(
text = stringResource(id = R.string.register_at, toLocalizedDate(memberState.value.data.familyJoinAt ?: "2000-01-01")),
text = stringResource(
id = R.string.register_at,
toLocalizedDate(memberState.value.data.familyJoinAt ?: "2000-01-01")
),
style = MaterialTheme.bbibbiTypo.caption,
color = MaterialTheme.bbibbiScheme.icon,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.no5ing.bbibbi.presentation.feature.view.landing.already_family_exists
import com.no5ing.bbibbi.presentation.feature.view_controller.NavigationDestination
import com.no5ing.bbibbi.presentation.feature.view_controller.landing.JoinFamilyWithLinkPageController.goJoinFamilyWithLinkPage
import com.no5ing.bbibbi.presentation.feature.view_model.family.QuitFamilyViewModel
import timber.log.Timber


object AlreadyFamilyExistsPageController : NavigationDestination(
Expand All @@ -33,7 +32,7 @@ object AlreadyFamilyExistsPageController : NavigationDestination(
navController.popBackStack()
},
onTapQuitAndJoin = {
if(familyQuitState.isIdle()) {
if (familyQuitState.isIdle()) {
familyQuitViewModel.invoke(Arguments())
}
}
Expand Down
12 changes: 5 additions & 7 deletions app/src/main/java/com/no5ing/bbibbi/util/DateParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ package com.no5ing.bbibbi.util
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.no5ing.bbibbi.R
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.time.Instant
import java.time.LocalDate
import java.time.YearMonth
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.time.temporal.WeekFields
import java.util.Locale

Expand All @@ -32,23 +29,23 @@ fun gapBetweenNow(time: Instant): String {
fun gapBetweenNow(time: ZonedDateTime) = gapBetweenNow(time.toInstant())

private fun getYearMonthPattern(): String {
return when(Locale.getDefault()) {
return when (Locale.getDefault()) {
Locale.KOREA -> "yyyy년 MM월"
Locale.ENGLISH -> "yyyy, MMMM"
else -> "yyyy/MM"
}
}

private fun getYearDatePattern(): String {
return when(Locale.getDefault()) {
return when (Locale.getDefault()) {
Locale.KOREA -> "yyyy년 MM월 dd일"
Locale.ENGLISH -> "yyyy, MMMM dd"
else -> "yyyy/MM/dd"
}
}

private fun getDatePattern(): String {
return when(Locale.getDefault()) {
return when (Locale.getDefault()) {
Locale.KOREA -> "MM월 dd일"
Locale.ENGLISH -> "MMMM dd"
else -> "MM/dd"
Expand Down Expand Up @@ -101,4 +98,5 @@ fun LocalDate.isBirthdayNow(): Boolean {
return this.monthValue == now.monthValue && this.dayOfMonth == now.dayOfMonth
}

fun formatYearMonth(year: Int, month: Int): String = YearMonth.of(year, month).format(yearMonthFormatter)
fun formatYearMonth(year: Int, month: Int): String =
YearMonth.of(year, month).format(yearMonthFormatter)
Loading

0 comments on commit d9caf1e

Please sign in to comment.