use of com.amazon.android.contentbrowser.database.helpers.RecentDatabaseHelper in project zype-firebuilder by zype.
the class ContentBrowser method getRecentContent.
/**
* Get a list of contents to display in the "Continue Watching" row that have been watched for
* more than the grace period value located in the custom.xml as recent_grace_period.
*
* @return A list of contents.
*/
public List<Content> getRecentContent() {
List<Content> contentList = new ArrayList<>();
RecentDatabaseHelper databaseHelper = RecentDatabaseHelper.getInstance();
if (databaseHelper != null) {
List<RecentRecord> records = databaseHelper.getUnfinishedRecords(mAppContext, mAppContext.getResources().getInteger(R.integer.recent_grace_period));
for (RecentRecord record : records) {
Content content = mContentLoader.getRootContentContainer().findContentById(record.getContentId());
if (content != null) {
contentList.add(content);
}
}
}
return contentList;
}
use of com.amazon.android.contentbrowser.database.helpers.RecentDatabaseHelper in project zype-firebuilder by zype.
the class ContentBrowser method getRecentRecord.
/**
* Get Recent Record from database based on content id
*
* @param content Content.
* @return Recent Record.
*/
public RecentRecord getRecentRecord(Content content) {
RecentRecord record = null;
RecentDatabaseHelper databaseHelper = RecentDatabaseHelper.getInstance();
if (databaseHelper != null) {
if (databaseHelper.recordExists(mAppContext, content.getId())) {
record = databaseHelper.getRecord(mAppContext, content.getId());
}
} else {
Log.e(TAG, "Unable to load content because database is null");
}
return record;
}
Aggregations