Interface PageNavigator
-
- All Implemented Interfaces:
public interface PageNavigator
Class responsible for managing current page and page navigation history in the .
-
-
Method Summary
Modifier and Type Method Description abstract int
getPageIndex()
Gets currently displayed document page. abstract int
getPageCount()
Gets number of pages in the document. abstract void
setPageIndex(@IntRange(from = 0) int pageIndex)
Sets the pageIndex
to be displayed (0 is the first one), using our default decision on animating, which is to animate the transition if the page is next/before the current page, and not animate if further away.abstract void
setPageIndex(@IntRange(from = 0) int pageIndex, boolean animated)
Sets the pageIndex
to be displayed (0 is the first one).abstract void
beginNavigation()
Notifies the navigation manager that calls to setPageIndex should be added to the navigation history until endNavigation is called. abstract void
endNavigation()
Commits the page changes to the navigation history dropping everything but the very last one. abstract NavigationBackStack<NavigationBackStack.NavigationItem<Integer>>
getNavigationHistory()
Returns the navigation history owned by this manager. -
-
Method Detail
-
getPageIndex
@IntRange(from = "-1") abstract int getPageIndex()
Gets currently displayed document page.
- Returns:
Currently displayed document page,
-1
if document isnull
.
-
getPageCount
@IntRange(from = "-1") abstract int getPageCount()
Gets number of pages in the document.
- Returns:
Number of pages in the displayed document,
-1
if document isnull
.
-
setPageIndex
@UiThread() abstract void setPageIndex(@IntRange(from = 0) int pageIndex)
Sets the
pageIndex
to be displayed (0 is the first one), using our default decision on animating, which is to animate the transition if the page is next/before the current page, and not animate if further away. For custom animation control , use setPageIndex.This method will throw an exception if
pageIndex < 0 || pageIndex >= pageCount
(as returned by getPageCount).- Parameters:
pageIndex
- Target page which should be displayed.
-
setPageIndex
@UiThread() abstract void setPageIndex(@IntRange(from = 0) int pageIndex, boolean animated)
Sets the
pageIndex
to be displayed (0 is the first one). Ifanimated
is set totrue
, the page jump will be animated. Iffalse
, thepage
will be shown immediately.This method will throw an exception if
pageIndex < 0 || pageIndex >= pageCount
(as returned by getPageCount).- Parameters:
pageIndex
- Target page which should be displayed.animated
- Set totrue
, if a transitioning animation should be performed.
-
beginNavigation
@UiThread() abstract void beginNavigation()
Notifies the navigation manager that calls to setPageIndex should be added to the navigation history until endNavigation is called.
-
endNavigation
@UiThread() abstract void endNavigation()
Commits the page changes to the navigation history dropping everything but the very last one.
-
getNavigationHistory
@NonNull() abstract NavigationBackStack<NavigationBackStack.NavigationItem<Integer>> getNavigationHistory()
Returns the navigation history owned by this manager.
- Returns:
NavigationBackStack containing the entire navigation history.
-
-
-
-