public final class ItemAlignmentFacet extends Object
RecyclerView.Adapter
or RecyclerView.ViewHolder
for
use in HorizontalGridView
and VerticalGridView
. Apps using Presenter
may
set facet using Presenter.setFacet(Class, Object)
or
Presenter.ViewHolder.setFacet(Class, Object)
. Facet on ViewHolder has a higher priority
than Presenter or Adapter.
ItemAlignmentFacet contains single or multiple ItemAlignmentFacet.ItemAlignmentDef
s. First
ItemAlignmentFacet.ItemAlignmentDef
describes the default alignment position for ViewHolder, it also
overrides the default item alignment settings on VerticalGridView
and
HorizontalGridView
. When there are multiple ItemAlignmentFacet.ItemAlignmentDef
s, the extra
ItemAlignmentFacet.ItemAlignmentDef
s are used to calculate deltas from first alignment position. When a
descendant view is focused within the ViewHolder, grid view will visit focused view and its
ancestors till the root of ViewHolder to match extra ItemAlignmentFacet.ItemAlignmentDef
s'
ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentViewId()
. Once a match found, the
ItemAlignmentFacet.ItemAlignmentDef
is used to adjust a scroll delta from default alignment position.
Modifier and Type | Class and Description |
---|---|
static class |
ItemAlignmentFacet.ItemAlignmentDef
Definition of an alignment position under a view.
|
Modifier and Type | Field and Description |
---|---|
static float |
ITEM_ALIGN_OFFSET_PERCENT_DISABLED
Value indicates that percent is not used.
|
Constructor and Description |
---|
ItemAlignmentFacet() |
Modifier and Type | Method and Description |
---|---|
ItemAlignmentFacet.ItemAlignmentDef[] |
getAlignmentDefs()
Returns read only definitions of alignment positions.
|
boolean |
isMultiAlignment() |
void |
setAlignmentDefs(ItemAlignmentFacet.ItemAlignmentDef[] defs)
Sets definitions of alignment positions.
|
public static final float ITEM_ALIGN_OFFSET_PERCENT_DISABLED
public boolean isMultiAlignment()
public void setAlignmentDefs(ItemAlignmentFacet.ItemAlignmentDef[] defs)
public ItemAlignmentFacet.ItemAlignmentDef[] getAlignmentDefs()