BackEvent
public
final
class
BackEvent
extends Object
| java.lang.Object | |
| ↳ | android.window.BackEvent |
Object used to report back gesture progress. Holds information about the touch event, swipe direction and the animation progress that predictive back animations should seek to.
Summary
Constants | |
|---|---|
int |
EDGE_LEFT
Indicates that the edge swipe starts from the left edge of the screen |
int |
EDGE_RIGHT
Indicates that the edge swipe starts from the right edge of the screen |
Public constructors | |
|---|---|
BackEvent(float touchX, float touchY, float progress, int swipeEdge)
Creates a new |
|
Public methods | |
|---|---|
float
|
getProgress()
Returns a value between 0 and 1 on how far along the back gesture is. |
int
|
getSwipeEdge()
Returns the screen edge that the swipe starts from. |
float
|
getTouchX()
Returns the absolute X location of the touch point, or NaN if the event is from a button press. |
float
|
getTouchY()
Returns the absolute Y location of the touch point, or NaN if the event is from a button press. |
String
|
toString()
Returns a string representation of the object. |
Inherited methods | |
|---|---|
Constants
EDGE_LEFT
public static final int EDGE_LEFT
Indicates that the edge swipe starts from the left edge of the screen
Constant Value: 0 (0x00000000)
EDGE_RIGHT
public static final int EDGE_RIGHT
Indicates that the edge swipe starts from the right edge of the screen
Constant Value: 1 (0x00000001)
Public constructors
BackEvent
public BackEvent (float touchX,
float touchY,
float progress,
int swipeEdge)
Creates a new BackMotionEvent instance.
| Parameters | |
|---|---|
touchX |
float: Absolute X location of the touch point of this event. |
touchY |
float: Absolute Y location of the touch point of this event. |
progress |
float: Value between 0 and 1 on how far along the back gesture is. |
swipeEdge |
int: Indicates which edge the swipe starts from.
Value is EDGE_LEFT, or EDGE_RIGHT |
Public methods
getProgress
public float getProgress ()
Returns a value between 0 and 1 on how far along the back gesture is. This value is driven by the horizontal location of the touch point, and should be used as the fraction to seek the predictive back animation with. Specifically,
- The progress is 0 when the touch is at the starting edge of the screen (left or right), and animation should seek to its start state.
- The progress is approximately 1 when the touch is at the opposite side of the screen, and animation should seek to its end state. Exact end value may vary depending on screen size.
| Returns | |
|---|---|
float |
Value is between 0 and 1 inclusive |
getSwipeEdge
public int getSwipeEdge ()
Returns the screen edge that the swipe starts from.
| Returns | |
|---|---|
int |
Value is EDGE_LEFT, or EDGE_RIGHT |
getTouchX
public float getTouchX ()
Returns the absolute X location of the touch point, or NaN if the event is from a button press.
| Returns | |
|---|---|
float |
|
getTouchY
public float getTouchY ()
Returns the absolute Y location of the touch point, or NaN if the event is from a button press.
| Returns | |
|---|---|
float |
|
toString
public String toString ()
Returns a string representation of the object. In general, the
toString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
| Returns | |
|---|---|
String |
a string representation of the object. |