From 57326f0df0c0cc9ac548fdb9696bfaa2e1bf1793 Mon Sep 17 00:00:00 2001 From: nain <126972030+nain-F49FF806@users.noreply.github.com> Date: Wed, 2 Oct 2024 06:53:51 +0000 Subject: [PATCH] Update selection on tap of StorageInfoCard --- .../nainapps/aer/config/StorageConfigActivity.kt | 15 +++++++++++---- app/src/main/res/values/strings.xml | 11 +++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/alt/nainapps/aer/config/StorageConfigActivity.kt b/app/src/main/java/alt/nainapps/aer/config/StorageConfigActivity.kt index 4c6d3d8..496473e 100644 --- a/app/src/main/java/alt/nainapps/aer/config/StorageConfigActivity.kt +++ b/app/src/main/java/alt/nainapps/aer/config/StorageConfigActivity.kt @@ -1,5 +1,6 @@ package alt.nainapps.aer.config +import alt.nainapps.aer.R import alt.nainapps.aer.config.ui.theme.AnemoaerTheme import android.annotation.SuppressLint import android.content.Context @@ -39,6 +40,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -60,7 +62,8 @@ class StorageConfigActivity : ComponentActivity() { topBar = { TopAppBar( title = { - Text("Aer Storage Backend priority") + // Text("Aer Storage Backend priority") + Text(stringResource(R.string.storage_config_screen_title)) } ) }) { innerPadding -> @@ -77,7 +80,7 @@ class StorageConfigActivity : ComponentActivity() { } Text( - text = "Drag to reorder:", + text = stringResource(R.string.storage_config_select_help), fontStyle = FontStyle.Italic, modifier = Modifier.padding(8.dp) ) @@ -135,7 +138,10 @@ fun StorageInfoListReorderable(storageInfos: List, sharedPrefs: Sha val interactionSource = remember { MutableInteractionSource() } val longPressDraggable = Modifier.longPressDraggableHandle(interactionSource = interactionSource) val draggable = Modifier.draggableHandle(interactionSource = interactionSource) - StorageInfoCard(info = info, longPressDraggable, draggable) + StorageInfoCard(info = info, longPressDraggable, draggable) { + savePreferredStorageDir(sharedPrefs, info.dir) + onFreshStorageSelect(getPreferredStorageDir(sharedPrefs)) + } } } } @@ -148,8 +154,9 @@ fun StorageInfoCard( @SuppressLint("ModifierParameter") longPressDraggableModifier: Modifier? = null, draggableModifier: Modifier? = null, + onClick: () -> Unit = {} ) { - Card(onClick = {}, modifier = (longPressDraggableModifier ?: Modifier).padding(horizontal = 8.dp)) { + Card(onClick = onClick, modifier = (longPressDraggableModifier ?: Modifier).padding(horizontal = 8.dp)) { Row { (draggableModifier ?: longPressDraggableModifier)?.let { IconButton( modifier = it, onClick = {}) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 04da4f2..e28656f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -50,9 +50,9 @@ Aer storage was automatically locked Can\'t find system Files app - Configuration - Configure - Configuration (disabled) + Access Configuration + Access Config + Access Configuration (disabled) Configuration Show shortcut in app list @@ -64,7 +64,10 @@ Allow storage unlock with biometric access Automatically lock access after 15 minutes StoragePrefActivity - Storage Backend Configuration + Storage Configuration Storage Config Storage Config (Disabled) + Tap to select / Drag to reorder: + Aer Storage Backend +