Skip to content

Commit

Permalink
Support for ViewPager
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeOrtiz committed Dec 19, 2013
1 parent 7f2cc4d commit 0fb9272
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/com/example/touch/TouchImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,24 @@ private void setState(State state) {
this.state = state;
}

@Override
public boolean canScrollHorizontally(int direction) {
matrix.getValues(m);
float x = m[Matrix.MTRANS_X];

if (getImageWidth() < viewWidth) {
return false;

} else if (x >= -1 && direction < 0) {
return false;

} else if (Math.abs(x) + viewWidth + 1 >= getImageWidth() && direction > 0) {
return false;
}

return true;
}

/**
* Gesture Listener detects a single click or long click and passes that on
* to the view's listener.
Expand Down

0 comments on commit 0fb9272

Please sign in to comment.