belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
Parallax
public
abstract
class
Parallax
extends Object
java.lang.Object | |
↳ | android.support.v17.leanback.widget.Parallax<PropertyT extends android.util.Property> |
Parallax tracks a list of dynamic Property
s typically representing foreground UI
element positions on screen. Parallax keeps a list of ParallaxEffect
objects which define
rules to mapping property values to ParallaxTarget
.
Example:
// when Property "var1" changes from 15 to max value, perform parallax effect to
// change myView's translationY from 0 to 100.
Parallax
To create a ParallaxEffect
, user calls addEffect(PropertyMarkerValue[])
with a
list of Parallax.PropertyMarkerValue
which defines the range of Parallax.IntProperty
or
Parallax.FloatProperty
. Then user adds ParallaxTarget
into
ParallaxEffect
.
App may subclass Parallax.IntProperty
or Parallax.FloatProperty
to supply
additional information about how to retrieve Property value. RecyclerViewParallax
is
a great example of Parallax implementation tracking child view positions on screen.
- Restrictions of properties
- FloatProperty and IntProperty cannot be mixed in one Parallax
- Values must be in ascending order.
- If the UI element is unknown above screen, use UNKNOWN_BEFORE.
- if the UI element is unknown below screen, use UNKNOWN_AFTER.
- UNKNOWN_BEFORE and UNKNOWN_AFTER are not allowed to be next to each other.
Subclass must override updateValues()
to update property values and perform
ParallaxEffect
s. Subclass may call updateValues()
automatically e.g.
RecyclerViewParallax
calls updateValues()
in RecyclerView scrolling. App might
call updateValues()
manually when Parallax is unaware of the value change. For example,
when a slide transition is running, RecyclerViewParallax
is unaware of translation value
changes; it's the app's responsibility to call updateValues()
in every frame of
animation.
Summary
Nested classes | |
---|---|
class |
Parallax.FloatProperty
FloatProperty provide access to an index based integer type property inside
|
class |
Parallax.IntProperty
IntProperty provide access to an index based integer type property inside
|
class |
Parallax.PropertyMarkerValue<PropertyT>
Class holding a fixed value for a Property in |
Public constructors | |
---|---|
Parallax()
|
Public methods | |
---|---|
ParallaxEffect
|
addEffect(PropertyMarkerValue... ranges)
Create a |
final
PropertyT
|
addProperty(String name)
Add a new IntProperty in the Parallax object. |
abstract
PropertyT
|
createProperty(String name, int index)
Create a new Property object. |
List<ParallaxEffect>
|
getEffects()
Returns a list of |
abstract
float
|
getMaxValue()
Return the max value which is typically size of parent visible area, e.g. |
final
List<PropertyT>
|
getProperties()
|
void
|
removeAllEffects()
Remove all |
void
|
removeEffect(ParallaxEffect effect)
Remove the |
void
|
updateValues()
Update property values and perform |
Public constructors
Public methods
addEffect
ParallaxEffect addEffect (PropertyMarkerValue... ranges)
Create a ParallaxEffect
object that will track source variable changes within a
provided set of ranges.
Parameters | |
---|---|
ranges |
PropertyMarkerValue : A list of marker values that defines the ranges. |
Returns | |
---|---|
ParallaxEffect |
Newly created ParallaxEffect object. |
addProperty
PropertyT addProperty (String name)
Add a new IntProperty in the Parallax object. App may override
createProperty(String, int)
.
Parameters | |
---|---|
name |
String : Name of the property. |
Returns | |
---|---|
PropertyT |
Newly created Property object. |
See also:
createProperty
PropertyT createProperty (String name, int index)
Create a new Property object. App does not directly call this method. See
addProperty(String)
.
Parameters | |
---|---|
name |
String |
index |
int : Index of the property in this Parallax object. |
Returns | |
---|---|
PropertyT |
Newly created Property object. |
getEffects
List<ParallaxEffect> getEffects ()
Returns a list of ParallaxEffect
object which defines rules to perform mapping to
multiple ParallaxTarget
s.
Returns | |
---|---|
List<ParallaxEffect> |
A list of ParallaxEffect object.
|
getMaxValue
float getMaxValue ()
Return the max value which is typically size of parent visible area, e.g. RecyclerView's height if we are tracking Y position of a child. The size can be used to calculate marker value using the provided fraction of FloatPropertyMarkerValue.
Returns | |
---|---|
float |
Size of parent visible area. |
getProperties
List<PropertyT> getProperties ()
Returns | |
---|---|
List<PropertyT> |
A unmodifiable list of properties. |
removeAllEffects
void removeAllEffects ()
Remove all ParallaxEffect
objects.
removeEffect
void removeEffect (ParallaxEffect effect)
Remove the ParallaxEffect
object.
Parameters | |
---|---|
effect |
ParallaxEffect : The ParallaxEffect object to remove.
|
updateValues
void updateValues ()
Update property values and perform ParallaxEffect
s. Subclass may override and call
super.updateValues() after updated properties values.
Interfaces
- BaseGridView.OnKeyInterceptListener
- BaseGridView.OnMotionInterceptListener
- BaseGridView.OnTouchInterceptListener
- BaseGridView.OnUnhandledKeyListener
- BaseOnItemViewClickedListener
- BaseOnItemViewSelectedListener
- BrowseFrameLayout.OnChildFocusListener
- BrowseFrameLayout.OnFocusSearchListener
- FacetProvider
- FacetProviderAdapter
- FocusHighlight
- FragmentAnimationProvider
- ImeKeyMonitor
- ImeKeyMonitor.ImeKeyListener
- MultiActionsProvider
- OnActionClickedListener
- OnChildLaidOutListener
- OnChildSelectedListener
- OnItemViewClickedListener
- OnItemViewSelectedListener
- PlaybackSeekUi
- SearchBar.SearchBarListener
- SearchBar.SearchBarPermissionListener
- SearchEditText.OnKeyboardDismissListener
- SpeechRecognitionCallback
- TitleViewAdapter.Provider
- ViewHolderTask
Classes
- AbstractDetailsDescriptionPresenter
- AbstractDetailsDescriptionPresenter.ViewHolder
- AbstractMediaItemPresenter
- AbstractMediaItemPresenter.ViewHolder
- AbstractMediaListHeaderPresenter
- AbstractMediaListHeaderPresenter.ViewHolder
- Action
- ArrayObjectAdapter
- BaseCardView
- BaseCardView.LayoutParams
- BaseGridView
- BrowseFrameLayout
- ClassPresenterSelector
- ControlButtonPresenterSelector
- CursorObjectAdapter
- DetailsOverviewLogoPresenter
- DetailsOverviewLogoPresenter.ViewHolder
- DetailsOverviewRow
- DetailsOverviewRow.Listener
- DetailsOverviewRowPresenter
- DetailsOverviewRowPresenter.ViewHolder
- DetailsParallax
- DiffCallback
- DividerPresenter
- DividerRow
- FocusHighlightHelper
- FullWidthDetailsOverviewRowPresenter
- FullWidthDetailsOverviewRowPresenter.Listener
- FullWidthDetailsOverviewRowPresenter.ViewHolder
- FullWidthDetailsOverviewRowPresenter.ViewHolder.DetailsOverviewRowListener
- FullWidthDetailsOverviewSharedElementHelper
- GuidanceStylist
- GuidanceStylist.Guidance
- GuidedAction
- GuidedAction.Builder
- GuidedAction.BuilderBase
- GuidedActionDiffCallback
- GuidedActionEditText
- GuidedActionsStylist
- GuidedActionsStylist.ViewHolder
- GuidedDatePickerAction
- GuidedDatePickerAction.Builder
- GuidedDatePickerAction.BuilderBase
- HeaderItem
- HorizontalGridView
- HorizontalHoverCardSwitcher
- ImageCardView
- ItemAlignmentFacet
- ItemAlignmentFacet.ItemAlignmentDef
- ItemBridgeAdapter
- ItemBridgeAdapter.AdapterListener
- ItemBridgeAdapter.ViewHolder
- ItemBridgeAdapter.Wrapper
- ItemBridgeAdapterShadowOverlayWrapper
- ListRow
- ListRowHoverCardView
- ListRowPresenter
- ListRowPresenter.SelectItemViewHolderTask
- ListRowPresenter.ViewHolder
- ListRowView
- MultiActionsProvider.MultiAction
- ObjectAdapter
- ObjectAdapter.DataObserver
- OnChildViewHolderSelectedListener
- PageRow
- Parallax
- Parallax.FloatProperty
- Parallax.IntProperty
- Parallax.PropertyMarkerValue
- ParallaxEffect
- ParallaxTarget
- ParallaxTarget.DirectPropertyTarget
- ParallaxTarget.PropertyValuesHolderTarget
- PlaybackControlsRow
- PlaybackControlsRow.ClosedCaptioningAction
- PlaybackControlsRow.FastForwardAction
- PlaybackControlsRow.HighQualityAction
- PlaybackControlsRow.MoreActions
- PlaybackControlsRow.MultiAction
- PlaybackControlsRow.OnPlaybackProgressCallback
- PlaybackControlsRow.PictureInPictureAction
- PlaybackControlsRow.PlayPauseAction
- PlaybackControlsRow.RepeatAction
- PlaybackControlsRow.RewindAction
- PlaybackControlsRow.ShuffleAction
- PlaybackControlsRow.SkipNextAction
- PlaybackControlsRow.SkipPreviousAction
- PlaybackControlsRow.ThumbsAction
- PlaybackControlsRow.ThumbsDownAction
- PlaybackControlsRow.ThumbsUpAction
- PlaybackControlsRowPresenter
- PlaybackControlsRowPresenter.ViewHolder
- PlaybackRowPresenter
- PlaybackRowPresenter.ViewHolder
- PlaybackSeekDataProvider
- PlaybackSeekDataProvider.ResultCallback
- PlaybackSeekUi.Client
- PlaybackTransportRowPresenter
- PlaybackTransportRowPresenter.ViewHolder
- Presenter
- Presenter.ViewHolder
- Presenter.ViewHolderTask
- PresenterSelector
- PresenterSwitcher
- RecyclerViewParallax
- RecyclerViewParallax.ChildPositionProperty
- Row
- RowHeaderPresenter
- RowHeaderPresenter.ViewHolder
- RowHeaderView
- RowPresenter
- RowPresenter.ViewHolder
- SearchBar
- SearchEditText
- SearchOrbView
- SearchOrbView.Colors
- SectionRow
- ShadowOverlayContainer
- ShadowOverlayHelper
- ShadowOverlayHelper.Builder
- ShadowOverlayHelper.Options
- SinglePresenterSelector
- SparseArrayObjectAdapter
- SpeechOrbView
- TitleHelper
- TitleView
- TitleViewAdapter
- VerticalGridPresenter
- VerticalGridPresenter.ViewHolder
- VerticalGridView