Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mr-pine/zoomables
Easy to use libraries for Android and Jetpack Compose
https://github.com/mr-pine/zoomables
Last synced: 11 days ago
JSON representation
Easy to use libraries for Android and Jetpack Compose
- Host: GitHub
- URL: https://github.com/mr-pine/zoomables
- Owner: Mr-Pine
- License: apache-2.0
- Created: 2022-03-22T16:09:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T22:33:22.000Z (over 1 year ago)
- Last Synced: 2024-10-11T11:47:03.200Z (28 days ago)
- Language: Kotlin
- Size: 13.5 MB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zoomables
[![MavenCentral](https://maven-badges.herokuapp.com/maven-central/de.mr-pine.utils/zoomables/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/de.mr-pine.utils/zoomables)
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](https://github.com/Mr-Pine/AndroidUtilityLibraries/issues/new/choose)Show comparison
### Comparison between this library and the way recommended by the Android documentation
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![](Zoom_comparison.gif)
## Why use this library?
- 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## What does this library provide?
- General Composables for with zooming behaviour
- Special Composables for Images, reducing boilerplate code even further
- A ZoomableState## How to use this library
Import via gradle using this version
number: [![MavenCentral](https://maven-badges.herokuapp.com/maven-central/de.mr-pine.utils/zoomables/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/de.mr-pine.utils/zoomables)`implementation "de.mr-pine.utils:zoomables:{Version number}"`
Zoomable Image:
```kt
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:
```kt
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 */
}
```