diff --git a/app/build.gradle b/app/build.gradle index f80453c..b83c3a3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,6 +65,9 @@ android { excludes += '/META-INF/{AL2.0,LGPL2.1}' } } + androidResources { + generateLocaleConfig true + } } aboutLibraries { diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItems.kt b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItems.kt index a5e7324..c82102e 100644 --- a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItems.kt +++ b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItems.kt @@ -456,28 +456,52 @@ fun GoalItemCompact( color = MaterialTheme.colorScheme.onSecondaryContainer ) - Row( - Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween - ) { + if (savedAmount.length >= 12) { Text( text = savedAmount, modifier = Modifier.padding(start = 4.dp), fontSize = 24.sp, fontFamily = greenstashNumberFont, fontWeight = FontWeight.Bold, - maxLines = 2, + maxLines = 3, + overflow = TextOverflow.Ellipsis, color = MaterialTheme.colorScheme.onSecondaryContainer ) - Text( - text = daysLeftText, - modifier = Modifier.padding(top = 18.dp), - fontSize = 16.sp, - fontFamily = greenstashFont, - fontWeight = FontWeight.Medium, - color = MaterialTheme.colorScheme.onSecondaryContainer - ) + Row(Modifier.fillMaxWidth()) { + Spacer(modifier = Modifier.weight(1f)) + Text( + text = daysLeftText, + fontSize = 16.sp, + fontFamily = greenstashFont, + fontWeight = FontWeight.Medium, + color = MaterialTheme.colorScheme.onSecondaryContainer + ) + } + } else { + Row( + Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = savedAmount, + modifier = Modifier.padding(start = 4.dp), + fontSize = 24.sp, + fontFamily = greenstashNumberFont, + fontWeight = FontWeight.Bold, + maxLines = 2, + color = MaterialTheme.colorScheme.onSecondaryContainer + ) + + Text( + text = daysLeftText, + modifier = Modifier.padding(top = 18.dp), + fontSize = 16.sp, + fontFamily = greenstashFont, + fontWeight = FontWeight.Medium, + color = MaterialTheme.colorScheme.onSecondaryContainer + ) + } } } } diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt index ba7724f..9a42ce3 100644 --- a/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt +++ b/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt @@ -78,6 +78,7 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.em import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController @@ -274,6 +275,9 @@ fun GoalInfoCard( fontWeight = FontWeight.Bold, fontSize = 38.sp, fontFamily = greenstashNumberFont, + maxLines = 3, + lineHeight = 1.3f.em, + overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 8.dp) ) diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt index 406efa1..66faff3 100644 --- a/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt +++ b/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt @@ -25,7 +25,10 @@ package com.starry.greenstash.ui.screens.settings.composables +import android.content.Intent +import android.net.Uri import android.os.Build +import android.provider.Settings import androidx.biometric.BiometricPrompt import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -43,6 +46,7 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.BrightnessMedium import androidx.compose.material.icons.filled.Contrast import androidx.compose.material.icons.filled.Info +import androidx.compose.material.icons.filled.Language import androidx.compose.material.icons.filled.LocalPolice import androidx.compose.material.icons.filled.Lock import androidx.compose.material.icons.filled.Palette @@ -356,6 +360,19 @@ private fun LocaleSettings(viewModel: SettingsViewModel) { SettingsContainer { SettingsCategory(title = stringResource(id = R.string.locales_setting_title)) + // App locale setting is only available on Android 13+. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + SettingsItem(title = stringResource(id = R.string.app_locale_setting), + description = stringResource(id = R.string.app_locale_setting_desc), + icon = Icons.Filled.Language, + onClick = { + val intent = Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply { + data = Uri.parse("package:${context.packageName}") + } + context.startActivity(intent) + } + ) + } SettingsItem(title = stringResource(id = R.string.date_format_setting), description = dateValue, icon = ImageVector.vectorResource(id = R.drawable.ic_settings_calender), diff --git a/app/src/main/res/resources.properties b/app/src/main/res/resources.properties new file mode 100644 index 0000000..d5a3ddc --- /dev/null +++ b/app/src/main/res/resources.properties @@ -0,0 +1 @@ +unqualifiedResLocale=en-US \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 1db26ff..d9bd5a9 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -173,6 +173,8 @@ Clásico Compacto Configuración regional + Idioma predeterminado + Selecciona tu idioma preferido Formato de Fecha Cambiar Formato de Fecha Moneda preferida diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index cbfd2d2..150b4cc 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -173,6 +173,8 @@ Классический Компактный Региональные настройки + Язык по умолчанию + Выберите предпочитаемый язык Формат даты Изменить формат даты Предпочтительная валюта diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index e882f7c..77c1cb0 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -175,6 +175,8 @@ Klasik Kompakt Yerel + Varsayılan Yerelleştirme + Tercih ettiğiniz yerelleştirmeyi seçin Tarih Biçimi Tarih Biçimini Değiştir Tercih Edilen Para Birimi diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b114da5..620aa94 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -173,6 +173,8 @@ 经典 紧凑 地区 + 默认语言环境 + 选择您喜欢的语言环境 日期格式 修改日期格式 首选货币 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 09e35fc..6e2049c 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -172,6 +172,8 @@ 傳統 緊湊 地區 + 預設語言環境 + 選擇您喜歡的語言環境 日期格式 更改日期格式 預設貨幣 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 319d0cd..fe4ffea 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -173,6 +173,8 @@ Classic Compact Locales + Default Locale + Select your preferred locale Date Format Change Date Format Preferred Currency