Revert "feat: improve layout in MainApp and SettingsScreen for better content visibility and user experience"

This reverts commit 498e8bcc06.

Revert animation changes
This commit is contained in:
2025-11-11 20:51:59 +01:00
parent ab014206fd
commit 1967dff5c3
2 changed files with 110 additions and 104 deletions
@@ -4,7 +4,6 @@ import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.Settings
@@ -107,13 +106,7 @@ fun MainApp() {
}
},
) { innerPadding ->
// Apply the innerPadding from the Scaffold so content is not obscured by the bottom navigation bar.
Surface(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding),
color = MaterialTheme.colorScheme.background,
) {
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
NavHost(
navController = navController,
startDestination = Routes.Tables,
@@ -133,6 +133,11 @@ fun SettingsScreen(
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.settings)) },
navigationIcon = {
IconButton(onClick = onNavigateBack) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
}
},
actions = {
ConnectionStatusAction(prefs = preferencesManager)
},
@@ -317,7 +322,110 @@ fun SettingsScreen(
}
}
// Notifications section (moved inside the main scroll column so it doesn't overlay other content)
// Diagnostics / Logs
Text(
text = "Diagnostics",
style = MaterialTheme.typography.titleMedium,
)
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
) {
Column(
modifier = Modifier.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
text = "View application logs",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Button(onClick = onNavigateToLogs, modifier = Modifier.fillMaxWidth()) {
Icon(Icons.AutoMirrored.Filled.List, contentDescription = null)
Spacer(modifier = Modifier.width(8.dp))
Text("Open Logs")
}
}
}
// Leave Server section
Text(
text = "Leave Server",
style = MaterialTheme.typography.titleMedium,
)
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
) {
Column(
modifier = Modifier.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
// Warning/info text appears above the action button
Text(
text = "Leaving removes local data",
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurface,
)
Text(
text = "Disconnects and clears local database",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "Clears stored server URL and password",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "Deletes all local data (tables, fields, items)",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "Returns to server setup screen",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
// Action button placed after the information for better UX
Button(
onClick = { showLeaveDialog = true },
modifier = Modifier.fillMaxWidth(),
enabled = !isLeaving,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.error,
contentColor = MaterialTheme.colorScheme.onError,
),
) {
if (isLeaving) {
CircularProgressIndicator(
modifier = Modifier.size(16.dp),
color = MaterialTheme.colorScheme.onError,
strokeWidth = 2.dp,
)
Spacer(modifier = Modifier.width(8.dp))
Text("Leaving...")
} else {
Text("Leave Server")
}
}
}
}
}
// Notifications section (placed after main content but before dialogs)
Column(
modifier =
Modifier
.fillMaxWidth()
.padding(padding)
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
Text(
text = "Notifications",
style = MaterialTheme.typography.titleMedium,
@@ -415,103 +523,8 @@ fun SettingsScreen(
)
}
}
// Diagnostics / Logs
Text(
text = "Diagnostics",
style = MaterialTheme.typography.titleMedium,
)
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
) {
Column(
modifier = Modifier.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
text = "View application logs",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Button(onClick = onNavigateToLogs, modifier = Modifier.fillMaxWidth()) {
Icon(Icons.AutoMirrored.Filled.List, contentDescription = null)
Spacer(modifier = Modifier.width(8.dp))
Text("Open Logs")
}
}
}
// Leave Server section
Text(
text = "Leave Server",
style = MaterialTheme.typography.titleMedium,
)
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
) {
Column(
modifier = Modifier.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
// Warning/info text appears above the action button
Text(
text = "Leaving removes local data",
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurface,
)
Text(
text = "Disconnects and clears local database",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "Clears stored server URL and password",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "Deletes all local data (tables, fields, items)",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "Returns to server setup screen",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
// Action button placed after the information for better UX
Button(
onClick = { showLeaveDialog = true },
modifier = Modifier.fillMaxWidth(),
enabled = !isLeaving,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.error,
contentColor = MaterialTheme.colorScheme.onError,
),
) {
if (isLeaving) {
CircularProgressIndicator(
modifier = Modifier.size(16.dp),
color = MaterialTheme.colorScheme.onError,
strokeWidth = 2.dp,
)
Spacer(modifier = Modifier.width(8.dp))
Text("Leaving...")
} else {
Text("Leave Server")
}
}
}
}
}
if (showLeaveDialog) {
AlertDialog(
onDismissRequest = { showLeaveDialog = false },