The Android Developer Challenge is back! Submit your idea before December 2.

WearableRecyclerView

open class WearableRecyclerView : RecyclerView
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ androidx.recyclerview.widget.RecyclerView
   ↳ androidx.wear.widget.WearableRecyclerView

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

Summary

Inherited constants

Public constructors

<init>(context: Context!)

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

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

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

Public methods

open Float

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

open Float

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

open Boolean

Returns whether circular scrolling is enabled for this view.

open Boolean

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

open Boolean

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
setCircularScrollingGestureEnabled(circularScrollingGestureEnabled: Boolean)

Enables/disables circular touch scrolling for this view.

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
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.

Protected methods

open Unit

open Unit

Inherited functions

Public constructors

<init>

WearableRecyclerView(context: Context!)

<init>

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

<init>

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

<init>

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

Public methods

getBezelFraction

open fun getBezelFraction(): Float

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

getScrollDegreesPerScreen

open fun getScrollDegreesPerScreen(): Float

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

isCircularScrollingGestureEnabled

open fun isCircularScrollingGestureEnabled(): Boolean

Returns whether circular scrolling is enabled for this view.

isEdgeItemsCenteringEnabled

open fun isEdgeItemsCenteringEnabled(): Boolean

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

onTouchEvent

open fun onTouchEvent(event: MotionEvent!): Boolean

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.

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.

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.

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,

Protected methods

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onDetachedFromWindow

protected open fun onDetachedFromWindow(): Unit