Baseflow / PhotoView

Implementation of ImageView for Android that supports zooming, by various touch gestures.
https://baseflow.com
Apache License 2.0
18.78k stars 3.92k forks source link

How to make PhotoView according to gesture to slide up and down #483

Open peixiaolin opened 7 years ago

peixiaolin commented 7 years ago

Call in the ViewPager PhotoView, how to make PhotoView according to gesture to slide up and down .Thanks

peixiaolin commented 7 years ago

java.lang.IllegalArgumentException: MATRIX is not supported in PhotoView at uk.co.senab.photoview.PhotoViewAttacher.isSupportedScaleType(PhotoViewAttacher.java:105) at uk.co.senab.photoview.PhotoViewAttacher.setScaleType(PhotoViewAttacher.java:654) at com.qianlong.bjissue.web.adapter.PhotosViewAdapter.onTouch(PhotosViewAdapter.java:151) at com.qianlong.bjissue.web.adapter.PhotosViewAdapter.access$000(PhotosViewAdapter.java:48) at com.qianlong.bjissue.web.adapter.PhotosViewAdapter$2.onResourceReady(PhotosViewAdapter.java:125) at com.qianlong.bjissue.web.adapter.PhotosViewAdapter$2.onResourceReady(PhotosViewAdapter.java:115) at com.bumptech.glide.request.GenericRequest.onResourceReady(GenericRequest.java:522) at com.bumptech.glide.request.GenericRequest.onResourceReady(GenericRequest.java:507) at com.bumptech.glide.load.engine.EngineJob.handleResultOnMainThread(EngineJob.java:158) at com.bumptech.glide.load.engine.EngineJob.access$100(EngineJob.java:22) at com.bumptech.glide.load.engine.EngineJob$MainThreadCallback.handleMessage(EngineJob.java:202) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

MATRIX is not supported in PhotoView ,why?

Jawnnypoo commented 7 years ago

It already uses Matrix scale type to support zooming. What exactly is the issue here?

jaredsburrows commented 7 years ago

I am seeing this as well:

Android: O Manufacturer: Google Model: Pixel XL

java.lang.IllegalStateException: Matrix scale type is not supported
    at com.github.chrisbanes.photoview.Util.isSupportedScaleType(Util.java:29)
    at com.github.chrisbanes.photoview.PhotoViewAttacher.setScaleType(PhotoViewAttacher.java:471)
    at com.github.chrisbanes.photoview.PhotoView.setScaleType(PhotoView.java:96)
    at android.app.ActivityTransitionCoordinator.setOriginalSharedElementState(ActivityTransitionCoordinator.java:708)
    at android.app.EnterTransitionCoordinator.startSharedElementTransition(EnterTransitionCoordinator.java:418)
    at android.app.EnterTransitionCoordinator.-wrap4(Unknown Source:0)
    at android.app.EnterTransitionCoordinator$3.lambda$-android_app_EnterTransitionCoordinator$3_17809(EnterTransitionCoordinator.java:465)
    at android.app.-$Lambda$CsyQO--8YdRe5wlajUCi-L98enA$1.$m$0(Unknown Source:8)
    at android.app.-$Lambda$CsyQO--8YdRe5wlajUCi-L98enA$1.run(Unknown Source:0)
    at android.app.ActivityTransitionCoordinator.startTransition(ActivityTransitionCoordinator.java:835)
    at android.app.EnterTransitionCoordinator$3.lambda$-android_app_EnterTransitionCoordinator$3_17761(EnterTransitionCoordinator.java:464)
    at android.app.-$Lambda$CsyQO--8YdRe5wlajUCi-L98enA$2.$m$0(Unknown Source:8)
    at android.app.-$Lambda$CsyQO--8YdRe5wlajUCi-L98enA$2.run(Unknown Source:0)
    at com.android.internal.view.OneShotPreDrawListener.onPreDraw(OneShotPreDrawListener.java:78)
    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2346)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1385)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6729)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:886)
    at android.view.Choreographer.doCallbacks(Choreographer.java:698)
    at android.view.Choreographer.doFrame(Choreographer.java:633)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:872)
    at android.os.Handler.handleCallback(Handler.java:769)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6535)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Jawnnypoo commented 7 years ago

The ImageView is already setting itself to a MATRIX scale type in order to do the scaling of the image. What exactly is the issue here?

JSnader commented 6 years ago

If it is already setting the matrix scale type, it doesn't seem proper to throw an exception and crash out when the matrix is set once more. Perhaps it should be an ignore case or warning. Crashing the system to an ignorable request doesn't seem like the appropriate approach. Of course now, if they are updating the matricies then they will have to wrap each call to this around an IllegalStateException try/catch block.