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

Commit

Permalink
Removed hard-coded strings
Browse files Browse the repository at this point in the history
  • Loading branch information
code-a1 committed May 5, 2022
1 parent 00f5951 commit 18957f6
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.material.Text
import androidx.compose.runtime.*
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 Down Expand Up @@ -111,7 +112,7 @@ private fun LazyListScope.plannedPaymentItems(
SectionDivider(
expanded = oneTimeExpanded,
setExpanded = setOneTimeExpanded,
title = "One time payments",
title = stringResource(R.string.one_time_payments),
titleColor = UI.colors.pureInverse,
baseCurrency = currency,
income = oneTimeIncome,
Expand Down Expand Up @@ -143,7 +144,7 @@ private fun LazyListScope.plannedPaymentItems(
SectionDivider(
expanded = recurringExpanded,
setExpanded = setRecurringExpanded,
title = "Recurring payments",
title = stringResource(R.string.recurring_payments),
titleColor = UI.colors.pureInverse,
baseCurrency = currency,
income = recurringIncome,
Expand Down Expand Up @@ -212,7 +213,7 @@ private fun LazyItemScope.NoPlannedPaymentsEmptyState() {
Spacer(Modifier.height(24.dp))

Text(
text = "No planned payments",
text = stringResource(R.string.no_planned_payments),
style = UI.typo.b1.style(
color = Gray,
fontWeight = FontWeight.ExtraBold
Expand All @@ -222,7 +223,7 @@ private fun LazyItemScope.NoPlannedPaymentsEmptyState() {
Spacer(Modifier.height(8.dp))

Text(
text = "You don't have any planed payments.\nPress the '⚡' bottom at the bottom to add one.",
text = stringResource(R.string.no_planned_payments_description),
style = UI.typo.b2.style(
color = Gray,
fontWeight = FontWeight.Medium,
Expand Down
18 changes: 10 additions & 8 deletions app/src/main/java/com/ivy/wallet/ui/reports/ReportScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -27,6 +28,7 @@ import com.ivy.wallet.R
import com.ivy.wallet.domain.data.TransactionType
import com.ivy.wallet.domain.data.core.Account
import com.ivy.wallet.domain.data.core.Category
import com.ivy.wallet.stringRes
import com.ivy.wallet.ui.IvyWalletPreview
import com.ivy.wallet.ui.PieChartStatistic
import com.ivy.wallet.ui.Report
Expand Down Expand Up @@ -80,7 +82,7 @@ private fun BoxWithConstraintsScope.UI(
contentAlignment = Alignment.Center
) {
Text(
text = "Generating report...",
text = stringResource(R.string.generating_report),
style = UI.typo.b1.style(
fontWeight = FontWeight.ExtraBold,
color = Orange
Expand Down Expand Up @@ -114,7 +116,7 @@ private fun BoxWithConstraintsScope.UI(
modifier = Modifier.padding(
start = 32.dp
),
text = "Reports",
text = stringResource(R.string.reports),
style = UI.typo.h2.style(
fontWeight = FontWeight.ExtraBold
)
Expand Down Expand Up @@ -207,9 +209,9 @@ private fun BoxWithConstraintsScope.UI(
onPayOrGet = {
onEventHandler.invoke(ReportScreenEvent.OnPayOrGet(transaction = it))
},
emptyStateTitle = "No transactions",
emptyStateTitle = stringRes(R.string.no_transactions),

emptyStateText = "You don't have any transactions for your filter."
emptyStateText = stringRes(R.string.no_transactions_for_your_filter)
)
} else {
item {
Expand Down Expand Up @@ -263,7 +265,7 @@ private fun NoFilterEmptyState(
Spacer(Modifier.height(8.dp))

Text(
text = "No Filter",
text = stringResource(R.string.no_filter),
style = UI.typo.b1.style(
color = Gray,
fontWeight = FontWeight.ExtraBold
Expand All @@ -274,7 +276,7 @@ private fun NoFilterEmptyState(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "To generate a report you must first set a valid filter.",
text = stringResource(R.string.invalid_filter_warning),
style = UI.typo.b2.style(
color = Gray,
fontWeight = FontWeight.Medium,
Expand All @@ -286,7 +288,7 @@ private fun NoFilterEmptyState(

IvyButton(
iconStart = R.drawable.ic_filter_xs,
text = "Set Filter"
text = stringResource(R.string.set_filter)
) {
setFilterOverlayVisible(true)
}
Expand All @@ -311,7 +313,7 @@ private fun Toolbar(

//Export CSV
IvyOutlinedButton(
text = "Export",
text = stringResource(R.string.export),
iconTint = Green,
textColor = Green,
solidBackground = true,
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -25,6 +26,7 @@ import com.ivy.wallet.R
import com.ivy.wallet.domain.data.TransactionHistoryItem
import com.ivy.wallet.domain.data.core.Account
import com.ivy.wallet.domain.data.core.Category
import com.ivy.wallet.stringRes
import com.ivy.wallet.ui.IvyWalletPreview
import com.ivy.wallet.ui.Search
import com.ivy.wallet.ui.ivyWalletCtx
Expand Down Expand Up @@ -123,8 +125,8 @@ private fun UI(
history = transactions,
onPayOrGet = { },
dateDividerMarginTop = 16.dp,
emptyStateTitle = "No transactions",
emptyStateText = "You don't have any transactions for \"${searchQueryTextFieldValue.text}\" query."
emptyStateTitle = stringRes(R.string.no_transactions),
emptyStateText = stringRes(R.string.no_transactions_for_query, searchQueryTextFieldValue.text)
)

item {
Expand Down Expand Up @@ -169,7 +171,7 @@ private fun SearchInput(
.padding(vertical = 12.dp)
.focusRequester(searchFocus),
value = searchQueryTextFieldValue,
hint = "Search transactions",
hint = stringResource(R.string.search_transactions),
onValueChanged = {
onSetSearchQueryTextField(it)
}
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.core.Account
import com.ivy.wallet.domain.data.core.Category
import com.ivy.wallet.domain.data.core.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 = stringRes(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 = stringRes(R.string.overdue),
titleColor = Red,
baseCurrency = baseCurrency,
income = overdueIncome,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,5 @@
<string name="transfers_as_income_expense"><![CDATA[Transfers as income & expenses]]></string>
<string name="transfers_as_income_expense_description">Treats account transfers as income or expense in Accounts Screen</string>
<string name="home_category">Дом</string>
<string name="generating_report">Generating report…</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,5 @@
<string name="transfers_as_income_expense"><![CDATA[Trasferimenti come entrate ed uscite]]></string>
<string name="transfers_as_income_expense_description">Tratta i trasferimenti di conto come entrate o uscite nella schermata dei conti</string>
<string name="home_category">Casa</string>
<string name="generating_report">Generazione report…</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,5 @@
<string name="transfers_as_income_expense"><![CDATA[Transfers as income & expenses]]></string>
<string name="transfers_as_income_expense_description">Treats account transfers as income or expense in Accounts Screen</string>
<string name="home_category">Home</string>
<string name="generating_report">Generating report…</string>
</resources>

0 comments on commit 18957f6

Please sign in to comment.