Android APIs
public class

ZoomButton

extends ImageButton
implements View.OnLongClickListener
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ImageView
       ↳ android.widget.ImageButton
         ↳ android.widget.ZoomButton

Summary

[Expand]
Inherited XML Attributes
From class android.widget.ImageView
From class android.view.View
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ZoomButton(Context context)
ZoomButton(Context context, AttributeSet attrs)
ZoomButton(Context context, AttributeSet attrs, int defStyleAttr)
ZoomButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
boolean dispatchUnhandledMove(View focused, int direction)
This method is the last chance for the focused view and its ancestors to respond to an arrow key.
void onInitializeAccessibilityEvent(AccessibilityEvent event)
Initializes an AccessibilityEvent with information about this View which is the event source.
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
Initializes an AccessibilityNodeInfo with information about this view.
boolean onKeyUp(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released.
boolean onLongClick(View v)
Called when a view has been clicked and held.
boolean onTouchEvent(MotionEvent event)
Implement this method to handle touch screen motion events.
void setEnabled(boolean enabled)
Set the enabled state of this view.
void setZoomSpeed(long speed)
[Expand]
Inherited Methods
From class android.widget.ImageButton
From class android.widget.ImageView
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.View.OnLongClickListener
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public ZoomButton (Context context)

Added in API level 1

public ZoomButton (Context context, AttributeSet attrs)

Added in API level 1

public ZoomButton (Context context, AttributeSet attrs, int defStyleAttr)

Added in API level 1

public ZoomButton (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public Methods

public boolean dispatchUnhandledMove (View focused, int direction)

Added in API level 1

This method is the last chance for the focused view and its ancestors to respond to an arrow key. This is called when the focused view did not consume the key internally, nor could the view system find a new view in the requested direction to give focus to.

Parameters
focused The currently focused view.
direction The direction focus wants to move. One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT.
Returns
  • True if the this view consumed this unhandled move.

public void onInitializeAccessibilityEvent (AccessibilityEvent event)

Added in API level 14

Initializes an AccessibilityEvent with information about this View which is the event source. In other words, the source of an accessibility event is the view whose state change triggered firing the event.

Example: Setting the password property of an event in addition to properties set by the super implementation:

 public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
     super.onInitializeAccessibilityEvent(event);
     event.setPassword(true);
 }

If an View.AccessibilityDelegate has been specified via calling setAccessibilityDelegate(AccessibilityDelegate) its onInitializeAccessibilityEvent(View, AccessibilityEvent) is responsible for handling this call.

Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.

Parameters
event The event to initialize.

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

Added in API level 14

Initializes an AccessibilityNodeInfo with information about this view. The base implementation sets:

Subclasses should override this method, call the super implementation, and set additional attributes.

If an View.AccessibilityDelegate has been specified via calling setAccessibilityDelegate(AccessibilityDelegate) its onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfo) is responsible for handling this call.

Parameters
info The instance to initialize.

public boolean onKeyUp (int keyCode, KeyEvent event)

Added in API level 1

Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released.

Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.

Parameters
keyCode A key code that represents the button pressed, from KeyEvent.
event The KeyEvent object that defines the button action.
Returns
  • If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

public boolean onLongClick (View v)

Added in API level 1

Called when a view has been clicked and held.

Parameters
v The view that was clicked and held.
Returns
  • true if the callback consumed the long click, false otherwise.

public boolean onTouchEvent (MotionEvent event)

Added in API level 1

Implement this method to handle touch screen motion events.

If this method is used to detect click actions, it is recommended that the actions be performed by implementing and calling performClick(). This will ensure consistent system behavior, including:

  • obeying click sound preferences
  • dispatching OnClickListener calls
  • handling ACTION_CLICK when accessibility features are enabled

Parameters
event The motion event.
Returns
  • True if the event was handled, false otherwise.

public void setEnabled (boolean enabled)

Added in API level 1

Set the enabled state of this view. The interpretation of the enabled state varies by subclass.

Parameters
enabled True if this view is enabled, false otherwise.

public void setZoomSpeed (long speed)

Added in API level 1