1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
private ImageView splash; //init dans la fct onCreate de la classe parent et récupéré depuis le constructeur de la classe GestureListener
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
float res = e2.getX() - e1.getX();
if (res > 0f)
rotateRight();
return true;
}
private void rotateRight()
{
Animation a = AnimationUtils.loadAnimation(parent, R.anim.rotate_right);
splash.startAnimation(a);
Matrix mat = new Matrix();
mat.setRotate(deg);
Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(), bMap.getHeight(), mat, true);
System.out.println("bMap taile : "+bMap.getWidth()+" "+bMap.getHeight());
System.out.println("bMapRotate taile : "+bMapRotate.getWidth()+" "+bMapRotate.getHeight());
splash.setImageBitmap(bMapRotate);
if (deg >= 360f)
deg = 45f;
else
deg += 45f;
} |
Partager