public class

ImagePicker

extends Object
java.lang.Object
   ↳ com.google.android.gms.cast.framework.media.ImagePicker

Class Overview

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).

Summary

Constants
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 Constructors
ImagePicker()
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object

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 (0x00000004)

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 (0x00000003)

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 (0x00000000)

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 (0x00000002)

public static final int IMAGE_TYPE_NOTIFICATION_THUMBNAIL

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

Constant Value: 1 (0x00000001)

public static final int IMAGE_TYPE_UNKNOWN

Indicates that the type of the image is unknown.

Constant Value: -1 (0xffffffff)

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 MediaMetadata: The MediaMetadata of a media.
type int: The type of the wanted image. One of the types defined in this class.
Returns
WebImage

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 MediaMetadata: The MediaMetadata of a media.
hints ImageHints: Contains the expected width and height, and the type of the wanted image.
Returns
WebImage