Class ShadowWindowManagerGlobal.PredictiveBackGesture

java.lang.Object
org.robolectric.shadows.ShadowWindowManagerGlobal.PredictiveBackGesture
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
ShadowWindowManagerGlobal

public static final class ShadowWindowManagerGlobal.PredictiveBackGesture extends Object implements Closeable
Ongoing predictive back gesture.

Start a predictive back gesture by calling ShadowWindowManagerGlobal.startPredictiveBackGesture(int). One or more drag progress events can be dispatched by calling moveBy(float, float). The gesture must be ended by either calling cancel() or close(), if cancel() is called a subsequent call to close() will do nothing to allow using the gesture in a try with resources statement:

 try (PredictiveBackGesture backGesture =
     ShadowWindowManagerGlobal.startPredictiveBackGesture(BackEvent.EDGE_LEFT)) {
   backGesture.moveBy(10, 10);
 }
 
  • Method Details

    • moveBy

      public void moveBy(float dx, float dy)
      Dispatches drag progress for a predictive back gesture.
    • cancel

      public void cancel()
      Cancels the back gesture.
    • close

      public void close()
      Ends the back gesture. If the back gesture has not been cancelled by calling cancel() then the back handler is invoked.

      Callers should always call either cancel() or close(). It is recommended to use the result of ShadowWindowManagerGlobal.startPredictiveBackGesture(int) in a try with resources.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable