chore: gallery
This commit is contained in:
1 parent
c822ad22e1
commit
b2859d138a
5 files changed
+12
No files matched your search
@@ -182,6 +182,9 @@ fun NavigationHost(
|
||||
galleryViewModel = galleryViewModel,
|
||||
onGalleryClick = {
|
||||
navController.navigate(Routes.GALLERY)
|
||||
if (galleryViewModel.latestPhoto.value != null) {
|
||||
navController.navigate(Routes.photoDetail(0))
|
||||
}
|
||||
},
|
||||
onSettingsClick = {
|
||||
navController.navigate(Routes.SETTINGS)
|
||||
|
||||
@@ -81,6 +81,7 @@ fun GalleryScreen(
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
modifier = Modifier.padding(top = 32.dp),
|
||||
title = {
|
||||
if (isSelectionMode) {
|
||||
Text(
|
||||
|
||||
@@ -79,6 +79,7 @@ fun PhotoDetailScreen(
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
modifier = Modifier.padding(top = 32.dp),
|
||||
title = {
|
||||
Text(
|
||||
text = "${pagerState.currentPage + 1} / ${photos.size}",
|
||||
|
||||
@@ -101,6 +101,7 @@ fun PhotoEditScreen(
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
modifier = Modifier.padding(top = 32.dp),
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(R.string.edit),
|
||||
|
||||
@@ -259,6 +259,12 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
}
|
||||
}
|
||||
_latestPhoto.value = updatedPhoto
|
||||
|
||||
// Also update the photos list if it's not already in it
|
||||
val currentPhotos = _photos.value
|
||||
if (currentPhotos.none { it.id == updatedPhoto.id }) {
|
||||
_photos.value = listOf(updatedPhoto) + currentPhotos
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user