From 686c7f6e45de7ae8d93ad2ee1f3fcd1b6ee871a6 Mon Sep 17 00:00:00 2001 From: Gerben Jongerius Date: Sun, 21 Jun 2026 10:32:33 +0200 Subject: [PATCH 1/2] Fix warnings about deprecation --- .../app/ui/accounts/AccountFormScreen.kt | 6 +- .../app/ui/accounts/AccountTypeUi.kt | 10 +-- .../app/ui/dashboard/DashboardScreen.kt | 10 +-- .../app/ui/reports/ReportsViewModel.kt | 80 +++++++++++-------- .../java/com/pledgerio/app/ui/theme/Theme.kt | 7 -- .../detail/TransactionDetailContent.kt | 8 +- .../form/TransactionAccountSlot.kt | 4 +- .../form/TransactionTypeSelector.kt | 8 +- 8 files changed, 71 insertions(+), 62 deletions(-) diff --git a/app/src/main/java/com/pledgerio/app/ui/accounts/AccountFormScreen.kt b/app/src/main/java/com/pledgerio/app/ui/accounts/AccountFormScreen.kt index cb456a0..e1c8d80 100644 --- a/app/src/main/java/com/pledgerio/app/ui/accounts/AccountFormScreen.kt +++ b/app/src/main/java/com/pledgerio/app/ui/accounts/AccountFormScreen.kt @@ -19,13 +19,13 @@ import androidx.compose.material3.Button import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.FilterChip import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuAnchorType import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.MenuAnchorType import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.Text @@ -284,7 +284,7 @@ private fun AccountTypeDropdown( trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) }, modifier = Modifier .fillMaxWidth() - .menuAnchor(MenuAnchorType.PrimaryNotEditable), + .menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable), ) ExposedDropdownMenu( expanded = expanded, @@ -389,7 +389,7 @@ private fun CurrencyDropdown( trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) }, modifier = Modifier .fillMaxWidth() - .menuAnchor(MenuAnchorType.PrimaryNotEditable), + .menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable), ) ExposedDropdownMenu( expanded = expanded, diff --git a/app/src/main/java/com/pledgerio/app/ui/accounts/AccountTypeUi.kt b/app/src/main/java/com/pledgerio/app/ui/accounts/AccountTypeUi.kt index c6a17e2..da3d759 100644 --- a/app/src/main/java/com/pledgerio/app/ui/accounts/AccountTypeUi.kt +++ b/app/src/main/java/com/pledgerio/app/ui/accounts/AccountTypeUi.kt @@ -1,14 +1,14 @@ package com.pledgerio.app.ui.accounts import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.TrendingDown +import androidx.compose.material.icons.automirrored.filled.TrendingUp import androidx.compose.material.icons.filled.AccountBalance import androidx.compose.material.icons.filled.CreditCard import androidx.compose.material.icons.filled.Group import androidx.compose.material.icons.filled.Payments import androidx.compose.material.icons.filled.Savings import androidx.compose.material.icons.filled.Store -import androidx.compose.material.icons.filled.TrendingDown -import androidx.compose.material.icons.filled.TrendingUp import androidx.compose.material.icons.filled.Wallet import androidx.compose.ui.graphics.vector.ImageVector import com.pledgerio.app.domain.model.Account @@ -23,8 +23,8 @@ fun accountTypeIcon(typeCode: String): ImageVector { AccountType.CASH -> Icons.Default.Wallet AccountType.CREDITOR -> Icons.Default.Store AccountType.DEBTOR -> Icons.Default.Payments - AccountType.LOAN, AccountType.MORTGAGE, AccountType.LIABILITY -> Icons.Default.TrendingDown - AccountType.INVESTMENT -> Icons.Default.TrendingUp + AccountType.LOAN, AccountType.MORTGAGE, AccountType.LIABILITY -> Icons.AutoMirrored.Filled.TrendingDown + AccountType.INVESTMENT -> Icons.AutoMirrored.Filled.TrendingUp AccountType.CHECKING -> when (typeCode.lowercase()) { "joined", "joined_savings" -> Icons.Default.Group else -> Icons.Default.AccountBalance @@ -39,7 +39,7 @@ fun AccountTypeGroup.icon(): ImageVector = when (this) { AccountTypeGroup.EVERYDAY -> Icons.Default.AccountBalance AccountTypeGroup.SAVINGS -> Icons.Default.Savings AccountTypeGroup.CREDIT -> Icons.Default.CreditCard - AccountTypeGroup.LIABILITIES -> Icons.Default.TrendingDown + AccountTypeGroup.LIABILITIES -> Icons.AutoMirrored.Filled.TrendingDown AccountTypeGroup.COUNTERPARTY -> Icons.Default.Payments AccountTypeGroup.OTHER -> Icons.Default.AccountBalance } diff --git a/app/src/main/java/com/pledgerio/app/ui/dashboard/DashboardScreen.kt b/app/src/main/java/com/pledgerio/app/ui/dashboard/DashboardScreen.kt index 162f54a..35a48a6 100644 --- a/app/src/main/java/com/pledgerio/app/ui/dashboard/DashboardScreen.kt +++ b/app/src/main/java/com/pledgerio/app/ui/dashboard/DashboardScreen.kt @@ -21,14 +21,14 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.TrendingDown +import androidx.compose.material.icons.automirrored.filled.TrendingUp import androidx.compose.material.icons.filled.ArrowDownward import androidx.compose.material.icons.filled.ArrowUpward import androidx.compose.material.icons.filled.School import androidx.compose.material.icons.filled.Receipt import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.Settings -import androidx.compose.material.icons.filled.TrendingDown -import androidx.compose.material.icons.filled.TrendingUp import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -376,9 +376,9 @@ fun TransactionItem( ) { Icon( imageVector = when (transaction.type) { - TransactionType.DEBIT -> Icons.Default.TrendingUp - TransactionType.CREDIT -> Icons.Default.TrendingDown - TransactionType.TRANSFER -> Icons.Default.TrendingUp + TransactionType.DEBIT -> Icons.AutoMirrored.Filled.TrendingUp + TransactionType.CREDIT -> Icons.AutoMirrored.Filled.TrendingDown + TransactionType.TRANSFER -> Icons.AutoMirrored.Filled.TrendingUp }, contentDescription = null, tint = when (transaction.type) { diff --git a/app/src/main/java/com/pledgerio/app/ui/reports/ReportsViewModel.kt b/app/src/main/java/com/pledgerio/app/ui/reports/ReportsViewModel.kt index 274b963..3fc693b 100644 --- a/app/src/main/java/com/pledgerio/app/ui/reports/ReportsViewModel.kt +++ b/app/src/main/java/com/pledgerio/app/ui/reports/ReportsViewModel.kt @@ -193,42 +193,58 @@ class ReportsViewModel @Inject constructor( type: ReportType, month: YearMonth, ) { - val result = when (type) { - ReportType.INCOME_EXPENSE -> reportRepository.getIncomeExpenseSummary(month) - ReportType.CATEGORY -> reportRepository.getCategoryBreakdown(month) - ReportType.BUDGET -> reportRepository.getBudgetPerformance(month) - ReportType.NET_WORTH -> reportRepository.getNetWorthTrend(month) - ReportType.BALANCE -> reportRepository.getAccountBalances(month) + when (type) { + ReportType.INCOME_EXPENSE -> applySingleReportResult( + result = reportRepository.getIncomeExpenseSummary(month), + ) { cleared, data -> + cleared.copy(incomeExpense = data) + } + ReportType.CATEGORY -> applySingleReportResult( + result = reportRepository.getCategoryBreakdown(month), + ) { cleared, data -> + cleared.copy(partitions = data) + } + ReportType.BALANCE -> applySingleReportResult( + result = reportRepository.getAccountBalances(month), + ) { cleared, data -> + cleared.copy(partitions = data) + } + ReportType.BUDGET -> applySingleReportResult( + result = reportRepository.getBudgetPerformance(month), + ) { cleared, data -> + cleared.copy(budgetItems = data) + } + ReportType.NET_WORTH -> applySingleReportResult( + result = reportRepository.getNetWorthTrend(month), + ) { cleared, data -> + cleared.copy(netWorthTrend = data.inMonth(month)) + } ReportType.OVERVIEW -> return } + } + + private fun baseSingleReportState(): ReportsUiState { + return _uiState.value.copy( + isLoading = false, + isRefreshing = false, + error = null, + overview = null, + lastUpdatedAtMillis = System.currentTimeMillis(), + incomeExpense = null, + partitions = emptyList(), + budgetItems = emptyList(), + netWorthTrend = emptyList(), + ) + } + + private inline fun applySingleReportResult( + result: Resource, + mapSuccess: (ReportsUiState, T) -> ReportsUiState, + ) { when (result) { is Resource.Success -> { - val cleared = _uiState.value.copy( - isLoading = false, - isRefreshing = false, - error = null, - overview = null, - lastUpdatedAtMillis = System.currentTimeMillis(), - incomeExpense = null, - partitions = emptyList(), - budgetItems = emptyList(), - netWorthTrend = emptyList(), - ) - _uiState.value = when (type) { - ReportType.INCOME_EXPENSE -> cleared.copy( - incomeExpense = result.data as IncomeExpenseSummary, - ) - ReportType.CATEGORY, ReportType.BALANCE -> cleared.copy( - partitions = result.data as List, - ) - ReportType.BUDGET -> cleared.copy( - budgetItems = result.data as List, - ) - ReportType.NET_WORTH -> cleared.copy( - netWorthTrend = (result.data as List).inMonth(month), - ) - ReportType.OVERVIEW -> cleared - } + val cleared = baseSingleReportState() + _uiState.value = mapSuccess(cleared, result.data) } is Resource.Error -> { _uiState.update { diff --git a/app/src/main/java/com/pledgerio/app/ui/theme/Theme.kt b/app/src/main/java/com/pledgerio/app/ui/theme/Theme.kt index e89d772..49fd3e8 100644 --- a/app/src/main/java/com/pledgerio/app/ui/theme/Theme.kt +++ b/app/src/main/java/com/pledgerio/app/ui/theme/Theme.kt @@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.SideEffect import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalView import androidx.core.view.WindowCompat @@ -68,12 +67,6 @@ fun PledgerTheme( if (!view.isInEditMode) { SideEffect { val window = (view.context as Activity).window - window.statusBarColor = if (darkTheme) { - HeaderGradientTopDark.toArgb() - } else { - HeaderGradientTopLight.toArgb() - } - window.navigationBarColor = colorScheme.background.toArgb() WindowCompat.getInsetsController(window, view).apply { isAppearanceLightStatusBars = false isAppearanceLightNavigationBars = !darkTheme diff --git a/app/src/main/java/com/pledgerio/app/ui/transactions/detail/TransactionDetailContent.kt b/app/src/main/java/com/pledgerio/app/ui/transactions/detail/TransactionDetailContent.kt index 81670e3..2fff84a 100644 --- a/app/src/main/java/com/pledgerio/app/ui/transactions/detail/TransactionDetailContent.kt +++ b/app/src/main/java/com/pledgerio/app/ui/transactions/detail/TransactionDetailContent.kt @@ -16,10 +16,10 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.TrendingDown +import androidx.compose.material.icons.automirrored.filled.TrendingUp import androidx.compose.material.icons.filled.South import androidx.compose.material.icons.filled.SwapHoriz -import androidx.compose.material.icons.filled.TrendingDown -import androidx.compose.material.icons.filled.TrendingUp import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -57,8 +57,8 @@ data class TransactionTypeStyle( ) fun transactionTypeStyle(type: TransactionType): TransactionTypeStyle = when (type) { - TransactionType.DEBIT -> TransactionTypeStyle("Income", Icons.Default.TrendingUp, IncomeGreen) - TransactionType.CREDIT -> TransactionTypeStyle("Expense", Icons.Default.TrendingDown, ExpenseRed) + TransactionType.DEBIT -> TransactionTypeStyle("Income", Icons.AutoMirrored.Filled.TrendingUp, IncomeGreen) + TransactionType.CREDIT -> TransactionTypeStyle("Expense", Icons.AutoMirrored.Filled.TrendingDown, ExpenseRed) TransactionType.TRANSFER -> TransactionTypeStyle("Transfer", Icons.Default.SwapHoriz, PledgerGreen) } diff --git a/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionAccountSlot.kt b/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionAccountSlot.kt index 92d6b4f..0d7d5ae 100644 --- a/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionAccountSlot.kt +++ b/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionAccountSlot.kt @@ -8,11 +8,11 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuAnchorType import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.MenuAnchorType import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -137,7 +137,7 @@ private fun OwnedAccountPicker( trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) }, modifier = Modifier .fillMaxWidth() - .menuAnchor(MenuAnchorType.PrimaryNotEditable), + .menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable), ) ExposedDropdownMenu( expanded = expanded, diff --git a/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionTypeSelector.kt b/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionTypeSelector.kt index 3b7bafc..9da3f62 100644 --- a/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionTypeSelector.kt +++ b/app/src/main/java/com/pledgerio/app/ui/transactions/form/TransactionTypeSelector.kt @@ -11,9 +11,9 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.TrendingDown +import androidx.compose.material.icons.automirrored.filled.TrendingUp import androidx.compose.material.icons.filled.SwapHoriz -import androidx.compose.material.icons.filled.TrendingDown -import androidx.compose.material.icons.filled.TrendingUp import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -49,7 +49,7 @@ fun TransactionTypeSelector( ) { TypeSegment( label = stringResource(R.string.transaction_type_income), - icon = Icons.Default.TrendingUp, + icon = Icons.AutoMirrored.Filled.TrendingUp, selected = selected == TransactionType.DEBIT, accent = IncomeGreen, onClick = { onSelected(TransactionType.DEBIT) }, @@ -57,7 +57,7 @@ fun TransactionTypeSelector( ) TypeSegment( label = stringResource(R.string.transaction_type_expense), - icon = Icons.Default.TrendingDown, + icon = Icons.AutoMirrored.Filled.TrendingDown, selected = selected == TransactionType.CREDIT, accent = ExpenseRed, onClick = { onSelected(TransactionType.CREDIT) }, From 96fcfaf2c1e0d4b5c333a404efcd2486f4d24cb7 Mon Sep 17 00:00:00 2001 From: Gerben Jongerius Date: Sun, 21 Jun 2026 10:44:47 +0200 Subject: [PATCH 2/2] Fix deprecation on the moshi code gen --- app/build.gradle.kts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d7d48ba..c428436 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -19,6 +19,12 @@ if (isCi && buildingReleaseTask && releaseKeystorePath.isNullOrBlank()) { ) } +configurations.matching { configuration -> + configuration.name.startsWith("hiltAnnotationProcessor") +}.configureEach { + exclude(group = "com.squareup.moshi", module = "moshi-kotlin-codegen") +} + ksp { arg("room.schemaLocation", "$projectDir/schemas") arg("room.incremental", "true")