Optional manifest icons

pull/199/head
M66B 4 years ago
parent 0fbc9fe735
commit 7357d926b8

@ -559,18 +559,20 @@ public class ContactInfo {
try { try {
String json = Helper.readStream(m.getInputStream()); String json = Helper.readStream(m.getInputStream());
JSONObject jroot = new JSONObject(json); JSONObject jroot = new JSONObject(json);
JSONArray jicons = jroot.getJSONArray("icons"); if (jroot.has("icons")) {
for (int i = 0; i < jicons.length(); i++) { JSONArray jicons = jroot.getJSONArray("icons");
JSONObject jicon = jicons.getJSONObject(i); for (int i = 0; i < jicons.length(); i++) {
String src = jicon.getString("src"); JSONObject jicon = jicons.getJSONObject(i);
String sizes = jicon.optString("sizes", ""); String src = jicon.optString("src");
String type = jicon.optString("type", ""); String sizes = jicon.optString("sizes", "");
if (!TextUtils.isEmpty(src)) { String type = jicon.optString("type", "");
Element img = doc.createElement("link") if (!TextUtils.isEmpty(src)) {
.attr("href", src) Element img = doc.createElement("link")
.attr("sizes", sizes) .attr("href", src)
.attr("type", type); .attr("sizes", sizes)
imgs.add(img); .attr("type", type);
imgs.add(img);
}
} }
} }
} finally { } finally {

Loading…
Cancel
Save