use of com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter in project SmartTubeNext by yuliskov.
the class MultipleRowsFragment method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMainPresenter = getMainPresenter();
mCardPresenter = new VideoCardPresenter();
mBackgroundManager = ((LeanbackActivity) getActivity()).getBackgroundManager();
setupAdapter();
setupEventListeners();
applyPendingUpdates();
}
use of com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter in project SmartTubeNext by yuliskov.
the class PlaybackFragment method initPresenters.
private void initPresenters() {
mRowPresenter = new CustomListRowPresenter() {
@Override
protected void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item) {
super.onBindRowViewHolder(holder, item);
// Set position of item inside first row (playlist items)
if (mRowsSupportFragment != null && mRowsSupportFragment.getVerticalGridView().getSelectedPosition() == 0) {
int index = getSuggestedItemIndex();
if (index > 0) {
ViewHolder vh = (ViewHolder) holder;
vh.getGridView().setSelectedPosition(index);
}
}
}
@Override
protected void onRowViewSelected(RowPresenter.ViewHolder holder, boolean selected) {
super.onRowViewSelected(holder, selected);
updatePlayerBackground();
}
};
mCardPresenter = new VideoCardPresenter();
}
use of com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter in project SmartTubeNext by yuliskov.
the class SearchFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBackgroundManager = ((LeanbackActivity) getActivity()).getBackgroundManager();
mSearchPresenter = SearchPresenter.instance(getContext());
mSearchPresenter.setView(this);
mCardPresenter = new VideoCardPresenter();
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
mProgressBarManager = new ProgressBarManager();
setSearchResultProvider(this);
setupEventListeners();
// TODO: move permission acquirement to presenter
Log.d(TAG, "User is initiating a search. Do we have RECORD_AUDIO permission? " + hasPermission(Manifest.permission.RECORD_AUDIO));
if (!hasPermission(Manifest.permission.RECORD_AUDIO)) {
Log.d(TAG, "Does not have RECORD_AUDIO, using SpeechRecognitionCallback");
// SpeechRecognitionCallback is not required and if not provided recognition will be
// handled using internal speech recognizer, in which case you must have RECORD_AUDIO
// permission
setSpeechRecognitionCallback(new SpeechRecognitionCallback() {
@Override
public void recognizeSpeech() {
if (isAdded()) {
try {
startActivityForResult(getRecognizerIntent(), REQUEST_SPEECH);
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Cannot find activity for speech recognizer", e);
}
} else {
Log.e(TAG, "Can't perform search. Fragment is detached.");
}
}
});
} else {
Log.d(TAG, "We DO have RECORD_AUDIO");
}
}
use of com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter 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.presenter.VideoCardPresenter in project SmartTubeNext by yuliskov.
the class VideoGridFragment method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMainPresenter = getMainPresenter();
mCardPresenter = new VideoCardPresenter();
mBackgroundManager = ((LeanbackActivity) getActivity()).getBackgroundManager();
mVideoGridScale = MainUIData.instance(getActivity()).getVideoGridScale();
setupAdapter();
setupEventListeners();
applyPendingUpdates();
if (getMainFragmentAdapter().getFragmentHost() != null) {
getMainFragmentAdapter().getFragmentHost().notifyDataReady(getMainFragmentAdapter());
}
}
Aggregations