Added option to hide balance
This commit is contained in:
parent
b7e693fa22
commit
a1c4f094f4
|
@ -45,6 +45,8 @@ fun NavigationMenuItem(
|
|||
) {
|
||||
val transactionsFilter by DI.uiState.transactionsFilter.collectAsState()
|
||||
|
||||
val showBalance by DI.uiSettings.showBalance.collectAsState()
|
||||
|
||||
val showColoredAmounts by DI.uiSettings.showColoredAmounts.collectAsState()
|
||||
|
||||
Row(
|
||||
|
@ -71,7 +73,9 @@ fun NavigationMenuItem(
|
|||
|
||||
Text(text, color = textColor, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
|
||||
val balance = if (bankAccount != null) {
|
||||
val balance = if (showBalance == false) {
|
||||
null
|
||||
} else if (bankAccount != null) {
|
||||
bankAccount.balance
|
||||
} else if (userAccount != null) {
|
||||
calculator.calculateBalanceOfUserAccount(userAccount)
|
||||
|
|
|
@ -13,6 +13,8 @@ import net.codinux.banking.ui.forms.BooleanOption
|
|||
fun UiSettings(modifier: Modifier, textColor: Color = Color.Unspecified) {
|
||||
val uiSettings = DI.uiSettings
|
||||
|
||||
val showBalance by uiSettings.showBalance.collectAsState()
|
||||
|
||||
val groupTransactions by uiSettings.groupTransactions.collectAsState()
|
||||
|
||||
val zebraStripes by uiSettings.zebraStripes.collectAsState()
|
||||
|
@ -23,6 +25,8 @@ fun UiSettings(modifier: Modifier, textColor: Color = Color.Unspecified) {
|
|||
|
||||
|
||||
Column(modifier) {
|
||||
BooleanOption("Kontostand anzeigen", showBalance, textColor = textColor) { uiSettings.showBalance.value = it }
|
||||
|
||||
BooleanOption("Umsätze gruppieren", groupTransactions, textColor = textColor) { uiSettings.groupTransactions.value = it }
|
||||
|
||||
BooleanOption("Zebra Stripes", zebraStripes, textColor = textColor) { uiSettings.zebraStripes.value = it }
|
||||
|
|
|
@ -37,6 +37,8 @@ fun TransactionsList(uiState: UiState, uiSettings: UiSettings) {
|
|||
derivedStateOf { filterService.filterAccounts(transactions, transactionsFilter) }
|
||||
}
|
||||
|
||||
val showBalance by uiSettings.showBalance.collectAsState()
|
||||
|
||||
val groupTransactions by uiSettings.groupTransactions.collectAsState()
|
||||
|
||||
val showColoredAmounts by DI.uiSettings.showColoredAmounts.collectAsState()
|
||||
|
@ -49,8 +51,10 @@ fun TransactionsList(uiState: UiState, uiSettings: UiSettings) {
|
|||
Text("${transactionsToDisplay.size} Umsätze")
|
||||
Spacer(Modifier.weight(1f))
|
||||
|
||||
val balance = calculator.calculateBalanceOfDisplayedTransactions(transactionsToDisplay, userAccounts, transactionsFilter)
|
||||
Text(formatUtil.formatAmount(balance, "EUR"), color = formatUtil.getColorForAmount(balance, showColoredAmounts))
|
||||
if (showBalance) {
|
||||
val balance = calculator.calculateBalanceOfDisplayedTransactions(transactionsToDisplay, userAccounts, transactionsFilter)
|
||||
Text(formatUtil.formatAmount(balance, "EUR"), color = formatUtil.getColorForAmount(balance, showColoredAmounts))
|
||||
}
|
||||
}
|
||||
|
||||
if (groupTransactions) {
|
||||
|
|
|
@ -5,6 +5,8 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||
|
||||
class UiSettings : ViewModel() {
|
||||
|
||||
val showBalance = MutableStateFlow(true)
|
||||
|
||||
val groupTransactions = MutableStateFlow(true)
|
||||
|
||||
val zebraStripes = MutableStateFlow(true)
|
||||
|
|
Loading…
Reference in New Issue