FileDocCategorySizeDatePackage
NumberPickerButton.javaAPI DocAndroid 1.5 API2541Wed May 06 22:41:56 BST 2009com.android.internal.widget

NumberPickerButton

public class NumberPickerButton extends android.widget.ImageButton
This class exists purely to cancel long click events.

Fields Summary
private NumberPicker
mNumberPicker
Constructors Summary
public NumberPickerButton(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

        super(context, attrs, defStyle);
    
public NumberPickerButton(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
public NumberPickerButton(android.content.Context context)

        super(context);
    
Methods Summary
private voidcancelLongpress()

        if (R.id.increment == getId()) {
            mNumberPicker.cancelIncrement();
        } else if (R.id.decrement == getId()) {
            mNumberPicker.cancelDecrement();
        }
    
private voidcancelLongpressIfRequired(android.view.MotionEvent event)

        if ((event.getAction() == MotionEvent.ACTION_CANCEL)
                || (event.getAction() == MotionEvent.ACTION_UP)) {
            cancelLongpress();
        }
    
public booleanonKeyUp(int keyCode, android.view.KeyEvent event)

        if ((keyCode == KeyEvent.KEYCODE_DPAD_CENTER)
                || (keyCode == KeyEvent.KEYCODE_ENTER)) {
            cancelLongpress();
        }
        return super.onKeyUp(keyCode, event);
    
public booleanonTouchEvent(android.view.MotionEvent event)

        cancelLongpressIfRequired(event);
        return super.onTouchEvent(event);
    
public booleanonTrackballEvent(android.view.MotionEvent event)

        cancelLongpressIfRequired(event);
        return super.onTrackballEvent(event);
    
public voidsetNumberPicker(NumberPicker picker)

        mNumberPicker = picker;