photos: reload photos when metadata changes (when the content is updated by saving)
- Commit
27d99877f906da67bf46ff898c513ee33ca450f7- Author
- Vayun Mathur <[email protected]>
- When
- 2026-04-13 05:34 UTC (7 months ago)
- Parents
947c1c8
Diff
photos/src/main/java/com/vayunmathur/photos/ImageLoader.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ImageLoader.kt b/photos/src/main/java/com/vayunmathur/photos/ImageLoader.ktindex 41cc0b3e1b..a81933eb76 100644--- a/photos/src/main/java/com/vayunmathur/photos/ImageLoader.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ImageLoader.kt@@ -66,8 +66,8 @@ object ImageLoader { model = ImageRequest.Builder(context) .data(photo.uri.toUri()) .videoFrameMillis(1000) // Grabs frame at 1s mark- .diskCacheKey("thumb_${photo.id}")- .memoryCacheKey("thumb_${photo.id}")+ .diskCacheKey("thumb_${photo.id}_${photo.dateModified}")+ .memoryCacheKey("thumb_${photo.id}_${photo.dateModified}") .crossfade(true) .size(256) // Increased slightly for better quality on high-DPI screens .build(),
photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.ktindex 457ae26fd9..114f564713 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt@@ -33,6 +33,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue+import androidx.compose.runtime.key import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember@@ -231,40 +232,42 @@ fun PhotoDetailView( } } ) {- if(photo.videoData == null) {- AsyncImage(- model = ImageRequest.Builder(context)- .data(photo.uri.toUri())- .build(),- contentDescription = null,- modifier = Modifier- .fillMaxSize()- .onGloballyPositioned { layoutCoordinates ->- size = layoutCoordinates.size- }- .graphicsLayer {- scaleX = currentZoom.scale- scaleY = currentZoom.scale- translationX = currentZoom.offset.x- translationY = currentZoom.offset.y- },- contentScale = ContentScale.Fit- )- } else {- VideoPlayer(- modifier = Modifier- .fillMaxSize()- .onGloballyPositioned { size = it.size }- .graphicsLayer {- scaleX = currentZoom.scale- scaleY = currentZoom.scale- translationX = currentZoom.offset.x- translationY = currentZoom.offset.y- },- uri = photo.uri.toUri(),- isMetadataVisible = isMetadataVisible,- isSettledPage = isSettled- )+ key(photo.dateModified) {+ if (photo.videoData == null) {+ AsyncImage(+ model = ImageRequest.Builder(context)+ .data(photo.uri.toUri())+ .build(),+ contentDescription = null,+ modifier = Modifier+ .fillMaxSize()+ .onGloballyPositioned { layoutCoordinates ->+ size = layoutCoordinates.size+ }+ .graphicsLayer {+ scaleX = currentZoom.scale+ scaleY = currentZoom.scale+ translationX = currentZoom.offset.x+ translationY = currentZoom.offset.y+ },+ contentScale = ContentScale.Fit+ )+ } else {+ VideoPlayer(+ modifier = Modifier+ .fillMaxSize()+ .onGloballyPositioned { size = it.size }+ .graphicsLayer {+ scaleX = currentZoom.scale+ scaleY = currentZoom.scale+ translationX = currentZoom.offset.x+ translationY = currentZoom.offset.y+ },+ uri = photo.uri.toUri(),+ isMetadataVisible = isMetadataVisible,+ isSettledPage = isSettled+ )+ } } AnimatedVisibility(