Added in API level 24

OnMagnificationChangedListener


interface OnMagnificationChangedListener
android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener

Listener for changes in the state of magnification.

Summary

Public methods
abstract Unit
onMagnificationChanged(controller: AccessibilityService.MagnificationController, region: Region, scale: Float, centerX: Float, centerY: Float)

Called when the magnified region, scale, or center changes.

open Unit

Called when the magnified region, mode, scale, or center changes of all magnification modes.

Public methods

onMagnificationChanged

Added in API level 24
Deprecated in API level 33
abstract fun onMagnificationChanged(
    controller: AccessibilityService.MagnificationController,
    region: Region,
    scale: Float,
    centerX: Float,
    centerY: Float
): Unit

Deprecated: Override onMagnificationChanged(android.accessibilityservice.AccessibilityService.MagnificationController,android.graphics.Region,android.accessibilityservice.MagnificationConfig) instead

Called when the magnified region, scale, or center changes.

Note: This legacy callback notifies only full-screen magnification change.

Parameters
controller AccessibilityService.MagnificationController: the magnification controller This value cannot be null.
region Region: the magnification region This value cannot be null.
scale Float: the new scale
centerX Float: the new X coordinate, in unscaled coordinates, around which magnification is focused
centerY Float: the new Y coordinate, in unscaled coordinates, around which magnification is focused

onMagnificationChanged

Added in API level 33
open fun onMagnificationChanged(
    controller: AccessibilityService.MagnificationController,
    region: Region,
    config: MagnificationConfig
): Unit

Called when the magnified region, mode, scale, or center changes of all magnification modes.

Note: This method can be overridden to listen to the magnification changes of all magnification modes then the legacy callback would not receive the notifications. Skipping calling super when overriding this method results in onMagnificationChanged(android.accessibilityservice.AccessibilityService.MagnificationController,android.graphics.Region,float,float,float) not getting called.

Parameters
controller AccessibilityService.MagnificationController: the magnification controller This value cannot be null.
region Region: the magnification region If the config mode is MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN, it is the region of the screen currently active for magnification. that is the same region as getMagnificationRegion(). If the config mode is MagnificationConfig#MAGNIFICATION_MODE_WINDOW, it is the region of screen projected on the magnification window. This value cannot be null.
config MagnificationConfig: The magnification config. That has the controlling magnification mode, the new scale and the new screen-relative center position This value cannot be null.