Label Changes - CheckPoint - Incoming Game
This commit is contained in:
@@ -55,14 +55,15 @@ fun ImageDetailScreen(
|
|||||||
|
|
||||||
// Navigation state
|
// Navigation state
|
||||||
val currentIndex = if (allImageUris.isNotEmpty()) allImageUris.indexOf(imageUri) else -1
|
val currentIndex = if (allImageUris.isNotEmpty()) allImageUris.indexOf(imageUri) else -1
|
||||||
val canGoPrevious = currentIndex > 0
|
val hasNavigation = allImageUris.isNotEmpty() && currentIndex >= 0
|
||||||
val canGoNext = currentIndex in 0 until allImageUris.size - 1
|
val canGoPrevious = hasNavigation && currentIndex > 0
|
||||||
|
val canGoNext = hasNavigation && currentIndex < allImageUris.size - 1
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
if (currentIndex >= 0) {
|
if (hasNavigation) {
|
||||||
Text(
|
Text(
|
||||||
"${currentIndex + 1} / ${allImageUris.size}",
|
"${currentIndex + 1} / ${allImageUris.size}",
|
||||||
style = MaterialTheme.typography.titleMedium
|
style = MaterialTheme.typography.titleMedium
|
||||||
@@ -110,8 +111,8 @@ fun ImageDetailScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Previous button
|
// Previous button (only show if has navigation)
|
||||||
if (navController != null && allImageUris.isNotEmpty()) {
|
if (hasNavigation && navController != null) {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (canGoPrevious) {
|
if (canGoPrevious) {
|
||||||
@@ -129,7 +130,7 @@ fun ImageDetailScreen(
|
|||||||
Icon(Icons.Default.KeyboardArrowLeft, "Previous")
|
Icon(Icons.Default.KeyboardArrowLeft, "Previous")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next button
|
// Next button (only show if has navigation)
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (canGoNext) {
|
if (canGoNext) {
|
||||||
|
|||||||
@@ -49,22 +49,22 @@ sealed class AppDestinations(
|
|||||||
data object Inventory : AppDestinations(
|
data object Inventory : AppDestinations(
|
||||||
route = AppRoutes.INVENTORY,
|
route = AppRoutes.INVENTORY,
|
||||||
icon = Icons.Default.Face,
|
icon = Icons.Default.Face,
|
||||||
label = "People",
|
label = "People Models",
|
||||||
description = "Trained face models"
|
description = "Existing Face Detection Models"
|
||||||
)
|
)
|
||||||
|
|
||||||
data object Train : AppDestinations(
|
data object Train : AppDestinations(
|
||||||
route = AppRoutes.TRAIN,
|
route = AppRoutes.TRAIN,
|
||||||
icon = Icons.Default.ModelTraining,
|
icon = Icons.Default.ModelTraining,
|
||||||
label = "Train",
|
label = "Create Model",
|
||||||
description = "Train new person"
|
description = "Create a new Person Model"
|
||||||
)
|
)
|
||||||
|
|
||||||
data object Models : AppDestinations(
|
data object Models : AppDestinations(
|
||||||
route = AppRoutes.MODELS,
|
route = AppRoutes.MODELS,
|
||||||
icon = Icons.Default.SmartToy,
|
icon = Icons.Default.SmartToy,
|
||||||
label = "Models",
|
label = "Generative",
|
||||||
description = "AI model management"
|
description = "AI Creation"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ==================
|
// ==================
|
||||||
|
|||||||
@@ -59,18 +59,12 @@ fun AppNavHost(
|
|||||||
*/
|
*/
|
||||||
composable(AppRoutes.SEARCH) {
|
composable(AppRoutes.SEARCH) {
|
||||||
val searchViewModel: SearchViewModel = hiltViewModel()
|
val searchViewModel: SearchViewModel = hiltViewModel()
|
||||||
val images by searchViewModel
|
|
||||||
.searchImages()
|
|
||||||
.collectAsStateWithLifecycle(initialValue = emptyList())
|
|
||||||
|
|
||||||
SearchScreen(
|
SearchScreen(
|
||||||
searchViewModel = searchViewModel,
|
searchViewModel = searchViewModel,
|
||||||
onImageClick = { imageUri ->
|
onImageClick = { imageUri ->
|
||||||
// Store full image list for prev/next navigation
|
// Single image view - no prev/next navigation
|
||||||
val allImageUris = images.map { it.image.imageUri }
|
ImageListHolder.clear() // Clear any previous list
|
||||||
navController.currentBackStackEntry
|
|
||||||
?.savedStateHandle
|
|
||||||
?.set("all_image_uris", allImageUris)
|
|
||||||
|
|
||||||
val encodedUri = URLEncoder.encode(imageUri, "UTF-8")
|
val encodedUri = URLEncoder.encode(imageUri, "UTF-8")
|
||||||
navController.navigate("${AppRoutes.IMAGE_DETAIL}/$encodedUri")
|
navController.navigate("${AppRoutes.IMAGE_DETAIL}/$encodedUri")
|
||||||
@@ -107,15 +101,15 @@ fun AppNavHost(
|
|||||||
?.let { URLDecoder.decode(it, "UTF-8") }
|
?.let { URLDecoder.decode(it, "UTF-8") }
|
||||||
?: error("imageUri missing from navigation")
|
?: error("imageUri missing from navigation")
|
||||||
|
|
||||||
// Get image list from previous screen
|
// Get image list from holder
|
||||||
val allImageUris = navController.previousBackStackEntry
|
val allImageUris = ImageListHolder.getImageList()
|
||||||
?.savedStateHandle
|
|
||||||
?.get<List<String>>("all_image_uris")
|
|
||||||
?: emptyList()
|
|
||||||
|
|
||||||
ImageDetailScreen(
|
ImageDetailScreen(
|
||||||
imageUri = imageUri,
|
imageUri = imageUri,
|
||||||
onBack = { navController.popBackStack() },
|
onBack = {
|
||||||
|
ImageListHolder.clear() // Clean up when leaving
|
||||||
|
navController.popBackStack()
|
||||||
|
},
|
||||||
navController = navController,
|
navController = navController,
|
||||||
allImageUris = allImageUris
|
allImageUris = allImageUris
|
||||||
)
|
)
|
||||||
@@ -152,9 +146,7 @@ fun AppNavHost(
|
|||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
navController.currentBackStackEntry
|
ImageListHolder.setImageList(allImageUris)
|
||||||
?.savedStateHandle
|
|
||||||
?.set("all_image_uris", allImageUris)
|
|
||||||
|
|
||||||
val encodedUri = URLEncoder.encode(imageUri, "UTF-8")
|
val encodedUri = URLEncoder.encode(imageUri, "UTF-8")
|
||||||
navController.navigate("${AppRoutes.IMAGE_DETAIL}/$encodedUri")
|
navController.navigate("${AppRoutes.IMAGE_DETAIL}/$encodedUri")
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.placeholder.sherpai2.ui.navigation
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple holder for passing image lists between screens
|
||||||
|
* Used for prev/next navigation in ImageDetailScreen
|
||||||
|
*/
|
||||||
|
object ImageListHolder {
|
||||||
|
private var imageUris: List<String> = emptyList()
|
||||||
|
|
||||||
|
fun setImageList(uris: List<String>) {
|
||||||
|
imageUris = uris
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getImageList(): List<String> {
|
||||||
|
return imageUris
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clear() {
|
||||||
|
imageUris = emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -115,8 +115,8 @@ fun AppDrawerContent(
|
|||||||
DrawerSection(title = "Face Recognition")
|
DrawerSection(title = "Face Recognition")
|
||||||
|
|
||||||
val faceItems = listOf(
|
val faceItems = listOf(
|
||||||
DrawerItem(AppRoutes.INVENTORY, "People", Icons.Default.Face, "Trained face models"),
|
DrawerItem(AppRoutes.INVENTORY, "People", Icons.Default.Face, "Existing models"),
|
||||||
DrawerItem(AppRoutes.TRAIN, "Train", Icons.Default.ModelTraining, "Train new person"),
|
DrawerItem(AppRoutes.TRAIN, "Create Person", Icons.Default.ModelTraining, "New person model"),
|
||||||
DrawerItem(AppRoutes.MODELS, "Models", Icons.Default.SmartToy, "AI model management")
|
DrawerItem(AppRoutes.MODELS, "Models", Icons.Default.SmartToy, "AI model management")
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -134,8 +134,8 @@ fun AppDrawerContent(
|
|||||||
DrawerSection(title = "Organization")
|
DrawerSection(title = "Organization")
|
||||||
|
|
||||||
val orgItems = listOf(
|
val orgItems = listOf(
|
||||||
DrawerItem(AppRoutes.TAGS, "Tags", Icons.AutoMirrored.Filled.Label, "Manage photo tags"),
|
DrawerItem(AppRoutes.TAGS, "Tags", Icons.AutoMirrored.Filled.Label, "Manage Tags"),
|
||||||
DrawerItem(AppRoutes.UTILITIES, "Upload", Icons.Default.UploadFile, "Add new photos")
|
DrawerItem(AppRoutes.UTILITIES, "Util.", Icons.Default.NewReleases, "Manage Collection")
|
||||||
)
|
)
|
||||||
|
|
||||||
orgItems.forEach { item ->
|
orgItems.forEach { item ->
|
||||||
|
|||||||
Reference in New Issue
Block a user