use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class PlaybackFragment method updateSuggestions.
@Override
public void updateSuggestions(VideoGroup group) {
if (mRowsAdapter == null) {
Log.e(TAG, "Related videos row not initialized yet.");
return;
}
HeaderItem rowHeader = new HeaderItem(group.getTitle());
// Create unique int from category.
int mediaGroupId = group.getId();
VideoGroupObjectAdapter existingAdapter = mMediaGroupAdapters.get(mediaGroupId);
if (existingAdapter == null) {
VideoGroupObjectAdapter mediaGroupAdapter = new VideoGroupObjectAdapter(group, mCardPresenter);
mMediaGroupAdapters.put(mediaGroupId, mediaGroupAdapter);
ListRow row = new ListRow(rowHeader, mediaGroupAdapter);
mRowsAdapter.add(row);
} else {
freeze(true);
// continue row
existingAdapter.append(group);
freeze(false);
}
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class SearchTagsFragment method checkScrollEnd.
private void checkScrollEnd(Video item) {
VideoGroupObjectAdapter resultsAdapter = getItemResultsAdapter(item);
if (resultsAdapter == null) {
return;
}
int size = resultsAdapter.size();
int index = resultsAdapter.indexOf(item);
if (index > (size - ViewUtil.ROW_SCROLL_CONTINUE_NUM)) {
mSearchPresenter.onScrollEnd((Video) resultsAdapter.get(size - 1));
}
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class SearchTagsFragment method update.
public void update(VideoGroup group) {
int action = group.getAction();
if (action == VideoGroup.ACTION_REPLACE) {
clearSearch();
} else if (action == VideoGroup.ACTION_SYNC) {
VideoGroupObjectAdapter adapter = mSearchGroupAdapters.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 = mSearchGroupAdapters.get(mediaGroupId);
if (existingAdapter == null) {
VideoGroupObjectAdapter mediaGroupAdapter = new VideoGroupObjectAdapter(group, mCardPresenter);
mSearchGroupAdapters.put(mediaGroupId, mediaGroupAdapter);
attachAdapter(getResultsAdapter().size(), rowHeader, mediaGroupAdapter);
} else {
Log.d(TAG, "Continue row %s %s", group.getTitle(), System.currentTimeMillis());
freeze(true);
// continue row
existingAdapter.append(group);
freeze(false);
}
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class SearchTagsFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
// Real restore takes place in the presenter
super.onCreate(null);
mIsFragmentCreated = true;
mSearchPresenter = SearchPresenter.instance(getContext());
mSearchPresenter.setView(this);
mCardPresenter = new VideoCardPresenter();
mSearchGroupAdapters = new HashMap<>();
// mItemResultsAdapter = new VideoGroupObjectAdapter(mCardPresenter);
mSearchData = SearchData.instance(getContext());
setupEventListeners();
// setItemResultsAdapter(mItemResultsAdapter);
setSearchTagsProvider(new MediaServiceSearchTagProvider());
enableKeyboardAutoShow(mSearchData.isKeyboardAutoShowEnabled());
}
use of com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter in project SmartTubeNext by yuliskov.
the class ViewUtil method isListRowEmpty.
public static boolean isListRowEmpty(Object obj) {
if (obj instanceof ListRow) {
ListRow row = (ListRow) obj;
VideoGroupObjectAdapter adapter = (VideoGroupObjectAdapter) row.getAdapter();
return adapter == null || adapter.size() == 0;
}
return true;
}
Aggregations