19f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima/*
29f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * Copyright (C) 2015 The Android Open Source Project
39f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima *
49f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * Licensed under the Apache License, Version 2.0 (the "License");
59f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * you may not use this file except in compliance with the License.
69f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * You may obtain a copy of the License at
79f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima *
89f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima *      http://www.apache.org/licenses/LICENSE-2.0
99f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima *
109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * Unless required by applicable law or agreed to in writing, software
119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * distributed under the License is distributed on an "AS IS" BASIS,
129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * See the License for the specific language governing permissions and
149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * limitations under the License.
159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima */
169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limapackage android.support.app.recommendation;
189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.app.Notification;
209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.app.PendingIntent;
219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.content.Context;
229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.content.Intent;
239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.graphics.Bitmap;
249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.os.Bundle;
259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.support.annotation.IntDef;
269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.support.annotation.Nullable;
279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.support.annotation.StringDef;
289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport android.text.TextUtils;
299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limaimport java.util.Arrays;
319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima/**
339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * The ContentRecommendation object encapsulates all application provided data for a single content
349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima * recommendation item.
359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima */
369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Limapublic final class ContentRecommendation
379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima{
389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    @StringDef({
399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_VIDEO,
409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_MOVIE,
419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_TRAILER,
429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_SERIAL,
439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_MUSIC,
449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_RADIO,
459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_PODCAST,
469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_NEWS,
479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_SPORTS,
489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_APP,
499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_GAME,
509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_BOOK,
519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_COMIC,
529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_MAGAZINE,
539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_TYPE_WEBSITE,
549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    })
559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public @interface ContentType {}
569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a video clip.
609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_VIDEO = "android.contentType.video";
629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a movie.
669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_MOVIE = "android.contentType.movie";
689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a trailer.
729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_TRAILER = "android.contentType.trailer";
749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is serial. It can refer to an entire show, a single season or
789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * series, or a single episode.
799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_SERIAL = "android.contentType.serial";
819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a song or album.
859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_MUSIC = "android.contentType.music";
879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a radio station.
919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_RADIO = "android.contentType.radio";
939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a podcast.
979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_PODCAST = "android.contentType.podcast";
999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a news item.
1039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_NEWS = "android.contentType.news";
1059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is sports.
1099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_SPORTS = "android.contentType.sports";
1119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is an application.
1159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_APP = "android.contentType.app";
1179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a game.
1219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_GAME = "android.contentType.game";
1239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a book.
1279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_BOOK = "android.contentType.book";
1299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a comic book.
1339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_COMIC = "android.contentType.comic";
1359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a magazine.
1399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_MAGAZINE = "android.contentType.magazine";
1419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentTypes} to indicate that the content referred
1449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification item is a website.
1459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_TYPE_WEBSITE = "android.contentType.website";
1479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    @StringDef({
1499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_PRICING_FREE,
1509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_PRICING_RENTAL,
1519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_PRICING_PURCHASE,
1529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_PRICING_PREORDER,
1539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_PRICING_SUBSCRIPTION,
1549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    })
1559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public @interface ContentPricing {}
1569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setPricingInformation} to indicate that the content
1599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * referred by the notification item is free to consume.
1609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_PRICING_FREE = "android.contentPrice.free";
1629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setPricingInformation} to indicate that the content
1659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * referred by the notification item is available as a rental, and the price value provided is
1669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * the rental price for the item.
1679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_PRICING_RENTAL = "android.contentPrice.rental";
1699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setPricingInformation} to indicate that the content
1729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * referred by the notification item is available for purchase, and the price value provided is
1739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * the purchase price for the item.
1749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_PRICING_PURCHASE = "android.contentPrice.purchase";
1769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setPricingInformation} to indicate that the content
1799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * referred by the notification item is available currently as a pre-order, and the price value
1809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * provided is the purchase price for the item.
1819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_PRICING_PREORDER = "android.contentPrice.preorder";
1839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
1859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setPricingInformation} to indicate that the content
1869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * referred by the notification item is available as part of a subscription based service, and
1879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * the price value provided is the subscription price for the service.
1889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
1899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_PRICING_SUBSCRIPTION =
1909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            "android.contentPrice.subscription";
1919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
1929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    @IntDef({
1939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_STATUS_READY,
1949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_STATUS_PENDING,
1959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_STATUS_AVAILABLE,
1969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_STATUS_UNAVAILABLE,
1979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    })
1989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public @interface ContentStatus {}
1999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setStatus} to indicate that the content referred by the
2029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * notification is available and ready to be consumed immediately.
2039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final int CONTENT_STATUS_READY = 0;
2059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setStatus} to indicate that the content referred by the
2089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * notification is pending, waiting on either a download or purchase operation to complete
2099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * before it can be consumed.
2109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final int CONTENT_STATUS_PENDING = 1;
2129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setStatus} to indicate that the content referred by the
2159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * notification is available, but needs to be first purchased, rented, subscribed or downloaded
2169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * before it can be consumed.
2179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final int CONTENT_STATUS_AVAILABLE = 2;
2199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setStatus} to indicate that the content referred by the
2229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * notification is not available. This could be content not available in a certain region or
2239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * incompatible with the device in use.
2249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final int CONTENT_STATUS_UNAVAILABLE = 3;
2269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    @StringDef({
2289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_MATURITY_ALL,
2299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_MATURITY_LOW,
2309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_MATURITY_MEDIUM,
2319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        CONTENT_MATURITY_HIGH,
2329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    })
2339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public @interface ContentMaturity {}
2349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setMaturityRating} to indicate that the content referred
2379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification is suitable for all audiences.
2389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_MATURITY_ALL = "android.contentMaturity.all";
2409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setMaturityRating} to indicate that the content referred
2439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification is suitable for audiences of low maturity and above.
2449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_MATURITY_LOW = "android.contentMaturity.low";
2469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setMaturityRating} to indicate that the content referred
2499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification is suitable for audiences of medium maturity and above.
2509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_MATURITY_MEDIUM = "android.contentMaturity.medium";
2529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setMaturityRating} to indicate that the content referred
2559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * by the notification is suitable for audiences of high maturity and above.
2569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final String CONTENT_MATURITY_HIGH = "android.contentMaturity.high";
2589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    @IntDef({
2609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            INTENT_TYPE_ACTIVITY,
2619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            INTENT_TYPE_BROADCAST,
2629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            INTENT_TYPE_SERVICE,
2639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    })
2649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public @interface IntentType {
2659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
2669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentIntentData} and
2699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * {@link Builder#setDismissIntentData} to indicate that a {@link PendingIntent} for an Activity
2709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * should be created when posting the recommendation to the HomeScreen.
2719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final int INTENT_TYPE_ACTIVITY = 1;
2739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentIntentData} and
2769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * {@link Builder#setDismissIntentData} to indicate that a {@link PendingIntent} for a Broadcast
2779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * should be created when posting the recommendation to the HomeScreen.
2789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final int INTENT_TYPE_BROADCAST = 2;
2809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Value to be used with {@link Builder#setContentIntentData} and
2839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * {@link Builder#setDismissIntentData} to indicate that a {@link PendingIntent} for a Service
2849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * should be created when posting the recommendation to the HomeScreen.
2859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final int INTENT_TYPE_SERVICE = 3;
2879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
2889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
2899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Object used to encapsulate the data to be used to build the {@link PendingIntent} object
2909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * associated with a given content recommendation, at the time this recommendation gets posted
2919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * to the home Screen.
2929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <p>
2939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * The members of this object correspond to the fields passed into the {@link PendingIntent}
2949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * factory methods, when creating a new PendingIntent.
2959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
2969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static class IntentData {
2979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        int mType;
2989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        Intent mIntent;
2999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        int mRequestCode;
3009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        Bundle mOptions;
3019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
3029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mIdTag;
3049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mTitle;
3059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mText;
3069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mSourceName;
3079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final Bitmap mContentImage;
3089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final int mBadgeIconId;
3099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mBackgroundImageUri;
3109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final int mColor;
3119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final IntentData mContentIntentData;
3129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final IntentData mDismissIntentData;
3139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String[] mContentTypes;
3149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String[] mContentGenres;
3159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mPriceType;
3169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mPriceValue;
3179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final String mMaturityRating;
3189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private final long mRunningTime;
3199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    // Mutable fields
3219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private String mGroup;
3229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private String mSortKey;
3239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private int mProgressAmount;
3249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private int mProgressMax;
3259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private boolean mAutoDismiss;
3269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private int mStatus;
3279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private ContentRecommendation(Builder builder) {
3299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mIdTag = builder.mBuilderIdTag;
3309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mTitle = builder.mBuilderTitle;
3319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mText = builder.mBuilderText;
3329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mSourceName = builder.mBuilderSourceName;
3339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mContentImage = builder.mBuilderContentImage;
3349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mBadgeIconId = builder.mBuilderBadgeIconId;
3359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mBackgroundImageUri = builder.mBuilderBackgroundImageUri;
3369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mColor = builder.mBuilderColor;
3379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mContentIntentData = builder.mBuilderContentIntentData;
3389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mDismissIntentData = builder.mBuilderDismissIntentData;
3399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mContentTypes = builder.mBuilderContentTypes;
3409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mContentGenres = builder.mBuilderContentGenres;
3419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mPriceType = builder.mBuilderPriceType;
3429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mPriceValue = builder.mBuilderPriceValue;
3439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mMaturityRating = builder.mBuilderMaturityRating;
3449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mRunningTime = builder.mBuilderRunningTime;
3459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mGroup = builder.mBuilderGroup;
3479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mSortKey = builder.mBuilderSortKey;
3489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mProgressAmount = builder.mBuilderProgressAmount;
3499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mProgressMax = builder.mBuilderProgressMax;
3509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mAutoDismiss = builder.mBuilderAutoDismiss;
3519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mStatus = builder.mBuilderStatus;
3529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
3539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
3559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the String Id tag which uniquely identifies this recommendation.
3569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
3579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return The String Id tag for this recommendation.
3589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
3599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getIdTag() {
3609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mIdTag;
3619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
3629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
3649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the content title for this recommendation.
3659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
3669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A String containing the recommendation content title.
3679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
3689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getTitle() {
3699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mTitle;
3709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
3719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
3739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the description text for this recommendation.
3749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
3759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A String containing the recommendation description text.
3769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
3779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getText() {
3789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mText;
3799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
3809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
3829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the source application name for this recommendation.
3839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
3849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A String containing the recommendation source name.
3859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
3869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getSourceName() {
3879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mSourceName;
3889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
3899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
3919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the Bitmap containing the recommendation image.
3929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
3939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A Bitmap containing the recommendation image.
3949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
3959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public Bitmap getContentImage() {
3969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mContentImage;
3979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
3989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
3999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the resource id for the recommendation badging icon.
4019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <p>
4029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * The resource id represents the icon resource in the source application package.
4039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An integer id for the badge icon resource.
4059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public int getBadgeImageResourceId() {
4079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mBadgeIconId;
4089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns a Content URI that can be used to retrieve the background image for this
4129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * recommendation.
4139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A Content URI pointing to the recommendation background image.
4159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getBackgroundImageUri() {
4179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mBackgroundImageUri;
4189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the accent color value to be used in the UI when displaying this content
4229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * recommendation to the user.
4239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An integer value representing the accent color for this recommendation.
4259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public int getColor() {
4279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mColor;
4289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Sets the String group ID tag for this recommendation.
4329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <p>
4339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Recommendations in the same group are ranked by the Home Screen together, and the sort order
4349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * within a group is respected. This can be useful if the application has different sources for
4359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * recommendations, like "trending", "subscriptions", and "new music" categories for YouTube,
4369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * where the user can be more interested in recommendations from one group than another.
4379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param groupTag A String containing the group ID tag for this recommendation.
4399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public void setGroup(String groupTag) {
4419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mGroup = groupTag;
4429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the String group ID tag for this recommendation.
4469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A String containing the group ID tag for this recommendation.
4489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getGroup() {
4509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mGroup;
4519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Sets the String sort key for this recommendation.
4559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <p>
4569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * The sort key must be a String representation of a float number between 0.0 and 1.0, and is
4579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * used to indicate the relative importance (and sort order) of a single recommendation within
4589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * its specified group. The recommendations will be ordered in decreasing order of importance
4599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * within a given group.
4609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param sortKey A String containing the sort key for this recommendation.
4629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public void setSortKey(String sortKey) {
4649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mSortKey = sortKey;
4659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the String sort key for this recommendation.
4699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A String containing the sort key for this recommendation.
4719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getSortKey() {
4739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mSortKey;
4749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Sets the progress information for the content pointed to by this recommendation.
4789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param max The maximum value for the progress of this content.
4809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param progress The progress amount for this content. Must be in the range (0 - max).
4819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public void setProgress(int max, int progress) {
4839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (max < 0 || progress < 0) {
4849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            throw new IllegalArgumentException();
4859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
4869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mProgressMax = max;
4879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mProgressAmount = progress;
4889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
4919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Indicates if this recommendation contains valid progress information.
4929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
4939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return true if the recommendation contains valid progress data, false otherwise.
4949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
4959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public boolean hasProgressInfo() {
4969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mProgressMax != 0;
4979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
4989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
4999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the maximum value for the progress data of this recommendation.
5019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An integer representing the maximum progress value.
5039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public int getProgressMax() {
5059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mProgressMax;
5069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the progress amount for this recommendation.
5109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An integer representing the recommendation progress amount.
5129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public int getProgressValue() {
5149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mProgressAmount;
5159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Sets the flag indicating if this recommendation should be dismissed automatically.
5199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <p>
5209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Auto-dismiss notifications are automatically removed from the Home Screen when the user
5219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * clicks on them.
5229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param autoDismiss A boolean indicating if the recommendation should be auto dismissed or
5249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *            not.
5259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public void setAutoDismiss(boolean autoDismiss) {
5279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mAutoDismiss = autoDismiss;
5289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Indicates whether this recommendation should be dismissed automatically.
5329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <p>
5339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Auto-dismiss notifications are automatically removed from the Home Screen when the user
5349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * clicks on them.
5359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return true if the recommendation is marked for auto dismissal, or false otherwise.
5379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public boolean isAutoDismiss() {
5399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mAutoDismiss;
5409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the data for the Intent that will be issued when the user clicks on the
5449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * recommendation.
5459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An IntentData object, containing the data for the Intent that gets issued when the
5479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         recommendation is clicked on.
5489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public IntentData getContentIntent() {
5509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mContentIntentData;
5519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the data for the Intent that will be issued when the recommendation gets dismissed
5559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * from the Home Screen, due to an user action.
5569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An IntentData object, containing the data for the Intent that gets issued when the
5589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         recommendation is dismissed from the Home Screen.
5599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public IntentData getDismissIntent() {
5619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mDismissIntentData;
5629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns an array containing the content types tags that describe the content. The first tag
5669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * entry is considered the primary type for the content, and is used for content ranking
5679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * purposes.
5689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An array of predefined type tags (see the <code>CONTENT_TYPE_*</code> constants) that
5709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         describe the recommended content.
5719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String[] getContentTypes() {
5739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (mContentTypes != null) {
5749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return Arrays.copyOf(mContentTypes, mContentTypes.length);
5759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
5769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mContentTypes;
5779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the primary content type tag for the recommendation, or null if no content types have
5819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * been specified.
5829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A predefined type tag (see the <code>CONTENT_TYPE_*</code> constants) indicating the
5849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         primary content type for the recommendation.
5859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getPrimaryContentType() {
5879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (mContentTypes != null && mContentTypes.length > 0) {
5889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return mContentTypes[0];
5899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
5909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return null;
5919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
5929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
5939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
5949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns an array containing the genres that describe the content. Genres are open ended
5959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * String tags.
5969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
5979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return An array of genre tags that describe the recommended content.
5989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
5999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String[] getGenres() {
6009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (mContentGenres != null) {
6019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return Arrays.copyOf(mContentGenres, mContentGenres.length);
6029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
6039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mContentGenres;
6049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
6079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Gets the pricing type for the content.
6089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
6099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A predefined tag indicating the pricing type for the content (see the <code>
6109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         CONTENT_PRICING_*</code> constants).
6119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
6129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getPricingType() {
6139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mPriceType;
6149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
6179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Gets the price value (when applicable) for the content. The value will be provided as a
6189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * String containing the price in the appropriate currency for the current locale.
6199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
6209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A string containing a representation of the content price in the current locale and
6219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         currency.
6229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
6239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getPricingValue() {
6249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mPriceValue;
6259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
6289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Sets the availability status value for the content. This status indicates whether the content
6299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * is ready to be consumed on the device, or if the user must first purchase, rent, subscribe
6309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * to, or download the content.
6319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
6329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param status The status value for the content. (see the <code>CONTENT_STATUS_*</code> for
6339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *            the valid status values).
6349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
6359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public void setStatus(@ContentStatus int status) {
6369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        mStatus = status;
6379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
6409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns availability status value for the content. This status indicates whether the content
6419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * is ready to be consumed on the device, or if the user must first purchase, rent, subscribe
6429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * to, or download the content.
6439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
6449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return The status value for the content, or -1 is a valid status has not been specified (see
6459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         the <code>CONTENT_STATUS_*</code> constants for the valid status values).
6469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
6479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public int getStatus() {
6489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mStatus;
6499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
6529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the maturity level rating for the content.
6539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
6549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return returns a predefined tag indicating the maturity level rating for the content (see
6559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         the <code>CONTENT_MATURITY_*</code> constants).
6569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
6579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public String getMaturityRating() {
6589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mMaturityRating;
6599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
6629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns the running time for the content.
6639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
6649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return The run length, in seconds, of the content associated with the notification.
6659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
6669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public long getRunningTime() {
6679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return mRunningTime;
6689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    @Override
6719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public boolean equals(Object other) {
6729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (other instanceof ContentRecommendation) {
6739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return TextUtils.equals(mIdTag, ((ContentRecommendation) other).getIdTag());
6749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
6759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return false;
6769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    @Override
6799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public int hashCode() {
6809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (mIdTag != null) {
6819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return mIdTag.hashCode();
6829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
6839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return Integer.MAX_VALUE;
6849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
6859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
6869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
6879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Builder class for {@link ContentRecommendation} objects. Provides a convenient way to set the
6889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * various fields of a {@link ContentRecommendation}.
6899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <p>
6909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Example:
6919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
6929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * <pre class="prettyprint">
6939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * ContentRecommendation rec = new ContentRecommendation.Builder()
6949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         .setIdInfo(id, &quot;MyTagId&quot;)
6959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         .setTitle(&quot;My Content Recommendation&quot;)
6969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         .setText(&quot;An example of content recommendation&quot;)
6979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         .setContentImage(myBitmap)
6989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         .setBadgeIcon(R.drawable.app_icon)
6999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         .setGroup(&quot;Trending&quot;)
7009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         .build();
7019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * </pre>
7029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
7039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public static final class Builder {
7049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderIdTag;
7059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderTitle;
7069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderText;
7079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderSourceName;
7089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private Bitmap mBuilderContentImage;
7099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private int mBuilderBadgeIconId;
7109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderBackgroundImageUri;
7119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private int mBuilderColor;
7129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderGroup;
7139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderSortKey;
7149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private int mBuilderProgressAmount;
7159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private int mBuilderProgressMax;
7169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private boolean mBuilderAutoDismiss;
7179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private IntentData mBuilderContentIntentData;
7189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private IntentData mBuilderDismissIntentData;
7199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String[] mBuilderContentTypes;
7209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String[] mBuilderContentGenres;
7219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderPriceType;
7229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderPriceValue;
7239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private int mBuilderStatus;
7249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private String mBuilderMaturityRating;
7259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        private long mBuilderRunningTime;
7269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
7279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
7289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Constructs a new Builder.
7299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
7309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
7319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder() {
7329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
7339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
7349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
7359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the Id tag that uniquely identifies this recommendation object.
7369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
7379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param idTag A String tag identifier for this recommendation.
7389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
7399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
7409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setIdTag(String idTag) {
7419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderIdTag = checkNotNull(idTag);
7429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
7439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
7449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
7459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
7469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the content title for the recommendation.
7479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
7489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param title A String containing the recommendation content title.
7499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
7509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
7519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setTitle(String title) {
7529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderTitle = checkNotNull(title);
7539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
7549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
7559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
7569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
7579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the description text for the recommendation.
7589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
7599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param description A String containing the recommendation description text.
7609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
7619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
7629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setText(@Nullable String description) {
7639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderText = description;
7649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
7659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
7669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
7679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
7689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the source application name for the recommendation.
7699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <P>
7709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * If the source name is never set, or set to null, the application name retrieved from its
7719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * package will be used by default.
7729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
7739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param source A String containing the recommendation source name.
7749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
7759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
7769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setSourceName(@Nullable String source) {
7779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderSourceName = source;
7789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
7799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
7809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
7819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
7829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the recommendation image.
7839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
7849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param image A Bitmap containing the recommendation image.
7859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
7869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
7879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setContentImage(Bitmap image) {
7889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentImage = checkNotNull(image);
7899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
7909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
7919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
7929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
7939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the resource ID for the recommendation badging icon.
7949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <p>
7959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * The resource id represents the icon resource in the source application package. If not
7969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * set, or an invalid resource ID is specified, the application icon retrieved from its
7979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * package will be used by default.
7989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
7999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param iconResourceId An integer id for the badge icon resource.
8009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
8019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
8029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setBadgeIcon(int iconResourceId) {
8039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderBadgeIconId = iconResourceId;
8049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
8059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
8069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
8079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
8089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the Content URI that will be used to retrieve the background image for the
8099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * recommendation.
8109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
8119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param imageUri A Content URI pointing to the recommendation background image.
8129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
8139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
8149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setBackgroundImageUri(@Nullable String imageUri) {
8159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderBackgroundImageUri = imageUri;
8169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
8179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
8189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
8199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
8209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the accent color value to be used in the UI when displaying this content
8219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * recommendation to the user.
8229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
8239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param color An integer value representing the accent color for this recommendation.
8249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
8259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
8269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setColor(int color) {
8279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderColor = color;
8289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
8299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
8309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
8319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
8329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the String group ID tag for the recommendation.
8339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <p>
8349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Recommendations in the same group are ranked by the Home Screen together, and the sort
8359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * order within a group is respected. This can be useful if the application has different
8369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * sources for recommendations, like "trending", "subscriptions", and "new music" categories
8379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * for YouTube, where the user can be more interested in recommendations from one group than
8389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * another.
8399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
8409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param groupTag A String containing the group ID tag for this recommendation.
8419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
8429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
8439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setGroup(@Nullable String groupTag) {
8449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderGroup = groupTag;
8459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
8469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
8479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
8489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
8499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the String sort key for the recommendation.
8509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <p>
8519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * The sort key must be a String representation of a float number between 0.0 and 1.0, and
8529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * is used to indicate the relative importance (and sort order) of a single recommendation
8539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * within its specified group. The recommendations will be ordered in decreasing order of
8549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * importance within a given group.
8559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
8569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param sortKey A String containing the sort key for this recommendation.
8579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
8589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
8599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setSortKey(@Nullable String sortKey) {
8609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderSortKey = sortKey;
8619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
8629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
8639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
8649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
8659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the progress information for the content pointed to by the recommendation.
8669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
8679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param max The maximum value for the progress of this content.
8689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param progress The progress amount for this content. Must be in the range (0 - max).
8699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
8709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
8719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setProgress(int max, int progress) {
8729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            if (max < 0 || progress < 0) {
8739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                throw new IllegalArgumentException();
8749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            }
8759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderProgressMax = max;
8769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderProgressAmount = progress;
8779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
8789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
8799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
8809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
8819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the flag indicating if the recommendation should be dismissed automatically.
8829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <p>
8839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Auto-dismiss notifications are automatically removed from the Home Screen when the user
8849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * clicks on them.
8859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
8869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param autoDismiss A boolean indicating if the recommendation should be auto dismissed or
8879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            not.
8889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
8899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
8909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setAutoDismiss(boolean autoDismiss) {
8919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderAutoDismiss = autoDismiss;
8929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
8939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
8949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
8959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
8969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the data for the Intent that will be issued when the user clicks on the
8979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * recommendation.
8989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <p>
8999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * The Intent data fields provided correspond to the fields passed into the
9009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * {@link PendingIntent} factory methods, when creating a new PendingIntent. The actual
9019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * PengindIntent object will only be created at the time a recommendation is posted to the
9029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Home Screen.
9039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
9049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param intentType The type of {@link PendingIntent} to be created when posting this
9059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            recommendation.
9069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param intent The Intent which to be issued when the recommendation is clicked on.
9079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param requestCode The private request code to be used when creating the
9089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            {@link PendingIntent}
9099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param options Only used for the Activity Intent type. Additional options for how the
9109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            Activity should be started. May be null if there are no options.
9119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
9129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
9139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setContentIntentData(@IntentType int intentType, Intent intent,
9149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                int requestCode, @Nullable Bundle options) {
9159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            if (intentType != INTENT_TYPE_ACTIVITY &&
9169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                    intentType != INTENT_TYPE_BROADCAST &&
9179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                    intentType != INTENT_TYPE_SERVICE) {
9189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                throw new IllegalArgumentException("Invalid Intent type specified.");
9199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            }
9209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
9219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentIntentData = new IntentData();
9229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentIntentData.mType = intentType;
9239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentIntentData.mIntent = checkNotNull(intent);
9249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentIntentData.mRequestCode = requestCode;
9259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentIntentData.mOptions = options;
9269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
9279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
9289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
9299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
9309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
9319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the data for the Intent that will be issued when the recommendation gets dismissed
9329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * from the Home Screen, due to an user action.
9339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <p>
9349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * The Intent data fields provided correspond to the fields passed into the
9359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * {@link PendingIntent} factory methods, when creating a new PendingIntent. The actual
9369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * PengindIntent object will only be created at the time a recommendation is posted to the
9379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Home Screen.
9389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
9399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param intentType The type of {@link PendingIntent} to be created when posting this
9409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            recommendation.
9419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param intent The Intent which gets issued when the recommendation is dismissed from the
9429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            Home Screen.
9439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param requestCode The private request code to be used when creating the
9449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            {@link PendingIntent}
9459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param options Only used for the Activity Intent type. Additional options for how the
9469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            Activity should be started. May be null if there are no options.
9479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @return The Builder object, for chaining.
9489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
9499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setDismissIntentData(@IntentType int intentType, @Nullable Intent intent,
9509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                int requestCode, @Nullable Bundle options) {
9519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            if (intent != null) {
9529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                if (intentType != INTENT_TYPE_ACTIVITY &&
9539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        intentType != INTENT_TYPE_BROADCAST &&
9549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        intentType != INTENT_TYPE_SERVICE) {
9559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                    throw new IllegalArgumentException("Invalid Intent type specified.");
9569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                }
9579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
9589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                mBuilderDismissIntentData = new IntentData();
9599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                mBuilderDismissIntentData.mType = intentType;
9609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                mBuilderDismissIntentData.mIntent = intent;
9619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                mBuilderDismissIntentData.mRequestCode = requestCode;
9629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                mBuilderDismissIntentData.mOptions = options;
9639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            } else {
9649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                mBuilderDismissIntentData = null;
9659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            }
9669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
9679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
9689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
9699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
9709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the content types associated with the content recommendation. The first tag entry
9719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * will be considered the primary type for the content and will be used for ranking
9729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * purposes. Other secondary type tags may be provided, if applicable, and may be used for
9739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * filtering purposes.
9749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
9759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param types Array of predefined type tags (see the <code>CONTENT_TYPE_*</code>
9769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            constants) that describe the recommended content.
9779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
9789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setContentTypes(String[] types) {
9799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentTypes = checkNotNull(types);
9809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
9819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
9829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
9839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
9849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the content genres for the recommendation. These genres may be used for content
9859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * ranking. Genres are open ended String tags.
9869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * <p>
9879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Some examples: "comedy", "action", "dance", "electronica", "racing", etc.
9889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
9899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param genres Array of genre string tags that describe the recommended content.
9909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
9919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setGenres(String[] genres) {
9929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderContentGenres = genres;
9939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
9949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
9959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
9969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
9979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the pricing and availability information for the recommendation. The provided
9989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * information will indicate the access model for the content (free, rental, purchase or
9999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * subscription) and the price value (if not free).
10009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
10019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param priceType Pricing type for this content. Must be one of the predefined pricing
10029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            type tags (see the <code>CONTENT_PRICING_*</code> constants).
10039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param priceValue A string containing a representation of the content price in the
10049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            current locale and currency.
10059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
10069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setPricingInformation(@ContentPricing String priceType,
10079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                @Nullable String priceValue) {
10089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderPriceType = checkNotNull(priceType);
10099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderPriceValue = priceValue;
10109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
10119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
10129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
10149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the availability status for the content. This status indicates whether the referred
10159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * content is ready to be consumed on the device, or if the user must first purchase, rent,
10169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * subscribe to, or download the content.
10179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
10189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param contentStatus The status value for this content. Must be one of the predefined
10199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            content status values (see the <code>CONTENT_STATUS_*</code> constants).
10209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
10219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setStatus(@ContentStatus int contentStatus) {
10229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderStatus = contentStatus;
10239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
10249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
10259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
10279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the maturity level rating for the content.
10289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
10299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param maturityRating A tag indicating the maturity level rating for the content. This
10309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            tag must be one of the predefined maturity rating tags (see the <code>
10319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *            CONTENT_MATURITY_*</code> constants).
10329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
10339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setMaturityRating(@ContentMaturity String maturityRating) {
10349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderMaturityRating = checkNotNull(maturityRating);
10359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
10369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
10379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
10399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Sets the running time (when applicable) for the content.
10409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         *
10419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * @param length The running time, in seconds, of the content.
10429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
10439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public Builder setRunningTime(long length) {
10449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            if (length < 0) {
10459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                throw new IllegalArgumentException();
10469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            }
10479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            mBuilderRunningTime = length;
10489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return this;
10499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
10509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        /**
10529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * Combine all of the options that have been set and return a new
10539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         * {@link ContentRecommendation} object.
10549f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima         */
10559f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        public ContentRecommendation build() {
10569f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            return new ContentRecommendation(this);
10579f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
10589f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
10599f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10609f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
10619f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Returns a {@link android.app.Notification Notification} object which contains the content
10629f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * recommendation data encapsulated by this object, which can be used for posting the
10639f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * recommendation via the {@link android.app.NotificationManager NotificationManager}.
10649f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
10659f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param context A {@link Context} that will be used to construct the
10669f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *            {@link android.app.Notification Notification} object which will carry the
10679f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *            recommendation data.
10689f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return A {@link android.app.Notification Notification} containing the stored recommendation
10699f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *         data.
10709f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
10719f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    public Notification getNotificationObject(Context context) {
10729f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        Notification.Builder builder = new Notification.Builder(context);
10739f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        RecommendationExtender recExtender = new RecommendationExtender();
10749f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10759f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        // Encode all the content recommendation data in a Notification object
10769f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10779f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setCategory(Notification.CATEGORY_RECOMMENDATION);
10789f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setContentTitle(mTitle);
10799f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setContentText(mText);
10809f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setContentInfo(mSourceName);
10819f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setLargeIcon(mContentImage);
10829f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setSmallIcon(mBadgeIconId);
10839f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (mBackgroundImageUri != null) {
10849f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            builder.getExtras().putString(Notification.EXTRA_BACKGROUND_IMAGE_URI,
10859f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                    mBackgroundImageUri);
10869f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
10879f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setColor(mColor);
10889f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setGroup(mGroup);
10899f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setSortKey(mSortKey);
10909f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setProgress(mProgressMax, mProgressAmount, false);
10919f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.setAutoCancel(mAutoDismiss);
10929f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
10939f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (mContentIntentData != null) {
10949f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            PendingIntent contentPending;
10959f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            if (mContentIntentData.mType == INTENT_TYPE_ACTIVITY) {
10969f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                contentPending = PendingIntent.getActivity(context, mContentIntentData.mRequestCode,
10979f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mContentIntentData.mIntent, PendingIntent.FLAG_UPDATE_CURRENT,
10989f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mContentIntentData.mOptions);
10999f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            } else if (mContentIntentData.mType == INTENT_TYPE_SERVICE) {
11009f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                contentPending = PendingIntent.getService(context, mContentIntentData.mRequestCode,
11019f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mContentIntentData.mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
11029f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            } else { // Default:INTENT_TYPE_BROADCAST{
11039f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                contentPending = PendingIntent.getBroadcast(context,
11049f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mContentIntentData.mRequestCode,
11059f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mContentIntentData.mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
11069f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            }
11079f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            builder.setContentIntent(contentPending);
11089f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
11099f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
11109f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (mDismissIntentData != null) {
11119f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            PendingIntent dismissPending;
11129f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            if (mDismissIntentData.mType == INTENT_TYPE_ACTIVITY) {
11139f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                dismissPending = PendingIntent.getActivity(context, mDismissIntentData.mRequestCode,
11149f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mDismissIntentData.mIntent, PendingIntent.FLAG_UPDATE_CURRENT,
11159f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mDismissIntentData.mOptions);
11169f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            } else if (mDismissIntentData.mType == INTENT_TYPE_SERVICE) {
11179f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                dismissPending = PendingIntent.getService(context, mDismissIntentData.mRequestCode,
11189f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mDismissIntentData.mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
11199f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            } else { // Default:INTENT_TYPE_BROADCAST{
11209f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                dismissPending = PendingIntent.getBroadcast(context,
11219f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mDismissIntentData.mRequestCode,
11229f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima                        mDismissIntentData.mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
11239f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            }
11249f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            builder.setDeleteIntent(dismissPending);
11259f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
11269f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
11279f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        recExtender.setContentTypes(mContentTypes);
11289f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        recExtender.setGenres(mContentGenres);
11299f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        recExtender.setPricingInformation(mPriceType, mPriceValue);
11309f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        recExtender.setStatus(mStatus);
11319f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        recExtender.setMaturityRating(mMaturityRating);
11329f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        recExtender.setRunningTime(mRunningTime);
11339f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
11349f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        builder.extend(recExtender);
11359f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        Notification notif = builder.build();
11369f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return notif;
11379f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
11389f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
11399f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    /**
11409f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * Ensures that an object reference passed as a parameter to the calling method is not null.
11419f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     *
11429f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @param reference an object reference
11439f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @return the non-null reference that was validated
11449f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     * @throws NullPointerException if {@code reference} is null
11459f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima     */
11469f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    private static <T> T checkNotNull(final T reference) {
11479f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        if (reference == null) {
11489f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima            throw new NullPointerException();
11499f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        }
11509f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima        return reference;
11519f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima    }
11529f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima
11539f7b11d8713c9c9dcaa3a308f01604897bfe4677Jose Lima}