make kiosk selector signle service again
This commit is contained in:
parent
7f9f075147
commit
7fcc07805a
2 changed files with 16 additions and 8 deletions
|
@ -185,13 +185,17 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
|
|
||||||
private Fragment getMainPageFramgent() {
|
private Fragment getMainPageFramgent() {
|
||||||
try {
|
try {
|
||||||
final String set_main_page = PreferenceManager.getDefaultSharedPreferences(getActivity())
|
SharedPreferences preferences =
|
||||||
.getString(getString(R.string.main_page_content_key),
|
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));
|
getString(R.string.main_page_selectd_kiosk_id));
|
||||||
if(set_main_page.equals(getString(R.string.blank_page_key))) {
|
if(set_main_page.equals(getString(R.string.blank_page_key))) {
|
||||||
return new BlankFragment();
|
return new BlankFragment();
|
||||||
} else if(set_main_page.equals(getString(R.string.kiosk_page_key))) {
|
} 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);
|
fragment.useAsFrontPage(true);
|
||||||
return fragment;
|
return fragment;
|
||||||
} else if(set_main_page.equals(getString(R.string.feed_page_key))) {
|
} 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);
|
fragment.useAsFrontPage(true);
|
||||||
return fragment;
|
return fragment;
|
||||||
} else if(set_main_page.equals(getString(R.string.channel_page_key))) {
|
} 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);
|
int serviceId = preferences.getInt(getString(R.string.main_page_selected_service), 0);
|
||||||
String url = preferences.getString(getString(R.string.main_page_selected_channel_url),
|
String url = preferences.getString(getString(R.string.main_page_selected_channel_url),
|
||||||
"https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ");
|
"https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ");
|
||||||
|
|
|
@ -117,25 +117,31 @@ public class SelectKioskFragment extends DialogFragment {
|
||||||
int serviceId;
|
int serviceId;
|
||||||
String kioskId;
|
String kioskId;
|
||||||
String kioskName;
|
String kioskName;
|
||||||
};
|
}
|
||||||
|
|
||||||
private List<Entry> kioskList = new Vector<>();
|
private List<Entry> kioskList = new Vector<>();
|
||||||
|
|
||||||
public SelectKioskAdapter()
|
public SelectKioskAdapter()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
for(StreamingService service : NewPipe.getServices()) {
|
for(StreamingService service : NewPipe.getServices()) {
|
||||||
for(String kioskId : service.getKioskList().getAvailableKisoks()) {
|
for(String kioskId : service.getKioskList().getAvailableKisoks()) {
|
||||||
|
String name = service.getServiceInfo().name;
|
||||||
|
name += "/";
|
||||||
|
name += KioskTranslator.getTranslatedKioskName(kioskId, getContext());
|
||||||
kioskList.add(new Entry(
|
kioskList.add(new Entry(
|
||||||
ServiceIconMapper.getIconResource(service.getServiceId()),
|
ServiceIconMapper.getIconResource(service.getServiceId()),
|
||||||
service.getServiceId(),
|
service.getServiceId(),
|
||||||
kioskId,
|
kioskId,
|
||||||
KioskTranslator.getTranslatedKioskName(kioskId, getContext())));
|
name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemCount() {
|
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) {
|
public SelectKioskItemHolder onCreateViewHolder(ViewGroup parent, int type) {
|
||||||
|
|
Loading…
Reference in a new issue