ImagePicker

public class ImagePicker extends Object

An image picker to pick an appropriate image from the list of images in a MediaMetadata based on the use of the image, for example, notification thumbnail or full screen background. The default implementation always chooses the first image, or returns null if no image is available in the MediaMetadata. A subclass can override this by overriding onPickImage(MediaMetadata, ImageHints).

Constant Summary

int IMAGE_TYPE_EXPANDED_CONTROLLER_BACKGROUND Type of the image to be displayed as background image of the expanded controller.
int IMAGE_TYPE_LOCK_SCREEN_BACKGROUND Type of the image to be displayed as background image on the lock screen.
int IMAGE_TYPE_MEDIA_ROUTE_CONTROLLER_DIALOG_BACKGROUND Type of the image to be displayed in the MediaRouter controller dialog.
int IMAGE_TYPE_MINI_CONTROLLER_THUMBNAIL Type of the image to be displayed as thumbnail image in the mini controller.
int IMAGE_TYPE_NOTIFICATION_THUMBNAIL Type of the image to be displayed as thumbnail image in the notification.
int IMAGE_TYPE_UNKNOWN Indicates that the type of the image is unknown.

Public Constructor Summary

Public Method Summary

WebImage
onPickImage(MediaMetadata mediaMetadata, int type)
This method is deprecated. Prefer to override onPickImage(MediaMetadata, ImageHints) instead.
WebImage
onPickImage(MediaMetadata mediaMetadata, ImageHints hints)
Returns the WebImage to be used based on the given ImageHints.

Inherited Method Summary

Constants

public static final int IMAGE_TYPE_EXPANDED_CONTROLLER_BACKGROUND

Type of the image to be displayed as background image of the expanded controller.

Constant Value: 4

public static final int IMAGE_TYPE_LOCK_SCREEN_BACKGROUND

Type of the image to be displayed as background image on the lock screen.

Constant Value: 3

public static final int IMAGE_TYPE_MEDIA_ROUTE_CONTROLLER_DIALOG_BACKGROUND

Type of the image to be displayed in the MediaRouter controller dialog. This image is also displayed on the lock screen.

Constant Value: 0

public static final int IMAGE_TYPE_MINI_CONTROLLER_THUMBNAIL

Type of the image to be displayed as thumbnail image in the mini controller.

Constant Value: 2

public static final int IMAGE_TYPE_NOTIFICATION_THUMBNAIL

Type of the image to be displayed as thumbnail image in the notification.

Constant Value: 1

public static final int IMAGE_TYPE_UNKNOWN

Indicates that the type of the image is unknown.

Constant Value: -1

Public Constructors

public ImagePicker ()

Public Methods

public WebImage onPickImage (MediaMetadata mediaMetadata, int type)

This method is deprecated.
Prefer to override onPickImage(MediaMetadata, ImageHints) instead.

Returns the WebImage to be used for the requested image type. The framework will call this method when trying to choose an image in a MediaMetadata. Subclass can override this method to pick an image based on the type. This method can return an image even if no image is available in the MediaMetadata.

Parameters
mediaMetadata The MediaMetadata of a media.
type The type of the wanted image. One of the types defined in this class.

public WebImage onPickImage (MediaMetadata mediaMetadata, ImageHints hints)

Returns the WebImage to be used based on the given ImageHints. The framework will call this method when trying to choose an image in a MediaMetadata. Subclass can override this method to pick an image based on the type. This method can return an image even if no image is available in the MediaMetadata.

Parameters
mediaMetadata The MediaMetadata of a media.
hints Contains the expected width and height, and the type of the wanted image.