kankan.wheel.widget
Class WheelScroller

java.lang.Object
  extended by kankan.wheel.widget.WheelScroller

public class WheelScroller
extends java.lang.Object

Scroller class handles scrolling events and updates the


Nested Class Summary
static interface WheelScroller.ScrollingListener
          Scrolling listener interface
 
Field Summary
private  Handler animationHandler
           
private  Context context
           
private  GestureDetector gestureDetector
           
private  SimpleOnGestureListener gestureListener
           
private  boolean isScrollingPerformed
           
private  int lastScrollY
           
private  float lastTouchedY
           
private  WheelScroller.ScrollingListener listener
           
private  int MESSAGE_JUSTIFY
           
private  int MESSAGE_SCROLL
           
static int MIN_DELTA_FOR_SCROLLING
          Minimum delta for scrolling
private  Scroller scroller
           
private static int SCROLLING_DURATION
          Scrolling duration
 
Constructor Summary
WheelScroller(Context context, WheelScroller.ScrollingListener listener)
          Constructor
 
Method Summary
private  void clearMessages()
          Clears messages from queue
(package private)  void finishScrolling()
          Finishes scrolling
private  void justify()
          Justifies wheel
 boolean onTouchEvent(MotionEvent event)
          Handles Touch event
 void scroll(int distance, int time)
          Scroll the wheel
 void setInterpolator(Interpolator interpolator)
          Set the the specified scrolling interpolator
private  void setNextMessage(int message)
          Set next message to queue.
private  void startScrolling()
          Starts scrolling
 void stopScrolling()
          Stops scrolling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCROLLING_DURATION

private static final int SCROLLING_DURATION
Scrolling duration

See Also:
Constant Field Values

MIN_DELTA_FOR_SCROLLING

public static final int MIN_DELTA_FOR_SCROLLING
Minimum delta for scrolling

See Also:
Constant Field Values

listener

private WheelScroller.ScrollingListener listener

context

private Context context

gestureDetector

private GestureDetector gestureDetector

scroller

private Scroller scroller

lastScrollY

private int lastScrollY

lastTouchedY

private float lastTouchedY

isScrollingPerformed

private boolean isScrollingPerformed

gestureListener

private SimpleOnGestureListener gestureListener

MESSAGE_SCROLL

private final int MESSAGE_SCROLL
See Also:
Constant Field Values

MESSAGE_JUSTIFY

private final int MESSAGE_JUSTIFY
See Also:
Constant Field Values

animationHandler

private Handler animationHandler
Constructor Detail

WheelScroller

public WheelScroller(Context context,
                     WheelScroller.ScrollingListener listener)
Constructor

Parameters:
context - the current context
listener - the scrolling listener
Method Detail

setInterpolator

public void setInterpolator(Interpolator interpolator)
Set the the specified scrolling interpolator

Parameters:
interpolator - the interpolator

scroll

public void scroll(int distance,
                   int time)
Scroll the wheel

Parameters:
distance - the scrolling distance
time - the scrolling duration

stopScrolling

public void stopScrolling()
Stops scrolling


onTouchEvent

public boolean onTouchEvent(MotionEvent event)
Handles Touch event

Parameters:
event - the motion event
Returns:

setNextMessage

private void setNextMessage(int message)
Set next message to queue. Clears queue before.

Parameters:
message - the message to set

clearMessages

private void clearMessages()
Clears messages from queue


justify

private void justify()
Justifies wheel


startScrolling

private void startScrolling()
Starts scrolling


finishScrolling

void finishScrolling()
Finishes scrolling