make summary a dynamic string
This commit is contained in:
parent
c3f04ea67d
commit
d1f446aae2
|
@ -40,16 +40,19 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
.putInt(getString(R.string.main_page_selected_service), service_id).apply();
|
.putInt(getString(R.string.main_page_selected_service), service_id).apply();
|
||||||
defaultPreferences.edit()
|
defaultPreferences.edit()
|
||||||
.putString(getString(R.string.main_page_selectd_kiosk_id), kioskId).apply();
|
.putString(getString(R.string.main_page_selectd_kiosk_id), kioskId).apply();
|
||||||
String summary = "";
|
String serviceName = "";
|
||||||
try {
|
try {
|
||||||
summary += NewPipe.getService(service_id).getServiceInfo().name;
|
serviceName = NewPipe.getService(service_id).getServiceInfo().name;
|
||||||
} catch (ExtractionException e) {
|
} catch (ExtractionException e) {
|
||||||
onError(e);
|
onError(e);
|
||||||
}
|
}
|
||||||
summary += "/";
|
String kioskName = KioskTranslator.getTranslatedKioskName(kioskId,
|
||||||
summary += KioskTranslator.getTranslatedKioskName(kioskId, getContext());
|
getContext());
|
||||||
|
|
||||||
|
|
||||||
|
String summary =
|
||||||
|
String.format(getString(R.string.service_kosk_string),
|
||||||
|
serviceName,
|
||||||
|
kioskName);
|
||||||
|
|
||||||
mainPageContentPref.setSummary(summary);
|
mainPageContentPref.setSummary(summary);
|
||||||
}
|
}
|
||||||
|
@ -112,13 +115,17 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
StreamingService service = NewPipe.getService(
|
StreamingService service = NewPipe.getService(
|
||||||
defaultPreferences.getInt(
|
defaultPreferences.getInt(
|
||||||
getString(R.string.main_page_selected_service), 0));
|
getString(R.string.main_page_selected_service), 0));
|
||||||
String summary = "";
|
|
||||||
summary += service.getServiceInfo().name;
|
String kioskName = KioskTranslator.getTranslatedKioskName(
|
||||||
summary += "/";
|
|
||||||
summary += KioskTranslator.getTranslatedKioskName(
|
|
||||||
defaultPreferences.getString(
|
defaultPreferences.getString(
|
||||||
getString(R.string.main_page_selectd_kiosk_id), "Trending"),
|
getString(R.string.main_page_selectd_kiosk_id), "Trending"),
|
||||||
getContext());
|
getContext());
|
||||||
|
|
||||||
|
String summary =
|
||||||
|
String.format(getString(R.string.service_kosk_string),
|
||||||
|
service.getServiceInfo().name,
|
||||||
|
kioskName);
|
||||||
|
|
||||||
mainPagePref.setSummary(summary);
|
mainPagePref.setSummary(summary);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onError(e);
|
onError(e);
|
||||||
|
|
|
@ -290,4 +290,5 @@
|
||||||
<string name="trending">Trending</string>
|
<string name="trending">Trending</string>
|
||||||
<string name="top_50">Top 50</string>
|
<string name="top_50">Top 50</string>
|
||||||
<string name="new_and_hot">New & hot</string>
|
<string name="new_and_hot">New & hot</string>
|
||||||
|
<string name="service_kosk_string">%1$s/%2$s</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue