Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mGestureDetector = new GestureDetector(getActivity(), new GestureDetector.SimpleOnGestureListener() {
- public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
- Log.i(LOG_TAG, "flip gesture");
- try {
- Log.i(LOG_TAG, "e1: " + e1.toString() + " || e2: " + e2.toString());
- if(velocityY > -500 && velocityY < 500) {
- if(velocityX < 0) {
- //flip from right to left
- Log.i(LOG_TAG, "flip gesture, right to left");
- mViewFlipper.showNext();
- return true;
- } else if(velocityX > 0) {
- //flip from left to right
- Log.i(LOG_TAG, "flip gesture, left to right");
- mViewFlipper.showPrevious();
- return true;
- }
- }
- } catch(Exception e) {
- Log.d(LOG_TAG, "wow... this is bad, something went wrong with paging gestures");
- }
- return false;
- }
- public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
- Log.i(LOG_TAG, "scroll gesture");
- return false;
- }
- public boolean onDown(MotionEvent e) {
- Log.i(LOG_TAG, "Down: "+e.toString());
- return false;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement