Skip to content

Instantly share code, notes, and snippets.

@yava555
Last active December 14, 2015 23:39
Show Gist options
  • Save yava555/5167328 to your computer and use it in GitHub Desktop.
Save yava555/5167328 to your computer and use it in GitHub Desktop.
LeftToRightFinishGesture [Android] [Carbon App]
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