Last active
December 14, 2015 23:39
-
-
Save yava555/5167328 to your computer and use it in GitHub Desktop.
LeftToRightFinishGesture [Android] [Carbon App]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dl.utils; | |
import android.app.Activity; | |
import android.view.GestureDetector.SimpleOnGestureListener; | |
import android.view.MotionEvent; | |
import java.io.PrintStream; | |
public class LeftToRightFinishGesture extends GestureDetector.SimpleOnGestureListener | |
{ | |
private Activity mActivity; | |
public LeftToRightFinishGesture(Activity paramActivity) | |
{ | |
this.mActivity = paramActivity; | |
} | |
public boolean onFling(MotionEvent paramMotionEvent1, MotionEvent paramMotionEvent2, float paramFloat1, float paramFloat2) | |
{ | |
System.out.println("LeftToRightGesture: Fling"); | |
if ((paramMotionEvent1 != null) && (paramMotionEvent2 != null) && (paramMotionEvent2.getRawX() - paramMotionEvent1.getRawX() > 150.0F)) | |
this.mActivity.finish(); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment