Skip to content

Commit

Permalink
Update selection on tap of StorageInfoCard
Browse files Browse the repository at this point in the history
  • Loading branch information
nain-F49FF806 committed Oct 2, 2024
1 parent a3e73d5 commit 57326f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
15 changes: 11 additions & 4 deletions app/src/main/java/alt/nainapps/aer/config/StorageConfigActivity.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 ->
Expand All @@ -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)
)
Expand Down Expand Up @@ -135,7 +138,10 @@ fun StorageInfoListReorderable(storageInfos: List<StorageInfo>, 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))
}
}
}
}
Expand All @@ -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 = {}) {
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
<string name="tile_auto_lock">Aer storage was automatically locked</string>

<string name="launcher_no_activity">Can\'t find system Files app</string>
<string name="shortcut_config_long">Configuration</string>
<string name="shortcut_config_short">Configure</string>
<string name="shortcut_config_disabled">Configuration (disabled)</string>
<string name="shortcut_config_long">Access Configuration</string>
<string name="shortcut_config_short">Access Config</string>
<string name="shortcut_config_disabled">Access Configuration (disabled)</string>

<string name="configuration_label">Configuration</string>
<string name="configuration_shortcut">Show shortcut in app list</string>
Expand All @@ -64,7 +64,10 @@
<string name="configuration_storage_unlock_biometric">Allow storage unlock with biometric access</string>
<string name="configuration_storage_lock_auto">Automatically lock access after 15 minutes</string>
<string name="title_activity_storage_pref">StoragePrefActivity</string>
<string name="shortcut_storageconfig_long">Storage Backend Configuration</string>
<string name="shortcut_storageconfig_long">Storage Configuration</string>
<string name="shortcut_storageconfig_short">Storage Config</string>
<string name="shortcut_storageconfig_disabled">Storage Config (Disabled)</string>
<string name="storage_config_select_help">Tap to select / Drag to reorder:</string>
<string name="storage_config_screen_title">Aer Storage Backend</string>

</resources>

0 comments on commit 57326f0

Please sign in to comment.