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 { dependencies {
implementation 'androidx.compose.material3:material3:1.4.0' 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' implementation 'androidx.navigation:navigation-compose:2.9.5'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.1.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.preference:preference-ktx:1.2.1'
implementation 'androidx.compose.ui:ui' implementation 'androidx.compose.ui:ui'
implementation "androidx.compose.material:material:1.9.2"
implementation "androidx.activity:activity-ktx:1.11.0" implementation "androidx.activity:activity-ktx:1.11.0"
implementation 'androidx.compose.ui:ui-tooling-preview' 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.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.helcel.beans.R import net.helcel.beans.R
import net.helcel.beans.activity.sub.EditPlaceScreen import net.helcel.beans.activity.sub.EditPlaceScreen
import net.helcel.beans.countries.World import net.helcel.beans.countries.World
@Preview
@Composable @Composable
fun EditScreen(onExit:()->Unit) { fun EditScreen(onExit:()->Unit = {}) {
SysTheme { SysTheme {
Scaffold( Scaffold(
topBar = { topBar = {

View File

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

View File

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