Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinch to zoom #46

Open
Tivoyagefeak opened this issue Mar 31, 2017 · 1 comment
Open

Pinch to zoom #46

Tivoyagefeak opened this issue Mar 31, 2017 · 1 comment
Labels

Comments

@Tivoyagefeak
Copy link

Tivoyagefeak commented Mar 31, 2017

Hey,
First: Thanks for your awesome library. It really helps a lot. But I have a strange error and dont know how to handle it. My initialization of the scrollviewGallery happens after a doubletap, recongized by a TouchListener. Then I simply add the bitmaps, enable zoom and request the SupportedFragmentManager:

case MotionEvent.ACTION_DOWN:

                    if(mTime != 0f && System.currentTimeMillis() - mTime<160f){
                        Log.d(TAG,"doubletap");
                        List<MediaInfo> infos = new ArrayList<>(mBitmaps.size());
                        for(Bitmap b : mBitmaps){
                            infos.add(MediaInfo.mediaLoader(new DefaultImageLoader(b)));
                        }
                       scrollGalleryView.setThumbnailSize(100)
                                .setZoom(true)
                                .setFragmentManager(getActivity().getSupportFragmentManager())
                                .addMedia(infos);
                        //scrollGalleryView.bringToFront();
                        scrollGalleryView.setVisibility(View.VISIBLE);
                        singleViewContainer.setVisibility(View.GONE);
                        mTime = System.currentTimeMillis();
                        break;
                    }else{
                        mTime = System.currentTimeMillis();
                    }
                    mScrollView.setScrollingEnabled(false);
                    lastImagePosition = event.getX();
                    break;

The Gallery shows up, but if I perform a "pinch to zoom" action, I get an Exception with:

03-31 17:46:56.893 12711-12711/de.reno.app E/AndroidRuntime: FATAL EXCEPTION: main Process: de.reno.app, PID: 12711 java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 at android.support.v4.widget.ViewDragHelper.saveLastMotion(ViewDragHelper.java:849) at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1057) at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1438) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2175) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:413) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1808) at android.app.Activity.dispatchTouchEvent(Activity.java:3061) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:63) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:375) at android.view.View.dispatchPointerEvent(View.java:10243) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4438) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4306) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3853) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3906) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3872) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3999) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3880) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4056) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3853) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3906) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3872) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3880) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3853) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6246) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6220) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6181) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6349) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176) at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6320) at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6372) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:615) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) 03-31 17:46:56.893 12711-12711/de.reno.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Do you have any idea how I can handle the pinch to zoom gesture?

@Tivoyagefeak
Copy link
Author

And with "handle" I mean block or exclude the pinch to zoom :)

@VEINHORN VEINHORN changed the title pinch to zoom Pinch to zoom Feb 6, 2018
@VEINHORN VEINHORN added the bug label Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants