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

Commit

Permalink
Added strings in strings.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
code-a1 committed Apr 20, 2022
1 parent 5746341 commit d278d07
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
9 changes: 5 additions & 4 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeHeader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
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.unit.dp
import com.ivy.design.api.navigation
Expand Down Expand Up @@ -120,7 +121,7 @@ private fun HeaderStickyRow(
modifier = Modifier
.alpha(percentExpanded)
.testTag("home_greeting_text"),
text = if (name.isNotNullOrBlank()) "Hi $name" else "Hi",
text = if (name.isNotNullOrBlank()) stringResource(R.string.hi_name, name) else stringResource(R.string.hi),
style = UI.typo.b1.style(
fontWeight = FontWeight.ExtraBold,
color = UI.colors.pureInverse
Expand Down Expand Up @@ -234,7 +235,7 @@ fun CashFlowInfo(
modifier = Modifier.padding(
start = 24.dp
),
text = "Cashflow: ${if (cashflow > 0) "+" else ""}${cashflow.format(currency)} $currency",
text = stringResource(R.string.cashflow, (if (cashflow > 0) "+" else ""), cashflow.format(currency), currency),
style = UI.typo.nB2.style(
color = if (cashflow < 0) Gray else Green
)
Expand Down Expand Up @@ -268,7 +269,7 @@ private fun IncomeExpenses(
icon = R.drawable.ic_income,
backgroundGradient = GradientGreen,
textColor = White,
label = "Income",
label = stringResource(R.string.income),
currency = currency,
amount = monthlyIncome
) {
Expand All @@ -286,7 +287,7 @@ private fun IncomeExpenses(
icon = R.drawable.ic_expense,
backgroundGradient = Gradient(UI.colors.pureInverse, UI.colors.gray),
textColor = UI.colors.pure,
label = "Expenses",
label = stringResource(R.string.expenses),
currency = currency,
amount = monthlyExpenses.absoluteValue
) {
Expand Down
29 changes: 15 additions & 14 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
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.TextAlign
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -250,7 +251,7 @@ private fun SearchButton(
modifier = Modifier.padding(
vertical = 12.dp,
),
text = "Search transactions",
text = stringResource(R.string.search_transactions),
style = UI.typo.b2.style(
fontWeight = FontWeight.SemiBold,
color = UI.colors.pureInverse
Expand Down Expand Up @@ -291,7 +292,7 @@ private fun ColumnScope.OpenSource() {
.padding(start = 16.dp, end = 24.dp)
) {
Text(
text = "Ivy Wallet is open-source",
text = stringResource(R.string.ivy_wallet_open_source),
style = UI.typo.b2.style(
fontWeight = FontWeight.ExtraBold
)
Expand Down Expand Up @@ -330,7 +331,7 @@ private fun ColumnScope.Buffer(
Spacer(Modifier.width(24.dp))

Text(
text = "Savings goal",
text = stringResource(R.string.savings_goal),
style = UI.typo.b1.style(
color = UI.colors.pureInverse,
fontWeight = FontWeight.ExtraBold
Expand Down Expand Up @@ -369,7 +370,7 @@ private fun QuickAccess(

Text(
modifier = Modifier.padding(start = 24.dp),
text = "Quick access"
text = stringResource(R.string.quick_access)
)

Spacer(Modifier.height(16.dp))
Expand All @@ -383,7 +384,7 @@ private fun QuickAccess(

MoreMenuButton(
icon = R.drawable.home_more_menu_settings,
label = "Settings"
label = stringResource(R.string.settings)
) {
nav.navigateTo(Settings)
}
Expand All @@ -392,7 +393,7 @@ private fun QuickAccess(

MoreMenuButton(
icon = R.drawable.home_more_menu_categories,
label = "Categories"
label = stringResource(R.string.categories)
) {
nav.navigateTo(Categories)
}
Expand All @@ -406,9 +407,9 @@ private fun QuickAccess(
Theme.AUTO -> R.drawable.home_more_menu_auto_mode
},
label = when (theme) {
Theme.LIGHT -> "Light mode"
Theme.DARK -> "Dark mode"
Theme.AUTO -> "Auto mode"
Theme.LIGHT -> stringResource(R.string.light_mode)
Theme.DARK -> stringResource(R.string.dark_mode)
Theme.AUTO -> stringResource(R.string.auto_mode)
},
backgroundColor = when (theme) {
Theme.LIGHT -> UI.colors.pure
Expand All @@ -428,7 +429,7 @@ private fun QuickAccess(

MoreMenuButton(
icon = R.drawable.home_more_menu_planned_payments,
label = "Planned\nPayments"
label = stringResource(R.string.planned_payments)
) {
nav.navigateTo(PlannedPayments)
}
Expand Down Expand Up @@ -456,7 +457,7 @@ private fun QuickAccess(

MoreMenuButton(
icon = R.drawable.home_more_menu_share,
label = "Share Ivy"
label = stringResource(R.string.share_ivy)
) {
(context as RootActivity).shareIvyWallet()
}
Expand All @@ -465,7 +466,7 @@ private fun QuickAccess(

MoreMenuButton(
icon = R.drawable.home_more_menu_reports,
label = "Reports",
label = stringResource(R.string.reports),
) {
nav.navigateTo(Report)
}
Expand All @@ -474,7 +475,7 @@ private fun QuickAccess(

MoreMenuButton(
icon = R.drawable.home_more_menu_budgets,
label = "Budgets",
label = stringResource(R.string.budgets),
) {
nav.navigateTo(BudgetScreen)
}
Expand All @@ -483,7 +484,7 @@ private fun QuickAccess(

MoreMenuButton(
icon = R.drawable.home_more_menu_loans,
label = "Loans",
label = stringResource(R.string.loans),
) {
nav.navigateTo(Loans)
}
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
import androidx.compose.ui.input.nestedscroll.NestedScrollSource
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Velocity
import androidx.compose.ui.unit.dp
Expand All @@ -20,12 +21,14 @@ import com.google.accompanist.insets.systemBarsPadding
import com.ivy.design.api.navigation
import com.ivy.design.l0_system.Theme
import com.ivy.wallet.Constants
import com.ivy.wallet.R
import com.ivy.wallet.domain.data.IvyCurrency
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.domain.logic.model.CustomerJourneyCardData
import com.ivy.wallet.stringRes
import com.ivy.wallet.ui.IvyWalletPreview
import com.ivy.wallet.ui.Main
import com.ivy.wallet.ui.ivyWalletCtx
Expand Down Expand Up @@ -287,7 +290,7 @@ private fun BoxWithConstraintsScope.UI(
}

CurrencyModal(
title = "Set currency",
title = stringResource(R.string.set_currency),
initialCurrency = IvyCurrency.fromCode(currencyCode),
visible = currencyModalVisible,
dismiss = { currencyModalVisible = false }
Expand Down Expand Up @@ -441,10 +444,8 @@ fun HomeLazyColumn(
overdueExpenses = overdueExpenses,
history = history,
onPayOrGet = onPayOrGet,
emptyStateTitle = "No transactions",
emptyStateText = "You don't have any transactions for ${
period.toDisplayLong(ivyContext.startDayOfMonth)
}.\nYou can add one by tapping the \"+\" button."
emptyStateTitle = stringRes(R.string.no_transactions),
emptyStateText = stringRes(R.string.no_transactions_description, period.toDisplayLong(ivyContext.startDayOfMonth))
)
}
}
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,22 @@
<string name="confirm">Confirm</string>
<string name="account_change_recalculating">Please wait, re-calculating all loan records</string>
<string name="created_on">Created on</string>
<string name="hi">Hi</string>
<string name="hi_name">Hi %1$s</string>
<string name="cashflow">Cashflow: %1$s%2$s %3$s</string>
<string name="search_transactions">Search transactions</string>
<string name="ivy_wallet_open_source">Ivy Wallet is open-source</string>
<string name="savings_goal">Savings goal</string>
<string name="quick_access">Quick access</string>
<string name="settings">Settings</string>
<string name="light_mode">Light mode</string>
<string name="dark_mode">Dark mode</string>
<string name="auto_mode">Auto mode</string>
<string name="planned_payments">Planned\nPayments</string>
<string name="share_ivy">Share Ivy</string>
<string name="reports">Reports</string>
<string name="loans">Loans</string>
<string name="set_currency">Set currency</string>
<string name="no_transactions">No transactions</string>
<string name="no_transactions_description">You don\'t have any transactions for %1$s.\nYou can add one by tapping the \"+\" button.</string>
</resources>

0 comments on commit d278d07

Please sign in to comment.