Search in sources :

Example 1 with VideoCardPresenter

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();
}
Also used : VideoCardPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter)

Example 2 with VideoCardPresenter

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();
}
Also used : ViewHolder(androidx.leanback.widget.RowPresenter.ViewHolder) ViewHolder(androidx.leanback.widget.RowPresenter.ViewHolder) VideoCardPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter) CustomListRowPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.CustomListRowPresenter) RowPresenter(androidx.leanback.widget.RowPresenter) ListRowPresenter(androidx.leanback.widget.ListRowPresenter) CustomListRowPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.CustomListRowPresenter)

Example 3 with 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");
    }
}
Also used : ProgressBarManager(com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager) ListRowPresenter(androidx.leanback.widget.ListRowPresenter) ActivityNotFoundException(android.content.ActivityNotFoundException) VideoCardPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter) ArrayObjectAdapter(androidx.leanback.widget.ArrayObjectAdapter) SpeechRecognitionCallback(androidx.leanback.widget.SpeechRecognitionCallback)

Example 4 with VideoCardPresenter

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());
}
Also used : MediaServiceSearchTagProvider(com.liskovsoft.smartyoutubetv2.common.app.models.search.MediaServiceSearchTagProvider) VideoCardPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter)

Example 5 with VideoCardPresenter

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());
    }
}
Also used : VideoCardPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter)

Aggregations

VideoCardPresenter (com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter)6 ListRowPresenter (androidx.leanback.widget.ListRowPresenter)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 ArrayObjectAdapter (androidx.leanback.widget.ArrayObjectAdapter)1 RowPresenter (androidx.leanback.widget.RowPresenter)1 ViewHolder (androidx.leanback.widget.RowPresenter.ViewHolder)1 SpeechRecognitionCallback (androidx.leanback.widget.SpeechRecognitionCallback)1 MediaServiceSearchTagProvider (com.liskovsoft.smartyoutubetv2.common.app.models.search.MediaServiceSearchTagProvider)1 ChannelCardPresenter (com.liskovsoft.smartyoutubetv2.tv.presenter.ChannelCardPresenter)1 CustomListRowPresenter (com.liskovsoft.smartyoutubetv2.tv.presenter.CustomListRowPresenter)1 ProgressBarManager (com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager)1