Slightly improved credentials dialog
This commit is contained in:
parent
8db1f183ff
commit
408d3d6dce
1 changed files with 17 additions and 5 deletions
|
@ -1,11 +1,12 @@
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.Button
|
import androidx.compose.material.*
|
||||||
import androidx.compose.material.OutlinedTextField
|
|
||||||
import androidx.compose.material.Text
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||||
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
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.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
|
@ -21,6 +22,7 @@ import org.eclipse.jgit.treewalk.CanonicalTreeParser
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
|
|
||||||
|
@ExperimentalMaterialApi
|
||||||
@Composable
|
@Composable
|
||||||
fun RepositorySelected(gitManager: GitManager, repository: Repository) {
|
fun RepositorySelected(gitManager: GitManager, repository: Repository) {
|
||||||
var selectedRevCommit by remember {
|
var selectedRevCommit by remember {
|
||||||
|
@ -41,13 +43,21 @@ fun RepositorySelected(gitManager: GitManager, repository: Repository) {
|
||||||
if (credentialsState == CredentialsState.CredentialsRequested) {
|
if (credentialsState == CredentialsState.CredentialsRequested) {
|
||||||
var userField by remember { mutableStateOf("") }
|
var userField by remember { mutableStateOf("") }
|
||||||
var passwordField by remember { mutableStateOf("") }
|
var passwordField by remember { mutableStateOf("") }
|
||||||
|
|
||||||
Dialog(
|
Dialog(
|
||||||
onCloseRequest = {
|
onCloseRequest = {
|
||||||
gitManager.credentialsDenied()
|
gitManager.credentialsDenied()
|
||||||
},
|
},
|
||||||
title = "Introduce your remote server credentials",
|
title = "",
|
||||||
|
|
||||||
) {
|
) {
|
||||||
Column {
|
Column (
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center,
|
||||||
|
) {
|
||||||
|
Text("Introduce your remote server credentials")
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = userField,
|
value = userField,
|
||||||
label = { Text("User", fontSize = 14.sp) },
|
label = { Text("User", fontSize = 14.sp) },
|
||||||
|
@ -57,12 +67,14 @@ fun RepositorySelected(gitManager: GitManager, repository: Repository) {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
|
modifier = Modifier.padding(bottom = 8.dp),
|
||||||
value = passwordField,
|
value = passwordField,
|
||||||
label = { Text("Password", fontSize = 14.sp) },
|
label = { Text("Password", fontSize = 14.sp) },
|
||||||
textStyle = TextStyle(fontSize = 14.sp),
|
textStyle = TextStyle(fontSize = 14.sp),
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
passwordField = it
|
passwordField = it
|
||||||
},
|
},
|
||||||
|
visualTransformation = PasswordVisualTransformation()
|
||||||
)
|
)
|
||||||
Button(onClick = {gitManager.credentialsAccepted(userField, passwordField)}) {
|
Button(onClick = {gitManager.credentialsAccepted(userField, passwordField)}) {
|
||||||
Text("Ok")
|
Text("Ok")
|
||||||
|
|
Loading…
Reference in a new issue