|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectandroid.support.wearable.view.GridPagerAdapter
public abstract class GridPagerAdapter
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.
| Constructor Summary | |
|---|---|
GridPagerAdapter()
|
|
| Method Summary | |
|---|---|
protected abstract 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. |
ImageReference |
getBackground(int row,
int column)
Provides a reference to an image to be displayed as the background for this page. |
abstract int |
getColumnCount(int row)
Returns the maximum number of columns for each row. |
int |
getCurrentColumnForRow(int row,
int currentColumn)
Returns the column to arrive at when navigating vertically to the specified row. |
abstract int |
getRowCount()
Returns the number of rows available. |
protected abstract java.lang.Object |
instantiateItem(ViewGroup container,
int row,
int column)
Creates the page for the given position. |
abstract boolean |
isViewFromObject(View view,
java.lang.Object object)
Determines whether a page View is associated with a specific key object as returned by instantiateItem(ViewGroup, int, int). |
void |
notifyDataSetChanged()
This method should be called by the application if the data backing this adapter has changed and associated views should update. |
void |
registerDataSetObserver(DataSetObserver observer)
Register an observer to receive callbacks related to the adapter's data changing. |
void |
restoreState(Parcelable savedState,
java.lang.ClassLoader classLoader)
Restores the previously saved state of this adapter. |
Parcelable |
saveState()
Saves the current state of this adapter. |
protected void |
setCurrentColumnForRow(int row,
int currentColumn)
Called to inform the adapter of which column is now current for the given row. |
protected void |
startUpdate(ViewGroup container)
Called when a change in the shown pages is going to start being made. |
void |
unregisterDataSetObserver(DataSetObserver observer)
Unregister an observer from callbacks related to the adapter's data changing. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GridPagerAdapter()
| Method Detail |
|---|
public abstract int getRowCount()
public abstract int getColumnCount(int row)
public int getCurrentColumnForRow(int row,
int currentColumn)
The default implementation simply returns 0.
row - the row in questioncurrentColumn - the column which is currently centered
protected void setCurrentColumnForRow(int row,
int currentColumn)
getCurrentColumnForRow(int, int).
The default implementation does nothing.
row - the row for the column changecurrentColumn - the column which is now currentprotected void startUpdate(ViewGroup container)
container - The containing View which is displaying this adapter's page views.
protected abstract java.lang.Object instantiateItem(ViewGroup container,
int row,
int column)
finishUpdate(ViewGroup)
container - containing View in which the page will be shownrow - the row to be instantiatedcolumn - the column within the row to be instantiated
protected abstract void destroyItem(ViewGroup container,
int row,
int column,
java.lang.Object object)
finishUpdate(ViewGroup).
container - 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
instantiateItem(ViewGroup, int, int).protected void finishUpdate(ViewGroup container)
container - The containing View which is displaying this adapter's page views
public abstract boolean isViewFromObject(View view,
java.lang.Object object)
instantiateItem(ViewGroup, int, int). This method is required for a PagerAdapter to
function properly.
view - Page View to check for association with objectobject - Object to check for association with view
view is associated with the key object object
public ImageReference getBackground(int row,
int column)
row - the row of the pagecolumn - the column of the page
ImageReference.NONE for no page
backgroundpublic void registerDataSetObserver(DataSetObserver observer)
observer - The android.database.DataSetObserver which will receive callbacks.public void unregisterDataSetObserver(DataSetObserver observer)
observer - The android.database.DataSetObserver which will be unregistered.public void notifyDataSetChanged()
public Parcelable saveState()
public void restoreState(Parcelable savedState,
java.lang.ClassLoader classLoader)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||