Search in sources :

Example 76 with Content

use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.

the class ContentBrowser method getWatchlistContent.

/**
 * Get a list of content that belong in the watchlist.
 *
 * @return List of content.
 */
public List<Content> getWatchlistContent() {
    List<Content> contentList = new ArrayList<>();
    WatchlistDatabaseHelper databaseHelper = WatchlistDatabaseHelper.getInstance();
    if (databaseHelper != null) {
        List<String> contendIds = databaseHelper.getWatchlistContentIds(mAppContext);
        for (String contentId : contendIds) {
            Content content = mContentLoader.getRootContentContainer().findContentById(contentId);
            if (content != null) {
                contentList.add(content);
            } else // The content is no longer valid so remove from database.
            {
                Log.d(TAG, "Content no longer valid");
                databaseHelper.deleteRecord(mAppContext, contentId);
            }
        }
    }
    return contentList;
}
Also used : Content(com.amazon.android.model.content.Content) ArrayList(java.util.ArrayList) WatchlistDatabaseHelper(com.amazon.android.contentbrowser.database.helpers.WatchlistDatabaseHelper)

Aggregations

Content (com.amazon.android.model.content.Content)76 ContentContainer (com.amazon.android.model.content.ContentContainer)28 Test (org.junit.Test)26 ArrayObjectAdapter (androidx.leanback.widget.ArrayObjectAdapter)13 ListRow (androidx.leanback.widget.ListRow)13 ArrayList (java.util.ArrayList)11 Recipe (com.amazon.android.recipe.Recipe)10 Intent (android.content.Intent)8 RecentDatabaseHelper (com.amazon.android.contentbrowser.database.helpers.RecentDatabaseHelper)7 TextUtils (android.text.TextUtils)6 RecentRecord (com.amazon.android.contentbrowser.database.records.RecentRecord)6 CardPresenter (com.amazon.android.tv.tenfoot.presenter.CardPresenter)6 List (java.util.List)6 Context (android.content.Context)5 HeaderItem (androidx.leanback.widget.HeaderItem)5 Action (com.amazon.android.model.Action)5 NavigatorModel (com.amazon.android.navigator.NavigatorModel)5 AndroidSchedulers (rx.android.schedulers.AndroidSchedulers)5 Bundle (android.os.Bundle)4 Log (android.util.Log)4