public
final
class
ContentRecommendation
extends Object
java.lang.Object | |
↳ | android.support.app.recommendation.ContentRecommendation |
The ContentRecommendation object encapsulates all application provided data for a single content recommendation item.
Nested classes | |
---|---|
class |
ContentRecommendation.Builder
Builder class for |
@interface |
ContentRecommendation.ContentMaturity
|
@interface |
ContentRecommendation.ContentPricing
|
@interface |
ContentRecommendation.ContentStatus
|
@interface |
ContentRecommendation.ContentType
|
class |
ContentRecommendation.IntentData
Object used to encapsulate the data to be used to build the |
@interface |
ContentRecommendation.IntentType
|
Constants | |
---|---|
String |
CONTENT_MATURITY_ALL
Value to be used with |
String |
CONTENT_MATURITY_HIGH
Value to be used with |
String |
CONTENT_MATURITY_LOW
Value to be used with |
String |
CONTENT_MATURITY_MEDIUM
Value to be used with |
String |
CONTENT_PRICING_FREE
Value to be used with |
String |
CONTENT_PRICING_PREORDER
Value to be used with |
String |
CONTENT_PRICING_PURCHASE
Value to be used with |
String |
CONTENT_PRICING_RENTAL
Value to be used with |
String |
CONTENT_PRICING_SUBSCRIPTION
Value to be used with |
int |
CONTENT_STATUS_AVAILABLE
Value to be used with |
int |
CONTENT_STATUS_PENDING
Value to be used with |
int |
CONTENT_STATUS_READY
Value to be used with |
int |
CONTENT_STATUS_UNAVAILABLE
Value to be used with |
String |
CONTENT_TYPE_APP
Value to be used with |
String |
CONTENT_TYPE_BOOK
Value to be used with |
String |
CONTENT_TYPE_COMIC
Value to be used with |
String |
CONTENT_TYPE_GAME
Value to be used with |
String |
CONTENT_TYPE_MAGAZINE
Value to be used with |
String |
CONTENT_TYPE_MOVIE
Value to be used with |
String |
CONTENT_TYPE_MUSIC
Value to be used with |
String |
CONTENT_TYPE_NEWS
Value to be used with |
String |
CONTENT_TYPE_PODCAST
Value to be used with |
String |
CONTENT_TYPE_RADIO
Value to be used with |
String |
CONTENT_TYPE_SERIAL
Value to be used with |
String |
CONTENT_TYPE_SPORTS
Value to be used with |
String |
CONTENT_TYPE_TRAILER
Value to be used with |
String |
CONTENT_TYPE_VIDEO
Value to be used with |
String |
CONTENT_TYPE_WEBSITE
Value to be used with |
int |
INTENT_TYPE_ACTIVITY
Value to be used with |
int |
INTENT_TYPE_BROADCAST
Value to be used with |
int |
INTENT_TYPE_SERVICE
Value to be used with |
Public methods | |
---|---|
boolean
|
equals(Object other)
Indicates whether some other object is "equal to" this one. |
String
|
getBackgroundImageUri()
Returns a Content URI that can be used to retrieve the background image for this recommendation. |
int
|
getBadgeImageResourceId()
Returns the resource id for the recommendation badging icon. |
int
|
getColor()
Returns the accent color value to be used in the UI when displaying this content recommendation to the user. |
Bitmap
|
getContentImage()
Returns the Bitmap containing the recommendation image. |
ContentRecommendation.IntentData
|
getContentIntent()
Returns the data for the Intent that will be issued when the user clicks on the recommendation. |
String[]
|
getContentTypes()
Returns an array containing the content types tags that describe the content. |
ContentRecommendation.IntentData
|
getDismissIntent()
Returns the data for the Intent that will be issued when the recommendation gets dismissed from the Home Screen, due to an user action. |
String[]
|
getGenres()
Returns an array containing the genres that describe the content. |
String
|
getGroup()
Returns the String group ID tag for this recommendation. |
String
|
getIdTag()
Returns the String Id tag which uniquely identifies this recommendation. |
String
|
getMaturityRating()
Returns the maturity level rating for the content. |
Notification
|
getNotificationObject(Context context)
Returns a |
String
|
getPricingType()
Gets the pricing type for the content. |
String
|
getPricingValue()
Gets the price value (when applicable) for the content. |
String
|
getPrimaryContentType()
Returns the primary content type tag for the recommendation, or null if no content types have been specified. |
int
|
getProgressMax()
Returns the maximum value for the progress data of this recommendation. |
int
|
getProgressValue()
Returns the progress amount for this recommendation. |
long
|
getRunningTime()
Returns the running time for the content. |
String
|
getSortKey()
Returns the String sort key for this recommendation. |
String
|
getSourceName()
Returns the source application name for this recommendation. |
int
|
getStatus()
Returns availability status value for the content. |
String
|
getText()
Returns the description text for this recommendation. |
String
|
getTitle()
Returns the content title for this recommendation. |
boolean
|
hasProgressInfo()
Indicates if this recommendation contains valid progress information. |
int
|
hashCode()
Returns a hash code value for the object. |
boolean
|
isAutoDismiss()
Indicates whether this recommendation should be dismissed automatically. |
void
|
setAutoDismiss(boolean autoDismiss)
Sets the flag indicating if this recommendation should be dismissed automatically. |
void
|
setGroup(String groupTag)
Sets the String group ID tag for this recommendation. |
void
|
setProgress(int max, int progress)
Sets the progress information for the content pointed to by this recommendation. |
void
|
setSortKey(String sortKey)
Sets the String sort key for this recommendation. |
void
|
setStatus(int status)
Sets the availability status value for the content. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
String CONTENT_MATURITY_ALL
Value to be used with setMaturityRating(String)
to indicate that the content referred
by the notification is suitable for all audiences.
Constant Value: "android.contentMaturity.all"
String CONTENT_MATURITY_HIGH
Value to be used with setMaturityRating(String)
to indicate that the content referred
by the notification is suitable for audiences of high maturity and above.
Constant Value: "android.contentMaturity.high"
String CONTENT_MATURITY_LOW
Value to be used with setMaturityRating(String)
to indicate that the content referred
by the notification is suitable for audiences of low maturity and above.
Constant Value: "android.contentMaturity.low"
String CONTENT_MATURITY_MEDIUM
Value to be used with setMaturityRating(String)
to indicate that the content referred
by the notification is suitable for audiences of medium maturity and above.
Constant Value: "android.contentMaturity.medium"
String CONTENT_PRICING_FREE
Value to be used with setPricingInformation(String, String)
to indicate that the content
referred by the notification item is free to consume.
Constant Value: "android.contentPrice.free"
String CONTENT_PRICING_PREORDER
Value to be used with setPricingInformation(String, String)
to indicate that the content
referred by the notification item is available currently as a pre-order, and the price value
provided is the purchase price for the item.
Constant Value: "android.contentPrice.preorder"
String CONTENT_PRICING_PURCHASE
Value to be used with setPricingInformation(String, String)
to indicate that the content
referred by the notification item is available for purchase, and the price value provided is
the purchase price for the item.
Constant Value: "android.contentPrice.purchase"
String CONTENT_PRICING_RENTAL
Value to be used with setPricingInformation(String, String)
to indicate that the content
referred by the notification item is available as a rental, and the price value provided is
the rental price for the item.
Constant Value: "android.contentPrice.rental"
String CONTENT_PRICING_SUBSCRIPTION
Value to be used with setPricingInformation(String, String)
to indicate that the content
referred by the notification item is available as part of a subscription based service, and
the price value provided is the subscription price for the service.
Constant Value: "android.contentPrice.subscription"
int CONTENT_STATUS_AVAILABLE
Value to be used with setStatus(int)
to indicate that the content referred by the
notification is available, but needs to be first purchased, rented, subscribed or downloaded
before it can be consumed.
Constant Value: 2 (0x00000002)
int CONTENT_STATUS_PENDING
Value to be used with setStatus(int)
to indicate that the content referred by the
notification is pending, waiting on either a download or purchase operation to complete
before it can be consumed.
Constant Value: 1 (0x00000001)
int CONTENT_STATUS_READY
Value to be used with setStatus(int)
to indicate that the content referred by the
notification is available and ready to be consumed immediately.
Constant Value: 0 (0x00000000)
int CONTENT_STATUS_UNAVAILABLE
Value to be used with setStatus(int)
to indicate that the content referred by the
notification is not available. This could be content not available in a certain region or
incompatible with the device in use.
Constant Value: 3 (0x00000003)
String CONTENT_TYPE_APP
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is an application.
Constant Value: "android.contentType.app"
String CONTENT_TYPE_BOOK
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a book.
Constant Value: "android.contentType.book"
String CONTENT_TYPE_COMIC
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a comic book.
Constant Value: "android.contentType.comic"
String CONTENT_TYPE_GAME
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a game.
Constant Value: "android.contentType.game"
String CONTENT_TYPE_MAGAZINE
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a magazine.
Constant Value: "android.contentType.magazine"
String CONTENT_TYPE_MOVIE
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a movie.
Constant Value: "android.contentType.movie"
String CONTENT_TYPE_MUSIC
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a song or album.
Constant Value: "android.contentType.music"
String CONTENT_TYPE_NEWS
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a news item.
Constant Value: "android.contentType.news"
String CONTENT_TYPE_PODCAST
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a podcast.
Constant Value: "android.contentType.podcast"
String CONTENT_TYPE_RADIO
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a radio station.
Constant Value: "android.contentType.radio"
String CONTENT_TYPE_SERIAL
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is serial. It can refer to an entire show, a single season or
series, or a single episode.
Constant Value: "android.contentType.serial"
String CONTENT_TYPE_SPORTS
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is sports.
Constant Value: "android.contentType.sports"
String CONTENT_TYPE_TRAILER
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a trailer.
Constant Value: "android.contentType.trailer"
String CONTENT_TYPE_VIDEO
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a video clip.
Constant Value: "android.contentType.video"
String CONTENT_TYPE_WEBSITE
Value to be used with setContentTypes(String[])
to indicate that the content referred
by the notification item is a website.
Constant Value: "android.contentType.website"
int INTENT_TYPE_ACTIVITY
Value to be used with setContentIntentData(int, Intent, int, Bundle)
and
setDismissIntentData(int, Intent, int, Bundle)
to indicate that a PendingIntent
for an Activity
should be created when posting the recommendation to the HomeScreen.
Constant Value: 1 (0x00000001)
int INTENT_TYPE_BROADCAST
Value to be used with setContentIntentData(int, Intent, int, Bundle)
and
setDismissIntentData(int, Intent, int, Bundle)
to indicate that a PendingIntent
for a Broadcast
should be created when posting the recommendation to the HomeScreen.
Constant Value: 2 (0x00000002)
int INTENT_TYPE_SERVICE
Value to be used with setContentIntentData(int, Intent, int, Bundle)
and
setDismissIntentData(int, Intent, int, Bundle)
to indicate that a PendingIntent
for a Service
should be created when posting the recommendation to the HomeScreen.
Constant Value: 3 (0x00000003)
boolean equals (Object other)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
Parameters | |
---|---|
other |
Object :
the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
String getBackgroundImageUri ()
Returns a Content URI that can be used to retrieve the background image for this recommendation.
Returns | |
---|---|
String |
A Content URI pointing to the recommendation background image. |
int getBadgeImageResourceId ()
Returns the resource id for the recommendation badging icon.
The resource id represents the icon resource in the source application package.
Returns | |
---|---|
int |
An integer id for the badge icon resource. |
int getColor ()
Returns the accent color value to be used in the UI when displaying this content recommendation to the user.
Returns | |
---|---|
int |
An integer value representing the accent color for this recommendation. |
Bitmap getContentImage ()
Returns the Bitmap containing the recommendation image.
Returns | |
---|---|
Bitmap |
A Bitmap containing the recommendation image. |
ContentRecommendation.IntentData getContentIntent ()
Returns the data for the Intent that will be issued when the user clicks on the recommendation.
Returns | |
---|---|
ContentRecommendation.IntentData |
An IntentData object, containing the data for the Intent that gets issued when the recommendation is clicked on. |
String[] getContentTypes ()
Returns an array containing the content types tags that describe the content. The first tag entry is considered the primary type for the content, and is used for content ranking purposes.
Returns | |
---|---|
String[] |
An array of predefined type tags (see the CONTENT_TYPE_* constants) that
describe the recommended content.
|
ContentRecommendation.IntentData getDismissIntent ()
Returns the data for the Intent that will be issued when the recommendation gets dismissed from the Home Screen, due to an user action.
Returns | |
---|---|
ContentRecommendation.IntentData |
An IntentData object, containing the data for the Intent that gets issued when the recommendation is dismissed from the Home Screen. |
String[] getGenres ()
Returns an array containing the genres that describe the content. Genres are open ended String tags.
Returns | |
---|---|
String[] |
An array of genre tags that describe the recommended content. |
String getGroup ()
Returns the String group ID tag for this recommendation.
Returns | |
---|---|
String |
A String containing the group ID tag for this recommendation. |
String getIdTag ()
Returns the String Id tag which uniquely identifies this recommendation.
Returns | |
---|---|
String |
The String Id tag for this recommendation. |
String getMaturityRating ()
Returns the maturity level rating for the content.
Returns | |
---|---|
String |
returns a predefined tag indicating the maturity level rating for the content (see
the CONTENT_MATURITY_* constants).
|
Notification getNotificationObject (Context context)
Returns a Notification
object which contains the content
recommendation data encapsulated by this object, which can be used for posting the
recommendation via the NotificationManager
.
Parameters | |
---|---|
context |
Context :
A Context that will be used to construct the
Notification object which will carry the
recommendation data. |
Returns | |
---|---|
Notification |
A Notification containing the stored recommendation
data.
|
String getPricingType ()
Gets the pricing type for the content.
Returns | |
---|---|
String |
A predefined tag indicating the pricing type for the content (see the
CONTENT_PRICING_* constants).
|
String getPricingValue ()
Gets the price value (when applicable) for the content. The value will be provided as a String containing the price in the appropriate currency for the current locale.
Returns | |
---|---|
String |
A string containing a representation of the content price in the current locale and currency. |
String getPrimaryContentType ()
Returns the primary content type tag for the recommendation, or null if no content types have been specified.
Returns | |
---|---|
String |
A predefined type tag (see the CONTENT_TYPE_* constants) indicating the
primary content type for the recommendation.
|
int getProgressMax ()
Returns the maximum value for the progress data of this recommendation.
Returns | |
---|---|
int |
An integer representing the maximum progress value. |
int getProgressValue ()
Returns the progress amount for this recommendation.
Returns | |
---|---|
int |
An integer representing the recommendation progress amount. |
long getRunningTime ()
Returns the running time for the content.
Returns | |
---|---|
long |
The run length, in seconds, of the content associated with the notification. |
String getSortKey ()
Returns the String sort key for this recommendation.
Returns | |
---|---|
String |
A String containing the sort key for this recommendation. |
String getSourceName ()
Returns the source application name for this recommendation.
Returns | |
---|---|
String |
A String containing the recommendation source name. |
int getStatus ()
Returns availability status value for the content. This status indicates whether the content is ready to be consumed on the device, or if the user must first purchase, rent, subscribe to, or download the content.
Returns | |
---|---|
int |
The status value for the content, or -1 is a valid status has not been specified (see
the CONTENT_STATUS_* constants for the valid status values).
|
String getText ()
Returns the description text for this recommendation.
Returns | |
---|---|
String |
A String containing the recommendation description text. |
String getTitle ()
Returns the content title for this recommendation.
Returns | |
---|---|
String |
A String containing the recommendation content title. |
boolean hasProgressInfo ()
Indicates if this recommendation contains valid progress information.
Returns | |
---|---|
boolean |
true if the recommendation contains valid progress data, false otherwise. |
int hashCode ()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer, provided no information
used in equals
comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
equals(java.lang.Object)
method, then calling the hashCode
method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
JavaTM programming language.)
Returns | |
---|---|
int |
a hash code value for this object. |
boolean isAutoDismiss ()
Indicates whether this recommendation should be dismissed automatically.
Auto-dismiss notifications are automatically removed from the Home Screen when the user clicks on them.
Returns | |
---|---|
boolean |
true if the recommendation is marked for auto dismissal, or false otherwise. |
void setAutoDismiss (boolean autoDismiss)
Sets the flag indicating if this recommendation should be dismissed automatically.
Auto-dismiss notifications are automatically removed from the Home Screen when the user clicks on them.
Parameters | |
---|---|
autoDismiss |
boolean :
A boolean indicating if the recommendation should be auto dismissed or
not.
|
void setGroup (String groupTag)
Sets the String group ID tag for this recommendation.
Recommendations in the same group are ranked by the Home Screen together, and the sort order within a group is respected. This can be useful if the application has different sources for recommendations, like "trending", "subscriptions", and "new music" categories for YouTube, where the user can be more interested in recommendations from one group than another.
Parameters | |
---|---|
groupTag |
String :
A String containing the group ID tag for this recommendation.
|
void setProgress (int max, int progress)
Sets the progress information for the content pointed to by this recommendation.
Parameters | |
---|---|
max |
int :
The maximum value for the progress of this content. |
progress |
int :
The progress amount for this content. Must be in the range (0 - max).
|
void setSortKey (String sortKey)
Sets the String sort key for this recommendation.
The sort key must be a String representation of a float number between 0.0 and 1.0, and is used to indicate the relative importance (and sort order) of a single recommendation within its specified group. The recommendations will be ordered in decreasing order of importance within a given group.
Parameters | |
---|---|
sortKey |
String :
A String containing the sort key for this recommendation.
|
void setStatus (int status)
Sets the availability status value for the content. This status indicates whether the content is ready to be consumed on the device, or if the user must first purchase, rent, subscribe to, or download the content.
Parameters | |
---|---|
status |
int :
The status value for the content. (see the CONTENT_STATUS_* for
the valid status values).
|