ZoomButtonpublic class ZoomButton extends ImageButton implements android.view.View.OnLongClickListener
Fields Summary |
---|
private final android.os.Handler | mHandler | private final Runnable | mRunnable | private long | mZoomSpeed | private boolean | mIsInLongpress |
Constructors Summary |
---|
public ZoomButton(android.content.Context context)
this(context, null);
| public ZoomButton(android.content.Context context, android.util.AttributeSet attrs)
this(context, attrs, 0);
| public ZoomButton(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
this(context, attrs, defStyleAttr, 0);
| public ZoomButton(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(context, attrs, defStyleAttr, defStyleRes);
mHandler = new Handler();
setOnLongClickListener(this);
|
Methods Summary |
---|
public boolean | dispatchUnhandledMove(android.view.View focused, int direction)
clearFocus();
return super.dispatchUnhandledMove(focused, direction);
| public void | onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
super.onInitializeAccessibilityEvent(event);
event.setClassName(ZoomButton.class.getName());
| public void | onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(ZoomButton.class.getName());
| public boolean | onKeyUp(int keyCode, android.view.KeyEvent event)
mIsInLongpress = false;
return super.onKeyUp(keyCode, event);
| public boolean | onLongClick(android.view.View v)
mIsInLongpress = true;
mHandler.post(mRunnable);
return true;
| public boolean | onTouchEvent(android.view.MotionEvent event)
if ((event.getAction() == MotionEvent.ACTION_CANCEL)
|| (event.getAction() == MotionEvent.ACTION_UP)) {
mIsInLongpress = false;
}
return super.onTouchEvent(event);
| public void | setEnabled(boolean enabled)
if (!enabled) {
/* If we're being disabled reset the state back to unpressed
* as disabled views don't get events and therefore we won't
* get the up event to reset the state.
*/
setPressed(false);
}
super.setEnabled(enabled);
| public void | setZoomSpeed(long speed)
mZoomSpeed = speed;
|
|