add edit server page, fix drawer not open

This commit is contained in:
Gary Wang 2021-11-21 14:34:49 +08:00
parent bea1235502
commit 8ab2f03a1b
2 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,106 @@
package net.blumia.pcmdroid.ui.screen.editserver
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AddCircle
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Edit
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@Preview(showBackground = true)
@Composable
fun EditServerScreen(
onCloseActionTriggered: () -> Unit = {},
)
{
Scaffold(
topBar = {
TopAppBar(
backgroundColor = Color.Transparent,
elevation = 0.dp,
title = {},
navigationIcon = {
IconButton(onClick = onCloseActionTriggered) {
Icon(imageVector = Icons.Filled.Close, contentDescription = "Close")
}
},
)
}
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(20.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
modifier = Modifier.size(50.dp),
imageVector = Icons.Filled.Edit,
contentDescription = null,
)
Text(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 10.dp),
text = "Edit Server",
textAlign = TextAlign.Center,
style = MaterialTheme.typography.h5,
)
Text(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 10.dp),
text = "Edit existed Private Cloud Music server",
textAlign = TextAlign.Center,
style = MaterialTheme.typography.subtitle2,
)
var nameStr by rememberSaveable { mutableStateOf("") }
var urlStr by rememberSaveable { mutableStateOf("") }
var baseFolderNameStr by rememberSaveable { mutableStateOf("") }
OutlinedTextField(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 10.dp),
value = nameStr,
onValueChange = { value -> nameStr = value},
label = { Text("Server Name") },
)
OutlinedTextField(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 10.dp),
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Uri,
),
value = urlStr,
onValueChange = { value -> urlStr = value},
label = { Text("Server API Url") },
)
OutlinedTextField(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 10.dp),
value = baseFolderNameStr,
onValueChange = { value -> baseFolderNameStr = value},
label = { Text("Base folder name") },
)
}
}
}

View File

@ -104,6 +104,7 @@ fun MainPlayer(
val scaffoldScope = rememberCoroutineScope() val scaffoldScope = rememberCoroutineScope()
Scaffold( Scaffold(
scaffoldState = scaffoldState,
topBar = { topBar = {
TopAppBar( TopAppBar(
title = { Text(stringResource(id = R.string.app_name)) }, title = { Text(stringResource(id = R.string.app_name)) },