Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -339,7 +339,7 @@ private fun LedgerRowView(
tint = resultTint,
),
style = style,
ruleTint = MaterialTheme.colorScheme.outlineVariant,
ruleTint = MaterialTheme.colorScheme.onSurface,
)
negativeReason(row)?.let { reason ->
Spacer(modifier = Modifier.height(6.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -43,6 +45,25 @@ import com.serranoie.app.minus.presentation.ui.theme.MinusTheme
import com.serranoie.app.minus.presentation.ui.theme.googleSansFlex
import com.serranoie.app.minus.presentation.ui.theme.titleMediumCondensed
import com.serranoie.app.minus.presentation.util.censor
import kotlin.math.roundToInt

private const val SECONDARY_MAX_WIDTH_FRACTION = 0.65f

private fun Modifier.secondaryWidthCap(enabled: Boolean) = if (!enabled) this else layout { measurable, constraints ->
val cap = if (constraints.hasBoundedWidth) {
(constraints.maxWidth * SECONDARY_MAX_WIDTH_FRACTION).roundToInt()
} else {
constraints.maxWidth
}
val placeable = measurable.measure(
Constraints(
maxWidth = cap,
minHeight = constraints.minHeight,
maxHeight = constraints.maxHeight,
)
)
layout(placeable.width, placeable.height) { placeable.place(0, 0) }
}

/**
* The status text on the left of the pill ("Today", "This week", "Daily Amount Exceeded",
Expand Down Expand Up @@ -132,6 +153,7 @@ internal fun StatusLabel(
}

AnimatedVisibility(
modifier = Modifier.secondaryWidthCap(!centreContent),
visible = secondaryVisible && !bigVariant, enter = slideInVertically(
initialOffsetY = { -it }, animationSpec = tween(300)
) + fadeIn(animationSpec = tween(300))
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@
<string name="budget_pill_label_weekly_exceeded">Седмичната сума е надвишена</string>
<string name="budget_pill_label_biweekly_exceeded">Двуседмичната сума е надвишена</string>
<string name="budget_pill_label_monthly_exceeded">Месечната сума е надвишена</string>
<string name="budget_pill_sub_exceeded_single">Сумата за %1$s е надвишена</string>
<string name="budget_pill_sub_exceeded_double">Сумите за %1$s и %2$s са надвишени</string>
<string name="budget_pill_sub_exceeded_triple">Сумите за %1$s, %2$s и %3$s са надвишени</string>
<string name="budget_pill_sub_exceeded_single">Превишен %1$s бюджет</string>
<string name="budget_pill_sub_exceeded_double">Превишени %1$s и %2$s бюджети</string>
<string name="budget_pill_sub_exceeded_triple">Превишени %1$s, %2$s и %3$s бюджети</string>
<string name="budget_formula_title">Как се изчислява</string>
<string name="budget_formula_hold_hint">Покажи как се изчислява сумата</string>
<string name="budget_formula_caption_surplus_split">Излишъкът от миналия период се добавя към бюджета</string>
Expand Down Expand Up @@ -433,12 +433,12 @@
<string name="budget_pill_over_budget">Бюджетната сума е надвишена</string>
<string name="budget_pill_no_budget">Няма бюджет</string>
<string name="budget_pill_no_budget_action">Настройте бюджета си</string>
<string name="budget_pill_exhausted_daily_label">Дневно</string>
<string name="budget_pill_exhausted_weekly_label">Седмично</string>
<string name="budget_pill_exhausted_biweekly_label">Двуседмично</string>
<string name="budget_pill_exhausted_single">Бюджетът за %1$s е изразходван</string>
<string name="budget_pill_exhausted_double">Бюджет %1$s и %2$s е изразходван</string>
<string name="budget_pill_exhausted_triple">Бюджет %1$s, %2$s и %3$s е изразходван</string>
<string name="budget_pill_exhausted_daily_label">дневен</string>
<string name="budget_pill_exhausted_weekly_label">седмичен</string>
<string name="budget_pill_exhausted_biweekly_label">двуседмичен</string>
<string name="budget_pill_exhausted_single">Изразходван %1$s бюджет</string>
<string name="budget_pill_exhausted_double">Изразходвани %1$s и %2$s бюджети</string>
<string name="budget_pill_exhausted_triple">Изразходвани %1$s, %2$s и %3$s бюджети</string>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<!-- Spend Budget Card -->
<string name="spend_budget_card_spent_label">Изразходвано</string>
<string name="spend_budget_card_available_percent_format">Налични: %1$s%%</string>
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@
<string name="budget_pill_label_weekly_exceeded">Weekly Amount exceeded</string>
<string name="budget_pill_label_biweekly_exceeded">Biweekly Amount exceeded</string>
<string name="budget_pill_label_monthly_exceeded">Monthly Amount exceeded</string>
<string name="budget_pill_sub_exceeded_single">%1$s amount exceeded</string>
<string name="budget_pill_sub_exceeded_double">%1$s and %2$s amount exceeded</string>
<string name="budget_pill_sub_exceeded_triple">%1$s, %2$s and %3$s amount exceeded</string>
<string name="budget_pill_sub_exceeded_single">%1$s überschritten</string>
<string name="budget_pill_sub_exceeded_double">%1$s und %2$s überschritten</string>
<string name="budget_pill_sub_exceeded_triple">%1$s, %2$s und %3$s überschritten</string>
<string name="budget_formula_title">So wird es berechnet</string>
<string name="budget_formula_hold_hint">Zeigen, wie der Betrag berechnet wird</string>
<string name="budget_formula_caption_surplus_split">Der Überschuss der letzten Periode fließt ins Budget</string>
Expand Down Expand Up @@ -435,12 +435,12 @@
<string name="budget_pill_no_budget">No budget</string>
<string name="budget_pill_no_budget_action">Set up your budget</string>
<string name="budget_pill_calc_subtracted">%1$s wird abgezogen</string>
<string name="budget_pill_exhausted_daily_label">Daily</string>
<string name="budget_pill_exhausted_weekly_label">Wöchentlich</string>
<string name="budget_pill_exhausted_biweekly_label">alle zwei Wochen</string>
<string name="budget_pill_exhausted_single">%1$s budget spent</string>
<string name="budget_pill_exhausted_double">%1$s and %2$s budget spent</string>
<string name="budget_pill_exhausted_triple">%1$s, %2$s and %3$s budget spent</string>
<string name="budget_pill_exhausted_daily_label">Tagesbudget</string>
<string name="budget_pill_exhausted_weekly_label">Wochenbudget</string>
<string name="budget_pill_exhausted_biweekly_label">Zweiwochenbudget</string>
<string name="budget_pill_exhausted_single">%1$s aufgebraucht</string>
<string name="budget_pill_exhausted_double">%1$s und %2$s aufgebraucht</string>
<string name="budget_pill_exhausted_triple">%1$s, %2$s und %3$s aufgebraucht</string>
<!-- Spend Budget Card -->
<string name="spend_budget_card_spent_label">Spent</string>
<string name="spend_budget_card_available_percent_format">Available: %1$s%%</string>
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@
<string name="budget_pill_label_weekly_exceeded">Υπέρβαση εβδομαδιαίας ποσότητας</string>
<string name="budget_pill_label_biweekly_exceeded">Υπέρβαση δεκαεξαδικής εβδομάδας</string>
<string name="budget_pill_label_monthly_exceeded">Υπέρβαση μηνιαίου ποσού</string>
<string name="budget_pill_sub_exceeded_single">Ποσό %1$s υπέρβαση</string>
<string name="budget_pill_sub_exceeded_double">%1$s και %2$s ποσό υπέρβαση</string>
<string name="budget_pill_sub_exceeded_triple">%1$s, %2$s και %3$s ποσό υπέρβαση</string>
<string name="budget_pill_sub_exceeded_single">Ξεπεράστηκε ο %1$s προϋπολογισμός</string>
<string name="budget_pill_sub_exceeded_double">Ξεπεράστηκαν οι %1$s και %2$s προϋπολογισμοί</string>
<string name="budget_pill_sub_exceeded_triple">Ξεπεράστηκαν οι %1$s, %2$s και %3$s προϋπολογισμοί</string>
<string name="budget_formula_title">Πώς υπολογίζεται</string>
<string name="budget_formula_hold_hint">Εμφάνιση του τρόπου υπολογισμού του ποσού</string>
<string name="budget_formula_caption_surplus_split">Το πλεόνασμα της προηγούμενης περιόδου προστίθεται στον προϋπολογισμό</string>
Expand Down Expand Up @@ -428,12 +428,12 @@
<string name="budget_pill_over_budget">Υπέρβαση του προϋπολογισμού</string>
<string name="budget_pill_no_budget">Χωρίς προϋπολογισμό</string>
<string name="budget_pill_no_budget_action">Δημιουργήστε τον προϋπολογισμό σας</string>
<string name="budget_pill_exhausted_daily_label">Καθημερινά</string>
<string name="budget_pill_exhausted_weekly_label">Εβδομαδιαία</string>
<string name="budget_pill_exhausted_biweekly_label">Ανά δύο εβδομάδες</string>
<string name="budget_pill_exhausted_single">Ο προϋπολογισμός %1$s δαπανήθηκε</string>
<string name="budget_pill_exhausted_double">Ο προϋπολογισμός %1$s και %2$s δαπανήθηκε</string>
<string name="budget_pill_exhausted_triple">%1$s, %2$s και %3$s προϋπολογισμός δαπανημένος</string>
<string name="budget_pill_exhausted_daily_label">ημερήσιος</string>
<string name="budget_pill_exhausted_weekly_label">εβδομαδιαίος</string>
<string name="budget_pill_exhausted_biweekly_label">δεκαπενθήμερος</string>
<string name="budget_pill_exhausted_single">Εξαντλήθηκε ο %1$s προϋπολογισμός</string>
<string name="budget_pill_exhausted_double">Εξαντλήθηκαν οι %1$s και %2$s προϋπολογισμοί</string>
<string name="budget_pill_exhausted_triple">Εξαντλήθηκαν οι %1$s, %2$s και %3$s προϋπολογισμοί</string>
<!-- Spend Budget Card -->
<string name="spend_budget_card_spent_label">Δαπανήθηκε</string>
<string name="spend_budget_card_available_percent_format">Διαθέσιμο: %1$s%%</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es-rMX/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
<string name="budget_pill_no_budget_action">Establece tu presupuesto</string>
<string name="budget_pill_calc_subtracted">%1$s será restado</string>
<string name="budget_pill_exhausted_daily_label">diario</string>
<string name="budget_pill_exhausted_weekly_label">semanalmente</string>
<string name="budget_pill_exhausted_weekly_label">semanal</string>
<string name="budget_pill_exhausted_biweekly_label">quincenal</string>
<string name="budget_pill_exhausted_single">Presupuesto %1$s gastado</string>
<string name="budget_pill_exhausted_double">Presupuesto %1$s y %2$s gastado</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
<string name="budget_pill_no_budget_action">Establece tu presupuesto</string>
<string name="budget_pill_calc_subtracted">%1$s será restado</string>
<string name="budget_pill_exhausted_daily_label">diario</string>
<string name="budget_pill_exhausted_weekly_label">semanalmente</string>
<string name="budget_pill_exhausted_weekly_label">semanal</string>
<string name="budget_pill_exhausted_biweekly_label">quincenal</string>
<string name="budget_pill_exhausted_single">Presupuesto %1$s gastado</string>
<string name="budget_pill_exhausted_double">Presupuesto %1$s y %2$s gastado</string>
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@
<string name="budget_pill_label_weekly_exceeded">Importo settimanale superato</string>
<string name="budget_pill_label_biweekly_exceeded">Importo settimanale superato</string>
<string name="budget_pill_label_monthly_exceeded">Importo mensile superato</string>
<string name="budget_pill_sub_exceeded_single">%1$s importo superato</string>
<string name="budget_pill_sub_exceeded_double">%1$s e %2$s importo superato</string>
<string name="budget_pill_sub_exceeded_triple">%1$s, %2$s e %3$s superato</string>
<string name="budget_pill_sub_exceeded_single">Importo %1$s superato</string>
<string name="budget_pill_sub_exceeded_double">Importo %1$s e %2$s superato</string>
<string name="budget_pill_sub_exceeded_triple">Importo %1$s, %2$s e %3$s superato</string>
<string name="budget_formula_title">Come viene calcolato</string>
<string name="budget_formula_hold_hint">Mostra come viene calcolato l\'importo</string>
<string name="budget_formula_caption_surplus_split">L\'eccedenza del periodo precedente si aggiunge al bilancio</string>
Expand Down Expand Up @@ -431,12 +431,12 @@
<string name="budget_pill_over_budget">Importo del bilancio Superato</string>
<string name="budget_pill_no_budget">Nessun budget</string>
<string name="budget_pill_no_budget_action">Configura il tuo budget</string>
<string name="budget_pill_exhausted_daily_label">Giornaliero</string>
<string name="budget_pill_exhausted_weekly_label">Settimanale</string>
<string name="budget_pill_exhausted_biweekly_label">Biodimanale</string>
<string name="budget_pill_exhausted_single">%1$s budget speso</string>
<string name="budget_pill_exhausted_double">%1$s e %2$s budget spesi</string>
<string name="budget_pill_exhausted_triple">%1$s, %2$s e %3$s budget speso</string>
<string name="budget_pill_exhausted_daily_label">giornaliero</string>
<string name="budget_pill_exhausted_weekly_label">settimanale</string>
<string name="budget_pill_exhausted_biweekly_label">bisettimanale</string>
<string name="budget_pill_exhausted_single">Budget %1$s speso</string>
<string name="budget_pill_exhausted_double">Budget %1$s e %2$s spesi</string>
<string name="budget_pill_exhausted_triple">Budget %1$s, %2$s e %3$s spesi</string>
<!-- Spend Budget Card -->
<string name="spend_budget_card_spent_label">Speso</string>
<string name="spend_budget_card_available_percent_format">Disponibile: %1$s%%</string>
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@
<string name="budget_pill_label_weekly_exceeded">Valor semanal excedido</string>
<string name="budget_pill_label_biweekly_exceeded">Quantia bisemanal excedida</string>
<string name="budget_pill_label_monthly_exceeded">Valor mensal excedido</string>
<string name="budget_pill_sub_exceeded_single">Valor de %1$s excedido</string>
<string name="budget_pill_sub_exceeded_double">Excedido o valor de %1$s e %2$s</string>
<string name="budget_pill_sub_exceeded_triple">%1$s, %2$s e %3$s valor excedido</string>
<string name="budget_pill_sub_exceeded_single">Valor %1$s excedido</string>
<string name="budget_pill_sub_exceeded_double">Valor %1$s e %2$s excedido</string>
<string name="budget_pill_sub_exceeded_triple">Valor %1$s, %2$s e %3$s excedido</string>
<string name="budget_formula_title">Como é calculado</string>
<string name="budget_formula_hold_hint">Mostrar como o valor é calculado</string>
<string name="budget_formula_caption_surplus_split">O excedente do período anterior entra no orçamento</string>
Expand Down Expand Up @@ -431,9 +431,9 @@
<string name="budget_pill_over_budget">Valor do orçamento excedido</string>
<string name="budget_pill_no_budget">Nenhum orçamento</string>
<string name="budget_pill_no_budget_action">Configurar seu orçamento</string>
<string name="budget_pill_exhausted_daily_label">Diariamente</string>
<string name="budget_pill_exhausted_weekly_label">Semanalmente</string>
<string name="budget_pill_exhausted_biweekly_label">Bienal</string>
<string name="budget_pill_exhausted_daily_label">diário</string>
<string name="budget_pill_exhausted_weekly_label">semanal</string>
<string name="budget_pill_exhausted_biweekly_label">quinzenal</string>
<string name="budget_pill_exhausted_single">Orçamento %1$s gasto</string>
<string name="budget_pill_exhausted_double">Orçamento %1$s e %2$s gasto</string>
<string name="budget_pill_exhausted_triple">Orçamento %1$s, %2$s e %3$s gasto</string>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@
<string name="budget_pill_no_budget">Бюджет не задан</string>
<string name="budget_pill_no_budget_action">Настроить бюджет</string>
<string name="budget_pill_calc_subtracted">Будет вычтено %1$s</string>
<string name="budget_pill_exhausted_daily_label">Дневной</string>
<string name="budget_pill_exhausted_weekly_label">Недельный</string>
<string name="budget_pill_exhausted_biweekly_label">Двухнедельный</string>
<string name="budget_pill_exhausted_daily_label">дневной</string>
<string name="budget_pill_exhausted_weekly_label">недельный</string>
<string name="budget_pill_exhausted_biweekly_label">двухнедельный</string>
<string name="budget_pill_exhausted_single">Исчерпан %1$s бюджет</string>
<string name="budget_pill_exhausted_double">Исчерпаны бюджеты: %1$s и %2$s</string>
<string name="budget_pill_exhausted_triple">Исчерпаны бюджеты: %1$s, %2$s и %3$s</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,50 @@ class BudgetPillScreenshotTest {
paparazzi.gif(view, start = 1, end = 3_800)
}
}

class BudgetPillSpanishScreenshotTest {
@get:Rule
val paparazzi = Paparazzi(
deviceConfig = DeviceConfig.PIXEL_5.copy(locale = "es"),
renderingMode = SessionParams.RenderingMode.SHRINK,
maxPercentDifference = 0.1,
)

@Test
fun budgetPillBiweeklyKeepsAmountWhenDailyAndWeeklyExhausted() {
Locale.setDefault(Locale.forLanguageTag("es-MX"))
paparazzi.snapshot {
MinusTheme {
Box(modifier = Modifier.padding(16.dp)) {
BudgetPill(
budgetState = BudgetState(
remainingToday = BigDecimal("0.00"),
totalSpentToday = BigDecimal("100.00"),
dailyBudget = BigDecimal("100.00"),
daysRemaining = 7,
progress = 0.5f,
isOverBudget = false,
totalBudget = BigDecimal("2000.00"),
totalSpentInPeriod = BigDecimal("700.00"),
totalSpentThisWeek = BigDecimal("700.00"),
totalSpentThisBiweek = BigDecimal("700.00"),
periodTotalDays = 14,
),
budgetSettings = BudgetSettings(
totalBudget = BigDecimal("2000.00"),
period = BudgetPeriod.BIWEEKLY,
startDate = LocalDate.now(),
currencyCode = "MXN",
),
viewPeriod = BudgetPeriod.BIWEEKLY,
currencyCode = "MXN",
onOpenBudgetSheet = { },
modifier = Modifier
.fillMaxWidth()
.height(50.dp),
)
}
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading