public final class RecommendationExtender extends Object implements Notification.Extender
Helper class to add content info extensions to notifications. To create a notification with content info extensions:
Notification.Builder
, setting any desired properties.
RecommendationExtender
.
add
and set
methods of
RecommendationExtender
.
Notification.Builder.extend(Notification.Extender)
to apply the extensions to a notification.
Notification notification = new Notification.Builder(context) * ... * .extend(new RecommendationExtender() * .set*(...)) * .build(); *
Content info extensions can be accessed on an existing notification by using the
RecommendationExtender(Notification)
constructor, and then using the get
methods
to access values.
Constructor and Description |
---|
RecommendationExtender()
Create a
RecommendationExtender with default options. |
RecommendationExtender(Notification notif)
Create a
RecommendationExtender from the RecommendationExtender options of an
existing Notification. |
Modifier and Type | Method and Description |
---|---|
Notification.Builder |
extend(Notification.Builder builder)
Apply content extensions to a notification that is being built.
|
String[] |
getContentTypes()
Returns an array containing the content types that describe the content associated with the
notification.
|
String[] |
getGenres()
Returns an array containing the content genres that describe the content associated with the
notification.
|
String |
getMaturityRating()
Returns the maturity level rating for the content associated with the notification.
|
String |
getPricingType()
Gets the pricing type for the content associated with the notification.
|
String |
getPricingValue()
Gets the price value (when applicable) for the content associated with a notification.
|
String |
getPrimaryContentType()
Returns the primary content type tag for the content associated with the notification.
|
long |
getRunningTime()
Returns the running time for the content associated with the notification.
|
int |
getStatus()
Returns status value for the content associated with the notification.
|
RecommendationExtender |
setContentTypes(String[] types)
Sets the content types associated with the notification content.
|
RecommendationExtender |
setGenres(String[] genres)
Sets the content genres associated with the notification content.
|
RecommendationExtender |
setMaturityRating(String maturityRating)
Sets the maturity level rating for the content associated with the notification.
|
RecommendationExtender |
setPricingInformation(String priceType,
String priceValue)
Sets the pricing and availability information for the content associated with the
notification.
|
RecommendationExtender |
setRunningTime(long length)
Sets the running time (when applicable) for the content associated with the notification.
|
RecommendationExtender |
setStatus(int contentStatus)
Sets the availability status for the content associated with the notification.
|
public RecommendationExtender()
RecommendationExtender
with default options.public RecommendationExtender(Notification notif)
RecommendationExtender
from the RecommendationExtender options of an
existing Notification.notif
- The notification from which to copy options.public Notification.Builder extend(Notification.Builder builder)
Notification.Builder.extend(Notification.Extender)
method of Notification.Builder
.extend
in interface Notification.Extender
builder
- the builder to be modified.public RecommendationExtender setContentTypes(String[] types)
types
- Array of predefined type tags (see the CONTENT_TYPE_*
constants)
that describe the content referred to by a notification.public String[] getContentTypes()
CONTENT_TYPE_*
constants) that
describe the content associated with the notification.setContentTypes(java.lang.String[])
public String getPrimaryContentType()
CONTENT_TYPE_*
constants) indicating the
primary type for the content associated with the notification.setContentTypes(java.lang.String[])
public RecommendationExtender setGenres(String[] genres)
Some examples: "comedy", "action", "dance", "electronica", "racing", etc.
genres
- Array of genre string tags that describe the content referred to by a
notification.public String[] getGenres()
setGenres(java.lang.String[])
public RecommendationExtender setPricingInformation(String priceType, String priceValue)
priceType
- Pricing type for this content. Must be one of the predefined pricing type
tags (see the CONTENT_PRICING_*
constants).priceValue
- A string containing a representation of the content price in the current
locale and currency.public String getPricingType()
CONTENT_PRICING_*
constants).setPricingInformation(java.lang.String, java.lang.String)
public String getPricingValue()
setPricingInformation(java.lang.String, java.lang.String)
public RecommendationExtender setStatus(int contentStatus)
contentStatus
- The status value for this content. Must be one of the predefined content
status values (see the CONTENT_STATUS_*
constants).public int getStatus()
CONTENT_STATUS_*
for the defined valid status values).setStatus(int)
public RecommendationExtender setMaturityRating(String maturityRating)
maturityRating
- A tag indicating the maturity level rating for the content. This tag
must be one of the predefined maturity rating tags (see the CONTENT_MATURITY_*
constants).public String getMaturityRating()
CONTENT_MATURITY_*
constants).setMaturityRating(java.lang.String)
public RecommendationExtender setRunningTime(long length)
length
- The runing time, in seconds, of the content associated with the notification.public long getRunningTime()
setRunningTime(long)