com.blogspot.applications4android.comicreader.numpicker
Class NumberPicker

java.lang.Object
  extended by LinearLayout
      extended by com.blogspot.applications4android.comicreader.numpicker.NumberPicker

public class NumberPicker
extends LinearLayout

This class has been pulled from the Android platform source code, its an internal widget that hasn't been made public so its included in the project in this fashion for use with the preferences screen.


Nested Class Summary
static interface NumberPicker.Formatter
           
static interface NumberPicker.OnChangedListener
           
 
Field Summary
static NumberPicker.Formatter FIVE_DIGIT_FORMATTER
           
protected  int mCurrent
           
protected  int mEnd
           
protected  int mPrevious
           
protected  int mStart
           
 
Constructor Summary
NumberPicker(Context context)
           
NumberPicker(Context context, AttributeSet attrs)
           
NumberPicker(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 void cancelDecrement()
           
 void cancelIncrement()
           
protected  void changeCurrent(int current)
           
 int getCurrent()
           
protected  void notifyChange()
           
 void onCancelListener(View.OnClickListener l)
           
 void onClick(View v)
           
 void onFocusChange(View v, boolean hasFocus)
           
 boolean onLongClick(View v)
          We start the long click here but rely on the NumberPickerButton to inform us when the long click has ended.
 void onSetListener(View.OnClickListener l)
           
 void setCurrent(int current)
           
 void setEnabled(boolean enabled)
           
 void setFormatter(NumberPicker.Formatter formatter)
           
 void setOnChangeListener(NumberPicker.OnChangedListener listener)
           
 void setRange(int start, int end)
          Set the range of numbers allowed for the number picker.
 void setRange(int start, int end, java.lang.String[] displayedValues)
          Set the range of numbers allowed for the number picker.
 void setSpeed(long speed)
          The speed (in milliseconds) at which the numbers will scroll when the the +/- buttons are longpressed.
protected  void updateView()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIVE_DIGIT_FORMATTER

public static final NumberPicker.Formatter FIVE_DIGIT_FORMATTER

mStart

protected int mStart

mEnd

protected int mEnd

mCurrent

protected int mCurrent

mPrevious

protected int mPrevious
Constructor Detail

NumberPicker

public NumberPicker(Context context)

NumberPicker

public NumberPicker(Context context,
                    AttributeSet attrs)

NumberPicker

public NumberPicker(Context context,
                    AttributeSet attrs,
                    int defStyle)
Method Detail

onCancelListener

public void onCancelListener(View.OnClickListener l)

onSetListener

public void onSetListener(View.OnClickListener l)

setEnabled

public void setEnabled(boolean enabled)

setOnChangeListener

public void setOnChangeListener(NumberPicker.OnChangedListener listener)

setFormatter

public void setFormatter(NumberPicker.Formatter formatter)

setRange

public void setRange(int start,
                     int end)
Set the range of numbers allowed for the number picker. The current value will be automatically set to the start.

Parameters:
start - the start of the range (inclusive)
end - the end of the range (inclusive)

setRange

public void setRange(int start,
                     int end,
                     java.lang.String[] displayedValues)
Set the range of numbers allowed for the number picker. The current value will be automatically set to the start. Also provide a mapping for values used to display to the user.

Parameters:
start - the start of the range (inclusive)
end - the end of the range (inclusive)
displayedValues - the values displayed to the user.

setCurrent

public void setCurrent(int current)

setSpeed

public void setSpeed(long speed)
The speed (in milliseconds) at which the numbers will scroll when the the +/- buttons are longpressed. Default is 50ms.


onClick

public void onClick(View v)

changeCurrent

protected void changeCurrent(int current)

notifyChange

protected void notifyChange()

updateView

protected void updateView()

onFocusChange

public void onFocusChange(View v,
                          boolean hasFocus)

onLongClick

public boolean onLongClick(View v)
We start the long click here but rely on the NumberPickerButton to inform us when the long click has ended.


cancelIncrement

public void cancelIncrement()

cancelDecrement

public void cancelDecrement()

getCurrent

public int getCurrent()
Returns:
the current value.