use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentDetailsFragment method checkGlobalSearchIntent.
/**
* Check if there is a global search intent.
*/
private boolean checkGlobalSearchIntent() {
Log.v(TAG, "checkGlobalSearchIntent called.");
Intent intent = getActivity().getIntent();
String intentAction = intent.getAction();
String globalSearch = getString(R.string.global_search);
if (globalSearch.equalsIgnoreCase(intentAction)) {
Uri intentData = intent.getData();
Log.d(TAG, "action: " + intentAction + " intentData:" + intentData);
int selectedIndex = Integer.parseInt(intentData.getLastPathSegment());
ContentContainer contentContainer = ContentBrowser.getInstance(getActivity()).getRootContentContainer();
int contentTally = 0;
if (contentContainer == null) {
return false;
}
for (Content content : contentContainer) {
++contentTally;
if (selectedIndex == contentTally) {
mSelectedContent = content;
return true;
}
}
}
return false;
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ZypeContentDetailsPlaylistFragment method onContentUpdateEvent.
@Subscribe
public void onContentUpdateEvent(ContentUpdateEvent event) {
ArrayObjectAdapter rowAdapter = (ArrayObjectAdapter) ((ListRow) mRowsAdapter.get(0)).getAdapter();
for (int i = 0; i < rowAdapter.size(); i++) {
Content content = (Content) rowAdapter.get(i);
if (content.getId().equals(event.videoId)) {
content.setExtraValue(Content.EXTRA_PLAYBACK_POSITION_PERCENTAGE, ContentBrowser.getInstance(getActivity()).getContentLoader().getContentPlaybackPositionPercentage(content));
rowAdapter.notifyArrayItemRangeChanged(i, i + 1);
}
}
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ZypeContentDetailsPlaylistFragment method getVideoPositionInPlaylist.
private int getVideoPositionInPlaylist() {
Content video = ContentBrowser.getInstance(getActivity()).getLastSelectedContent();
String playlistId = video.getExtraValueAsString(Content.EXTRA_PLAYLIST_ID);
ContentContainer playlist = ContentBrowser.getInstance(getActivity()).getPlayList(playlistId);
if (playlist == null) {
return -1;
} else {
return playlist.getContents().indexOf(video);
}
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ZypeContentDetailsPlaylistFragment method updateContents.
public void updateContents() {
Log.d(TAG, "updateContents()");
ArrayObjectAdapter rowsAdapter = mRowsAdapter;
Content video = ContentBrowser.getInstance(getActivity()).getLastSelectedContent();
String playlistId = video.getExtraValueAsString(Content.EXTRA_PLAYLIST_ID);
ContentContainer playlist = ContentBrowser.getInstance(getActivity()).getPlayList(playlistId);
if (playlist == null) {
return;
}
int index = 0;
ListRow row = (ListRow) rowsAdapter.get(index);
ArrayObjectAdapter listRowAdapter = (ArrayObjectAdapter) row.getAdapter();
// Remove 'Load more' action button
if (listRowAdapter.size() > 0 && listRowAdapter.get(listRowAdapter.size() - 1) instanceof PlaylistAction) {
listRowAdapter.remove(listRowAdapter.get(listRowAdapter.size() - 1));
}
if (listRowAdapter.size() > 0 && listRowAdapter.get(listRowAdapter.size() - 1) instanceof Content) {
Content content = (Content) listRowAdapter.get(listRowAdapter.size() - 1);
content.setExtraValue(ContentBrowser.NEXT_PAGE, false);
}
// Add new contents
if (playlist.getContentCount() > listRowAdapter.size()) {
for (int i = listRowAdapter.size(); i < playlist.getContentCount(); i++) {
Content content = playlist.getContents().get(i);
if (playlist.getExtraValueAsInt(ExtraKeys.NEXT_PAGE) > 0 && playlist.getContents().indexOf(content) == playlist.getContentCount() - 1) {
content.setExtraValue(ContentBrowser.NEXT_PAGE, true);
content.setExtraValue(Content.EXTRA_PLAYLIST_ID, playlist.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG));
}
listRowAdapter.add(content);
}
}
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ZypePlaylistContentBrowseFragment method onContentUpdateEvent.
@Subscribe
public void onContentUpdateEvent(ContentUpdateEvent event) {
for (int rowIndex = 0; rowIndex < mRowsAdapter.size(); rowIndex++) {
ArrayObjectAdapter rowAdapter = (ArrayObjectAdapter) ((ListRow) mRowsAdapter.get(rowIndex)).getAdapter();
for (int i = 0; i < rowAdapter.size(); i++) {
Content content = (Content) rowAdapter.get(i);
if (content.getId().equals(event.videoId)) {
content.setExtraValue(Content.EXTRA_PLAYBACK_POSITION_PERCENTAGE, ContentBrowser.getInstance(getActivity()).getContentLoader().getContentPlaybackPositionPercentage(content));
}
rowAdapter.notifyArrayItemRangeChanged(i, i + 1);
}
}
}
Aggregations