refactor: migrate all strings to stringresource

This commit is contained in:
Ushie 2022-11-14 15:55:06 +03:00
parent f4ccf85b81
commit a171502475
No known key found for this signature in database
GPG Key ID: 0EF73F1CA38B2D5F
9 changed files with 29 additions and 15 deletions

View File

@ -56,7 +56,7 @@ fun ExpandableCard(
) )
} }
OutlinedButton(onClick = { /*TODO*/ }, shape = CircleShape) { OutlinedButton(onClick = { /*TODO*/ }, shape = CircleShape) {
Text("Update") Text(stringResource(R.string.update))
} }
} }
if (expandedState) { if (expandedState) {

View File

@ -39,7 +39,7 @@ fun PatchCompatibilityDialog(
}, },
confirmButton = { confirmButton = {
TextButton(onClick = onClose) { TextButton(onClick = onClose) {
Text(text = "Dismiss") Text(stringResource(R.string.dismiss))
} }
} }
) )

View File

@ -69,15 +69,15 @@ fun DashboardScreen(viewModel: DashboardViewModel = getViewModel()) {
} }
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) { Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
Text( Text(
text = "Patched Applications", text = stringResource(R.string.patched_applications),
style = MaterialTheme.typography.headlineSmall style = MaterialTheme.typography.headlineSmall
) )
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
FilterChip(selected = true, onClick = { /*TODO*/ }, label = { FilterChip(selected = true, onClick = { /*TODO*/ }, label = {
Text("Updates Available") Text(stringResource(R.string.updates_available))
}) })
FilterChip(selected = false, onClick = { /*TODO*/ }, label = { FilterChip(selected = false, onClick = { /*TODO*/ }, label = {
Text("Installed") Text(stringResource(R.string.installed))
}) })
} }
@ -133,7 +133,7 @@ fun CommitDate(@StringRes label: Int, date: String) {
fun ChangelogText(text: String) { fun ChangelogText(text: String) {
Column { Column {
Text( Text(
text = "Changelog", text = stringResource(R.string.changelog),
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold

View File

@ -48,8 +48,8 @@ fun PatcherScreen(
FloatingActionButton( FloatingActionButton(
enabled = hasAppSelected && psvm.anyPatchSelected(), enabled = hasAppSelected && psvm.anyPatchSelected(),
onClick = { onClickPatch(); patcherUtils.loadPatchBundle() }, // TODO: replace this with something better onClick = { onClickPatch(); patcherUtils.loadPatchBundle() }, // TODO: replace this with something better
icon = { Icon(Icons.Default.Build, contentDescription = "Patch") }, icon = { Icon(Icons.Default.Build, contentDescription = stringResource(R.string.patch)) },
text = { Text(text = "Patch") } text = { Text(stringResource(R.string.patch)) }
) )
}) { paddingValues -> }) { paddingValues ->
Column( Column(
@ -114,7 +114,7 @@ fun PatcherScreen(
) )
Text( Text(
text = if (!hasAppSelected) { text = if (!hasAppSelected) {
"Select an application first." stringResource(R.string.select_an_application_first)
} else if (psvm.anyPatchSelected()) { } else if (psvm.anyPatchSelected()) {
"$selectedAmount patches selected." "$selectedAmount patches selected."
} else { } else {

View File

@ -44,7 +44,7 @@ fun SettingsScreen(
onConfirm = viewModel::setTheme onConfirm = viewModel::setTheme
) )
} }
GroupHeader(title = "Appearance") GroupHeader(stringResource(R.string.appearance))
ListItem( ListItem(
modifier = Modifier.clickable { viewModel.showThemePicker() }, modifier = Modifier.clickable { viewModel.showThemePicker() },
headlineText = { Text(stringResource(R.string.theme)) }, headlineText = { Text(stringResource(R.string.theme)) },

View File

@ -59,7 +59,7 @@ fun AppSelectorSubscreen(
filePicker.launch(arrayOf("application/vnd.android.package-archive")) filePicker.launch(arrayOf("application/vnd.android.package-archive"))
}, },
icon = { Icon(Icons.Default.SdStorage, contentDescription = null) }, icon = { Icon(Icons.Default.SdStorage, contentDescription = null) },
text = { Text("Storage") }, text = { Text(stringResource(R.string.storage)) },
) )
}, },
) { paddingValues -> ) { paddingValues ->

View File

@ -91,14 +91,14 @@ fun PatchesSelectorSubscreen(
query = newValue query = newValue
}, },
leadingIcon = { leadingIcon = {
Icon(Icons.Default.Search, "Search") Icon(Icons.Default.Search, stringResource(R.string.search))
}, },
trailingIcon = { trailingIcon = {
if (query.isNotEmpty()) { if (query.isNotEmpty()) {
IconButton(onClick = { IconButton(onClick = {
query = "" query = ""
}) { }) {
Icon(Icons.Default.Clear, "Clear") Icon(Icons.Default.Clear, stringResource(R.string.clear))
} }
} }
}, },
@ -133,7 +133,7 @@ fun PatchesSelectorSubscreen(
Arrangement.Center, Arrangement.Center,
Alignment.CenterHorizontally Alignment.CenterHorizontally
) { ) {
Text(text = "No compatible patches found.") Text(stringResource(R.string.no_compatible_patches))
} }
} }
} }

View File

@ -64,7 +64,7 @@ fun SourceSelectorSubscreen(
.nestedScroll(scrollBehavior.nestedScrollConnection), .nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { topBar = {
LargeTopAppBar( LargeTopAppBar(
title = { Text(text = stringResource(R.string.select_sources)) }, title = { Text(stringResource(R.string.select_sources)) },
navigationIcon = { navigationIcon = {
IconButton(onClick = navigator::pop) { IconButton(onClick = navigator::pop) {
Icon(imageVector = Icons.Default.ArrowBack, contentDescription = null) Icon(imageVector = Icons.Default.ArrowBack, contentDescription = null)

View File

@ -5,12 +5,20 @@
<string name="dynamic_color">Dynamic Color</string> <string name="dynamic_color">Dynamic Color</string>
<string name="github" translatable="false">GitHub</string> <string name="github" translatable="false">GitHub</string>
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="update">Update</string>
<string name="updates">Updates</string> <string name="updates">Updates</string>
<string name="changelog">Changelog</string>
<string name="updates_available">Updates available</string>
<string name="installed">Installed</string>
<string name="manager">Manager</string> <string name="manager">Manager</string>
<string name="clear">Clear</string>
<string name="search">Search</string>
<string name="update_patch_bundle">Update Patches</string> <string name="update_patch_bundle">Update Patches</string>
<string name="expand">Expand</string> <string name="expand">Expand</string>
<string name="appearance">Appearance</string>
<string name="app_selector_title">Select an app…</string> <string name="app_selector_title">Select an app…</string>
<string name="card_application_header">Select Application</string> <string name="card_application_header">Select Application</string>
<string name="select_an_application_first">Select an application first.</string>
<string name="card_patches_header">Select Patches</string> <string name="card_patches_header">Select Patches</string>
<string name="card_application_not_loaded">Loading applications.</string> <string name="card_application_not_loaded">Loading applications.</string>
<string name="card_application_not_selected">No application selected.</string> <string name="card_application_not_selected">No application selected.</string>
@ -35,7 +43,13 @@
<string name="opensource_licenses">Open source licenses</string> <string name="opensource_licenses">Open source licenses</string>
<string name="select_sources">Select sources</string> <string name="select_sources">Select sources</string>
<string name="sentry">Sentry</string> <string name="sentry">Sentry</string>
<string name="storage">Storage</string>
<string name="patched_applications">Patched Applications</string>
<string name="please_select_an_application">Please select an application.</string>
<string name="select_bundle_from_storage">Select a bundle from storage</string> <string name="select_bundle_from_storage">Select a bundle from storage</string>
<string name="text_continue">Continue</string> <string name="text_continue">Continue</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="dismiss">Dismiss</string>
<string name="patch">Patch</string>
<string name="no_compatible_patches">No compatible patches found.</string>
</resources> </resources>