Search in sources :

Example 1 with ProgressBarManager

use of com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager 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 2 with ProgressBarManager

use of com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager in project SmartTubeNext by yuliskov.

the class SearchTagsFragmentBase method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mProgressBarManager = new ProgressBarManager();
    mResultsPresenter = new CustomListRowPresenter();
    mResultsAdapter = new ArrayObjectAdapter(mResultsPresenter);
    mSearchTagsAdapter = new TagAdapter(getActivity(), "");
    setSearchResultProvider(this);
    setupListeners();
}
Also used : TagAdapter(com.liskovsoft.smartyoutubetv2.tv.adapter.vineyard.TagAdapter) ProgressBarManager(com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager) ArrayObjectAdapter(androidx.leanback.widget.ArrayObjectAdapter) CustomListRowPresenter(com.liskovsoft.smartyoutubetv2.tv.presenter.CustomListRowPresenter)

Example 3 with ProgressBarManager

use of com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager in project SmartTubeNext by yuliskov.

the class BrowseFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(null);
    mRestoredHeaderIndex = savedInstanceState != null ? savedInstanceState.getInt(SELECTED_HEADER_INDEX, -1) : -1;
    mRestoredItemIndex = savedInstanceState != null ? savedInstanceState.getInt(SELECTED_ITEM_INDEX, -1) : -1;
    mIsFragmentCreated = true;
    mSections = new LinkedHashMap<>();
    mHandler = new Handler();
    mBrowsePresenter = BrowsePresenter.instance(getContext());
    mBrowsePresenter.setView(this);
    mProgressBarManager = new ProgressBarManager();
    setupAdapter();
    setupFragmentFactory();
    setupUi();
    enableMainFragmentScaling(false);
}
Also used : ProgressBarManager(com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager) Handler(android.os.Handler)

Example 4 with ProgressBarManager

use of com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager in project SmartTubeNext by yuliskov.

the class ChannelFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    // Real restore takes place in the presenter
    super.onCreate(null);
    mRestoredItemIndex = savedInstanceState != null ? savedInstanceState.getInt(SELECTED_ITEM_INDEX, -1) : -1;
    mIsFragmentCreated = true;
    mChannelPresenter = ChannelPresenter.instance(getContext());
    mChannelPresenter.setView(this);
    mProgressBarManager = new ProgressBarManager();
}
Also used : ProgressBarManager(com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager)

Example 5 with ProgressBarManager

use of com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager in project SmartTubeNext by yuliskov.

the class ChannelUploadsFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    // Real restore takes place in the presenter
    super.onCreate(null);
    mRestoredItemIndex = savedInstanceState != null ? savedInstanceState.getInt(SELECTED_ITEM_INDEX, -1) : -1;
    mIsFragmentCreated = true;
    mChannelUploadsPresenter = ChannelUploadsPresenter.instance(getContext());
    mChannelUploadsPresenter.setView(this);
    mProgressBarManager = new ProgressBarManager();
}
Also used : ProgressBarManager(com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager)

Aggregations

ProgressBarManager (com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.ProgressBarManager)5 ArrayObjectAdapter (androidx.leanback.widget.ArrayObjectAdapter)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 Handler (android.os.Handler)1 ListRowPresenter (androidx.leanback.widget.ListRowPresenter)1 SpeechRecognitionCallback (androidx.leanback.widget.SpeechRecognitionCallback)1 TagAdapter (com.liskovsoft.smartyoutubetv2.tv.adapter.vineyard.TagAdapter)1 CustomListRowPresenter (com.liskovsoft.smartyoutubetv2.tv.presenter.CustomListRowPresenter)1 VideoCardPresenter (com.liskovsoft.smartyoutubetv2.tv.presenter.VideoCardPresenter)1