public interface Swipable
Modifier and Type | Interface and Description |
---|---|
static class |
Swipable.Page |
Modifier and Type | Field and Description |
---|---|
static int |
PAGE_ABOVE |
static int |
PAGE_BACKGROUND |
static int |
PAGE_BELOW |
static int |
PAGE_CURRENT |
static int |
PAGE_LEFT |
static int |
PAGE_RIGHT |
static int |
SHOULD_END_DEFAULT
A return value for shouldEnd().
|
static int |
SHOULD_END_PAGE_CHANGE
A return value for shouldEnd().
|
static int |
SHOULD_END_STAY_IN_PLACE
A return value for shouldEnd().
|
static int |
SHOULD_END_STAY_ON_PAGE
A return value for shouldEnd().
|
static int |
SWIPE_ACCEPTED_DRAG_PAGES
This is a value you can return from swipeStarting().
|
static int |
SWIPE_ACCEPTED_GIVE_EVENTS
This is a value you can return from swipeStarting().
|
static int |
SWIPE_REJECTED
This is a value you can return from swipeStarting().
|
Modifier and Type | Method and Description |
---|---|
BufferedGraphics |
getGraphics()
Get a BufferedGraphics to draw the pages to while swiping.
|
void |
getPage(int whichPage,
Swipable.Page page)
This is called to retrieve a page to display while swiping.
|
Dimension |
getSize(Dimension destination)
Get the dimensions of the Swipable.
|
int |
shouldEnd(int swipeDistanceX,
int swipeDistanceY,
int startPointX,
int startPointY)
This is called when the swipe has ended and it should return one of the SHOULD_END_XXX values.
|
void |
swipeEnded(int pageChange,
int pixelChangeX,
int pixelChangeY)
This is called when the swipe has ended after shouldEnd() is called.
|
int |
swipeStarting(Swiper swiper,
boolean horizontally,
boolean vertically,
int type)
This is called when a swipe is beginning and before getPage() is called.
|
boolean |
swiping(int swipeDistanceX,
int swipeDistanceY,
int startPointX,
int startPointY)
This is only called if swipeStarting() returned SWIPE_ACCEPTED_GIVE_EVENTS.
|
static final int PAGE_CURRENT
static final int PAGE_LEFT
static final int PAGE_RIGHT
static final int PAGE_ABOVE
static final int PAGE_BELOW
static final int PAGE_BACKGROUND
static final int SWIPE_ACCEPTED_DRAG_PAGES
static final int SWIPE_ACCEPTED_GIVE_EVENTS
static final int SWIPE_REJECTED
static final int SHOULD_END_DEFAULT
static final int SHOULD_END_PAGE_CHANGE
static final int SHOULD_END_STAY_ON_PAGE
static final int SHOULD_END_STAY_IN_PLACE
int swipeStarting(Swiper swiper, boolean horizontally, boolean vertically, int type)
swiper
- the Swiper (swipe handler) handling the swipe. This is the only time this parameter is given
during a swipe.horizontally
- true if horizontal swiping is being done. This may be in conjunction with vertical swiping.vertically
- true if vertical swiping is being done. This may be in conjunction with horizontal swiping.type
- either SWIPER_SINGLE_SWIPE or SWIPER_DRAGGING_SWIPE.void getPage(int whichPage, Swipable.Page page)
whichPage
- one of the PAGE_XXX values.page
- the destination Page object.void swipeEnded(int pageChange, int pixelChangeX, int pixelChangeY)
pageChange
- this will be one or more of the PAGE_XXX values OR'ed together or zero if there
was no page change.pixelChangeX
- if shouldEnd() returned SHOULD_END_STAY_IN_PLACE then this is the change in horizontal pixels
(positive indicates a shift right, negative a shift left), otherwise it is zero.pixelChangeY
- if shouldEnd() returned SHOULD_END_STAY_IN_PLACE then this is the change in vertical pixels
(positive indicates a shift down, negative a shift up), otherwise it is zero.BufferedGraphics getGraphics()
Dimension getSize(Dimension destination)
destination
- a non-null destination Dimension that should be filled in with
the width and height data for the Swipable.int shouldEnd(int swipeDistanceX, int swipeDistanceY, int startPointX, int startPointY)
swipeDistanceX
- the horizontal distance, positive (to the right) or negative (to the left)
that the swipe ended from the starting point. If it is a vertical only swipe, this is set to zero.swipeDistanceY
- the vertical distance, positive (downwards) or negative (upwards) that the
swipe ended from the starting point. If it is a horizontal only swipe, this is set to zero.startPointX
- the start x-point on the Control of the swipe.startPointY
- the start Y-point on the Control of the swipe.boolean swiping(int swipeDistanceX, int swipeDistanceY, int startPointX, int startPointY)
swipeDistanceX
- the horizontal distance, positive (to the right) or negative (to the left)
that the swipe has traveled from the starting point. If it is a vertical only swipe, this is set to zero.swipeDistanceY
- the vertical distance, positive (downwards) or negative (upwards) that the
swipe has traveled from the starting point. If it is a horizontal only swipe, this is set to zero.startPointX
- the start x-point on the Control of the swipe.startPointY
- the start Y-point on the Control of the swipe.