Added in API level 1
Deprecated in API level 26

ZoomButton


open class ZoomButton : ImageButton, View.OnLongClickListener
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.ImageView
   ↳ android.widget.ImageButton
   ↳ android.widget.ZoomButton

This widget provides a simple utility for turning a continued long-press event into a series of clicks at some set frequency. There is no actual 'zoom' functionality handled by this widget directly. Instead, clients of this API should set up an onClickListener to handle zoom functionality. That click listener is called on a frequency determined by setZoomSpeed(long) whenever the user long-presses on the ZoomButton.

Summary

Inherited XML attributes
Inherited constants
Public constructors
ZoomButton(context: Context!)

ZoomButton(context: Context!, attrs: AttributeSet!)

ZoomButton(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

ZoomButton(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Boolean
dispatchUnhandledMove(focused: View!, direction: Int)

This method is the last chance for the focused view and its ancestors to respond to an arrow key.

open CharSequence!

Return the class name of this object to be used for accessibility purposes.

open Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)

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

open Boolean

Called when a view has been clicked and held.

open Boolean

Implement this method to handle pointer events.

open Unit
setEnabled(enabled: Boolean)

Set the enabled state of this view.

open Unit

Sets the delay between calls to the widget's onClickListener.

Inherited functions
Inherited properties

Public constructors

ZoomButton

Added in API level 1
ZoomButton(context: Context!)

ZoomButton

Added in API level 1
ZoomButton(
    context: Context!,
    attrs: AttributeSet!)

ZoomButton

Added in API level 1
ZoomButton(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

ZoomButton

Added in API level 21
ZoomButton(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

dispatchUnhandledMove

Added in API level 1
open fun dispatchUnhandledMove(
    focused: View!,
    direction: Int
): Boolean

Deprecated: Deprecated in Java.

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 View!: The currently focused view.
direction Int: The direction focus wants to move. One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT.
Value is one of the following:
Return
Boolean True if the this view consumed this unhandled move.

getAccessibilityClassName

Added in API level 23
Deprecated in API level 26
open fun getAccessibilityClassName(): CharSequence!

Deprecated: Deprecated in Java.

Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely new class of view when used by accessibility, unrelated to the class it is deriving from. This is used to fill in AccessibilityNodeInfo.setClassName.

onKeyUp

Added in API level 1
open fun onKeyUp(
    keyCode: Int,
    event: KeyEvent!
): Boolean

Deprecated: Deprecated in Java.

Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER or KeyEvent.KEYCODE_SPACE 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 Int: A key code that represents the button pressed, from android.view.KeyEvent.
event KeyEvent!: The KeyEvent object that defines the button action.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onLongClick

Added in API level 1
open fun onLongClick(v: View!): Boolean

Deprecated: Deprecated in Java.

Called when a view has been clicked and held.

Parameters
v View!: The view that was clicked and held.
Return
Boolean true if the callback consumed the long click, false otherwise.

onTouchEvent

Added in API level 1
open fun onTouchEvent(event: MotionEvent!): Boolean

Deprecated: Deprecated in Java.

Implement this method to handle pointer events.

This method is called to handle motion events where pointers are down on the view. For example, this could include touchscreen touches, stylus touches, or click-and-drag events from a mouse. However, it is not called for motion events that do not involve pointers being down, such as hover events or mouse scroll wheel movements.

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 MotionEvent!: The motion event.
Return
Boolean True if the event was handled, false otherwise.

setEnabled

Added in API level 1
open fun setEnabled(enabled: Boolean): Unit

Deprecated: Deprecated in Java.

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

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

setZoomSpeed

Added in API level 1
open fun setZoomSpeed(speed: Long): Unit

Deprecated: Deprecated in Java.

Sets the delay between calls to the widget's onClickListener.

Parameters
speed Long: The delay between calls to the click listener, in milliseconds