feat: Improve WebAppIntegrationScreen UI and scrollability
- Removed redundant Scaffold and TopAppBar from WebAppIntegrationScreen. - Configured MainActivity's TopAppBar to show a back arrow for WebAppIntegrationScreen. - Made WebAppIntegrationScreen content scrollable to improve usability in landscape mode.
This commit is contained in:
@@ -1247,6 +1247,11 @@ fun AppShell(
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
|
||||
}
|
||||
}
|
||||
is Screen.WebAppIntegration -> {
|
||||
IconButton(onClick = { currentScreen = Screen.Settings }) {
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
IconButton(onClick = { scope.launch { drawerState.apply { if (isClosed) open() else close() } } }) {
|
||||
Icon(imageVector = Icons.Default.Menu, contentDescription = stringResource(id = R.string.menu_open))
|
||||
@@ -1890,7 +1895,8 @@ fun AppShell(
|
||||
is Screen.WebAppIntegration -> {
|
||||
de.lxtools.noteshop.ui.webapp.WebAppIntegrationScreen(
|
||||
viewModel = viewModel(factory = AppViewModelProvider.Factory),
|
||||
onNavigateUp = { currentScreen = Screen.Settings }
|
||||
onNavigateUp = { currentScreen = Screen.Settings },
|
||||
padding = innerPadding
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package de.lxtools.noteshop.ui.webapp
|
||||
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.foundation.layout.*
|
||||
@@ -16,61 +18,50 @@ import de.lxtools.noteshop.R
|
||||
@Composable
|
||||
fun WebAppIntegrationScreen(
|
||||
viewModel: WebAppIntegrationViewModel,
|
||||
onNavigateUp: () -> Unit
|
||||
onNavigateUp: () -> Unit,
|
||||
padding: PaddingValues
|
||||
) {
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(stringResource(R.string.webapp_integration_title)) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onNavigateUp) {
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
) { padding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(padding)
|
||||
.padding(16.dp)
|
||||
.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(padding)
|
||||
.padding(horizontal = 16.dp)
|
||||
.fillMaxSize()
|
||||
.verticalScroll(rememberScrollState()),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value = viewModel.webAppUrl,
|
||||
onValueChange = viewModel::onWebAppUrlChange,
|
||||
label = { Text(stringResource(R.string.webapp_url_label)) },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = viewModel.username,
|
||||
onValueChange = viewModel::onUsernameChange,
|
||||
label = { Text(stringResource(R.string.username_label)) },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = viewModel.password,
|
||||
onValueChange = viewModel::onPasswordChange,
|
||||
label = { Text(stringResource(R.string.password_label)) },
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = viewModel.deletePassword,
|
||||
onValueChange = viewModel::onDeletePasswordChange,
|
||||
label = { Text(stringResource(R.string.delete_password_label)) },
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Button(
|
||||
onClick = viewModel::saveAndTestConnection,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value = viewModel.webAppUrl,
|
||||
onValueChange = viewModel::onWebAppUrlChange,
|
||||
label = { Text(stringResource(R.string.webapp_url_label)) },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = viewModel.username,
|
||||
onValueChange = viewModel::onUsernameChange,
|
||||
label = { Text(stringResource(R.string.username_label)) },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = viewModel.password,
|
||||
onValueChange = viewModel::onPasswordChange,
|
||||
label = { Text(stringResource(R.string.password_label)) },
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = viewModel.deletePassword,
|
||||
onValueChange = viewModel::onDeletePasswordChange,
|
||||
label = { Text(stringResource(R.string.delete_password_label)) },
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Button(
|
||||
onClick = viewModel::saveAndTestConnection,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(stringResource(R.string.save_and_test_connection_button))
|
||||
}
|
||||
Text(stringResource(R.string.save_and_test_connection_button))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user