I want to implement filters on bitmap images, for example, on facebook, which apply filters to the image using gestures left or right. How to do it? I use this code to detect left and right gestures.
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
x1 = event.getX();
break;
case MotionEvent.ACTION_UP:
x2 = event.getX();
float deltaX = x2 - x1;
if (Math.abs(deltaX) > MIN_DISTANCE) {
if (x2 > x1) {
Toast.makeText(this, "Left to Right swipe [Next]", Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(this, "Right to Left swipe [Previous]", Toast.LENGTH_SHORT).show();
}
} else {
}
break;
}
return super.onTouchEvent(event);
}
source
share