Skip to content

Commit

Permalink
Remove usages of the deprecated overload of ZoomableState#resetZoom()
Browse files Browse the repository at this point in the history
  • Loading branch information
saket committed Jul 1, 2024
1 parent b5be68b commit 4b5c32e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/zoomable/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ HorizontalPager(
// Page is now off-screen. Prevent restoration of
// current zoom when this page becomes visible again.
LaunchedEffect(Unit) {
zoomableState.resetZoom(withAnimation = false)
zoomableState.resetZoom(animationSpec = SnapSpec())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.saket.telephoto.sample.viewer

import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.SnapSpec
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
Expand Down Expand Up @@ -141,12 +142,12 @@ private fun MediaPage(

if (flickState.gestureState is FlickToDismissState.GestureState.Dragging) {
LaunchedEffect(Unit) {
zoomableState.resetZoom(withAnimation = true)
zoomableState.resetZoom()
}
}
if (!isActivePage) {
LaunchedEffect(Unit) {
zoomableState.resetZoom(withAnimation = false)
zoomableState.resetZoom(animationSpec = SnapSpec())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package me.saket.telephoto.zoomable
import android.graphics.BitmapFactory
import android.view.ViewConfiguration
import androidx.activity.ComponentActivity
import androidx.compose.animation.core.SnapSpec
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.gestures.DraggableState
Expand Down Expand Up @@ -606,7 +607,7 @@ class ZoomableImageTest {
}
LaunchedEffect(resetTriggers) {
resetTriggers.receive()
zoomableState.resetZoom(withAnimation = false)
zoomableState.resetZoom(animationSpec = SnapSpec())
}
}

Expand Down

0 comments on commit 4b5c32e

Please sign in to comment.