photo / mobile-android

Trovebox mobile application for Android
Apache License 2.0
120 stars 64 forks source link

Crash on use of PinchZoom #457

Closed ghost closed 11 years ago

ghost commented 11 years ago

Using the Pinch Zoom, sometimes occurred this crash:

09-12 14:22:55.705: E/AndroidRuntime(21738): FATAL EXCEPTION: main 09-12 14:22:55.705: E/AndroidRuntime(21738): java.lang.IllegalArgumentException: pointerIndex out of range 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.MotionEvent.nativeGetAxisValue(Native Method) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.MotionEvent.getX(MotionEvent.java:1979) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:91) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:219) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1834) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1852) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2209) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1952) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2209) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1952) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2209) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1952) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2209) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1952) 09-12 14:22:55.705: E/AndroidRuntime(21738): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1966) 09-12 14:22:55.705: E/AndroidRuntime(21738): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1418) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.app.Activity.dispatchTouchEvent(Activity.java:2424) 09-12 14:22:55.705: E/AndroidRuntime(21738): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1914) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.View.dispatchPointerEvent(View.java:7564) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3883) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3778) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5419) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5399) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5370) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5493) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:182) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:174) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5472) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5512) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.Choreographer.doCallbacks(Choreographer.java:562) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.Choreographer.doFrame(Choreographer.java:530) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.os.Handler.handleCallback(Handler.java:730) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.os.Handler.dispatchMessage(Handler.java:92) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.os.Looper.loop(Looper.java:137) 09-12 14:22:55.705: E/AndroidRuntime(21738): at android.app.ActivityThread.main(ActivityThread.java:5103) 09-12 14:22:55.705: E/AndroidRuntime(21738): at java.lang.reflect.Method.invokeNative(Native Method) 09-12 14:22:55.705: E/AndroidRuntime(21738): at java.lang.reflect.Method.invoke(Method.java:525) 09-12 14:22:55.705: E/AndroidRuntime(21738): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteIni

httpdispatch commented 11 years ago

What app version do you use? Does this exception crash app? Very weird because we use PhotoView HackyViewPager from here https://github.com/chrisbanes/PhotoView/issues/31 so exception should be catched.

ghost commented 11 years ago

Solved, Thanks.

Suggestion for HackyViewPager, a new constructor to use the findViewById method:

public class HackyViewPager extends ViewPager {

public HackyViewPager(Context context) {
    super(context);
}

public HackyViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
}

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    try {
        return super.onInterceptTouchEvent(ev);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        return false;
    }
}

}

ghost commented 11 years ago

The problema are not solved. Using the Hacky ViewPager, and the last version, in a Android 2.3.6 device... the problem persists...

httpdispatch commented 11 years ago

@felipepx i can't understand do you use modified source code or you receive crashes on the clean build?

ghost commented 11 years ago

https://github.com/chrisbanes/PhotoView/issues/31