Sesl Immersive Scroll Behavior
AppBarLayout.Behavior that coordinates "immersive scroll" between an AppBarLayout and the system bars (status/navigation bars) on Android R+.
When immersive scroll is enabled (via seslIsActivatedImmsersiveScroll), this behavior requests a WindowInsetsAnimationController from the WindowInsetsController and drives it based on AppBarLayout offset changes. This allows the app bar collapsing/expanding motion to be synchronized with showing/hiding system bars, and also translates any optional bottom overlay view (see setBottomView).
When immersive scroll is disabled
- If accessibility touch exploration is enabled.
- If a mouse is used to scroll.
- If the device is in DeX mode.
- If the activity is in multi-window mode.
- If a custom WindowInsetsAnimation.Callback is set via setWindowInsetsAnimationCallback.
This class is a SESL/Samsung extension and relies on platform APIs such as WindowInsetsAnimationController.
Functions
Link copied to clipboard
Cancels any in-progress insets animation control request and finishes the controller.
Link copied to clipboard
Link copied to clipboard
Re-evaluates whether immersive scroll can run and applies any related configuration.
Link copied to clipboard
Finishes the current WindowInsetsAnimationController based on its current insets.
Link copied to clipboard
Forces system bars to be shown if they are hidden or if the app bar is currently hidden.
Link copied to clipboard
Link copied to clipboard
open fun initImmViews(@NonNull coordinatorLayout: CoordinatorLayout, @NonNull appBarLayout: AppBarLayout)
Initializes references to the relevant views (decor/content/system bar backgrounds) and hooks offset/insets callbacks.
Link copied to clipboard
Link copied to clipboard
Returns whether the device is using gesture navigation.
Link copied to clipboard
open fun layoutChild(@NonNull parent: CoordinatorLayout, @NonNull child: AppBarLayout, layoutDirection: Int)
Link copied to clipboard
Notifies the behavior that window insets have been applied/changed.
Link copied to clipboard
Notifies the behavior that the associated app bar has been detached.
Link copied to clipboard
open fun onInterceptTouchEvent(@NonNull coordinatorLayout: CoordinatorLayout, @NonNull appBarLayout: AppBarLayout, @NonNull motionEvent: MotionEvent): Boolean
Link copied to clipboard
open fun onMeasureChild(@NonNull parent: CoordinatorLayout, @NonNull child: AppBarLayout, parentWidthMeasureSpec: Int, widthUsed: Int, parentHeightMeasureSpec: Int, heightUsed: Int): Boolean
Link copied to clipboard
open fun onNestedPreScroll(parent: CoordinatorLayout, @NonNull child: AppBarLayout, target: View, dx: Int, dy: Int, consumed: Array<Int>, type: Int)
Link copied to clipboard
open fun onNestedScroll(@NonNull coordinatorLayout: CoordinatorLayout, @NonNull appBarLayout: AppBarLayout, @NonNull target: View, dxConsumed: Int, i2: Int, i3: Int, dyUnconsumed: Int, type: Int, @NonNull consumed: Array<Int>)
Link copied to clipboard
open fun onStartNestedScroll(@NonNull coordinatorLayout: CoordinatorLayout, @NonNull appBarLayout: AppBarLayout, @NonNull view: View, @NonNull view2: View, i: Int, i2: Int): Boolean
Link copied to clipboard
open fun onStopNestedScroll(coordinatorLayout: CoordinatorLayout, @NonNull appBarLayout: AppBarLayout, view: View, i: Int)
Link copied to clipboard
Restores (shows) the top and bottom areas after they have been hidden by immersive scroll.
Link copied to clipboard
Enables/disables automatic restoration when system bars become controllable again.
Link copied to clipboard
Sets an optional bottom overlay view that should translate together with the navigation bar.
Link copied to clipboard
Applies the default shown-state insets to the active WindowInsetsAnimationController.
Link copied to clipboard
Controls whether the behavior should adjust the bottom view translation using current navigation bar insets when immersive scroll is disabled.
Link copied to clipboard
Restores
decorFitsSystemWindows when immersive scroll has been detached/disabled.Link copied to clipboard
open fun setWindowInsetsAnimationCallback(@NonNull appBarLayout: AppBarLayout, @Nullable callback: WindowInsetsAnimation.Callback)
Sets a custom WindowInsetsAnimation.Callback on the content view.