So, I have a GestureDetector, but it all shows the "Deprecated Constructor" in Eclipse ..
I use it to detect flings, and it works fine, but I cannot find a parallel constructor. All this is out of date. What am I going to?
Anyway, here is the code:
mGestureDetector = new GestureDetector(
new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2,
float velocityX, float velocityY) {
Direction mCommandedRollDirection = Direction.NONE;
if (Math.abs(velocityX) > Math.abs(velocityY)) {
if (velocityX < 0)
mCommandedRollDirection = Direction.LEFT;
else
mCommandedRollDirection = Direction.RIGHT;
} else {
if (velocityY < 0)
mCommandedRollDirection = Direction.UP;
else
mCommandedRollDirection = Direction.DOWN;
}
if (mCommandedRollDirection != Direction.NONE) {
mGameEngine.rollBall(mCommandedRollDirection);
}
return true;
}
});
mGestureDetector.setIsLongpressEnabled(false);
}
Clearly, I need the same functionality. So, what new features do I need to add (if any) and which constructor do I need to use?
(Yes, I know about Android dev docs, but, as I said, I have problems finding a newer version of what is called the "GestureDetector")
Thanks!
source
share