From de72f88953d19cf18df413d8d228f395000c7baa Mon Sep 17 00:00:00 2001
From: Myzel394 <50424412+Myzel394@users.noreply.github.com>
Date: Sun, 31 Dec 2023 21:11:31 +0100
Subject: [PATCH] feat: Improve SaveFolderTile selected value and order of
selectionsheet
---
.../SettingsScreen/Tiles/SaveFolderTile.kt | 76 ++++++-------------
app/src/main/res/values/strings.xml | 1 +
2 files changed, 25 insertions(+), 52 deletions(-)
diff --git a/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/SaveFolderTile.kt b/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/SaveFolderTile.kt
index 2436856..e33a672 100644
--- a/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/SaveFolderTile.kt
+++ b/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/SaveFolderTile.kt
@@ -194,6 +194,17 @@ fun SaveFolderTile(
Divider()
+ SelectionButton(
+ label = stringResource(R.string.ui_settings_option_saveFolder_action_dcim_label),
+ icon = Icons.Default.PermMedia,
+ onClick = {
+ hideSheet()
+ updateValue(RECORDER_MEDIA_SELECTED_VALUE)
+ },
+ )
+
+ Divider()
+
Column {
SelectionButton(
label = stringResource(R.string.ui_settings_option_saveFolder_action_custom_label),
@@ -221,17 +232,6 @@ fun SaveFolderTile(
}
}
}
-
- Divider()
-
- SelectionButton(
- label = stringResource(R.string.ui_settings_option_saveFolder_action_dcim_label),
- icon = Icons.Default.PermMedia,
- onClick = {
- hideSheet()
- updateValue(RECORDER_MEDIA_SELECTED_VALUE)
- },
- )
}
}
}
@@ -267,48 +267,20 @@ fun SaveFolderTile(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
- if (settings.saveFolder != null) {
- Text(
- text = stringResource(
- R.string.form_value_selected,
- splitPath(settings.saveFolder).joinToString(" > ")
- ),
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- textAlign = TextAlign.Center,
- modifier = Modifier.fillMaxWidth(),
- )
- Button(
- colors = ButtonDefaults.filledTonalButtonColors(),
- contentPadding = ButtonDefaults.ButtonWithIconContentPadding,
- onClick = {
- updateValue(null)
+ Text(
+ text = stringResource(
+ R.string.form_value_selected,
+ when (settings.saveFolder) {
+ RECORDER_MEDIA_SELECTED_VALUE -> stringResource(R.string.ui_settings_option_saveFolder_dcimValue)
+ null -> stringResource(R.string.ui_settings_option_saveFolder_defaultValue)
+ else -> splitPath(settings.saveFolder).joinToString(" > ")
}
- ) {
- Icon(
- Icons.Default.Lock,
- contentDescription = null,
- modifier = Modifier.size(ButtonDefaults.IconSize),
- )
- Spacer(
- modifier = Modifier.size(ButtonDefaults.IconSpacing)
- )
- Text(
- text = stringResource(R.string.ui_settings_option_saveFolder_action_default_label),
- )
- }
- } else {
- Text(
- text = stringResource(
- R.string.form_value_selected,
- stringResource(R.string.ui_settings_option_saveFolder_defaultValue)
- ),
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- textAlign = TextAlign.Center,
- modifier = Modifier.fillMaxWidth(),
- )
- }
+ ),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.fillMaxWidth(),
+ )
}
}
)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 859b479..e6dd150 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -171,4 +171,5 @@
You will need an Android phone running at least Android %s (API-Level: %s) to use this feature
Select a custom location
Use the DCIM folder
+ DCIM Folder
\ No newline at end of file