Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Balance row enhancement, attempt #2 #2847

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -295,14 +295,11 @@ private fun AccountHeader(
.clickableNoIndication {
onBalanceClick()
},
decimalPaddingTop = 7.dp,
spacerDecimal = 6.dp,
textColor = contrastColor,
currency = currency,
balance = accountData.balance,

integerFontSize = 30.sp,
decimalFontSize = 18.sp,
balanceFontSize = 30.sp,
currencyFontSize = 30.sp,

currencyUpfront = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ private fun ColumnScope.BalanceAfterPlannedPayments(
currency = currency,
balance = balanceAfterPlannedPayments,

integerFontSize = 30.sp,
decimalFontSize = 18.sp,
balanceFontSize = 30.sp,
currencyFontSize = 18.sp,

currencyUpfront = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,6 @@ private fun CategoryCard(
onLongClick: () -> Unit,
onClick: () -> Unit
) {
val category = categoryData.category
val contrastColor = findContrastTextColor(category.color.toComposeColor())

Spacer(Modifier.height(16.dp))

Column(
modifier = Modifier
.padding(horizontal = 16.dp)
Expand All @@ -238,14 +233,18 @@ private fun CategoryCard(
onClick = onClick
)
) {
// Emitting content
Spacer(Modifier.height(16.dp))

CategoryHeader(
categoryData = categoryData,
currency = currency,
contrastColor = contrastColor
contrastColor = findContrastTextColor(categoryData.category.color.toComposeColor())
)

Spacer(Modifier.height(12.dp))

// Emitting content
AddedSpent(
currency = currency,
monthlyIncome = categoryData.monthlyIncome,
Expand All @@ -258,15 +257,16 @@ private fun CategoryCard(

@Composable
fun AddedSpent(
modifier: Modifier = Modifier,
textColor: Color = UI.colors.pureInverse,
dividerColor: Color = UI.colors.medium,
monthlyIncome: Double,
monthlyExpenses: Double,
currency: String,
modifier: Modifier = Modifier,
textColor: Color = UI.colors.pureInverse,
dividerColor: Color = UI.colors.medium,
center: Boolean = true,
dividerSpacer: Dp? = null,
) {

) {
Row(
modifier = modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
Expand Down Expand Up @@ -396,13 +396,11 @@ private fun CategoryHeader(
BalanceRow(
modifier = Modifier.align(Alignment.CenterHorizontally),

decimalPaddingTop = 4.dp,
textColor = contrastColor,
currency = currency,
balance = categoryData.monthlyBalance,

integerFontSize = 30.sp,
decimalFontSize = 18.sp,
balanceFontSize = 30.sp,
currencyFontSize = 30.sp,

currencyUpfront = false,
Expand All @@ -418,13 +416,14 @@ private fun CategoryHeader(

@Composable
fun BoxWithConstraintsScope.SortModal(
title: String = stringResource(R.string.sort_by),
items: List<SortOrder>,
visible: Boolean,
initialType: SortOrder,
id: UUID = UUID.randomUUID(),
dismiss: () -> Unit,
onSortOrderChanged: (SortOrder) -> Unit
onSortOrderChanged: (SortOrder) -> Unit,
modifier: Modifier = Modifier,
title: String = stringResource(R.string.sort_by),
id: UUID = UUID.randomUUID()
) {
var sortOrder by remember(initialType) {
mutableStateOf(initialType)
Expand All @@ -443,7 +442,7 @@ fun BoxWithConstraintsScope.SortModal(
ModalSet {
applyChange()
}
}
},
) {
Spacer(Modifier.height(32.dp))

Expand Down
3 changes: 1 addition & 2 deletions screen-home/src/main/java/com/ivy/home/HomeHeader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ private fun HeaderStickyRow(
currency = currency,
balance = balance,
shortenBigNumbers = true,
hiddenMode = hideBalance,
overflow = overflow
hiddenMode = hideBalance

)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,11 @@ private fun LoanHeader(
BalanceRow(
modifier = Modifier
.align(Alignment.CenterHorizontally),
decimalPaddingTop = 7.dp,
spacerDecimal = 6.dp,
textColor = contrastColor,
currency = displayLoan.currencyCode ?: getDefaultFIATCurrency().currencyCode,
balance = leftToPay,

integerFontSize = 30.sp,
decimalFontSize = 18.sp,
balanceFontSize = 30.sp,
currencyFontSize = 30.sp,

currencyUpfront = false
Expand Down
Loading
Loading