-
abstract class SwipeDirectionDetector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumSwipeDirectionDetector.Direction
-
Constructor Summary
Constructors Constructor Description SwipeDirectionDetector(Context context)
-
Method Summary
Modifier and Type Method Description abstract voidonDirectionDetected(SwipeDirectionDetector.Direction direction)booleanonTouchEvent(MotionEvent event)SwipeDirectionDetector.DirectiongetDirection(float x1, float y1, float x2, float y2)Given two points in the plane p1=(x1, x2) and p2=(y1, y1), this methodreturns the direction that an arrow pointing from p1 to p2 would have. doublegetAngle(float x1, float y1, float x2, float y2)Finds the angle between two points in the plane (x1,y1) and (x2, y2)The angle is measured with 0/360 being the X-axis to the right, anglesincrease counter clockwise. -
-
Constructor Detail
-
SwipeDirectionDetector
SwipeDirectionDetector(Context context)
-
-
Method Detail
-
onDirectionDetected
abstract void onDirectionDetected(SwipeDirectionDetector.Direction direction)
-
onTouchEvent
boolean onTouchEvent(MotionEvent event)
-
getDirection
SwipeDirectionDetector.Direction getDirection(float x1, float y1, float x2, float y2)
Given two points in the plane p1=(x1, x2) and p2=(y1, y1), this methodreturns the direction that an arrow pointing from p1 to p2 would have.
- Parameters:
x1- the x position of the first pointy1- the y position of the first pointx2- the x position of the second pointy2- the y position of the second point
-
getAngle
double getAngle(float x1, float y1, float x2, float y2)
Finds the angle between two points in the plane (x1,y1) and (x2, y2)The angle is measured with 0/360 being the X-axis to the right, anglesincrease counter clockwise.
- Parameters:
x1- the x position of the first pointy1- the y position of the first pointx2- the x position of the second pointy2- the y position of the second point
-
-
-
-