WearableRecyclerView

public class WearableRecyclerView extends RecyclerView implements ScrollingView, NestedScrollingChild, NestedScrollingChild2, NestedScrollingChild, NestedScrollingChild2, NestedScrollingChild3

Object
   ↳ RecyclerView
     ↳ WearableRecyclerView

Wearable specific implementation of the RecyclerView enabling circular scrolling} and semi-circular layouts.

See also
setCircularScrollingGestureEnabled

#setCircularScrollingGestureEnabled(boolean)

Summary

Public constructors

WearableRecyclerView(
    @NonNull Context context,
    @Nullable AttributeSet attrs
)
WearableRecyclerView(
    @NonNull Context context,
    @Nullable AttributeSet attrs,
    @NonNull int defStyle
)
WearableRecyclerView(
    @NonNull Context context,
    @Nullable AttributeSet attrs,
    @NonNull int defStyle,
    @NonNull int defStyleRes
)

Public methods

@NonNull float

Returns the current bezel width for circular scrolling as a fraction of the screen's radius.

@NonNull float

Returns how many degrees does the user have to rotate for to scroll through one screen height.

@NonNull boolean

Returns whether circular scrolling is enabled for this view.

@NonNull boolean

Returns whether the view is currently configured to center the edge children.

@Override @NonNull boolean
@NonNull void
setBezelFraction(@NonNull float fraction)

Taps within this radius and the radius of the screen are considered close enough to the bezel to be candidates for circular scrolling.

@NonNull void
setCircularScrollingGestureEnabled(
    @NonNull boolean circularScrollingGestureEnabled
)

Enables/disables circular touch scrolling for this view.

@NonNull void

Use this method to configure the WearableRecyclerView on round watches to always align the first and last items with the vertical center of the screen.

@NonNull void
setScrollDegreesPerScreen(@NonNull float degreesPerScreen)

Sets how many degrees the user has to rotate by to scroll through one screen height when they are using the circular scrolling gesture.The default value equates 180 degrees scroll to one screen.

Inherited methods

From class NestedScrollingChild
abstract @NonNull boolean
dispatchNestedPreScroll(
    @NonNull int dx,
    @NonNull int dy,
    @Nullable Array<@NonNull int> consumed,
    @Nullable Array<@NonNull int> offsetInWindow
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

abstract @NonNull boolean
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @Nullable Array<@NonNull int> offsetInWindow
)

Dispatch one step of a nested scroll in progress.

abstract @NonNull boolean

Begin a nestable scroll operation along the given axes.

From class NestedScrollingChild2
abstract @NonNull boolean
dispatchNestedPreScroll(
    @NonNull int dx,
    @NonNull int dy,
    @Nullable Array<@NonNull int> consumed,
    @Nullable Array<@NonNull int> offsetInWindow,
    @ViewCompat.NestedScrollType @NonNull int type
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

abstract @NonNull boolean
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @Nullable Array<@NonNull int> offsetInWindow,
    @ViewCompat.NestedScrollType @NonNull int type
)

Dispatch one step of a nested scroll in progress.

abstract @NonNull boolean

Returns true if this view has a nested scrolling parent for the given input type.

abstract @NonNull boolean

Begin a nestable scroll operation along the given axes, for the given input type.

abstract @NonNull void

Stop a nested scroll in progress for the given input type.

From class NestedScrollingChild3
abstract @NonNull void
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @Nullable Array<@NonNull int> offsetInWindow,
    @ViewCompat.NestedScrollType @NonNull int type,
    @NonNull Array<@NonNull int> consumed
)

Dispatch one step of a nested scroll in progress.

From class RecyclerView
@Override @NonNull void
addFocusables(
    @NonNull ArrayList<@NonNull View> views,
    @NonNull int direction,
    @NonNull int focusableMode
)
@NonNull void

Add an ItemDecoration to this RecyclerView.

@NonNull void
addItemDecoration(
    @NonNull RecyclerView.ItemDecoration decor,
    @NonNull int index
)

Add an ItemDecoration to this RecyclerView.

@NonNull void

Register a listener that will be notified whenever a child view is attached to or detached from RecyclerView.

@NonNull void

Add an OnItemTouchListener to intercept touch events before they are dispatched to child views or this view's standard scrolling behavior.

@NonNull void

Add a listener that will be notified of any changes in scroll state or position.

@NonNull void

Register a listener that will be notified whenever a child view is recycled.

@NonNull void

Removes all listeners that were added via addOnChildAttachStateChangeListener.

@NonNull void

Remove all secondary listener that were notified of any changes in scroll state or position.

@Override @NonNull int

Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range.

@Override @NonNull int

Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range.

@Override @NonNull int

Compute the horizontal range that the horizontal scrollbar represents.

@Override @NonNull int

Compute the vertical extent of the vertical scrollbar's thumb within the vertical range.

@Override @NonNull int

Compute the vertical offset of the vertical scrollbar's thumb within the vertical range.

@Override @NonNull int

Compute the vertical range that the vertical scrollbar represents.

@Override @NonNull boolean
dispatchNestedFling(
    @NonNull float velocityX,
    @NonNull float velocityY,
    @NonNull boolean consumed
)
@Override @NonNull boolean
dispatchNestedPreFling(@NonNull float velocityX, @NonNull float velocityY)
@Override @NonNull boolean
dispatchNestedPreScroll(
    @NonNull int dx,
    @NonNull int dy,
    @NonNull Array<@NonNull int> consumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@Override @NonNull boolean
dispatchNestedPreScroll(
    @NonNull int dx,
    @NonNull int dy,
    @NonNull Array<@NonNull int> consumed,
    @NonNull Array<@NonNull int> offsetInWindow,
    @NonNull int type
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

@Override @NonNull boolean
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@Override @NonNull boolean
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @NonNull Array<@NonNull int> offsetInWindow,
    @NonNull int type
)

Dispatch one step of a nested scroll in progress.

final @Override @NonNull void
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @NonNull Array<@NonNull int> offsetInWindow,
    @NonNull int type,
    @NonNull Array<@NonNull int> consumed
)

Dispatch one step of a nested scroll in progress.

@Override @NonNull boolean
@Override @NonNull void
@Override @NonNull boolean
drawChild(
    @NonNull Canvas canvas,
    @NonNull View child,
    @NonNull long drawingTime
)
@Nullable View
findChildViewUnder(@NonNull float x, @NonNull float y)

Find the topmost view under the given point.

@Nullable View

Traverses the ancestors of the given view and returns the item view that contains it and also a direct child of the RecyclerView.

@Nullable RecyclerView.ViewHolder

Returns the ViewHolder that contains the given view.

@Nullable RecyclerView.ViewHolder

Return the ViewHolder for the item in the given position of the data set.

@NonNull RecyclerView.ViewHolder

Return the ViewHolder for the item with the given id.

@Nullable RecyclerView.ViewHolder

Return the ViewHolder for the item in the given position of the data set as of the latest layout pass.

@Nullable RecyclerView.ViewHolder

This method is deprecated.

use findViewHolderForLayoutPosition or findViewHolderForAdapterPosition

@NonNull boolean
fling(@NonNull int velocityX, @NonNull int velocityY)

Begin a standard fling with an initial velocity along each axis in pixels per second.

@Override @NonNull View
focusSearch(@NonNull View focused, @NonNull int direction)

Since RecyclerView is a collection ViewGroup that includes virtual children (items that are in the Adapter but not visible in the UI), it employs a more involved focus search strategy that differs from other ViewGroups.

@Override @NonNull ViewGroup.LayoutParams
@Override @NonNull CharSequence
@Nullable RecyclerView.Adapter

Retrieves the previously set adapter or null if no adapter is set.

@Override @NonNull int

Return the offset of the RecyclerView's text baseline from the its top boundary.

@NonNull int

Return the adapter position that the given child view corresponds to.

@NonNull long

Return the stable item id that the given child view corresponds to.

@NonNull int

Return the adapter position of the given child view as of the latest completed layout pass.

@NonNull int

This method is deprecated.

use getChildAdapterPosition or getChildLayoutPosition.

@NonNull RecyclerView.ViewHolder

Retrieve the ViewHolder for the given child view.

@Override @NonNull boolean

Returns whether this RecyclerView will clip its children to its padding, and resize (but not clip) any EdgeEffect to the padded region, if padding is present.

@Nullable RecyclerViewAccessibilityDelegate

Returns the accessibility delegate compatibility implementation used by the RecyclerView.

@NonNull void

Returns the bounds of the view including its decoration and margins.

@NonNull RecyclerView.EdgeEffectFactory

Retrieves the previously set EdgeEffectFactory or the default factory if nothing was set.

@Nullable RecyclerView.ItemAnimator

Gets the current ItemAnimator for this RecyclerView.

@NonNull RecyclerView.ItemDecoration

Returns an ItemDecoration previously added to this RecyclerView.

@NonNull int

Returns the number of ItemDecoration currently added to this RecyclerView.

@Nullable RecyclerView.LayoutManager

Return the LayoutManager currently responsible for layout policy for this RecyclerView.

@NonNull int

Returns the maximum fling velocity used by this RecyclerView.

@NonNull int

Returns the minimum velocity to start a fling.

@Nullable RecyclerView.OnFlingListener

Get the current OnFlingListener from this RecyclerView.

@NonNull boolean

Returns true if the RecyclerView should attempt to preserve currently focused Adapter Item's focus even if the View representing the Item is replaced during a layout calculation.

@NonNull RecyclerView.RecycledViewPool

Retrieve this RecyclerView's RecycledViewPool.

@NonNull int

Return the current scrolling state of the RecyclerView.

@NonNull boolean
@Override @NonNull boolean
@Override @NonNull boolean

Returns true if this view has a nested scrolling parent for the given input type.

@NonNull boolean

Returns whether there are pending adapter updates which are not yet applied to the layout.

@NonNull void

Invalidates all ItemDecorations.

@NonNull boolean

Returns true if RecyclerView is currently running some animations.

@Override @NonNull boolean

Returns true if RecyclerView is attached to window.

@NonNull boolean

Returns whether RecyclerView is currently computing a layout.

@NonNull boolean

This method is deprecated.

Use isLayoutSuppressed.

final @Override @NonNull boolean

Returns whether layout and scroll calls on this container are currently being suppressed, due to an earlier call to suppressLayout.

@Override @NonNull boolean
@NonNull void
nestedScrollBy(@NonNull int x, @NonNull int y)

Same as scrollBy, but also participates in nested scrolling.

@NonNull void

Offset the bounds of all child views by dx pixels.

@NonNull void

Offset the bounds of all child views by dy pixels.

@NonNull void

Called when an item view is attached to this RecyclerView.

@NonNull void

Called when an item view is detached from this RecyclerView.

@Override @NonNull void
@Override @NonNull boolean
@Override @NonNull boolean
@NonNull void

Called when the scroll state of this RecyclerView changes.

@NonNull void
onScrolled(@Px @NonNull int dx, @Px @NonNull int dy)

Called when the scroll position of this RecyclerView changes.

@NonNull void

Remove an ItemDecoration from this RecyclerView.

@NonNull void

Removes the ItemDecoration associated with the supplied index position.

@NonNull void

Removes the provided listener from child attached state listeners list.

@NonNull void

Remove an OnItemTouchListener.

@NonNull void

Remove a listener that was notified of any changes in scroll state or position.

@NonNull void

Removes the provided listener from RecyclerListener list.

@Override @NonNull void
@Override @NonNull boolean
requestChildRectangleOnScreen(
    @NonNull View child,
    @NonNull Rect rect,
    @NonNull boolean immediate
)
@Override @NonNull void
requestDisallowInterceptTouchEvent(@NonNull boolean disallowIntercept)
@Override @NonNull void
@Override @NonNull void
scrollBy(@NonNull int x, @NonNull int y)
@Override @NonNull void
scrollTo(@NonNull int x, @NonNull int y)
@NonNull void
scrollToPosition(@NonNull int position)

Convenience method to scroll to a certain position.

@Override @NonNull void
@NonNull void

Sets the accessibility delegate compatibility implementation used by RecyclerView.

@NonNull void

Set a new adapter to provide child views on demand.

@NonNull void

Sets the ChildDrawingOrderCallback to be used for drawing children.

@Override @NonNull void
setClipToPadding(@NonNull boolean clipToPadding)
@NonNull void

Set a EdgeEffectFactory for this RecyclerView.

@NonNull void
setHasFixedSize(@NonNull boolean hasFixedSize)

RecyclerView can perform several optimizations if it can know in advance that RecyclerView's size is not affected by the adapter contents.

@NonNull void

Sets the ItemAnimator that will handle animations involving changes to the items in this RecyclerView.

@NonNull void

Set the number of offscreen views to retain before adding them to the potentially shared recycled view pool.

@NonNull void
setLayoutFrozen(@NonNull boolean frozen)

This method is deprecated.

Use suppressLayout.

@NonNull void

Set the LayoutManager that this RecyclerView will use.

@Override @NonNull void

This method is deprecated.

Use setItemAnimator ()}.

@Override @NonNull void
@NonNull void

Set a OnFlingListener for this RecyclerView.

@NonNull void

This method is deprecated.

Use addOnScrollListener and removeOnScrollListener

@NonNull void
setPreserveFocusAfterLayout(@NonNull boolean preserveFocusAfterLayout)

Set whether the RecyclerView should try to keep the same Item focused after a layout calculation or not.

@NonNull void

Recycled view pools allow multiple RecyclerViews to share a common pool of scrap views.

@NonNull void

This method is deprecated.

Use addRecyclerListener and removeRecyclerListener

@NonNull void
setScrollingTouchSlop(@NonNull int slopConstant)

Configure the scrolling touch slop for a specific use case.

@NonNull void

Sets a new ViewCacheExtension to be used by the Recycler.

@NonNull void
smoothScrollBy(@Px @NonNull int dx, @Px @NonNull int dy)

Animate a scroll by the given amount of pixels along either axis.

@NonNull void
smoothScrollBy(
    @Px @NonNull int dx,
    @Px @NonNull int dy,
    @Nullable Interpolator interpolator
)

Animate a scroll by the given amount of pixels along either axis.

@NonNull void
smoothScrollBy(
    @Px @NonNull int dx,
    @Px @NonNull int dy,
    @Nullable Interpolator interpolator,
    @NonNull int duration
)

Smooth scrolls the RecyclerView by a given distance.

@NonNull void

Starts a smooth scroll to an adapter position.

@Override @NonNull boolean
@Override @NonNull boolean
startNestedScroll(@NonNull int axes, @NonNull int type)

Begin a nestable scroll operation along the given axes, for the given input type.

@Override @NonNull void
@Override @NonNull void

Stop a nested scroll in progress for the given input type.

@NonNull void

Stop any current scroll in progress, such as one started by smoothScrollBy, fling or a touch-initiated fling.

final @Override @NonNull void
suppressLayout(@NonNull boolean suppress)

Tells this RecyclerView to suppress all layout and scroll calls until layout suppression is disabled with a later call to suppressLayout(false).

@NonNull void
swapAdapter(
    @Nullable RecyclerView.Adapter adapter,
    @NonNull boolean removeAndRecycleExistingViews
)

Swaps the current adapter with the provided one.

From class View
@NonNull void
@NonNull void
@NonNull void
@NonNull ViewPropertyAnimator
@NonNull void
@NonNull void
@NonNull void
@NonNull void

This method is deprecated.

@NonNull void
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
canScrollVertically(@NonNull int direction)
final @NonNull void
@NonNull void
final @NonNull void
@NonNull boolean
@NonNull void
static @NonNull int
combineMeasuredStates(@NonNull int curState, @NonNull int newState)
@NonNull void
@NonNull WindowInsets
computeSystemWindowInsets(
    @NonNull WindowInsets in,
    @NonNull Rect outLocalInsets
)
@NonNull AccessibilityNodeInfo
@NonNull void
@NonNull void

This method is deprecated.

@NonNull boolean
@NonNull boolean
dispatchNestedFling(
    @NonNull float velocityX,
    @NonNull float velocityY,
    @NonNull boolean consumed
)
@NonNull boolean
dispatchNestedPreFling(@NonNull float velocityX, @NonNull float velocityY)
@NonNull boolean
dispatchNestedPrePerformAccessibilityAction(
    @NonNull int action,
    @NonNull Bundle arguments
)
@NonNull boolean
dispatchNestedPreScroll(
    @NonNull int dx,
    @NonNull int dy,
    @NonNull Array<@NonNull int> consumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@NonNull boolean
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@NonNull boolean
@NonNull void
draw(@NonNull Canvas canvas)
@NonNull void
drawableHotspotChanged(@NonNull float x, @NonNull float y)
final @NonNull T
<T extends View> findViewById(@NonNull int id)
final @NonNull T
<T extends View> findViewWithTag(@NonNull Object tag)
@NonNull void
forceHasOverlappingRendering(@NonNull boolean hasOverlappingRendering)
@NonNull void
static @NonNull int
@NonNull View.AccessibilityDelegate
@NonNull int
@NonNull AccessibilityNodeProvider
@NonNull CharSequence
@NonNull int
@NonNull int
@NonNull float
@NonNull Animation
@NonNull Matrix
@NonNull IBinder
@NonNull Array<@NonNull int>
@NonNull Map<@NonNull Integer, @NonNull Integer>
@NonNull Array<@NonNull String>
final @NonNull AutofillId
@NonNull int
@NonNull AutofillValue
@NonNull Drawable
@NonNull BlendMode
@NonNull ColorStateList
@NonNull PorterDuff.Mode
@NonNull int
final @NonNull int
@NonNull float
@NonNull Rect
@NonNull boolean
final @NonNull boolean
final @NonNull ContentCaptureSession
@NonNull CharSequence
final @NonNull Context
final @NonNull boolean
static @NonNull int
getDefaultSize(@NonNull int size, @NonNull int measureSpec)
@NonNull Display
final @NonNull Array<@NonNull int>
@NonNull Bitmap

This method is deprecated.

@NonNull int

This method is deprecated.

@NonNull int

This method is deprecated.

@NonNull void
@NonNull long
@NonNull float
@NonNull int
@NonNull boolean
@NonNull boolean
@NonNull int
@NonNull ArrayList<@NonNull View>
getFocusables(@NonNull int direction)
@NonNull void
@NonNull Drawable
@NonNull int
@NonNull BlendMode
@NonNull ColorStateList
@NonNull PorterDuff.Mode
@NonNull boolean
@NonNull Handler
final @NonNull boolean
final @NonNull int
@NonNull void
@NonNull int
@NonNull Drawable
@NonNull Drawable
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull boolean
@NonNull KeyEvent.DispatcherState
@NonNull int
@NonNull int
@NonNull int
@NonNull ViewGroup.LayoutParams
final @NonNull int
final @NonNull boolean
@NonNull void
@NonNull void
@NonNull void
@NonNull Matrix
final @NonNull int
final @NonNull int
final @NonNull int
final @NonNull int
final @NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull View.OnFocusChangeListener
@NonNull int
@NonNull ViewOutlineProvider
@NonNull int
@NonNull int
@NonNull ViewOverlay
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
final @NonNull ViewParent
@NonNull ViewParent
@NonNull float
@NonNull float
@NonNull PointerIcon
@NonNull Resources
final @NonNull boolean
final @NonNull int
@NonNull View
@NonNull WindowInsets
@NonNull float
@NonNull float
@NonNull float
@NonNull float
@NonNull float
@NonNull int
@NonNull int
@NonNull int
@NonNull int
@NonNull int
final @NonNull int
final @NonNull int
@NonNull int
@NonNull int
final @NonNull CharSequence
@NonNull StateListAnimator
@NonNull List<@NonNull Rect>
@NonNull int

This method is deprecated.

@NonNull Object
@NonNull int
@NonNull int
@NonNull CharSequence
final @NonNull int
@NonNull TouchDelegate
@NonNull ArrayList<@NonNull View>
@NonNull float
@NonNull String
@NonNull float
@NonNull float
@NonNull float
@NonNull long
@NonNull int
@NonNull int
@NonNull Drawable
@NonNull Drawable
@NonNull int
@NonNull ViewTreeObserver
@NonNull int
final @NonNull int
@