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 | |
↳ | android.support.wearable.view.FragmentGridPagerAdapter |
An implementation of GridPagerAdapter which represents each page as a Fragment
.
A minimal implementation needs only the abstract methods: getRowCount()
,
getColumnCount(int)
, getFragment(int, int)
.
If any changes are made to the data, notifyDataSetChanged()
must be called to notify the
adapter of the change, so it can be reflected in the View.
If pages the data at be inserted or removed, performance can be improved by implementing
getFragmentId(int, int)
to to provide a stable ID for each item, based on the content.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.wearable.view.GridPagerAdapter
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.wearable.view.GridPagerAdapter
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Provides content to be displayed as the background for a specific page.
| |||||||||||
Returns the
Fragment at the specified row number and column number.
| |||||||||||
Determines whether a page View is associated with a specific key object as returned by
instantiateItem(ViewGroup, int, int) .
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Removes a page for the given position.
| |||||||||||
Called when the a change in the shown pages has been completed.
| |||||||||||
Returns a background for Fragments implementing
GridPageOptions .
| |||||||||||
Returns a unique identifier for the
Fragment at the given row/column
position.
| |||||||||||
Creates the page for the given position.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.wearable.view.GridPagerAdapter
| |||||||||||
From class
java.lang.Object
|
Provides content to be displayed as the 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).
This implementation simply returns the result of getFragmentBackground(int, int)
.
row | the row of the page |
---|---|
column | the column of the page |
BACKGROUND_NONE
Returns the Fragment
at the specified row number and column number.
Fragment instances MAY be stored and reused ONLY if no structural changes are made to the
data set or if getFragmentId(int, int)
is overridden to provide a stable identifier
for each the item at each position, otherwise results are undefined.
row | the row of the position |
---|---|
column | the column of the position |
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
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 |
---|
Returns a background for Fragments implementing GridPageOptions
.
row | the row of the fragment |
---|---|
column | the column of the fragment |
BACKGROUND_NONE
if the fragment does not
implement GridPageOptions
Returns a unique identifier for the Fragment
at the given row/column
position.
The default implementation returns a fixed number based on the position. Subclasses should override this method if the positions of items can change.
row | the row that this item is at |
---|---|
column | the column within this row that the item is at |
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 |