|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectandroid.support.wearable.view.GridPagerAdapter
android.support.wearable.view.FragmentGridPagerAdapter
public abstract class FragmentGridPagerAdapter
An implementation of GridPagerAdapter which represents each page as a Fragment.
A minimal implementation needs only the abstract methods: GridPagerAdapter.getRowCount(),
GridPagerAdapter.getColumnCount(int), getFragment(int, int).
If any changes are made to the data, GridPagerAdapter.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.
| Constructor Summary | |
|---|---|
FragmentGridPagerAdapter(FragmentManager fm)
|
|
| Method Summary | |
|---|---|
protected void |
destroyItem(ViewGroup container,
int row,
int column,
java.lang.Object object)
Removes a page for the given position. |
protected void |
finishUpdate(ViewGroup container)
Called when the a change in the shown pages has been completed. |
int |
getCurrentColumnForRow(int row,
int currentColumn)
Returns the column to arrive at when navigating vertically to the specified row. |
abstract Fragment |
getFragment(int row,
int column)
Returns the Fragment at the specified row number and column number. |
protected long |
getFragmentId(int row,
int column)
Returns a unique identifier for the Fragment at the given row/column
position. |
protected Fragment |
instantiateItem(ViewGroup container,
int row,
int column)
Creates the page for the given position. |
boolean |
isViewFromObject(View view,
java.lang.Object object)
Determines whether a page View is associated with a specific key object as returned by GridPagerAdapter.instantiateItem(ViewGroup, int, int). |
| Methods inherited from class android.support.wearable.view.GridPagerAdapter |
|---|
getBackground, getColumnCount, getRowCount, notifyDataSetChanged, registerDataSetObserver, restoreState, saveState, setCurrentColumnForRow, startUpdate, unregisterDataSetObserver |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FragmentGridPagerAdapter(FragmentManager fm)
| Method Detail |
|---|
public abstract Fragment getFragment(int row,
int column)
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.
row - the row of the positioncolumn - the column of the position
public int getCurrentColumnForRow(int row,
int currentColumn)
GridPagerAdapterThe default implementation simply returns 0.
getCurrentColumnForRow in class GridPagerAdapterrow - the row in questioncurrentColumn - the column which is currently centered
protected long getFragmentId(int row,
int column)
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 atcolumn - the column within this row that the item is at
protected Fragment instantiateItem(ViewGroup container,
int row,
int column)
GridPagerAdapterGridPagerAdapter.finishUpdate(ViewGroup)
instantiateItem in class GridPagerAdaptercontainer - containing View in which the page will be shownrow - the row to be instantiatedcolumn - the column within the row to be instantiated
public boolean isViewFromObject(View view,
java.lang.Object object)
GridPagerAdapterGridPagerAdapter.instantiateItem(ViewGroup, int, int). This method is required for a PagerAdapter to
function properly.
isViewFromObject in class GridPagerAdapterview - Page View to check for association with objectobject - Object to check for association with view
view is associated with the key object object
protected void destroyItem(ViewGroup container,
int row,
int column,
java.lang.Object object)
GridPagerAdapterGridPagerAdapter.finishUpdate(ViewGroup).
destroyItem in class GridPagerAdaptercontainer - The containing View from which the page will be removed.row - the row to be destroyedcolumn - the column within the row to be destroyedobject - The same object that was returned by
GridPagerAdapter.instantiateItem(ViewGroup, int, int).protected void finishUpdate(ViewGroup container)
finishUpdate in class GridPagerAdaptercontainer - The containing View which is displaying this adapter's page views
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||