Skip to content

Commit

Permalink
Merge branch 'develop' into feature/MZ-138-sent-search
Browse files Browse the repository at this point in the history
# Conflicts:
#	feature/navigator/src/main/java/com/susu/feature/navigator/MainNavigator.kt
#	feature/sent/src/main/java/com/susu/feature/sent/SentScreen.kt
#	feature/sent/src/main/java/com/susu/feature/sent/navigation/SentNavigation.kt
#	feature/sent/src/main/res/values/strings.xml
  • Loading branch information
yangsooplus committed Feb 5, 2024
2 parents 9f4e422 + 1546b26 commit 27be78c
Show file tree
Hide file tree
Showing 148 changed files with 4,363 additions and 889 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.susu.core.designsystem.component.dialog

import androidx.compose.foundation.background
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
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -19,10 +17,10 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.susu.core.designsystem.component.button.FilledButtonColor
import com.susu.core.designsystem.component.button.GhostButtonColor
import com.susu.core.designsystem.component.button.SmallButtonStyle
Expand All @@ -34,34 +32,26 @@ import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.Gray40
import com.susu.core.designsystem.theme.Gray80
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.core.ui.extension.susuClickable

@Composable
fun SusuCheckedDialog(
modifier: Modifier = Modifier,
title: String? = null,
text: String? = null,
defaultChecked: Boolean = false,
checkboxText: String = "",
confirmText: String = "",
dismissText: String? = null,
isDimmed: Boolean = true,
textAlign: TextAlign = TextAlign.Center,
onConfirmRequest: (isChecked: Boolean) -> Unit = {},
onDismissRequest: () -> Unit = {},
) {
val rootModifier = modifier
.fillMaxSize()
.background(color = if (isDimmed) Color.Black.copy(alpha = 0.16f) else Color.Transparent)
.padding(horizontal = SusuTheme.spacing.spacing_xl)
var isChecked by remember { mutableStateOf(defaultChecked) }

Box(
modifier = rootModifier,
) {
Dialog(onDismissRequest = onDismissRequest) {
Column(
modifier = Modifier
.fillMaxWidth()
.align(Alignment.Center)
.background(color = Gray10, shape = RoundedCornerShape(8.dp))
.padding(SusuTheme.spacing.spacing_xl),
horizontalAlignment = Alignment.CenterHorizontally,
Expand Down Expand Up @@ -97,6 +87,10 @@ fun SusuCheckedDialog(
text = checkboxText,
style = SusuTheme.typography.title_xxs,
color = if (isChecked) Gray100 else Gray40,
modifier = Modifier.susuClickable(
onClick = { isChecked = !isChecked },
rippleEnabled = false,
),
)
}
Spacer(modifier = Modifier.height(SusuTheme.spacing.spacing_xl))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.susu.core.designsystem.component.dialog

import androidx.compose.foundation.background
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
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -14,10 +12,10 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.susu.core.designsystem.component.button.FilledButtonColor
import com.susu.core.designsystem.component.button.GhostButtonColor
import com.susu.core.designsystem.component.button.SmallButtonStyle
Expand All @@ -30,28 +28,18 @@ import com.susu.core.designsystem.theme.SusuTheme

@Composable
fun SusuDialog(
modifier: Modifier = Modifier,
title: String? = null,
text: String? = null,
confirmText: String = "",
dismissText: String? = null,
isDimmed: Boolean = true,
textAlign: TextAlign = TextAlign.Center,
onConfirmRequest: () -> Unit = {},
onDismissRequest: () -> Unit = {},
) {
val rootModifier = modifier
.fillMaxSize()
.background(color = if (isDimmed) Color.Black.copy(alpha = 0.16f) else Color.Transparent)
.padding(horizontal = SusuTheme.spacing.spacing_xl)

Box(
modifier = rootModifier,
) {
Dialog(onDismissRequest = onDismissRequest) {
Column(
modifier = Modifier
.fillMaxWidth()
.align(Alignment.Center)
.background(color = Gray10, shape = RoundedCornerShape(8.dp))
.padding(SusuTheme.spacing.spacing_xl),
horizontalAlignment = Alignment.CenterHorizontally,
Expand Down Expand Up @@ -100,7 +88,7 @@ fun SusuDialog(
}
}

@Preview
@Preview(showBackground = true)
@Composable
fun SusuDialogPreview() {
SusuTheme {
Expand All @@ -112,7 +100,7 @@ fun SusuDialogPreview() {
}
}

@Preview
@Preview(showBackground = true)
@Composable
fun SusuDialogLongTitlePreview() {
SusuTheme {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.susu.core.designsystem.component.text

import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.SusuTheme
import java.text.DecimalFormat

private val upward = slideInVertically { it } togetherWith slideOutVertically { -it }
private val downward = slideInVertically { -it } togetherWith slideOutVertically { it }

@Composable
fun AnimatedCounterText(
number: Int,
modifier: Modifier = Modifier,
prefix: String? = null,
postfix: String? = null,
style: TextStyle = SusuTheme.typography.title_xs,
color: Color = Gray100,
) {
val moneyFormat = remember { DecimalFormat("#,###") }
val currentString = moneyFormat.format(number)

Row(
modifier = modifier,
horizontalArrangement = Arrangement.End,
) {
prefix?.let {
Text(
text = it,
style = style,
color = color,
)
}
for (i in currentString.indices) {
val char = currentString[i]

AnimatedContent(
targetState = char,
transitionSpec = {
when {
initialState.isDigit() && targetState.isDigit() &&
initialState.digitToInt() < targetState.digitToInt() -> upward

initialState.isDigit() && targetState.isDigit() &&
initialState.digitToInt() > targetState.digitToInt() -> downward

else -> upward
}
},
label = "animatedCounterChar$i",
) {
Text(
text = it.toString(),
style = style,
color = color,
)
}
}
postfix?.let {
Text(
text = it,
style = style,
color = color,
)
}
}
}

@Preview(showBackground = true)
@Composable
fun AnimatedCounterTextPreview() {
SusuTheme {
var number by remember { mutableStateOf(10000) }
Column {
Button(onClick = { number += 6000 }) {
Text(text = "증가")
}
AnimatedCounterText(number = number)
}
}
}
1 change: 1 addition & 0 deletions core/model/src/main/java/com/susu/core/model/Category.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data class Category(
val id: Int = 0,
val seq: Int = 0,
val name: String = "",
val category: String = "",
val customCategory: String? = null,
val style: String = "",
)
5 changes: 4 additions & 1 deletion core/model/src/main/java/com/susu/core/model/Envelope.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.susu.core.model

import androidx.compose.runtime.Stable
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.toKotlinLocalDateTime
import kotlinx.serialization.Serializable

@Stable
@Serializable
data class Envelope(
val id: Long = 0,
Expand All @@ -12,7 +15,7 @@ data class Envelope(
val gift: String? = null,
val memo: String? = null,
val hasVisited: Boolean? = null,
val handedOverAt: LocalDateTime? = null,
val handedOverAt: LocalDateTime = java.time.LocalDateTime.now().toKotlinLocalDateTime(),
val friend: Friend = Friend(),
val relationship: Relationship = Relationship(),
)
14 changes: 14 additions & 0 deletions core/model/src/main/java/com/susu/core/model/EnvelopeDetail.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.susu.core.model

import androidx.compose.runtime.Stable
import kotlinx.serialization.Serializable

@Stable
@Serializable
data class EnvelopeDetail(
val envelope: Envelope = Envelope(),
val category: Category = Category(),
val relationship: Relationship = Relationship(),
val friendRelationship: FriendRelationship = FriendRelationship(),
val friend: Friend = Friend(),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.susu.core.model

data class EnvelopeSearch(
val envelope: Envelope,
val category: Category? = null,
val friend: Friend? = null,
val relationship: Relationship? = null,
)
2 changes: 2 additions & 0 deletions core/model/src/main/java/com/susu/core/model/Friend.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.susu.core.model

import androidx.compose.runtime.Stable
import kotlinx.serialization.Serializable

@Stable
@Serializable
data class Friend(
val id: Long = 0,
Expand Down
12 changes: 12 additions & 0 deletions core/model/src/main/java/com/susu/core/model/FriendRelationship.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.susu.core.model

import androidx.compose.runtime.Stable
import kotlinx.serialization.Serializable

@Stable
@Serializable
data class FriendRelationship(
val id: Long = 0,
val friendId: Long = 0,
val relationshipId: Long = 0,
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.susu.core.model

data class EnvelopeStatics(
data class FriendStatistics(
val friend: Friend = Friend(),
val receivedAmounts: Int = 0,
val sentAmounts: Int = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ data class Relationship(
val id: Long = -1,
val relation: String = "",
val customRelation: String? = null,
val description: String? = null,
)
16 changes: 16 additions & 0 deletions core/model/src/main/java/com/susu/core/model/SusuStatistics.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.susu.core.model

import androidx.compose.runtime.Stable

@Stable
data class SusuStatistics(
val averageSent: Int = 0,
val averageRelationship: StatisticsElement = StatisticsElement(),
val averageCategory: StatisticsElement = StatisticsElement(),
val recentSpent: List<StatisticsElement> = emptyList(),
val recentTotalSpent: Int = 0,
val recentMaximumSpent: Int = 0,
val mostSpentMonth: Int = 0,
val mostRelationship: StatisticsElement = StatisticsElement(),
val mostCategory: StatisticsElement = StatisticsElement(),
)
1 change: 1 addition & 0 deletions core/model/src/main/java/com/susu/core/model/Vote.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data class Vote(
val id: Long = 0,
val uid: Long = 0,
val profile: Profile = Profile(),
val boardId: Long = 0,
val boardName: String = "",
val content: String = "",
val count: Long = 0,
Expand Down
Loading

0 comments on commit 27be78c

Please sign in to comment.