A Jetpack Compose Library provides Composables that handle nice and smooth zooming behaviour for you
If you have any issues or ideas how to improve any of these libraries feel free to open an issue
Show comparison
Notice that the rotation and zoom are centered at the touch point with this library but at the center of the image with the other option
- It provides nicer zooming behaviour (see comparison)
- Provides callback functions to handle swiping left/right on the image when not zoomed in
- Reduces difficult to read code
- General Composables for with zooming behaviour
- Special Composables for Images, reducing boilerplate code even further
- A ZoomableState
Import via gradle using this version number:
implementation "de.mr-pine.utils:zoomables:{Version number}"
Zoomable Image:
ZoomableImage(
coroutineScope = rememberCoroutineScope(),
zoomableState = rememberZoomableState(),
painter = /* Painter */, //also possible with ImageVector and ImageBitmap
onSwipeRight = {
Toast.makeText(
context, "Swipe right", Toast.LENGTH_LONG
).show()
},
onSwipeLeft = {
Toast.makeText(
context, "Swipe left", Toast.LENGTH_LONG
).show()
}
)
Zoomable:
Zoomable(
coroutineScope = rememberCoroutineScope(),
zoomableState = rememberZoomableState(),
onSwipeLeft = {
Toast.makeText(
context, "Swipe left", Toast.LENGTH_LONG
).show()
},
onSwipeRight = {
Toast.makeText(
context, "Swipe right", Toast.LENGTH_LONG
).show()
}
) {
/* Your Composable */
}