use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class PlaybackFragment method getSuggestionsIndex.
@Override
public int getSuggestionsIndex(VideoGroup group) {
if (mRowsAdapter == null) {
Log.e(TAG, "Related videos row not initialized yet.");
return -1;
}
VideoGroupObjectAdapter existingAdapter = mMediaGroupAdapters.get(group.getId());
int index = -1;
for (int i = 0; i < mRowsAdapter.size(); i++) {
Object row = mRowsAdapter.get(i);
if (row instanceof ListRow) {
ObjectAdapter adapter = ((ListRow) row).getAdapter();
if (adapter == existingAdapter) {
index = mRowsAdapter.indexOf(row);
break;
}
}
}
return index != -1 ? index - 1 : -1;
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class SearchFragment method updateSearch.
@Override
public void updateSearch(VideoGroup group) {
int titleRes;
if (group.getVideos() != null) {
mResultsFound = true;
titleRes = R.string.search_results;
} else {
mResultsFound = false;
titleRes = R.string.no_search_results;
}
if (mRowsAdapter.size() == 0) {
HeaderItem header = new HeaderItem(getString(titleRes, mQuery));
mAdapter = new VideoGroupObjectAdapter(group, mCardPresenter);
ListRow row = new ListRow(header, mAdapter);
mRowsAdapter.add(row);
} else {
mAdapter.append(group);
}
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class SearchTagsFragment method clearSearch.
@Override
public void clearSearch() {
mSearchQuery = null;
for (VideoGroupObjectAdapter adapter : mSearchGroupAdapters.values()) {
adapter.clear();
}
mSearchGroupAdapters.clear();
ObjectAdapter resultsAdapter = getResultsAdapter();
if (resultsAdapter == null) {
return;
}
int size = resultsAdapter.size();
for (int i = 0; i < size; i++) {
// Notify about changes (could help with search autofocus)
// first adapter is tag adapter
detachAdapter(1);
}
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class VideoGridFragment method setupAdapter.
private void setupAdapter() {
VerticalGridPresenter presenter = new CustomVerticalGridPresenter();
presenter.setNumberOfColumns(GridFragmentHelper.getMaxColsNum(getContext(), R.dimen.card_width, mVideoGridScale));
setGridPresenter(presenter);
if (mGridAdapter == null) {
mGridAdapter = new VideoGroupObjectAdapter(mCardPresenter);
setAdapter(mGridAdapter);
}
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class PlaybackFragment method getSuggestedItemIndex.
private int getSuggestedItemIndex() {
if (getVideo() == null || !getVideo().hasPlaylist() || !getVideo().hasVideo()) {
return -1;
}
// NOTE: skip first row. It's PlaybackControlsRow
Object row = mRowsAdapter != null && mRowsAdapter.size() > 1 ? mRowsAdapter.get(1) : null;
if (row instanceof ListRow) {
VideoGroupObjectAdapter adapter = (VideoGroupObjectAdapter) ((ListRow) row).getAdapter();
int index = adapter.indexOfAlt(getVideo());
// select last possible item on fail
return index == -1 ? adapter.size() - 1 : index;
}
return -1;
}
Aggregations