Improve upload parameters dialog to make fields clearly editable
Add visual cues and instructions to clarify that upload parameter fields can be edited: - Add instructional text at top of dialog - Add edit icons to both text fields - Update labels to include "(tap to edit)" hint - Change placeholders to action-oriented text - Auto-focus first field to show keyboard immediately - Add keyboard actions for better navigation
This commit is contained in:
@@ -1,11 +1,17 @@
|
|||||||
package com.mattintech.simplelogupload.ui.components
|
package com.mattintech.simplelogupload.ui.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Edit
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
|
import androidx.compose.ui.focus.focusRequester
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.mattintech.simplelogupload.util.PreferencesUtil
|
import com.mattintech.simplelogupload.util.PreferencesUtil
|
||||||
@@ -55,6 +61,12 @@ fun UploadParamsDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
focusRequester.requestFocus()
|
||||||
|
}
|
||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onDismiss,
|
onDismissRequest = onDismiss,
|
||||||
title = { Text("Upload Parameters") },
|
title = { Text("Upload Parameters") },
|
||||||
@@ -62,6 +74,15 @@ fun UploadParamsDialog(
|
|||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
) {
|
) {
|
||||||
|
// Instructions
|
||||||
|
Text(
|
||||||
|
text = "Edit the values below to customize upload settings:",
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
|
|
||||||
// Max Downloads
|
// Max Downloads
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = maxDownloads,
|
value = maxDownloads,
|
||||||
@@ -69,15 +90,27 @@ fun UploadParamsDialog(
|
|||||||
maxDownloads = it
|
maxDownloads = it
|
||||||
maxDownloadsError = null
|
maxDownloadsError = null
|
||||||
},
|
},
|
||||||
label = { Text("Maximum Downloads") },
|
label = { Text("Maximum Downloads (tap to edit)") },
|
||||||
placeholder = { Text("Default: 5") },
|
placeholder = { Text("Enter number") },
|
||||||
|
leadingIcon = {
|
||||||
|
Icon(
|
||||||
|
Icons.Default.Edit,
|
||||||
|
contentDescription = "Edit max downloads",
|
||||||
|
tint = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
},
|
||||||
supportingText = {
|
supportingText = {
|
||||||
Text(maxDownloadsError ?: "Set to 0 for unlimited downloads")
|
Text(maxDownloadsError ?: "Set to 0 for unlimited downloads")
|
||||||
},
|
},
|
||||||
isError = maxDownloadsError != null,
|
isError = maxDownloadsError != null,
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
keyboardOptions = KeyboardOptions(
|
||||||
|
keyboardType = KeyboardType.Number,
|
||||||
|
imeAction = ImeAction.Next
|
||||||
|
),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.focusRequester(focusRequester)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Expiry Hours
|
// Expiry Hours
|
||||||
@@ -87,13 +120,26 @@ fun UploadParamsDialog(
|
|||||||
expiryHours = it
|
expiryHours = it
|
||||||
expiryHoursError = null
|
expiryHoursError = null
|
||||||
},
|
},
|
||||||
label = { Text("Expiry Time (hours)") },
|
label = { Text("Expiry Time in hours (tap to edit)") },
|
||||||
placeholder = { Text("Default: 24") },
|
placeholder = { Text("Enter hours") },
|
||||||
|
leadingIcon = {
|
||||||
|
Icon(
|
||||||
|
Icons.Default.Edit,
|
||||||
|
contentDescription = "Edit expiry hours",
|
||||||
|
tint = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
},
|
||||||
supportingText = {
|
supportingText = {
|
||||||
Text(expiryHoursError ?: "Maximum 24 hours (1 day)")
|
Text(expiryHoursError ?: "Maximum 24 hours (1 day)")
|
||||||
},
|
},
|
||||||
isError = expiryHoursError != null,
|
isError = expiryHoursError != null,
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
keyboardOptions = KeyboardOptions(
|
||||||
|
keyboardType = KeyboardType.Number,
|
||||||
|
imeAction = ImeAction.Done
|
||||||
|
),
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
|
onDone = { validateAndConfirm() }
|
||||||
|
),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user