use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class MultiVideoGridFragment method setupAdapter.
private void setupAdapter() {
// Left vertical list of channels
VerticalGridPresenter presenter1 = new CustomVerticalGridPresenter(R.layout.lb_vertical_grid1, R.id.browse_grid1);
presenter1.setNumberOfColumns(1);
// Right grid of channel's content
VerticalGridPresenter presenter2 = new CustomVerticalGridPresenter(R.layout.lb_vertical_grid2, R.id.browse_grid2);
presenter2.setNumberOfColumns(GridFragmentHelper.getMaxColsNum(getContext(), R.dimen.card_width, mVideoGridScale) - 1);
setGridPresenter1(presenter1);
setGridPresenter2(presenter2);
if (mGridAdapter1 == null) {
mGridAdapter1 = new VideoGroupObjectAdapter(mCardPresenter1);
setAdapter1(mGridAdapter1);
}
if (mGridAdapter2 == null) {
mGridAdapter2 = new VideoGroupObjectAdapter(mCardPresenter2);
setAdapter2(mGridAdapter2);
}
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class MultipleRowsFragment method update.
@Override
public void update(VideoGroup group) {
if (mVideoGroupAdapters == null) {
mPendingUpdates.add(group);
return;
}
int action = group.getAction();
if (action == VideoGroup.ACTION_REPLACE) {
clear();
} else if (action == VideoGroup.ACTION_REMOVE) {
VideoGroupObjectAdapter adapter = mVideoGroupAdapters.get(group.getId());
if (adapter != null) {
adapter.remove(group);
}
return;
} else if (action == VideoGroup.ACTION_SYNC) {
VideoGroupObjectAdapter adapter = mVideoGroupAdapters.get(group.getId());
if (adapter != null) {
adapter.sync(group);
}
return;
}
if (group.isEmpty()) {
return;
}
HeaderItem rowHeader = new HeaderItem(group.getTitle());
// Create unique int from category.
int mediaGroupId = group.getId();
VideoGroupObjectAdapter existingAdapter = mVideoGroupAdapters.get(mediaGroupId);
if (existingAdapter == null) {
VideoGroupObjectAdapter mediaGroupAdapter = new VideoGroupObjectAdapter(group, mCardPresenter);
mVideoGroupAdapters.put(mediaGroupId, mediaGroupAdapter);
ListRow row = new ListRow(rowHeader, mediaGroupAdapter);
if (group.getPosition() == -1) {
mRowsAdapter.add(row);
} else {
mRowsAdapter.add(group.getPosition(), row);
}
} else {
Log.d(TAG, "Continue row %s %s", group.getTitle(), System.currentTimeMillis());
freeze(true);
// continue row
existingAdapter.append(group);
freeze(false);
}
restorePosition();
}
Aggregations