Revert "Revert "Changed the way how kiosks are handled""

This reverts commit b020567
This commit is contained in:
Somethingweirdhere 2018-06-28 14:58:02 +02:00 committed by Christian Schabesberger
parent 552a1d0464
commit 7bedacf5ad
1 changed files with 7 additions and 5 deletions

View File

@ -69,7 +69,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
private static final String TAB_NUMBER_CHANNEL = "6"; private static final String TAB_NUMBER_CHANNEL = "6";
SharedPreferences.OnSharedPreferenceChangeListener listener = (prefs, key) -> { SharedPreferences.OnSharedPreferenceChangeListener listener = (prefs, key) -> {
if(key.equals("service")||key.equals("saveUsedTabs")) { if(key.equals("saveUsedTabs")) {
mainPageChanged(); mainPageChanged();
} }
}; };
@ -126,7 +126,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
String tabInformation = tabs.get(0); String tabInformation = tabs.get(0);
if (tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) { if (tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) {
String kiosk[] = tabInformation.split("\t"); String kiosk[] = tabInformation.split("\t");
if (kiosk.length == 2) { if (kiosk.length == 3) {
setTitle(kiosk[1]); setTitle(kiosk[1]);
} }
} else if (tabInformation.startsWith(TAB_NUMBER_CHANNEL + "\t")) { } 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")) { if (tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) {
String kiosk[] = tabInformation.split("\t"); String kiosk[] = tabInformation.split("\t");
if (kiosk.length == 2) { if (kiosk.length == 3) {
tabToSet.setIcon(KioskTranslator.getKioskIcons(kiosk[1], getContext())); tabToSet.setIcon(KioskTranslator.getKioskIcons(kiosk[1], getContext()));
} }
} else if (tabInformation.startsWith(TAB_NUMBER_CHANNEL + "\t")) { } else if (tabInformation.startsWith(TAB_NUMBER_CHANNEL + "\t")) {
@ -228,6 +228,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
} }
} else { } else {
tabs.add(tabInformation); 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")) { if(tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) {
String kiosk[] = tabInformation.split("\t"); String kiosk[] = tabInformation.split("\t");
if(kiosk.length==2) { if(kiosk.length==3) {
KioskFragment fragment = null; KioskFragment fragment = null;
try { try {
fragment = KioskFragment.getInstance(currentServiceId, kiosk[1]); fragment = KioskFragment.getInstance(Integer.parseInt(kiosk[2]), kiosk[1]);
fragment.useAsFrontPage(true); fragment.useAsFrontPage(true);
return fragment; return fragment;
} catch (Exception e) { } catch (Exception e) {