If you think the Android project campus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*******************************************************************************
* Copyright 2013 Tomasz Zawada/*fromwww.java2s.com*/
*
* Based on the excellent PhotoView by Chris Banes:
* https://github.com/chrisbanes/PhotoView
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/package lecho.app.campus.view;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* 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.
*
* Also the android.support.v4.view.MotionEventCompatEclair.getX() throws some
* java.lang.ArrayIndexOutOfBoundsException exceptions which seems like a bug.
*/publicclass ZoomViewPager extends ViewPager {
public ZoomViewPager(Context context) {
super(context);
}
public ZoomViewPager(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
@Override
publicboolean onInterceptTouchEvent(MotionEvent event) {
try {
return super.onInterceptTouchEvent(event);
} catch (Exception e) {
return false;
}
}
@Override
publicboolean onTouchEvent(MotionEvent event) {
try {
return super.onTouchEvent(event);
} catch (Exception e) {
return false;
}
}
}