Browse Source

hotifx bug with related pictures (#3017)

pull/3019/head
dima.avdeev 2 years ago committed by GitHub
parent
commit
cc1ad2fe41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/ImageViewer.common.kt
  2. 6
      examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MemoryScreen.kt

4
examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/ImageViewer.common.kt

@ -94,8 +94,8 @@ fun ImageViewerWithProvidedDependencies(
MemoryScreen( MemoryScreen(
pictures = pictures, pictures = pictures,
memoryPage = page, memoryPage = page,
onSelectRelatedMemory = { pictureIndex -> onSelectRelatedMemory = { picture: PictureData ->
navigationStack.push(MemoryPage(pictureIndex)) navigationStack.push(MemoryPage(pictures.indexOf(picture)))
}, },
onBack = { resetNavigation -> onBack = { resetNavigation ->
if (resetNavigation) { if (resetNavigation) {

6
examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MemoryScreen.kt

@ -43,7 +43,7 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi
fun MemoryScreen( fun MemoryScreen(
pictures: SnapshotStateList<PictureData>, pictures: SnapshotStateList<PictureData>,
memoryPage: MemoryPage, memoryPage: MemoryPage,
onSelectRelatedMemory: (index: Int) -> Unit, onSelectRelatedMemory: (picture: PictureData) -> Unit,
onBack: (resetNavigation: Boolean) -> Unit, onBack: (resetNavigation: Boolean) -> Unit,
onHeaderClick: (index: Int) -> Unit, onHeaderClick: (index: Int) -> Unit,
) { ) {
@ -273,7 +273,7 @@ fun Headliner(s: String) {
@Composable @Composable
fun RelatedMemoriesVisualizer( fun RelatedMemoriesVisualizer(
pictures: List<PictureData>, pictures: List<PictureData>,
onSelectRelatedMemory: (index: Int) -> Unit onSelectRelatedMemory: (picture: PictureData) -> Unit
) { ) {
Box( Box(
modifier = Modifier.padding(10.dp, 0.dp).clip(RoundedCornerShape(10.dp)).fillMaxWidth() modifier = Modifier.padding(10.dp, 0.dp).clip(RoundedCornerShape(10.dp)).fillMaxWidth()
@ -287,7 +287,7 @@ fun RelatedMemoriesVisualizer(
SquareThumbnail( SquareThumbnail(
picture = item, picture = item,
isHighlighted = false, isHighlighted = false,
onClick = { onSelectRelatedMemory(index) }) onClick = { onSelectRelatedMemory(item) })
} }
} }
} }

Loading…
Cancel
Save