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

Commit

Permalink
Merge pull request #764 from code-a1/develop
Browse files Browse the repository at this point in the history
Added strings for the ui
  • Loading branch information
ILIYANGERMANOV authored Apr 22, 2022
2 parents 26a4d98 + c08e9bd commit 9904011
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 66 deletions.
13 changes: 7 additions & 6 deletions app/src/main/java/com/ivy/wallet/ui/main/MainBottomBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.layout
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.unit.dp
Expand Down Expand Up @@ -97,7 +98,7 @@ fun BoxWithConstraintsScope.BottomBar(
) {
Tab(
icon = R.drawable.ic_home,
name = "Home",
name = stringResource(R.string.home),
selected = tab == MainTab.HOME,
selectedColor = Ivy
) {
Expand All @@ -108,7 +109,7 @@ fun BoxWithConstraintsScope.BottomBar(

Tab(
icon = R.drawable.ic_accounts,
name = "Accounts",
name = stringResource(R.string.accounts),
selected = tab == MainTab.ACCOUNTS,
selectedColor = Green
) {
Expand Down Expand Up @@ -272,7 +273,7 @@ private fun TransactionButtons(
.alpha(buttonsShownPercent)
.zIndex(200f),
iconStart = R.drawable.ic_planned_payments,
text = "Add planned payment",
text = stringResource(R.string.add_planned_payment),
solidBackground = true
) {
onAddPlannedPayment()
Expand Down Expand Up @@ -371,7 +372,7 @@ private fun AddIncomeButton(
onAddIncome()
}
.zIndex(200f),
text = "ADD INCOME",
text = stringResource(R.string.add_income_uppercase),
style = UI.typo.c.style(
color = UI.colors.pureInverse,
fontWeight = FontWeight.ExtraBold,
Expand Down Expand Up @@ -457,7 +458,7 @@ private fun AddExpenseButton(
onAddExpense()
}
.zIndex(200f),
text = "ADD EXPENSE",
text = stringResource(R.string.add_expense_uppercase),
style = UI.typo.c.style(
color = UI.colors.pureInverse,
fontWeight = FontWeight.ExtraBold,
Expand Down Expand Up @@ -543,7 +544,7 @@ private fun AddTransferButton(
onAddTransfer()
}
.zIndex(200f),
text = "ACCOUNT TRANSFER",
text = stringResource(R.string.account_transfer),
style = UI.typo.c.style(
color = UI.colors.pureInverse,
fontWeight = FontWeight.ExtraBold,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
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
import com.ivy.design.l0_system.UI
import com.ivy.design.l0_system.style
import com.ivy.wallet.R
import com.ivy.wallet.ui.IvyWalletComponentPreview
import com.ivy.wallet.ui.theme.Gray
import com.ivy.wallet.ui.theme.components.IvyToolbar
Expand All @@ -35,7 +37,7 @@ fun OnboardingToolbar(
onSkip()
}
.padding(all = 16.dp), //enlarge click area
text = "Skip",
text = stringResource(R.string.skip),
style = UI.typo.b2.style(
color = Gray,
fontWeight = FontWeight.Bold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
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 @@ -117,7 +118,7 @@ private fun AddNewButton(

Text(
modifier = Modifier.padding(vertical = 16.dp),
text = "Add new",
text = stringResource(R.string.add_new),
style = UI.typo.b2.style(
color = UI.colors.pure,
fontWeight = FontWeight.Bold
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.ivy.wallet.ui.onboarding.model

import com.ivy.wallet.R
import com.ivy.wallet.domain.data.entity.Transaction
import com.ivy.wallet.domain.fp.data.ClosedTimeRange
import com.ivy.wallet.stringRes
import com.ivy.wallet.utils.*
import java.time.LocalDateTime

Expand Down Expand Up @@ -36,13 +38,13 @@ data class FromToTimeRange(
"${from.toLocalDate().formatDateOnly()} - ${to.toLocalDate().formatDateOnly()}"
}
from != null && to == null -> {
"From ${from.toLocalDate().formatDateOnly()}"
stringRes(R.string.from_date, from.toLocalDate().formatDateOnly())
}
from == null && to != null -> {
"To ${to.toLocalDate().formatDateOnly()}"
stringRes(R.string.to_date, to.toLocalDate().formatDateOnly())
}
else -> {
"Range"
stringRes(R.string.range)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.res.painterResource
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 @@ -78,7 +79,7 @@ fun BoxWithConstraintsScope.OnboardingAccounts(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "Add accounts",
text = stringResource(R.string.add_accounts),
style = UI.typo.h2.style(
fontWeight = FontWeight.Black
)
Expand Down Expand Up @@ -130,7 +131,7 @@ fun BoxWithConstraintsScope.OnboardingAccounts(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "Suggestions",
text = stringResource(R.string.suggestion),
style = UI.typo.b1.style(
fontWeight = FontWeight.ExtraBold
)
Expand Down Expand Up @@ -173,7 +174,7 @@ fun BoxWithConstraintsScope.OnboardingAccounts(
.navigationBarsPadding()
.padding(bottom = 20.dp),

text = "Next",
text = stringResource(R.string.next),
textColor = White,
backgroundGradient = GradientIvy,
hasNext = true,
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.res.painterResource
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 @@ -73,7 +74,7 @@ fun BoxWithConstraintsScope.OnboardingCategories(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "Add categories",
text = stringResource(R.string.add_categories),
style = UI.typo.h2.style(
fontWeight = FontWeight.Black
)
Expand Down Expand Up @@ -121,7 +122,7 @@ fun BoxWithConstraintsScope.OnboardingCategories(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "Suggestions",
text = stringResource(R.string.suggestions),
style = UI.typo.b1.style(
fontWeight = FontWeight.ExtraBold
)
Expand Down Expand Up @@ -162,7 +163,7 @@ fun BoxWithConstraintsScope.OnboardingCategories(
.navigationBarsPadding()
.padding(bottom = 20.dp),

text = "Finish",
text = stringResource(R.string.finish),
textColor = White,
backgroundGradient = GradientIvy,
hasNext = false,
Expand Down
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.*
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 @@ -13,6 +14,7 @@ import com.google.accompanist.insets.statusBarsPadding
import com.ivy.design.api.navigation
import com.ivy.design.l0_system.UI
import com.ivy.design.l0_system.style
import com.ivy.wallet.R
import com.ivy.wallet.domain.data.IvyCurrency
import com.ivy.wallet.ui.IvyWalletPreview
import com.ivy.wallet.ui.theme.GradientIvy
Expand Down Expand Up @@ -56,7 +58,7 @@ fun BoxWithConstraintsScope.OnboardingSetCurrency(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "Set currency",
text = stringResource(R.string.set_currency),
style = UI.typo.h2.style(
fontWeight = FontWeight.Black
)
Expand Down Expand Up @@ -92,7 +94,7 @@ fun BoxWithConstraintsScope.OnboardingSetCurrency(
.navigationBarsPadding()
.padding(bottom = 20.dp),

text = "Set",
text = stringResource(R.string.set),
textColor = White,
backgroundGradient = GradientIvy,
hasNext = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -181,7 +182,7 @@ fun BoxWithConstraintsScope.OnboardingSplashLogin(
ivyContext = ivyContext,
percentTransition = percentTransition
),
text = "Your personal money manager",
text = stringResource(R.string.your_personal_money_manager),
style = UI.typo.b2.style(
color = UI.colors.pureInverse,
fontWeight = FontWeight.SemiBold
Expand All @@ -203,7 +204,7 @@ fun BoxWithConstraintsScope.OnboardingSplashLogin(
}
.padding(vertical = 8.dp)
.padding(end = 8.dp),
text = "#opensource",
text = stringResource(R.string.opensource),
style = UI.typo.c.style(
color = Green,
fontWeight = FontWeight.Bold
Expand Down Expand Up @@ -261,10 +262,10 @@ private fun LoginSection(

LoginButton(
text = when (opGoogleSignIn) {
is OpResult.Failure -> "Error. Try again: ${opGoogleSignIn.error()}"
OpResult.Loading -> "Signing in..."
is OpResult.Success -> "Success!"
null -> "Login with Google"
is OpResult.Failure -> stringResource(R.string.google_error_try_again, opGoogleSignIn.error())
OpResult.Loading -> stringResource(R.string.google_signing_in)
is OpResult.Success -> stringResource(R.string.google_signing_in_success)
null -> stringResource(R.string.login_with_google)
},
textColor = White,
backgroundGradient = GradientRed,
Expand All @@ -288,7 +289,7 @@ private fun LoginSection(

LoginButton(
icon = R.drawable.ic_local_account,
text = "Offline account",
text = stringResource(R.string.offline_account),
textColor = UI.colors.pureInverse,
backgroundGradient = Gradient.solid(UI.colors.medium),
hasShadow = false
Expand Down Expand Up @@ -322,7 +323,7 @@ private fun LoginWithGoogleExplanation() {

Column {
Text(
text = "SYNC YOUR DATA ON THE IVY CLOUD",
text = stringResource(R.string.sync_data_ivy_cloud),
style = UI.typo.c.style(
color = Green,
fontWeight = FontWeight.ExtraBold
Expand All @@ -332,7 +333,7 @@ private fun LoginWithGoogleExplanation() {
Spacer(Modifier.height(2.dp))

Text(
text = "Data integrity and protection aren't guaranteed!",
text = stringResource(R.string.data_integrity_protection_warning),
style = UI.typo.c.style(
color = UI.colors.pureInverse,
fontWeight = FontWeight.Medium
Expand All @@ -346,7 +347,7 @@ private fun LoginWithGoogleExplanation() {
private fun LocalAccountExplanation() {
Text(
modifier = Modifier.padding(start = 32.dp),
text = "OR ENTER WITH OFFLINE ACCOUNT",
text = stringResource(R.string.or_enter_with_offline_account),
style = UI.typo.c.style(
color = Gray,
fontWeight = FontWeight.ExtraBold
Expand All @@ -357,7 +358,7 @@ private fun LocalAccountExplanation() {

Text(
modifier = Modifier.padding(start = 32.dp, end = 32.dp),
text = "Your data will be saved locally (only on your phone) and won't be synced with the cloud. You risk losing it if you uninstall the app or change your device. You can always activate sync later if you decide to.",
text = stringResource(R.string.offline_warning),
style = UI.typo.c.style(
color = Gray,
fontWeight = FontWeight.Medium
Expand All @@ -367,9 +368,9 @@ private fun LocalAccountExplanation() {

@Composable
private fun PrivacyPolicyAndTC() {
val terms = "Terms & Conditions"
val privacy = "Privacy Policy"
val text = "By signing in, you agree with our $terms and $privacy."
val terms = stringResource(R.string.terms_conditions)
val privacy = stringResource(R.string.privacy_policy)
val text = stringResource(R.string.by_signing_in, terms, privacy)

val tcStart = text.indexOf(terms)
val tcEnd = tcStart + terms.length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
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 @@ -48,7 +49,7 @@ fun OnboardingType(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "Import CSV file",
text = stringResource(R.string.import_csv_file),
style = UI.typo.h2.style(
fontWeight = FontWeight.Black
)
Expand All @@ -58,7 +59,7 @@ fun OnboardingType(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "from Ivy or another app",
text = stringResource(R.string.from_ivy_or_another_app),
style = UI.typo.nB2.style(
fontWeight = FontWeight.Bold,
color = Gray
Expand All @@ -84,7 +85,7 @@ fun OnboardingType(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "Importing a backup file from another can take up to 5 min. You can always import your data later if you want to.",
text = stringResource(R.string.importing_another_time_warning),
style = UI.typo.b2.style(
fontWeight = FontWeight.Bold
)
Expand All @@ -95,7 +96,7 @@ fun OnboardingType(
IvyOutlinedButtonFillMaxWidth(
modifier = Modifier
.padding(horizontal = 16.dp),
text = "Import backup file",
text = stringResource(R.string.import_backup_file),
iconStart = R.drawable.ic_export_csv,
iconTint = Green,
textColor = Green
Expand All @@ -109,7 +110,7 @@ fun OnboardingType(
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth(),
text = "Start fresh",
text = stringResource(R.string.start_fresh),
textColor = White,
backgroundGradient = GradientIvy,
hasNext = true,
Expand Down
Loading

0 comments on commit 9904011

Please sign in to comment.