Interface Swipeable

All Superinterfaces:
Proxy
All Known Implementing Classes:
BottomSheet, Carousel, Flap, Leaflet, NavigationView, OverlaySplitView, Swipeable.Swipeable$Impl

@Generated("org.javagi.JavaGI") public interface Swipeable extends Proxy

An interface for swipeable widgets.

The AdwSwipeable interface is implemented by all swipeable widgets.

See SwipeTracker for details about implementing it.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    The Swipeable$Impl type represents a native instance of the Swipeable interface.
    static class 
    An interface for swipeable widgets.
  • Method Summary

    Modifier and Type
    Method
    Description
    default double
    Gets the progress this Swipeable will snap back to after the gesture is canceled.
    default double
    Gets the swipe distance of self.
    default double
    Gets the current progress of self.
    default double[]
    Gets the snap points of self.
    default void
    getSwipeArea(NavigationDirection navigationDirection, boolean isDrag, Rectangle rect)
    Gets the area this Swipeable can start a swipe from for the given direction and gesture type.
    static @Nullable Type
    Get the GType of the Swipeable class.

    Methods inherited from interface Proxy

    handle
  • Method Details

    • getType

      static @Nullable Type getType()
      Get the GType of the Swipeable class.
      Returns:
      the GType
    • getCancelProgress

      default double getCancelProgress()
      Gets the progress this Swipeable will snap back to after the gesture is canceled.
      Returns:
      the cancel progress, unitless
    • getDistance

      default double getDistance()

      Gets the swipe distance of self.

      This corresponds to how many pixels 1 unit represents.

      Returns:
      the swipe distance in pixels
    • getProgress

      default double getProgress()
      Gets the current progress of self.
      Returns:
      the current progress, unitless
    • getSnapPoints

      default double[] getSnapPoints()

      Gets the snap points of self.

      Each snap point represents a progress value that is considered acceptable to end the swipe on.

      Returns:
      the snap points
    • getSwipeArea

      default void getSwipeArea(NavigationDirection navigationDirection, boolean isDrag, Rectangle rect)

      Gets the area this Swipeable can start a swipe from for the given direction and gesture type.

      This can be used to restrict swipes to only be possible from a certain area, for example, to only allow edge swipes, or to have a draggable element and ignore swipes elsewhere.

      If not implemented, the default implementation returns the allocation of self, allowing swipes from anywhere.

      Parameters:
      navigationDirection - the direction of the swipe
      isDrag - whether the swipe is caused by a dragging gesture
      rect - a pointer to a rectangle to store the swipe area