Android Open Source - TouchImageView Extended View Pager






From Project

Back to project page TouchImageView.

License

The source code is released under:

opyright (c) 2012 Michael Ortiz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softw...

If you think the Android project TouchImageView 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 com.ortiz.touch;
/*from   w ww .j ava2s  .  c o  m*/
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;


public class ExtendedViewPager extends ViewPager {

  public ExtendedViewPager(Context context) {
      super(context);
  }
  
  public ExtendedViewPager(Context context, AttributeSet attrs) {
      super(context, attrs);
  }
  
  @Override
  protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
      if (v instanceof TouchImageView) {
        //
        // canScrollHorizontally is not supported for Api < 14. To get around this issue,
        // ViewPager is extended and canScrollHorizontallyFroyo, a wrapper around
        // canScrollHorizontally supporting Api >= 8, is called.
        //
          return ((TouchImageView) v).canScrollHorizontallyFroyo(-dx);
          
      } else {
          return super.canScroll(v, checkV, dx, x, y);
      }
  }

}




Java Source Code List

com.ortiz.touch.ExtendedViewPager.java
com.ortiz.touch.MainActivity.java
com.ortiz.touch.MirroringExampleActivity.java
com.ortiz.touch.SingleTouchImageViewActivity.java
com.ortiz.touch.SwitchImageExampleActivity.java
com.ortiz.touch.SwitchScaleTypeExampleActivity.java
com.ortiz.touch.TouchImageView.java
com.ortiz.touch.ViewPagerExampleActivity.java