com.blogspot.applications4android.comicreader.zoom
Class PanZoomListener

java.lang.Object
  extended by com.blogspot.applications4android.comicreader.zoom.PanZoomListener

public class PanZoomListener
extends java.lang.Object

Class responsible for listening to all sorts of events for pan/zoom


Field Summary
static long DELAY_VISIBILITY
          time taken (in ms) for changing visibility
static long MAX_DOUBLE_TAP
          maximum duration for double tap
static float MIN_DIST_ZOOM
          minimum distance difference for working on zoom
static long MIN_DOUBLE_TAP
          minimum duration for double tap
static float MIN_FLING_VEL
          minimum velocity needed for deciding on a pan-fling
static float MIN_VELX_SWIPE_HORIZONTAL
          minimum velocity needed along X for it to be considered for right/left swipe
static float MIN_VELY_SWIPE_VERTICAL
          minimum velocity needed along Y for it to be considered for up/down swipe
static int MODE_PAN
          DRAG mode
static int MODE_RESET
          RESET mode
static int MODE_ZOOM
          ZOOM mode
static int MODE_ZOOM_IN
          mode = zoom in
static int MODE_ZOOM_OUT
          mode = zoom out
static float RATIO_SWIPE_HORIZONTAL
          ratio above which is considered to be a right/left swipe
static float RATIO_SWIPE_VERTICAL
          ratio above which is considered to be an up/down swipe
static float ZOOM_FACTOR
          zomm in/out factor for the button based zoom
 
Constructor Summary
PanZoomListener(PanZoomControl ctrl, LinearLayout ctrls)
          Constructor
 
Method Summary
 void hideControls()
          Hide the control buttons.
 boolean onFling(MotionEvent me, View v)
          Callback when the first finger has been lifted
 boolean onTouch(View v, MotionEvent me)
          Main function responsible for handling touch events.
 void resetChangeVisibility()
          Remove the previous callback and set it again.
 void setComicActivity(ComicStripViewer ser)
          Set the comic activity which needs to be used for displaying previous/next strips
 void setModeToPan()
          Set the current mode as pan.
 void setModeToZoom()
          Set the current mode as zoom.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_ZOOM_IN

public static final int MODE_ZOOM_IN
mode = zoom in

See Also:
Constant Field Values

MODE_ZOOM_OUT

public static final int MODE_ZOOM_OUT
mode = zoom out

See Also:
Constant Field Values

MIN_DIST_ZOOM

public static final float MIN_DIST_ZOOM
minimum distance difference for working on zoom

See Also:
Constant Field Values

ZOOM_FACTOR

public static final float ZOOM_FACTOR
zomm in/out factor for the button based zoom

See Also:
Constant Field Values

MIN_DOUBLE_TAP

public static final long MIN_DOUBLE_TAP
minimum duration for double tap

See Also:
Constant Field Values

MAX_DOUBLE_TAP

public static final long MAX_DOUBLE_TAP
maximum duration for double tap

See Also:
Constant Field Values

MODE_RESET

public static final int MODE_RESET
RESET mode

See Also:
Constant Field Values

MODE_ZOOM

public static final int MODE_ZOOM
ZOOM mode

See Also:
Constant Field Values

MODE_PAN

public static final int MODE_PAN
DRAG mode

See Also:
Constant Field Values

DELAY_VISIBILITY

public static final long DELAY_VISIBILITY
time taken (in ms) for changing visibility

See Also:
Constant Field Values

RATIO_SWIPE_HORIZONTAL

public static final float RATIO_SWIPE_HORIZONTAL
ratio above which is considered to be a right/left swipe

See Also:
Constant Field Values

RATIO_SWIPE_VERTICAL

public static final float RATIO_SWIPE_VERTICAL
ratio above which is considered to be an up/down swipe

See Also:
Constant Field Values

MIN_VELX_SWIPE_HORIZONTAL

public static final float MIN_VELX_SWIPE_HORIZONTAL
minimum velocity needed along X for it to be considered for right/left swipe

See Also:
Constant Field Values

MIN_VELY_SWIPE_VERTICAL

public static final float MIN_VELY_SWIPE_VERTICAL
minimum velocity needed along Y for it to be considered for up/down swipe

See Also:
Constant Field Values

MIN_FLING_VEL

public static final float MIN_FLING_VEL
minimum velocity needed for deciding on a pan-fling

See Also:
Constant Field Values
Constructor Detail

PanZoomListener

public PanZoomListener(PanZoomControl ctrl,
                       LinearLayout ctrls)
Constructor

Parameters:
ctrl - the pan/zoom controller
ctrls - controls layout
Method Detail

setComicActivity

public void setComicActivity(ComicStripViewer ser)
Set the comic activity which needs to be used for displaying previous/next strips

Parameters:
ser - the comic activity

setModeToZoom

public void setModeToZoom()
Set the current mode as zoom. This is used only by the on-screen zoom in/out buttons!


setModeToPan

public void setModeToPan()
Set the current mode as pan. This is used only by the on-screen reset button!


onFling

public boolean onFling(MotionEvent me,
                       View v)
Callback when the first finger has been lifted

Parameters:
me - motion event
v - view generating this event
Returns:
whether or not this event was consumed

resetChangeVisibility

public void resetChangeVisibility()
Remove the previous callback and set it again.


hideControls

public void hideControls()
Hide the control buttons. used while you are trying to download comic


onTouch

public boolean onTouch(View v,
                       MotionEvent me)
Main function responsible for handling touch events.

Parameters:
v - the view generating this callback.
me - event generating this callback
Returns:
true if the event is consumed, else false