add string resources
This commit is contained in:
@@ -86,7 +86,7 @@ class Account(
|
|||||||
|
|
||||||
var userProfileCache: User? = null
|
var userProfileCache: User? = null
|
||||||
fun updateAutomaticallyStartPlayback(
|
fun updateAutomaticallyStartPlayback(
|
||||||
automaticallyStartPlayback: Boolean?,
|
automaticallyStartPlayback: Boolean?
|
||||||
) {
|
) {
|
||||||
settings.automaticallyStartPlayback = automaticallyStartPlayback
|
settings.automaticallyStartPlayback = automaticallyStartPlayback
|
||||||
live.invalidateData()
|
live.invalidateData()
|
||||||
@@ -94,7 +94,7 @@ class Account(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateAutomaticallyShowUrlPreview(
|
fun updateAutomaticallyShowUrlPreview(
|
||||||
automaticallyShowUrlPreview: Boolean?,
|
automaticallyShowUrlPreview: Boolean?
|
||||||
) {
|
) {
|
||||||
settings.automaticallyShowUrlPreview = automaticallyShowUrlPreview
|
settings.automaticallyShowUrlPreview = automaticallyShowUrlPreview
|
||||||
live.invalidateData()
|
live.invalidateData()
|
||||||
@@ -102,14 +102,13 @@ class Account(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateAutomaticallyShowImages(
|
fun updateAutomaticallyShowImages(
|
||||||
automaticallyShowImages: Boolean?,
|
automaticallyShowImages: Boolean?
|
||||||
) {
|
) {
|
||||||
settings.automaticallyShowImages = automaticallyShowImages
|
settings.automaticallyShowImages = automaticallyShowImages
|
||||||
live.invalidateData()
|
live.invalidateData()
|
||||||
saveable.invalidateData()
|
saveable.invalidateData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun updateOptOutOptions(warnReports: Boolean, filterSpam: Boolean) {
|
fun updateOptOutOptions(warnReports: Boolean, filterSpam: Boolean) {
|
||||||
warnAboutPostsWithReports = warnReports
|
warnAboutPostsWithReports = warnReports
|
||||||
filterSpamFromStrangers = filterSpam
|
filterSpamFromStrangers = filterSpam
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import androidx.compose.ui.platform.LocalClipboardManager
|
|||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalView
|
import androidx.compose.ui.platform.LocalView
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.AnnotatedString
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
import androidx.compose.ui.text.Placeholder
|
import androidx.compose.ui.text.Placeholder
|
||||||
import androidx.compose.ui.text.PlaceholderVerticalAlign
|
import androidx.compose.ui.text.PlaceholderVerticalAlign
|
||||||
@@ -321,7 +322,7 @@ fun LoadImageBox(showImage: MutableState<Boolean>) {
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Load Image",
|
text = stringResource(R.string.load_image),
|
||||||
style = TextStyle(color = Color.Black, fontSize = 18.sp)
|
style = TextStyle(color = Color.Black, fontSize = 18.sp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,19 +50,19 @@ class AccountViewModel(val account: Account, private val themeViewModel: ThemeVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateAutomaticallyStartPlayback(
|
fun updateAutomaticallyStartPlayback(
|
||||||
automaticallyStartPlayback: Boolean?,
|
automaticallyStartPlayback: Boolean?
|
||||||
) {
|
) {
|
||||||
account.updateAutomaticallyStartPlayback(automaticallyStartPlayback)
|
account.updateAutomaticallyStartPlayback(automaticallyStartPlayback)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateAutomaticallyShowUrlPreview(
|
fun updateAutomaticallyShowUrlPreview(
|
||||||
automaticallyShowUrlPreview: Boolean?,
|
automaticallyShowUrlPreview: Boolean?
|
||||||
) {
|
) {
|
||||||
account.updateAutomaticallyShowUrlPreview(automaticallyShowUrlPreview)
|
account.updateAutomaticallyShowUrlPreview(automaticallyShowUrlPreview)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateAutomaticallyShowImages(
|
fun updateAutomaticallyShowImages(
|
||||||
automaticallyShowImages: Boolean?,
|
automaticallyShowImages: Boolean?
|
||||||
) {
|
) {
|
||||||
account.updateAutomaticallyShowImages(automaticallyShowImages)
|
account.updateAutomaticallyShowImages(automaticallyShowImages)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.intl.Locale
|
import androidx.compose.ui.text.intl.Locale
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -90,7 +91,13 @@ fun SettingsScreen(
|
|||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val selectedItens = persistentListOf("Always", "Wifi-only", "Never")
|
val selectedItens = persistentListOf(
|
||||||
|
stringResource(R.string.always),
|
||||||
|
stringResource(R.string.wifi_only),
|
||||||
|
stringResource(R.string.never).replaceFirstChar {
|
||||||
|
it.uppercase()
|
||||||
|
}
|
||||||
|
)
|
||||||
val settings = accountViewModel.account.settings
|
val settings = accountViewModel.account.settings
|
||||||
val index = if (settings.automaticallyShowImages == null) { 0 } else {
|
val index = if (settings.automaticallyShowImages == null) { 0 } else {
|
||||||
if (settings.automaticallyShowImages == true) 1 else 2
|
if (settings.automaticallyShowImages == true) 1 else 2
|
||||||
@@ -102,7 +109,11 @@ fun SettingsScreen(
|
|||||||
if (settings.automaticallyShowUrlPreview == true) 1 else 2
|
if (settings.automaticallyShowUrlPreview == true) 1 else 2
|
||||||
}
|
}
|
||||||
|
|
||||||
val themeItens = persistentListOf("System", "Light", "Dark")
|
val themeItens = persistentListOf(
|
||||||
|
stringResource(R.string.system),
|
||||||
|
stringResource(R.string.light),
|
||||||
|
stringResource(R.string.dark)
|
||||||
|
)
|
||||||
val themeIndex = accountViewModel.currentTheme()
|
val themeIndex = accountViewModel.currentTheme()
|
||||||
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@@ -116,14 +127,14 @@ fun SettingsScreen(
|
|||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
Section("Application preferences")
|
Section(stringResource(R.string.application_preferences))
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
TextSpinner(
|
TextSpinner(
|
||||||
label = "Language",
|
label = stringResource(R.string.language),
|
||||||
placeholder = languageList[languageIndex],
|
placeholder = languageList[languageIndex],
|
||||||
options = languageList,
|
options = languageList,
|
||||||
onSelect = {
|
onSelect = {
|
||||||
@@ -146,7 +157,7 @@ fun SettingsScreen(
|
|||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
TextSpinner(
|
TextSpinner(
|
||||||
label = "Theme",
|
label = stringResource(R.string.theme),
|
||||||
placeholder = themeItens[themeIndex],
|
placeholder = themeItens[themeIndex],
|
||||||
options = themeItens,
|
options = themeItens,
|
||||||
onSelect = {
|
onSelect = {
|
||||||
@@ -166,7 +177,7 @@ fun SettingsScreen(
|
|||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
TextSpinner(
|
TextSpinner(
|
||||||
label = "Automatically load images/gifs",
|
label = stringResource(R.string.automatically_load_images_gifs),
|
||||||
placeholder = selectedItens[index],
|
placeholder = selectedItens[index],
|
||||||
options = selectedItens,
|
options = selectedItens,
|
||||||
onSelect = {
|
onSelect = {
|
||||||
@@ -192,7 +203,7 @@ fun SettingsScreen(
|
|||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
TextSpinner(
|
TextSpinner(
|
||||||
label = "Automatically play videos",
|
label = stringResource(R.string.automatically_play_videos),
|
||||||
placeholder = selectedItens[videoIndex],
|
placeholder = selectedItens[videoIndex],
|
||||||
options = selectedItens,
|
options = selectedItens,
|
||||||
onSelect = {
|
onSelect = {
|
||||||
@@ -218,7 +229,7 @@ fun SettingsScreen(
|
|||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
TextSpinner(
|
TextSpinner(
|
||||||
label = "Automatically show url preview",
|
label = stringResource(R.string.automatically_show_url_preview),
|
||||||
placeholder = selectedItens[linkIndex],
|
placeholder = selectedItens[linkIndex],
|
||||||
options = selectedItens,
|
options = selectedItens,
|
||||||
onSelect = {
|
onSelect = {
|
||||||
@@ -229,7 +240,7 @@ fun SettingsScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.updateAutomaticallyStartPlayback(automaticallyShowUrlPreview)
|
accountViewModel.updateAutomaticallyShowUrlPreview(automaticallyShowUrlPreview)
|
||||||
LocalPreferences.saveToEncryptedStorage(accountViewModel.account)
|
LocalPreferences.saveToEncryptedStorage(accountViewModel.account)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -484,4 +484,16 @@
|
|||||||
<string name="add_sensitive_content_label">Sensitive Content</string>
|
<string name="add_sensitive_content_label">Sensitive Content</string>
|
||||||
<string name="add_sensitive_content_description">Adds sensitive content warning before showing this content</string>
|
<string name="add_sensitive_content_description">Adds sensitive content warning before showing this content</string>
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
|
<string name="always">Always</string>
|
||||||
|
<string name="wifi_only">Wifi-only</string>
|
||||||
|
<string name="system">System</string>
|
||||||
|
<string name="light">Light</string>
|
||||||
|
<string name="dark">Dark</string>
|
||||||
|
<string name="application_preferences">Application preferences</string>
|
||||||
|
<string name="language">Language</string>
|
||||||
|
<string name="theme">Theme</string>
|
||||||
|
<string name="automatically_load_images_gifs">Automatically load images/gifs</string>
|
||||||
|
<string name="automatically_play_videos">Automatically play videos</string>
|
||||||
|
<string name="automatically_show_url_preview">Automatically show url preview</string>
|
||||||
|
<string name="load_image">Load Image</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user