natario1 / ZoomLayout

2D zoom and pan behavior for View hierarchies, images, video streams, and much more, written in Kotlin for Android.
https://natario1.github.io/ZoomLayout
Apache License 2.0
1.03k stars 148 forks source link

How to save and restore value of an image? #237

Open andysagar opened 1 week ago

andysagar commented 1 week ago

How to save and restore value of an image from one activity to another?

            <com.otaliastudios.zoom.ZoomImageView
                    android:id="@+id/user_photo"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_centerInParent="true"
                    android:nestedScrollingEnabled="true"
                    app:transformation="centerCrop" />

i tried using

binding.userPhoto.getEngine().getMatrix()

but it does not seem to work for me. I also logged everything, but I was wondering if there is any method for this?

   Log.e("getMatrix", binding.userPhoto.getEngine().getMatrix() + " :::");
            Log.e("getPanX", binding.userPhoto.getEngine().getPanX() + " :::");
            Log.e("getPanY", binding.userPhoto.getEngine().getPanY() + " :::");
            Log.e("getZoom", binding.userPhoto.getEngine().getZoom() + " :::");
            Log.e("getScaledPan", binding.userPhoto.getEngine().getScaledPan() + " :::");
            Log.e("getScaledPanX", binding.userPhoto.getEngine().getScaledPanX() + " :::");
            Log.e("getScaledPanY", binding.userPhoto.getEngine().getScaledPanY() + " :::");