Back to project page Android-Photo-Zoom.
The source code is released under:
Apache License
If you think the Android project Android-Photo-Zoom listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.blocker.photo; /*from w ww . j ava 2s . co m*/ import com.blocker.photo.ImageAdapter.SamplePagerAdapter; import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.ViewGroup; /** * Hacky fix for Issue #4 and * http://code.google.com/p/android/issues/detail?id=18990 * * ScaleGestureDetector seems to mess up the touch events, which means that * ViewGroups which make use of onInterceptTouchEvent throw a lot of * IllegalArgumentException: pointerIndex out of range. * * There's not much I can do in my code for now, but we can mask the result by * just catching the problem and ignoring it. * * @author Chris Banes */ 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; } catch (ArrayIndexOutOfBoundsException e) { e.printStackTrace(); return false; } } }