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

Commit

Permalink
Added strings for ui.theme.wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
mhss1 committed Apr 22, 2022
1 parent 9904011 commit 1b1e49e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
Expand All @@ -18,6 +19,7 @@ import com.ivy.wallet.utils.dateNowUTC
import com.ivy.wallet.utils.format
import com.ivy.wallet.utils.formatLocal
import java.time.LocalDate
import com.ivy.wallet.R

@Composable
fun HistoryDateDivider(
Expand Down Expand Up @@ -53,13 +55,13 @@ fun HistoryDateDivider(
Text(
text = when (date) {
today -> {
"Today"
stringResource(R.string.today)
}
today.minusDays(1) -> {
"Yesterday"
stringResource(R.string.yesterday)
}
today.plusDays(1) -> {
"Tomorrow"
stringResource(R.string.tomorrow)
}
else -> {
date.formatLocal("EEEE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -84,7 +85,7 @@ fun LazyItemScope.TransactionCard(

Text(
modifier = Modifier.padding(horizontal = 24.dp),
text = "DUE ON ${transaction.dueDate.formatNicely()}".uppercase(),
text = stringResource(R.string.due_on, transaction.dueDate.formatNicely()).uppercase(),
style = UI.typo.nC.style(
color = if (transaction.dueDate.isAfter(timeNowUTC()))
Orange else UI.colors.gray,
Expand Down Expand Up @@ -145,7 +146,7 @@ fun LazyItemScope.TransactionCard(
if (transaction.type == TransactionType.TRANSFER && transaction.toAmount != null && toAccountCurrency != transactionCurrency) {
Text(
modifier = Modifier.padding(start = 68.dp),
text = transaction.toAmount.format(2) + " $toAccountCurrency",
text = "${transaction.toAmount.format(2)} $toAccountCurrency",
style = UI.typo.nB2.style(
color = Gray,
fontWeight = FontWeight.Normal
Expand All @@ -162,7 +163,7 @@ fun LazyItemScope.TransactionCard(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 24.dp),
text = if (isExpense) "Pay" else "Get",
text = if (isExpense) stringResource(R.string.pay) else stringResource(R.string.get),
wrapContentMode = false,
backgroundGradient = if (isExpense) gradientExpenses() else GradientGreen,
textStyle = UI.typo.b2.style(
Expand Down Expand Up @@ -233,7 +234,7 @@ private fun TransactionHeaderRow(
backgroundGradient = Gradient.solid(UI.colors.pure),
hasGlow = false,
iconTint = UI.colors.pureInverse,
text = account?.name ?: "deleted",
text = account?.name ?: stringResource(R.string.deleted),
iconStart = getCustomIconIdS(
iconName = account?.icon,
defaultIcon = R.drawable.ic_custom_account_s
Expand Down Expand Up @@ -282,7 +283,8 @@ private fun TransferHeader(
Text(
modifier = Modifier
.padding(vertical = 8.dp),
text = account?.name ?: "null",
// used toString() in case of null
text = account?.name.toString(),
style = UI.typo.c.style(
fontWeight = FontWeight.ExtraBold,
color = UI.colors.pureInverse
Expand All @@ -306,7 +308,8 @@ private fun TransferHeader(
Text(
modifier = Modifier
.padding(vertical = 8.dp),
text = toAccount?.name ?: "null",
// used toString() in case of null
text = toAccount?.name.toString(),
style = UI.typo.c.style(
fontWeight = FontWeight.ExtraBold,
color = UI.colors.pureInverse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -107,8 +108,9 @@ private fun SectionDividerIncomeExpenseRow(
color = UI.colors.pureInverse
)
)
Spacer(modifier = Modifier.width(4.dp))
Text(
text = " expenses",
text = stringResource(R.string.expenses_lowercase),
style = UI.typo.c.style(
fontWeight = FontWeight.Normal,
color = UI.colors.pureInverse
Expand All @@ -133,8 +135,9 @@ private fun SectionDividerIncomeExpenseRow(
color = UI.colors.green
)
)
Spacer(modifier = Modifier.width(4.dp))
Text(
text = " income",
text = stringResource(R.string.income_lowercase),
style = UI.typo.c.style(
fontWeight = FontWeight.Normal,
color = UI.colors.pureInverse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
Expand All @@ -22,6 +23,7 @@ import com.ivy.wallet.domain.data.TransactionHistoryItem
import com.ivy.wallet.domain.data.entity.Account
import com.ivy.wallet.domain.data.entity.Category
import com.ivy.wallet.domain.data.entity.Transaction
import com.ivy.wallet.stringRes
import com.ivy.wallet.ui.EditTransaction
import com.ivy.wallet.ui.IvyWalletCtx
import com.ivy.wallet.ui.theme.Gray
Expand Down Expand Up @@ -50,7 +52,7 @@ fun LazyListScope.transactions(
history: List<TransactionHistoryItem>,
lastItemSpacer: Dp? = null,
onPayOrGet: (Transaction) -> Unit,
emptyStateTitle: String = "No transactions",
emptyStateTitle: String = stringRes(R.string.no_transactions),
emptyStateText: String,
dateDividerMarginTop: Dp? = null
) {
Expand All @@ -59,7 +61,7 @@ fun LazyListScope.transactions(
SectionDivider(
expanded = upcomingExpanded,
setExpanded = setUpcomingExpanded,
title = "Upcoming",
title = stringResource(R.string.upcoming),
titleColor = Orange,
baseCurrency = baseCurrency,
income = upcomingIncome,
Expand Down Expand Up @@ -91,7 +93,7 @@ fun LazyListScope.transactions(
SectionDivider(
expanded = overdueExpanded,
setExpanded = setOverdueExpanded,
title = "Overdue",
title = stringResource(R.string.overdue),
titleColor = Red,
baseCurrency = baseCurrency,
income = overdueIncome,
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,13 @@
<string name="no_planned_payments">No planned payments</string>
<string name="no_planned_payments_description">You don\'t have any planned payments.\nPress the \'⚡\' bottom at the bottom to add one.</string>
<string name="planned_payments_inline">Planned payments</string>
<string name="today">Today</string>
<string name="yesterday">Yesterday</string>
<string name="tomorrow">Tomorrow</string>
<string name="due_on">Due on %1$s</string>
<string name="upcoming">Upcoming</string>
<string name="overdue">Overdue</string>
<string name="expenses_lowercase">expenses</string>
<string name="income_lowercase">income</string>

</resources>

0 comments on commit 1b1e49e

Please sign in to comment.