public class Swiper extends Object
Modifier and Type | Field and Description |
---|---|
protected Drawable |
above |
static int |
ALL_PAGES |
int |
animateFramesPerPage
The number of frames to animate the movement of a full page in any direction.
|
int |
animatePauseTimeMillis
The pause time between frames when animating a page scroll.
|
protected Drawable |
back |
protected Drawable |
below |
protected Drawable |
current |
protected int |
curSwiping |
protected Swipable |
forWho |
protected Drawable |
left |
float |
moveToNextPageFraction
This is the fraction of the page size that the user must swipe the current page
before it is considered a full page move.
|
static int |
NEEDS_PAGES |
static int |
NOT_A_SWIPE |
protected Drawable |
right |
static int |
SWIPE_COMPLETE |
static int |
SWIPE_OK |
static int |
SWIPER_DRAGGING_SWIPE |
static int |
SWIPER_HORIZONTAL |
static int |
SWIPER_SINGLE_SWIPE |
static int |
SWIPER_VERTICAL |
protected int |
type |
Constructor and Description |
---|
Swiper(Swipable c,
int swiperType)
Create a Swiper for this control.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelSwiping(boolean animateToFinal)
This tells the swiper to cancel swiping if it were in the middle of a swipe and to
redisplay the original current page.
|
int |
getHorizontalChange()
Call this after a SWIPE_COMPLETE return from handleSwipe().
|
int |
getPagesNeeded()
If handleSwipe() returns NEEDS_PAGES then call this method to get the pages that are required,
set the pages appropriately and then call handleSwipe() again.
|
int |
getType() |
int |
getVerticalChange()
Call this after a SWIPE_COMPLETE return from handleSwipe().
|
int |
handleSwipe(PenEvent pe)
A control that expects swipes should send pen events to this method first and then
take action depending on the return value.
|
public float moveToNextPageFraction
public int animateFramesPerPage
public int animatePauseTimeMillis
protected Swipable forWho
protected int type
protected int curSwiping
protected Drawable left
protected Drawable right
protected Drawable above
protected Drawable below
protected Drawable current
protected Drawable back
public static final int SWIPER_HORIZONTAL
public static final int SWIPER_VERTICAL
public static final int SWIPER_SINGLE_SWIPE
public static final int SWIPER_DRAGGING_SWIPE
public static final int ALL_PAGES
public static final int SWIPE_OK
public static final int NEEDS_PAGES
public static final int SWIPE_COMPLETE
public static final int NOT_A_SWIPE
public Swiper(Swipable c, int swiperType)
c
- the control that expects possible swipes.swiperType
- either or both of SWIPER_HORIZONTAL, SWIPER_VERTICAL OR'ed together.public int getType()
public int getPagesNeeded()
public int getHorizontalChange()
public int getVerticalChange()
public void cancelSwiping(boolean animateToFinal)
animateToFinal
- if this is true then the swiper will animate a move back to
the current page. Otherwise it will display the page directly.public int handleSwipe(PenEvent pe)
pe
- the received pen event.