Search in sources :

Example 1 with KioskList

use of org.schabi.newpipe.extractor.kiosk.KioskList in project NewPipe by TeamNewPipe.

the class MainFragment method createKioskMenu.

/*//////////////////////////////////////////////////////////////////////////
    // Select Kiosk
    //////////////////////////////////////////////////////////////////////////*/
private void createKioskMenu(Menu menu, MenuInflater menuInflater) throws Exception {
    StreamingService service = NewPipe.getService(currentServiceId);
    KioskList kl = service.getKioskList();
    int i = 0;
    for (final String ks : kl.getAvailableKiosks()) {
        menu.add(0, KIOSK_MENU_OFFSET + i, Menu.NONE, KioskTranslator.getTranslatedKioskName(ks, getContext())).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem menuItem) {
                try {
                    NavigationHelper.openKioskFragment(getFragmentManager(), currentServiceId, ks);
                } catch (Exception e) {
                    ErrorActivity.reportError(activity, e, activity.getClass(), null, ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR, "none", "", R.string.app_ui_crash));
                }
                return true;
            }
        });
        i++;
    }
}
Also used : KioskList(org.schabi.newpipe.extractor.kiosk.KioskList) MenuItem(android.view.MenuItem) StreamingService(org.schabi.newpipe.extractor.StreamingService)

Aggregations

MenuItem (android.view.MenuItem)1 StreamingService (org.schabi.newpipe.extractor.StreamingService)1 KioskList (org.schabi.newpipe.extractor.kiosk.KioskList)1