make kiosk selector signle service again

This commit is contained in:
Christian Schabesberger 2017-10-09 14:34:10 +02:00
parent 7f9f075147
commit 7fcc07805a
2 changed files with 16 additions and 8 deletions

View File

@ -185,13 +185,17 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
private Fragment getMainPageFramgent() {
try {
final String set_main_page = PreferenceManager.getDefaultSharedPreferences(getActivity())
.getString(getString(R.string.main_page_content_key),
SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(getActivity());
final String set_main_page = preferences.getString(getString(R.string.main_page_content_key),
getString(R.string.main_page_selectd_kiosk_id));
if(set_main_page.equals(getString(R.string.blank_page_key))) {
return new BlankFragment();
} else if(set_main_page.equals(getString(R.string.kiosk_page_key))) {
KioskFragment fragment = KioskFragment.getInstance(currentServiceId);
int serviceId = preferences.getInt(getString(R.string.main_page_selected_service), 0);
String kioskId = preferences.getString(getString(R.string.main_page_selectd_kiosk_id), "Trending");
KioskFragment fragment = KioskFragment.getInstance(serviceId, kioskId
);
fragment.useAsFrontPage(true);
return fragment;
} else if(set_main_page.equals(getString(R.string.feed_page_key))) {
@ -199,8 +203,6 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
fragment.useAsFrontPage(true);
return fragment;
} else if(set_main_page.equals(getString(R.string.channel_page_key))) {
SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(getActivity());
int serviceId = preferences.getInt(getString(R.string.main_page_selected_service), 0);
String url = preferences.getString(getString(R.string.main_page_selected_channel_url),
"https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ");

View File

@ -117,25 +117,31 @@ public class SelectKioskFragment extends DialogFragment {
int serviceId;
String kioskId;
String kioskName;
};
}
private List<Entry> kioskList = new Vector<>();
public SelectKioskAdapter()
throws Exception {
for(StreamingService service : NewPipe.getServices()) {
for(String kioskId : service.getKioskList().getAvailableKisoks()) {
String name = service.getServiceInfo().name;
name += "/";
name += KioskTranslator.getTranslatedKioskName(kioskId, getContext());
kioskList.add(new Entry(
ServiceIconMapper.getIconResource(service.getServiceId()),
service.getServiceId(),
kioskId,
KioskTranslator.getTranslatedKioskName(kioskId, getContext())));
name));
}
}
}
public int getItemCount() {
return kioskList.size();
//todo: uncommend this line on multyservice support
//return kioskList.size();
return 1;
}
public SelectKioskItemHolder onCreateViewHolder(ViewGroup parent, int type) {