Compare commits
No commits in common. "8403bcf9c7382eba9045d221f820baf4de7ba831" and "b7933fc5b0e36770cda51d928e657df4ed9f6b2f" have entirely different histories.
8403bcf9c7
...
b7933fc5b0
1 changed files with 20 additions and 33 deletions
|
|
@ -11,7 +11,6 @@ import androidx.compose.animation.fadeIn
|
|||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
|
|
@ -65,12 +64,11 @@ fun HomeScreen(paddingValues: PaddingValues) {
|
|||
.padding(paddingValues)
|
||||
.fillMaxSize()
|
||||
.imePadding()
|
||||
.padding(start = 56.dp, end = 56.dp),
|
||||
.padding(all = 56.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center) {
|
||||
Greeting(serverURL, currentScreen);
|
||||
AnimatedContent(
|
||||
modifier = Modifier.padding(bottom = 24.dp),
|
||||
targetState = currentScreen,
|
||||
transitionSpec = {
|
||||
fadeIn(
|
||||
|
|
@ -86,34 +84,24 @@ fun HomeScreen(paddingValues: PaddingValues) {
|
|||
}
|
||||
}
|
||||
|
||||
AnimatedVisibility(currentScreen == "passwordDialog" || currentScreen == "apiDialog") {
|
||||
Row (
|
||||
modifier = Modifier.padding(bottom = 12.dp)
|
||||
.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
AnimatedVisibility(currentScreen == "passwordDialog") {
|
||||
OutlinedButton (
|
||||
onClick = {currentScreen = "serverDialog"},
|
||||
modifier = Modifier.weight(1f)
|
||||
modifier = Modifier.padding(top = 24.dp)
|
||||
) {
|
||||
Row() {
|
||||
Text(text = "Change Server")
|
||||
}
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
AnimatedVisibility(currentScreen == "passwordDialog") {
|
||||
OutlinedButton (
|
||||
modifier = Modifier.weight(1f),
|
||||
onClick = {
|
||||
when (currentScreen) {
|
||||
"passwordDialog" -> {
|
||||
currentScreen = "apiDialog"
|
||||
}
|
||||
|
||||
"apidialog" -> {
|
||||
currentScreen = "passwordDialog"
|
||||
}
|
||||
}
|
||||
},
|
||||
onClick = {},
|
||||
modifier = Modifier.padding(top = 24.dp)
|
||||
) {
|
||||
Row() {
|
||||
when(currentScreen) {
|
||||
|
|
@ -131,9 +119,9 @@ fun HomeScreen(paddingValues: PaddingValues) {
|
|||
"apiDialog" -> currentScreen = "loadingDialog"
|
||||
"loadingDialog" -> currentScreen = "loadingDialog"
|
||||
}},
|
||||
modifier = Modifier
|
||||
modifier = Modifier.padding(top = 24.dp)
|
||||
.fillMaxWidth()
|
||||
.height(96.dp),
|
||||
.height(128.dp),
|
||||
enabled = when(currentScreen) {
|
||||
"serverDialog" -> isValidUrl(serverURL)
|
||||
"passwordDialog" -> username.isNotEmpty() && password.isNotEmpty()
|
||||
|
|
@ -241,11 +229,11 @@ fun PasswordDialog(username: String, password: String, updateUsername: (newUsern
|
|||
|
||||
@Composable
|
||||
fun ApiDialog(apiKey: String, updateApiKey: (newApiKey: String) -> Unit) {
|
||||
var dialogApiKey by remember { mutableStateOf(apiKey) }
|
||||
var dialogApiKey by remember { mutableStateOf("") }
|
||||
Column {
|
||||
OutlinedTextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
label = { Text(text = "API Key") },
|
||||
label = { Text(text = "Password") },
|
||||
textStyle = MaterialTheme.typography.bodySmall,
|
||||
value = dialogApiKey,
|
||||
onValueChange = { text ->
|
||||
|
|
@ -257,7 +245,6 @@ fun ApiDialog(apiKey: String, updateApiKey: (newApiKey: String) -> Unit) {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
@Composable
|
||||
fun LoadingDialog () {
|
||||
CircularWavyProgressIndicator()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue