use of androidx.collection.ArrayMap in project AntennaPod by AntennaPod.
the class PlaybackPreferencesFragment method buildEnqueueLocationPreference.
private void buildEnqueueLocationPreference() {
final Resources res = requireActivity().getResources();
final Map<String, String> options = new ArrayMap<>();
{
String[] keys = res.getStringArray(R.array.enqueue_location_values);
String[] values = res.getStringArray(R.array.enqueue_location_options);
for (int i = 0; i < keys.length; i++) {
options.put(keys[i], values[i]);
}
}
ListPreference pref = requirePreference(UserPreferences.PREF_ENQUEUE_LOCATION);
pref.setSummary(res.getString(R.string.pref_enqueue_location_sum, options.get(pref.getValue())));
pref.setOnPreferenceChangeListener((preference, newValue) -> {
if (!(newValue instanceof String)) {
return false;
}
String newValStr = (String) newValue;
pref.setSummary(res.getString(R.string.pref_enqueue_location_sum, options.get(newValStr)));
return true;
});
}
use of androidx.collection.ArrayMap in project AntennaPod by AntennaPod.
the class FeedDiscoverer method findLinks.
private Map<String, String> findLinks(Document document, String baseUrl) {
Map<String, String> res = new ArrayMap<>();
Elements links = document.head().getElementsByTag("link");
for (Element link : links) {
String rel = link.attr("rel");
String href = link.attr("href");
if (!TextUtils.isEmpty(href) && (rel.equals("alternate") || rel.equals("feed"))) {
String type = link.attr("type");
if (type.equals(MIME_RSS) || type.equals(MIME_ATOM)) {
String title = link.attr("title");
String processedUrl = processURL(baseUrl, href);
if (processedUrl != null) {
res.put(processedUrl, (TextUtils.isEmpty(title)) ? href : title);
}
}
}
}
return res;
}
Aggregations