FIX: Navigation using Breadcrumbs
This commit is contained in:
parent
828a4e0fd3
commit
b9fe9cf184
@ -4,10 +4,10 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2025-05-10T09:28:03.000292036Z">
|
<DropdownSelection timestamp="2025-05-10T09:35:55.287804256Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=R52N50NLGRT" />
|
<DeviceId pluginId="LocalEmulator" identifier="path=/home/sebastian/.android/avd/Pixel_9.avd" />
|
||||||
</handle>
|
</handle>
|
||||||
</Target>
|
</Target>
|
||||||
</DropdownSelection>
|
</DropdownSelection>
|
||||||
|
@ -112,27 +112,35 @@ fun CollectionBreadcrumbs(
|
|||||||
.padding(8.dp),
|
.padding(8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Text(
|
BreadcrumbItem(label = "Start", onClick = { onNavigateTo(-1) })
|
||||||
text = "Start",
|
|
||||||
modifier = Modifier
|
|
||||||
.clickable { onNavigateTo(-1) }
|
|
||||||
.padding(horizontal = 4.dp),
|
|
||||||
style = MaterialTheme.typography.labelLarge
|
|
||||||
)
|
|
||||||
|
|
||||||
path.forEachIndexed { index, collection ->
|
path.forEachIndexed { index, collection ->
|
||||||
Text(" / ", style = MaterialTheme.typography.labelLarge)
|
Text(" / ", style = MaterialTheme.typography.labelLarge)
|
||||||
Text(
|
|
||||||
text = collection.name,
|
BreadcrumbItem(label = collection.name, onClick = {
|
||||||
modifier = Modifier
|
Log.d("Breadcrumb", "BreadcrumbItem " + collection.name + " was clicked")
|
||||||
.clickable { onNavigateTo(index) }
|
onNavigateTo(index)
|
||||||
.padding(horizontal = 4.dp),
|
})
|
||||||
style = MaterialTheme.typography.labelLarge
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun BreadcrumbItem(label: String, onClick: () -> Unit) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(horizontal = 4.dp)
|
||||||
|
.clickable(onClick = {
|
||||||
|
Log.d("Individual Breadcrumb", "A simple test " + label)
|
||||||
|
onClick()
|
||||||
|
})
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = label,
|
||||||
|
style = MaterialTheme.typography.labelLarge,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun NotesScreen(
|
fun NotesScreen(
|
||||||
@ -184,61 +192,69 @@ fun NotesScreen(
|
|||||||
content = { innerPadding ->
|
content = { innerPadding ->
|
||||||
|
|
||||||
val path by viewModel.pathStack.collectAsState()
|
val path by viewModel.pathStack.collectAsState()
|
||||||
|
|
||||||
BackHandler(enabled = path.isNotEmpty()) {
|
BackHandler(enabled = path.isNotEmpty()) {
|
||||||
viewModel.navigateUp()
|
viewModel.navigateUp()
|
||||||
}
|
}
|
||||||
CollectionBreadcrumbs(
|
|
||||||
path = path,
|
|
||||||
onNavigateTo = { index ->
|
|
||||||
if (index == -1) viewModel.loadContentForParent(null)
|
|
||||||
else viewModel.navigateToLevel(index)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
LazyColumn(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(innerPadding)
|
.padding(innerPadding)
|
||||||
) {
|
) {
|
||||||
item {
|
// Breadcrumbs sichtbar & klickbar machen
|
||||||
Text(
|
CollectionBreadcrumbs(
|
||||||
"Ordner",
|
path = path,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
onNavigateTo = { index ->
|
||||||
modifier = Modifier.padding(16.dp)
|
Log.d("NoteBrowser", "Navigate to: $index")
|
||||||
)
|
if (index == -1) viewModel.loadContentForParent(null)
|
||||||
}
|
else viewModel.navigateToLevel(index)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
items(collections) { collection ->
|
LazyColumn {
|
||||||
ListItem(
|
item {
|
||||||
headlineContent = { Text(collection.name) },
|
Text(
|
||||||
modifier = Modifier
|
"Ordner",
|
||||||
.clickable { viewModel.loadContentForParent(collection.id, collection) }
|
style = MaterialTheme.typography.titleMedium,
|
||||||
.padding(horizontal = 8.dp)
|
modifier = Modifier.padding(16.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
items(collections) { collection ->
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
ListItem(
|
||||||
Text(
|
headlineContent = { Text(collection.name) },
|
||||||
"Noten",
|
modifier = Modifier
|
||||||
style = MaterialTheme.typography.titleMedium,
|
.clickable {
|
||||||
modifier = Modifier.padding(16.dp)
|
viewModel.loadContentForParent(collection.id, collection)
|
||||||
)
|
}
|
||||||
}
|
.padding(horizontal = 8.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
items(notes) { note ->
|
item {
|
||||||
ListItem(
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
headlineContent = { Text(note.title) },
|
Text(
|
||||||
supportingContent = {
|
"Noten",
|
||||||
note.composer?.let { Text(it) }
|
style = MaterialTheme.typography.titleMedium,
|
||||||
},
|
modifier = Modifier.padding(16.dp)
|
||||||
modifier = Modifier
|
)
|
||||||
.padding(horizontal = 8.dp)
|
}
|
||||||
)
|
|
||||||
|
items(notes) { note ->
|
||||||
|
ListItem(
|
||||||
|
headlineContent = { Text(note.title) },
|
||||||
|
supportingContent = {
|
||||||
|
note.composer?.let { Text(it) }
|
||||||
|
},
|
||||||
|
modifier = Modifier.padding(horizontal = 8.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
CreateCollectionDialog(
|
CreateCollectionDialog(
|
||||||
onDismiss = { showDialog = false },
|
onDismiss = { showDialog = false },
|
||||||
|
Loading…
Reference in New Issue
Block a user