declare namespace Titanium { namespace UI { /** * Base event for class Titanium.UI.ImageView */ interface ImageViewBaseEvent extends Ti.Event { /** * Source object that fired the event. */ source: Titanium.UI.ImageView; } /** * Fired when the device detects a click against the view. */ interface ImageView_click_Event extends ImageViewBaseEvent { /** * Returns `true` if the click passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a double click against the view. */ interface ImageView_dblclick_Event extends ImageViewBaseEvent { /** * Returns `true` if the double click passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a double tap against the view. */ interface ImageView_doubletap_Event extends ImageViewBaseEvent { /** * Returns `true` if the double tap passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the view element gains focus. */ interface ImageView_focus_Event extends ImageViewBaseEvent { } /** * Fired when a hardware key is pressed in the view. */ interface ImageView_keypressed_Event extends ImageViewBaseEvent { /** * The code for the physical key that was pressed. For more details, see [KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html). This API is experimental and subject to change. */ keyCode: number; } /** * Fired when the device detects a long click. */ interface ImageView_longclick_Event extends ImageViewBaseEvent { } /** * Fired when the device detects a long press. */ interface ImageView_longpress_Event extends ImageViewBaseEvent { /** * Returns `true` if the long press passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a pinch gesture. */ interface ImageView_pinch_Event extends ImageViewBaseEvent { /** * The average distance between each of the pointers forming the gesture in progress through * the focal point. */ currentSpan: number; /** * The average X distance between each of the pointers forming the gesture in progress through * the focal point. */ currentSpanX: number; /** * The average Y distance between each of the pointers forming the gesture in progress through * the focal point. */ currentSpanY: number; /** * The X coordinate of the current gesture's focal point. */ focusX: number; /** * The Y coordinate of the current gesture's focal point. */ focusY: number; /** * Returns `true` if a scale gesture is in progress, `false` otherwise. */ inProgress: boolean; /** * The previous average distance between each of the pointers forming the gesture in progress through * the focal point. */ previousSpan: number; /** * The previous average X distance between each of the pointers forming the gesture in progress through * the focal point. */ previousSpanX: number; /** * The previous average Y distance between each of the pointers forming the gesture in progress through * the focal point. */ previousSpanY: number; /** * The scale factor relative to the points of the two touches in screen coordinates. */ scale: number; /** * The event time of the current event being processed. */ time: number; /** * The time difference in milliseconds between the previous accepted scaling event and the * current scaling event. */ timeDelta: number; /** * The velocity of the pinch in scale factor per second. */ velocity: number; } /** * Fired when a layout cycle is finished. */ interface ImageView_postlayout_Event extends ImageViewBaseEvent { } /** * Fired when the device detects a single tap against the view. */ interface ImageView_singletap_Event extends ImageViewBaseEvent { /** * Returns `true` if the single tap passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a swipe gesture against the view. */ interface ImageView_swipe_Event extends ImageViewBaseEvent { /** * Direction of the swipe--either 'left', 'right', 'up', or 'down'. */ direction: string; /** * Returns `true` if the swipe passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event's endpoint from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event's endpoint from the `source` view's coordinate system. */ y: number; } /** * Fired when a touch event is interrupted by the device. */ interface ImageView_touchcancel_Event extends ImageViewBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when a touch event is completed. */ interface ImageView_touchend_Event extends ImageViewBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Penciland are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired as soon as the device detects movement of a touch. */ interface ImageView_touchmove_Event extends ImageViewBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired as soon as the device detects a touch gesture. */ interface ImageView_touchstart_Event extends ImageViewBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a two-finger tap against the view. */ interface ImageView_twofingertap_Event extends ImageViewBaseEvent { /** * Returns `true` if the tap passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired for each frame change during an animation. */ interface ImageView_change_Event extends ImageViewBaseEvent { /** * Index of the image frame being displayed. */ index: number; } /** * Fired when either the initial image and/or all of the images in an animation are loaded. */ interface ImageView_load_Event extends ImageViewBaseEvent { /** * Set to `image` when the image defined in the [image](Titanium.UI.ImageView.image) * property is loaded. Set to `images`, when the series of images defined in the * [images](Titanium.UI.ImageView.images) property are loaded. */ state: string; } /** * Fired when the animation starts. */ interface ImageView_start_Event extends ImageViewBaseEvent { } /** * Fired when the animation stops. */ interface ImageView_stop_Event extends ImageViewBaseEvent { } /** * Fired when an image fails to load. */ interface ImageView_error_Event extends ImageViewBaseEvent { /** * Error code. * If the error was generated by the operating system, that system's error value * is used. Otherwise, this value will be -1. */ code: number; /** * Error message, if any returned. May be undefined. */ error: string; /** * URL of the image that failed to load. */ image: string; /** * Indicates a successful operation. Returns `false`. */ success: boolean; } /** * Fired when the animation pauses. */ interface ImageView_pause_Event extends ImageViewBaseEvent { } interface ImageViewEventMap extends ProxyEventMap { change: ImageView_change_Event; click: ImageView_click_Event; dblclick: ImageView_dblclick_Event; doubletap: ImageView_doubletap_Event; error: ImageView_error_Event; focus: ImageView_focus_Event; keypressed: ImageView_keypressed_Event; load: ImageView_load_Event; longclick: ImageView_longclick_Event; longpress: ImageView_longpress_Event; pause: ImageView_pause_Event; pinch: ImageView_pinch_Event; postlayout: ImageView_postlayout_Event; singletap: ImageView_singletap_Event; start: ImageView_start_Event; stop: ImageView_stop_Event; swipe: ImageView_swipe_Event; touchcancel: ImageView_touchcancel_Event; touchend: ImageView_touchend_Event; touchmove: ImageView_touchmove_Event; touchstart: ImageView_touchstart_Event; twofingertap: ImageView_twofingertap_Event; } /** * A view to display a single image or series of animated images. */ class ImageView extends Titanium.UI.View { /** * Indicates whether animation is running. */ readonly animating: boolean; /** * Indicates whether the image should be rotated based on EXIF orientation data. * Before Titanium 10.1.0, this defaulted to `false` on Android. */ autorotate: boolean; /** * Array of this view's child views. */ readonly children: never; /** * Number of times to retry decoding the bitmap at a URL. */ decodeRetries: number; /** * Local path to the default image to display while loading a remote image. */ defaultImage: string; /** * Amount of time in milliseconds to animate one cycle. */ duration: number; /** * Show zoom controls when the user touches the image view. */ enableZoomControls: boolean; /** * Set to `true` to prevent scaling of 2x/3x-resolution remote images for retina * displays. */ hires: boolean; /** * Image to display. */ image: string | Titanium.Blob | Titanium.Filesystem.File; /** * Enables a ripple effect when the foreground image is touched. */ imageTouchFeedback: boolean; /** * Optional touch feedback ripple color. This has no effect unless `imageTouchFeedback` is true. */ imageTouchFeedbackColor: string; /** * Array of images to animate, defined using local filesystem paths, `File` objects, * remote URLs (Android only), or `Blob` objects containing image data. * When using this property, an initial `start()` needs to be called upon the ImageView before any image will show in this imageview. * Related properties/methods to look at: `start`, `stop`, `pause`, `reverse`, `resume` and `repeatCount` */ images: string[] | Titanium.Blob[] | Titanium.Filesystem.File[]; /** * Indicates whether the animation is paused. */ readonly paused: boolean; /** * Prevent the default image from being displayed while loading a remote image. This property * is ignored when the `defaultImage` property is set. */ preventDefaultImage: boolean; /** * Number of times to repeat the image animation. */ repeatCount: number; /** * Run the animation in reverse. */ reverse: boolean; /** * Determines how the image is scaled within the view. */ scalingMode: number; /** * The view's tintColor. Android does not support setting instances of */ tintColor: string | Titanium.UI.Color; /** * Adds a child to this view's hierarchy. */ add: never; /** * Adds the specified callback as an event listener for the named event. */ addEventListener(name: K, callback: (this: Titanium.UI.ImageView, event: ImageViewEventMap[K]) => void): void; /** * Adds the specified callback as an event listener for the named event. */ addEventListener(name: string, callback: (param0: Titanium.Event) => void): void; /** * Fires a synthesized event to any registered listeners. */ fireEvent(name: K, event?: ImageViewEventMap[K]): void; /** * Fires a synthesized event to any registered listeners. */ fireEvent(name: string, event?: any): void; /** * Pauses a running animation. Use `resume` method to continue. */ pause(): void; /** * Removes a child view from this view's hierarchy. */ remove: never; /** * Removes all child views from this view's hierarchy. */ removeAllChildren: never; /** * Removes the specified callback as an event listener for the named event. */ removeEventListener(name: K, callback: (this: Titanium.UI.ImageView, event: ImageViewEventMap[K]) => void): void; /** * Removes the specified callback as an event listener for the named event. */ removeEventListener(name: string, callback: (param0: Titanium.Event) => void): void; /** * Replaces a view at the specified position in the [children](Titanium.UI.View.children) array. */ replaceAt: never; /** * Resumes an animation from a `pause` state. */ resume(): void; /** * Starts the image animation. On Android, also resets `index` to the first image. */ start(): void; /** * Stops a running animation. On iOS, also resets `index` to the first image. */ stop(): void; /** * Returns the image as a Blob object. */ toBlob(): Titanium.Blob; } } }