show domain url on title screen
This commit is contained in:
parent
ac695e3109
commit
e7086791c8
1 changed files with 19 additions and 9 deletions
|
|
@ -56,7 +56,7 @@ fun homeScreen(paddingValues: PaddingValues) {
|
||||||
.imePadding(),
|
.imePadding(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.Center) {
|
verticalArrangement = Arrangement.Center) {
|
||||||
Greeting(serverURL);
|
Greeting(serverURL, currentScreen);
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
targetState = currentScreen,
|
targetState = currentScreen,
|
||||||
transitionSpec = {
|
transitionSpec = {
|
||||||
|
|
@ -66,7 +66,7 @@ fun homeScreen(paddingValues: PaddingValues) {
|
||||||
},
|
},
|
||||||
|
|
||||||
) { targetState -> when(targetState) {
|
) { targetState -> when(targetState) {
|
||||||
0 -> serverDialog(serverURL)
|
0 -> serverDialog(serverURL, {newServerURL -> serverURL = newServerURL })
|
||||||
1 -> passwordDialog(username, password)
|
1 -> passwordDialog(username, password)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -80,13 +80,15 @@ fun homeScreen(paddingValues: PaddingValues) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Greeting(serverURL: String) {
|
fun Greeting(serverURL: String, currentScreen: Int) {
|
||||||
Column (horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.padding(bottom = 24.dp)) {
|
Column (horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.padding(bottom = 24.dp)) {
|
||||||
Text(
|
AnimatedVisibility (currentScreen == 0) {
|
||||||
text = "Welcome to",
|
Text(
|
||||||
style = MaterialTheme.typography.headlineLarge,
|
text = "Welcome to",
|
||||||
textAlign = TextAlign.Center
|
style = MaterialTheme.typography.headlineLarge,
|
||||||
)
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
Text(
|
Text(
|
||||||
text = "Keeper",
|
text = "Keeper",
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
|
|
@ -95,13 +97,20 @@ fun Greeting(serverURL: String) {
|
||||||
brush = Brush.linearGradient(listOf(MaterialTheme.colorScheme.onPrimaryContainer, MaterialTheme.colorScheme.onSecondaryContainer))),
|
brush = Brush.linearGradient(listOf(MaterialTheme.colorScheme.onPrimaryContainer, MaterialTheme.colorScheme.onSecondaryContainer))),
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
)
|
)
|
||||||
|
AnimatedVisibility(currentScreen != 0) {
|
||||||
|
Text(
|
||||||
|
text = "@$serverURL",
|
||||||
|
style = MaterialTheme.typography.titleSmall,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun serverDialog(serverURL: String) {
|
fun serverDialog(serverURL: String, updateServerURL: (newServerURL: String) -> Unit) {
|
||||||
var serverURL by remember { mutableStateOf("") }
|
var serverURL by remember { mutableStateOf("") }
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
label = { Text(text = "Server URL") },
|
label = { Text(text = "Server URL") },
|
||||||
|
|
@ -109,6 +118,7 @@ fun serverDialog(serverURL: String) {
|
||||||
value = serverURL,
|
value = serverURL,
|
||||||
onValueChange = { text ->
|
onValueChange = { text ->
|
||||||
serverURL = text
|
serverURL = text
|
||||||
|
updateServerURL(serverURL)
|
||||||
},
|
},
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
|
||||||
supportingText = {
|
supportingText = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue