-
- All Implemented Interfaces:
-
android.view.View.OnTouchListener
public final class InsetsAnimationTouchListener implements View.OnTouchListener
A View.OnTouchListener which can be set on a scrolling view, to control the IME inset and visibility. When set on a view, it will track drag gestures and trigger a request to control the IME insets via SimpleImeAnimationController.startControlRequest once the user is dragging the view.
Once in control, the listener will inset the IME in/off screen based on the user's scroll position, using SimpleImeAnimationController.insetBy.
This class should not be used in conjunction with scrolling views, such as androidx.recyclerview.widget.RecyclerView. For these views, prefer to use InsetsAnimationLinearLayout which uses the much richer nested scrolling APIs to detect and consume scrolling, overscrolling, and flinging interactions.
The class supports both animating the IME onto screen (from not visible), and animating it off-screen (from visible). This can be customize through the scrollImeOnScreenWhenNotVisible and scrollImeOffScreenWhenVisible constructor parameters.
This class is not actually used in the sample, but is left here as an example of how to implement a View.OnTouchListener with SimpleImeAnimationController.
-
-
Constructor Summary
Constructors Constructor Description InsetsAnimationTouchListener(Boolean scrollImeOffScreenWhenVisible, Boolean scrollImeOnScreenWhenNotVisible)
-
Method Summary
Modifier and Type Method Description BooleanonTouch(View v, MotionEvent event)-
-
Constructor Detail
-
InsetsAnimationTouchListener
InsetsAnimationTouchListener(Boolean scrollImeOffScreenWhenVisible, Boolean scrollImeOnScreenWhenNotVisible)
- Parameters:
scrollImeOffScreenWhenVisible- Whether the IME should be scrolled off screen (from being visible), by an downwards scroll.scrollImeOnScreenWhenNotVisible- Whether the IME should be scrolled on screen (from not being visible), by an downwards scroll.
-
-
Method Detail
-
onTouch
Boolean onTouch(View v, MotionEvent event)
-
-
-
-