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