This commit is contained in:
soraefir
2025-10-07 22:38:21 +02:00
parent 2ae7e1fb8c
commit 472237ba8f
4 changed files with 14 additions and 7 deletions

View File

@@ -96,11 +96,15 @@ aboutLibraries {
dependencies {
implementation 'androidx.compose.material3:material3:1.4.0'
implementation "androidx.compose.material:material:1.9.2"
implementation 'androidx.compose.material:material-icons-extended:1.7.8'
implementation 'androidx.navigation:navigation-compose:2.9.5'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.1.5'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.compose.ui:ui'
implementation "androidx.compose.material:material:1.9.2"
implementation "androidx.activity:activity-ktx:1.11.0"
implementation 'androidx.compose.ui:ui-tooling-preview'

View File

@@ -19,13 +19,15 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import net.helcel.beans.R
import net.helcel.beans.activity.sub.EditPlaceScreen
import net.helcel.beans.countries.World
@Preview
@Composable
fun EditScreen(onExit:()->Unit) {
fun EditScreen(onExit:()->Unit = {}) {
SysTheme {
Scaffold(
topBar = {

View File

@@ -18,6 +18,7 @@ import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DateRange
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Percent
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
@@ -82,7 +83,7 @@ class MainScreen : ComponentActivity() {
Icon(Icons.Default.Edit, contentDescription = "Edit")
}
IconButton(onClick = { nav.navigate("stats") }){
Icon(Icons.Default.DateRange, contentDescription = "Stats")
Icon(Icons.Default.Percent, contentDescription = "Stats")
}
IconButton(onClick = { nav.navigate("settings") }) {
Icon(Icons.Default.Settings, contentDescription = "Settings")

View File

@@ -118,9 +118,10 @@ fun settingsNav(): NavHostController {
return navController
}
@Preview
@Composable
fun SettingsMainScreen(onExit: ()->Unit = {}) {
var nav: NavHostController? = null
val nav: NavHostController = settingsNav()
SysTheme {
Scaffold(
topBar = {
@@ -128,7 +129,7 @@ fun SettingsMainScreen(onExit: ()->Unit = {}) {
title = { Text(stringResource(R.string.action_settings)) },
navigationIcon = {
IconButton(onClick = {
if(nav!=null && !nav!!.popBackStack())
if(!nav.popBackStack())
onExit()
}) {
Icon(
@@ -141,13 +142,12 @@ fun SettingsMainScreen(onExit: ()->Unit = {}) {
}
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) {
nav = settingsNav()
SettingsScreen()
}
}
}
}
@Preview
@Composable
fun SettingsScreen(navController: NavHostController = settingsNav()) {
val context = LocalContext.current