Android Open Source - Dust514SkirmishMaps Hacky View Pager






From Project

Back to project page Dust514SkirmishMaps.

License

The source code is released under:

Apache License

If you think the Android project Dust514SkirmishMaps 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

package net.skink.dustmapsactivity;
//www.j a v a 2  s  . co m
import android.content.Context;
import android.support.v4.view.ViewPager;
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.
 * 
 * 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);
  }

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

}




Java Source Code List

net.skink.dustmapactivity.AshlandActivity.java
net.skink.dustmapactivity.HackyViewPager.java
net.skink.dustmapactivity.IronDeltaActivity.java
net.skink.dustmapactivity.LauncherActivity.java
net.skink.dustmapactivity.LineHarvestActivity.java
net.skink.dustmapactivity.ManusPeakActivity.java
net.skink.dustmapactivity.SkimJunctionActivity.java
net.skink.dustmapactivity.SpineCrescentActivity.java
net.skink.dustmapsactivity.AshlandActivity.java
net.skink.dustmapsactivity.HackyViewPager.java
net.skink.dustmapsactivity.IronDeltaActivity.java
net.skink.dustmapsactivity.LauncherActivity.java
net.skink.dustmapsactivity.LineHarvestActivity.java
net.skink.dustmapsactivity.ManusPeakActivity.java
net.skink.dustmapsactivity.SkimJunctionActivity.java
net.skink.dustmapsactivity.SpineCrescentActivity.java