WearableRecyclerView

open class WearableRecyclerView
kotlin.Any
   ↳ androidx.wear.widget.WearableRecyclerView

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

Summary

Public constructors
<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet?)

<init>(context: Context!, attrs: AttributeSet?, defStyle: Int)

<init>(context: Context!, attrs: AttributeSet?, defStyle: Int, defStyleRes: Int)

Public methods
open Unit

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

open Unit
setScrollDegreesPerScreen(degreesPerScreen: Float)

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

open Boolean

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

open Boolean

Returns whether circular scrolling is enabled for this view.

open Float

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

open Boolean

open Float

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

open Unit

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

open Unit
setCircularScrollingGestureEnabled(circularScrollingGestureEnabled: Boolean)

Enables/disables circular touch scrolling for this view.

Protected methods
open Unit

open Unit

Public constructors

<init>

WearableRecyclerView(context: Context!)

<init>

WearableRecyclerView(context: Context!, attrs: AttributeSet?)

<init>

WearableRecyclerView(context: Context!, attrs: AttributeSet?, defStyle: Int)

<init>

WearableRecyclerView(context: Context!, attrs: AttributeSet?, defStyle: Int, defStyleRes: Int)

Public methods

setBezelFraction

open fun setBezelFraction(fraction: Float): Unit

Taps within this radius and the radius of the screen are considered close enough to the bezel to be candidates for circular scrolling. Expressed as a fraction of the screen's radius. The default is the whole screen i.e 1.0f.

setScrollDegreesPerScreen

open fun setScrollDegreesPerScreen(degreesPerScreen: Float): Unit

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.

Parameters
degreesPerScreen Float: the number of degrees to rotate by to scroll through one whole height of the screen,

isEdgeItemsCenteringEnabled

open fun isEdgeItemsCenteringEnabled(): Boolean

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

isCircularScrollingGestureEnabled

open fun isCircularScrollingGestureEnabled(): Boolean

Returns whether circular scrolling is enabled for this view.

getScrollDegreesPerScreen

open fun getScrollDegreesPerScreen(): Float

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

onTouchEvent

open fun onTouchEvent(event: MotionEvent!): Boolean

getBezelFraction

open fun getBezelFraction(): Float

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

setEdgeItemsCenteringEnabled

open fun setEdgeItemsCenteringEnabled(isEnabled: Boolean): Unit

Use this method to configure the WearableRecyclerView to always align the first and last items with the vertical center of the screen. This effectively moves the start and end of the list to the middle of the screen if the user has scrolled so far. It takes the height of the children into account so that they are correctly centered.

Parameters
isEnabled Boolean: set to true if you wish to align the edge children (first and last) with the center of the screen.

setCircularScrollingGestureEnabled

open fun setCircularScrollingGestureEnabled(circularScrollingGestureEnabled: Boolean): Unit

Enables/disables circular touch scrolling for this view. When enabled, circular touch gestures around the edge of the screen will cause the view to scroll up or down. Related methods let you specify the characteristics of the scrolling, like the speed of the scroll or the are considered for the start of this scrolling gesture.

Protected methods

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onDetachedFromWindow

protected open fun onDetachedFromWindow(): Unit