Note: The Wearable Support Library classes under the android.support.wearable
package are subject to change. For the full Android API reference, see Reference.
java.lang.Object | |
↳ | android.support.wearable.view.GridPagerAdapter |
Known Direct Subclasses |
This component is responsible for providing views requested by a GridViewPager
.
Content is organized into rows and columns of pages, where each page is represented by a View. Each row may contain a different number of columns.
In addition to content views, this adapter is also queried for backgrounds to be displayed for each page. When the same background spans multiple pages, it's automatically zoomed and panned to create a parallax effect against the movement of the page content as it moves. By default, no background is provided.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | OPTION_DISABLE_PARALLAX | Disables zooming and parallax scrolling of the background. | |||||||||
int | PAGE_DEFAULT_OPTIONS | Default background options. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BACKGROUND_NONE | This value indicates that no background should drawn. | ||||||||||
POSITION_NONE | |||||||||||
POSITION_UNCHANGED |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Provides content to be displayed as background for a specific page.
| |||||||||||
Provides content to be displayed as the default background for all pages on the given row.
| |||||||||||
Returns the maximum number of columns for each row.
| |||||||||||
Returns the column to arrive at when navigating vertically to the specified row.
| |||||||||||
Called when the host view is attempting to determine if an item's position has changed.
| |||||||||||
Provides a set of features to apply to a page background.
| |||||||||||
Returns the number of rows available.
| |||||||||||
Determines whether a page View is associated with a specific key object as returned by
instantiateItem(ViewGroup, int, int) .
| |||||||||||
This method should be called by the application if the data backing this adapter has changed
and associated views should update.
| |||||||||||
This method should be called if the value returned by
getBackgroundForPage(int, int)
or options returned by getOptionsForPage(int, int) change.
| |||||||||||
This method should be called if the value returned by
getBackgroundForRow(int)
changes.
| |||||||||||
Register an observer to receive callbacks related to the adapter's data changing.
| |||||||||||
Restores the previously saved state of this adapter.
| |||||||||||
Saves the current state of this adapter.
| |||||||||||
Unregister an observer from callbacks related to the adapter's data changing.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Removes a page for the given position.
| |||||||||||
Called when the a change in the shown pages has been completed.
| |||||||||||
Creates the page for the given position.
| |||||||||||
Called to inform the adapter of which column is now current for the given row.
| |||||||||||
Called when a change in the shown pages is going to start being made.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Disables zooming and parallax scrolling of the background.
Default background options. Parallax scrolling is enabled.
This value indicates that no background should drawn. See getBackgroundForRow(int)
and
getBackgroundForPage(int, int)
for specific effects.
Provides content to be displayed as background for a specific page.
The return value BACKGROUND_NONE
indicates that there is no page-specific background.
and the row background should be used (if any).
The return value of this method can be cached. notifyPageBackgroundChanged(int, int)
may be
used to invalidate a previously returned value. getBackgroundForPage(int, int)
will then be
called to request the new value when necessary.
row | the row of the page |
---|---|
column | the column of the page |
Provides content to be displayed as the default background for all pages on the given row.
The return value BACKGROUND_NONE
causes no background to be displayed, except for
those applied by getBackgroundForPage(int, int)
.
The return value of this method can be cached. notifyRowBackgroundChanged(int)
may be
used to invalidate a previously returned value. getBackgroundForRow(int)
will then be
called to request the new value when necessary.
row | the row of the page |
---|
Returns the maximum number of columns for each row. The number of columns may vary by row.
Returns the column to arrive at when navigating vertically to the specified row.
The default implementation simply returns 0.
row | the row in question |
---|---|
currentColumn | the column which is currently centered |
Called when the host view is attempting to determine if an item's position has changed.
Returns POSITION_UNCHANGED
if the position of the given item has not changed or
POSITION_NONE
if the item is no longer present in the adapter.
The default implementation assumes that all items have been removed and always returns
POSITION_NONE
. This causes all fragments to be detached and re-attached as needed.
object | Object representing an item, previously returned by a call to
instantiateItem(ViewGroup, int, int) . |
---|
POSITION_UNCHANGED
if the object's position has not
changed, or POSITION_NONE
if the item is no longer present.
Provides a set of features to apply to a page background. The return value should be a combination of one or more of the following, combined via bitwise-or:
The default return value isPAGE_DEFAULT_OPTIONS
.row | the row of the page |
---|---|
column | the column of the page |
Returns the number of rows available.
Determines whether a page View is associated with a specific key object as returned by
instantiateItem(ViewGroup, int, int)
. This method is required for a PagerAdapter to
function properly.
view | Page View to check for association with object |
---|---|
object | Object to check for association with view |
view
is associated with the key object object
This method should be called by the application if the data backing this adapter has changed and associated views should update.
This method should be called if the value returned by getBackgroundForPage(int, int)
or options returned by getOptionsForPage(int, int)
change. Any cached value are
removed and the the new value will be requested when necessary.
This method should be called if the value returned by getBackgroundForRow(int)
changes. Any cached value is removed and the the new value will be requested when necessary.
Register an observer to receive callbacks related to the adapter's data changing.
observer | The DataSetObserver which will receive callbacks.
|
---|
Restores the previously saved state of this adapter.
Saves the current state of this adapter.
Unregister an observer from callbacks related to the adapter's data changing.
observer | The DataSetObserver which will be unregistered.
|
---|
Removes a page for the given position. The adapter is responsible for removing the view from
its container, although it only must ensure this is done by the time it returns from
finishUpdate(ViewGroup)
.
container | The containing View from which the page will be removed. |
---|---|
row | the row to be destroyed |
column | the column within the row to be destroyed |
object | The same object that was returned by
instantiateItem(ViewGroup, int, int) .
|
Called when the a change in the shown pages has been completed. At this point you must ensure that all of the pages have actually been added or removed from the container as appropriate.
container | The containing View which is displaying this adapter's page views |
---|
Creates the page for the given position. The adapter is responsible for adding the view to
the container given here, although it only must ensure this is done by the time it returns
from finishUpdate(ViewGroup)
container | containing View in which the page will be shown |
---|---|
row | the row to be instantiated |
column | the column within the row to be instantiated |
Called to inform the adapter of which column is now current for the given row. This
information could be stored and used to implement getCurrentColumnForRow(int, int)
.
The default implementation does nothing.
row | the row for the column change |
---|---|
currentColumn | the column which is now current |
Called when a change in the shown pages is going to start being made.
container | The containing View which is displaying this adapter's page views. |
---|