From 7bedacf5adff35f717e9886029da1796d28f5bb8 Mon Sep 17 00:00:00 2001 From: Somethingweirdhere Date: Thu, 28 Jun 2018 14:58:02 +0200 Subject: [PATCH] Revert "Revert "Changed the way how kiosks are handled"" This reverts commit b020567 --- .../org/schabi/newpipe/fragments/MainFragment.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java index db962dd6e..7e72d3955 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java @@ -69,7 +69,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte private static final String TAB_NUMBER_CHANNEL = "6"; SharedPreferences.OnSharedPreferenceChangeListener listener = (prefs, key) -> { - if(key.equals("service")||key.equals("saveUsedTabs")) { + if(key.equals("saveUsedTabs")) { mainPageChanged(); } }; @@ -126,7 +126,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte String tabInformation = tabs.get(0); if (tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) { String kiosk[] = tabInformation.split("\t"); - if (kiosk.length == 2) { + if (kiosk.length == 3) { setTitle(kiosk[1]); } } else if (tabInformation.startsWith(TAB_NUMBER_CHANNEL + "\t")) { @@ -170,7 +170,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte if (tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) { String kiosk[] = tabInformation.split("\t"); - if (kiosk.length == 2) { + if (kiosk.length == 3) { tabToSet.setIcon(KioskTranslator.getKioskIcons(kiosk[1], getContext())); } } else if (tabInformation.startsWith(TAB_NUMBER_CHANNEL + "\t")) { @@ -228,6 +228,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte } } else { tabs.add(tabInformation); + for(String tabNumber:tabsArray) { { + tabs.add(tabNumber); } } } @@ -293,10 +295,10 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte if(tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) { String kiosk[] = tabInformation.split("\t"); - if(kiosk.length==2) { + if(kiosk.length==3) { KioskFragment fragment = null; try { - fragment = KioskFragment.getInstance(currentServiceId, kiosk[1]); + fragment = KioskFragment.getInstance(Integer.parseInt(kiosk[2]), kiosk[1]); fragment.useAsFrontPage(true); return fragment; } catch (Exception e) {