1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| private class GestureListener extends SimpleOnGestureListener {
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
Intent intent = new Intent(Accueil.this, JeuxDeRole.class);
startActivity(intent);
overridePendingTransition(R.anim.translate_in_droite_gauche, R.anim.translate_out_droite_gauche);
return false; // droite gauche
} else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
Intent intent = new Intent(Accueil.this, A_propos.class);
startActivity(intent);
overridePendingTransition(R.anim.translate_in_gauche_droite, R.anim.translate_out_gauche_droite);
return false; // gauche droite
}
return false;
}
} |
Partager