public final class ContentRecommendation extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ContentRecommendation.Builder
Builder class for
ContentRecommendation objects. |
static interface |
ContentRecommendation.ContentMaturity |
static interface |
ContentRecommendation.ContentPricing |
static interface |
ContentRecommendation.ContentStatus |
static interface |
ContentRecommendation.ContentType |
static class |
ContentRecommendation.IntentData
Object used to encapsulate the data to be used to build the
PendingIntent object
associated with a given content recommendation, at the time this recommendation gets posted
to the home Screen. |
static interface |
ContentRecommendation.IntentType |
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_MATURITY_ALL
Value to be used with
ContentRecommendation.Builder.setMaturityRating(java.lang.String) to indicate that the content referred
by the notification is suitable for all audiences. |
static String |
CONTENT_MATURITY_HIGH
Value to be used with
ContentRecommendation.Builder.setMaturityRating(java.lang.String) to indicate that the content referred
by the notification is suitable for audiences of high maturity and above. |
static String |
CONTENT_MATURITY_LOW
Value to be used with
ContentRecommendation.Builder.setMaturityRating(java.lang.String) to indicate that the content referred
by the notification is suitable for audiences of low maturity and above. |
static String |
CONTENT_MATURITY_MEDIUM
Value to be used with
ContentRecommendation.Builder.setMaturityRating(java.lang.String) to indicate that the content referred
by the notification is suitable for audiences of medium maturity and above. |
static String |
CONTENT_PRICING_FREE
Value to be used with
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.String) to indicate that the content
referred by the notification item is free to consume. |
static String |
CONTENT_PRICING_PREORDER
Value to be used with
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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. |
static String |
CONTENT_PRICING_PURCHASE
Value to be used with
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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. |
static String |
CONTENT_PRICING_RENTAL
Value to be used with
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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. |
static String |
CONTENT_PRICING_SUBSCRIPTION
Value to be used with
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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. |
static int |
CONTENT_STATUS_AVAILABLE
Value to be used with
ContentRecommendation.Builder.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. |
static int |
CONTENT_STATUS_PENDING
Value to be used with
ContentRecommendation.Builder.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. |
static int |
CONTENT_STATUS_READY
Value to be used with
ContentRecommendation.Builder.setStatus(int) to indicate that the content referred by the
notification is available and ready to be consumed immediately. |
static int |
CONTENT_STATUS_UNAVAILABLE
Value to be used with
ContentRecommendation.Builder.setStatus(int) to indicate that the content referred by the
notification is not available. |
static String |
CONTENT_TYPE_APP
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is an application. |
static String |
CONTENT_TYPE_BOOK
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a book. |
static String |
CONTENT_TYPE_COMIC
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a comic book. |
static String |
CONTENT_TYPE_GAME
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a game. |
static String |
CONTENT_TYPE_MAGAZINE
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a magazine. |
static String |
CONTENT_TYPE_MOVIE
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a movie. |
static String |
CONTENT_TYPE_MUSIC
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a song or album. |
static String |
CONTENT_TYPE_NEWS
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a news item. |
static String |
CONTENT_TYPE_PODCAST
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a podcast. |
static String |
CONTENT_TYPE_RADIO
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a radio station. |
static String |
CONTENT_TYPE_SERIAL
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is serial. |
static String |
CONTENT_TYPE_SPORTS
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is sports. |
static String |
CONTENT_TYPE_TRAILER
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a trailer. |
static String |
CONTENT_TYPE_VIDEO
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a video clip. |
static String |
CONTENT_TYPE_WEBSITE
Value to be used with
ContentRecommendation.Builder.setContentTypes(java.lang.String[]) to indicate that the content referred
by the notification item is a website. |
static int |
INTENT_TYPE_ACTIVITY
Value to be used with
ContentRecommendation.Builder.setContentIntentData(int, android.content.Intent, int, android.os.Bundle) and
ContentRecommendation.Builder.setDismissIntentData(int, android.content.Intent, int, android.os.Bundle) to indicate that a PendingIntent for an Activity
should be created when posting the recommendation to the HomeScreen. |
static int |
INTENT_TYPE_BROADCAST
Value to be used with
ContentRecommendation.Builder.setContentIntentData(int, android.content.Intent, int, android.os.Bundle) and
ContentRecommendation.Builder.setDismissIntentData(int, android.content.Intent, int, android.os.Bundle) to indicate that a PendingIntent for a Broadcast
should be created when posting the recommendation to the HomeScreen. |
static int |
INTENT_TYPE_SERVICE
Value to be used with
ContentRecommendation.Builder.setContentIntentData(int, android.content.Intent, int, android.os.Bundle) and
ContentRecommendation.Builder.setDismissIntentData(int, android.content.Intent, int, android.os.Bundle) to indicate that a PendingIntent for a Service
should be created when posting the recommendation to the HomeScreen. |
Modifier and Type | Method and Description |
---|---|
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
Notification object which contains the content
recommendation data encapsulated by this object, which can be used for posting the
recommendation via the NotificationManager . |
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.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
hasProgressInfo()
Indicates if this recommendation contains valid progress information.
|
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.
|
public static final String CONTENT_TYPE_VIDEO
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a video clip.public static final String CONTENT_TYPE_MOVIE
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a movie.public static final String CONTENT_TYPE_TRAILER
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a trailer.public static final String CONTENT_TYPE_SERIAL
ContentRecommendation.Builder.setContentTypes(java.lang.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.public static final String CONTENT_TYPE_MUSIC
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a song or album.public static final String CONTENT_TYPE_RADIO
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a radio station.public static final String CONTENT_TYPE_PODCAST
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a podcast.public static final String CONTENT_TYPE_NEWS
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a news item.public static final String CONTENT_TYPE_SPORTS
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is sports.public static final String CONTENT_TYPE_APP
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is an application.public static final String CONTENT_TYPE_GAME
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a game.public static final String CONTENT_TYPE_BOOK
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a book.public static final String CONTENT_TYPE_COMIC
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a comic book.public static final String CONTENT_TYPE_MAGAZINE
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a magazine.public static final String CONTENT_TYPE_WEBSITE
ContentRecommendation.Builder.setContentTypes(java.lang.String[])
to indicate that the content referred
by the notification item is a website.public static final String CONTENT_PRICING_FREE
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.String)
to indicate that the content
referred by the notification item is free to consume.public static final String CONTENT_PRICING_RENTAL
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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.public static final String CONTENT_PRICING_PURCHASE
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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.public static final String CONTENT_PRICING_PREORDER
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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.public static final String CONTENT_PRICING_SUBSCRIPTION
ContentRecommendation.Builder.setPricingInformation(java.lang.String, java.lang.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.public static final int CONTENT_STATUS_READY
ContentRecommendation.Builder.setStatus(int)
to indicate that the content referred by the
notification is available and ready to be consumed immediately.public static final int CONTENT_STATUS_PENDING
ContentRecommendation.Builder.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.public static final int CONTENT_STATUS_AVAILABLE
ContentRecommendation.Builder.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.public static final int CONTENT_STATUS_UNAVAILABLE
ContentRecommendation.Builder.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.public static final String CONTENT_MATURITY_ALL
ContentRecommendation.Builder.setMaturityRating(java.lang.String)
to indicate that the content referred
by the notification is suitable for all audiences.public static final String CONTENT_MATURITY_LOW
ContentRecommendation.Builder.setMaturityRating(java.lang.String)
to indicate that the content referred
by the notification is suitable for audiences of low maturity and above.public static final String CONTENT_MATURITY_MEDIUM
ContentRecommendation.Builder.setMaturityRating(java.lang.String)
to indicate that the content referred
by the notification is suitable for audiences of medium maturity and above.public static final String CONTENT_MATURITY_HIGH
ContentRecommendation.Builder.setMaturityRating(java.lang.String)
to indicate that the content referred
by the notification is suitable for audiences of high maturity and above.public static final int INTENT_TYPE_ACTIVITY
ContentRecommendation.Builder.setContentIntentData(int, android.content.Intent, int, android.os.Bundle)
and
ContentRecommendation.Builder.setDismissIntentData(int, android.content.Intent, int, android.os.Bundle)
to indicate that a PendingIntent
for an Activity
should be created when posting the recommendation to the HomeScreen.public static final int INTENT_TYPE_BROADCAST
ContentRecommendation.Builder.setContentIntentData(int, android.content.Intent, int, android.os.Bundle)
and
ContentRecommendation.Builder.setDismissIntentData(int, android.content.Intent, int, android.os.Bundle)
to indicate that a PendingIntent
for a Broadcast
should be created when posting the recommendation to the HomeScreen.public static final int INTENT_TYPE_SERVICE
ContentRecommendation.Builder.setContentIntentData(int, android.content.Intent, int, android.os.Bundle)
and
ContentRecommendation.Builder.setDismissIntentData(int, android.content.Intent, int, android.os.Bundle)
to indicate that a PendingIntent
for a Service
should be created when posting the recommendation to the HomeScreen.public String getIdTag()
public String getTitle()
public String getText()
public String getSourceName()
public Bitmap getContentImage()
public int getBadgeImageResourceId()
The resource id represents the icon resource in the source application package.
public String getBackgroundImageUri()
public int getColor()
public void setGroup(String groupTag)
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.
groupTag
- A String containing the group ID tag for this recommendation.public String getGroup()
public void setSortKey(String sortKey)
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.
sortKey
- A String containing the sort key for this recommendation.public String getSortKey()
public void setProgress(int max, int progress)
max
- The maximum value for the progress of this content.progress
- The progress amount for this content. Must be in the range (0 - max).public boolean hasProgressInfo()
public int getProgressMax()
public int getProgressValue()
public void setAutoDismiss(boolean autoDismiss)
Auto-dismiss notifications are automatically removed from the Home Screen when the user clicks on them.
autoDismiss
- A boolean indicating if the recommendation should be auto dismissed or
not.public boolean isAutoDismiss()
Auto-dismiss notifications are automatically removed from the Home Screen when the user clicks on them.
public ContentRecommendation.IntentData getContentIntent()
public ContentRecommendation.IntentData getDismissIntent()
public String[] getContentTypes()
CONTENT_TYPE_*
constants) that
describe the recommended content.public String getPrimaryContentType()
CONTENT_TYPE_*
constants) indicating the
primary content type for the recommendation.public String[] getGenres()
public String getPricingType()
CONTENT_PRICING_*
constants).public String getPricingValue()
public void setStatus(int status)
status
- The status value for the content. (see the CONTENT_STATUS_*
for
the valid status values).public int getStatus()
CONTENT_STATUS_*
constants for the valid status values).public String getMaturityRating()
CONTENT_MATURITY_*
constants).public long getRunningTime()
public boolean equals(Object other)
Object
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.
equals
in class Object
other
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public int hashCode()
Object
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.
Object.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.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public Notification getNotificationObject(Context context)
Notification
object which contains the content
recommendation data encapsulated by this object, which can be used for posting the
recommendation via the NotificationManager
.context
- A Context
that will be used to construct the
Notification
object which will carry the
recommendation data.Notification
containing the stored recommendation
data.