Parse backported shortcut icon if it is a string

This commit is contained in:
Amir Zaidi
2018-08-03 23:05:24 +02:00
parent ed1c4c27d1
commit a39cc8a82c

View File

@@ -76,9 +76,15 @@ public class ShortcutInfoCompatBackport extends ShortcutInfoCompat {
mEnabled = !xmlData.containsKey("enabled") || xmlData.get("enabled").toLowerCase().equals("true");
mIcon = xmlData.containsKey("icon") ?
Integer.valueOf(xmlData.get("icon").substring(1)) :
0;
if (xmlData.containsKey("icon")) {
String icon = xmlData.get("icon");
int resId = resources.getIdentifier(icon, null, packageName);
mIcon = resId == 0
? Integer.parseInt(icon.substring(1))
: resId;
} else {
mIcon = 0;
}
mShortLabel = xmlData.containsKey("shortcutShortLabel") ?
resources.getString(Integer.valueOf(xmlData.get("shortcutShortLabel").substring(1))) :