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