added autofill
This commit is contained in:
parent
b8d6c098ac
commit
664824b368
2 changed files with 16 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package de.lelehier.keeper.screens
|
package de.lelehier.keeper.screens
|
||||||
|
|
||||||
import KeeperLargeFontFamily
|
import KeeperLargeFontFamily
|
||||||
|
|
||||||
import android.util.Patterns
|
import android.util.Patterns
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.AnimatedContentTransitionScope
|
import androidx.compose.animation.AnimatedContentTransitionScope
|
||||||
|
|
@ -48,9 +49,11 @@ import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.autofill.ContentType
|
||||||
|
import androidx.compose.ui.semantics.contentType
|
||||||
|
import androidx.compose.ui.semantics.semantics
|
||||||
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LoginScreen(paddingValues: PaddingValues) {
|
fun LoginScreen(paddingValues: PaddingValues) {
|
||||||
|
|
@ -194,6 +197,7 @@ fun Greeting(serverURL: String, currentScreen: String) {
|
||||||
fun ServerDialog(serverURL: String, updateServerURL: (newServerURL: String) -> Unit) {
|
fun ServerDialog(serverURL: String, updateServerURL: (newServerURL: String) -> Unit) {
|
||||||
var dialogServerURL by remember { mutableStateOf("") }
|
var dialogServerURL by remember { mutableStateOf("") }
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
label = { Text(text = "Server URL") },
|
label = { Text(text = "Server URL") },
|
||||||
textStyle = MaterialTheme.typography.bodySmall,
|
textStyle = MaterialTheme.typography.bodySmall,
|
||||||
|
|
@ -230,23 +234,26 @@ fun PasswordDialog(username: String, password: String, updateUsername: (newUsern
|
||||||
var dialogPassword by remember { mutableStateOf("") }
|
var dialogPassword by remember { mutableStateOf("") }
|
||||||
Column {
|
Column {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
singleLine = true,
|
||||||
|
modifier = Modifier.fillMaxWidth().semantics {contentType = ContentType.Username + ContentType.EmailAddress},
|
||||||
label = { Text(text = "Username") },
|
label = { Text(text = "Username") },
|
||||||
textStyle = MaterialTheme.typography.bodySmall,
|
textStyle = MaterialTheme.typography.bodySmall,
|
||||||
value = username,
|
value = username,
|
||||||
onValueChange = { text ->
|
onValueChange = { text ->
|
||||||
dialogUsername = text
|
dialogUsername = text
|
||||||
updateUsername(dialogUsername)
|
updateUsername(dialogUsername)
|
||||||
});
|
})
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
singleLine = true,
|
||||||
|
modifier = Modifier.fillMaxWidth().semantics {contentType = ContentType.Password},
|
||||||
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
|
||||||
label = { Text(text = "Password") },
|
label = { Text(text = "Password") },
|
||||||
textStyle = MaterialTheme.typography.bodySmall,
|
textStyle = MaterialTheme.typography.bodySmall,
|
||||||
value = password,
|
value = password,
|
||||||
|
visualTransformation = PasswordVisualTransformation(),
|
||||||
onValueChange = { text ->
|
onValueChange = { text ->
|
||||||
dialogPassword = text
|
dialogPassword = text
|
||||||
updatePassword(dialogPassword)
|
updatePassword(dialogPassword)}
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -257,6 +264,7 @@ fun ApiDialog(apiKey: String, updateApiKey: (newApiKey: String) -> Unit) {
|
||||||
var dialogApiKey by remember { mutableStateOf(apiKey) }
|
var dialogApiKey by remember { mutableStateOf(apiKey) }
|
||||||
Column {
|
Column {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
label = { Text(text = "API Key") },
|
label = { Text(text = "API Key") },
|
||||||
textStyle = MaterialTheme.typography.bodySmall,
|
textStyle = MaterialTheme.typography.bodySmall,
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ composeBom = "2024.09.00"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
|
||||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue