Add check for icon res name

This commit is contained in:
Vitaliy 2020-01-24 18:16:45 +02:00
parent 360a8565c7
commit d33abf0f03

View file

@ -254,9 +254,13 @@ public class ApplicationMode {
public ApplicationModeBuilder icon(Context app, String iconResName) { public ApplicationModeBuilder icon(Context app, String iconResName) {
try { try {
applicationMode.iconResName = iconResName; int iconRes = app.getResources().getIdentifier(iconResName, "drawable", app.getPackageName());
applicationMode.iconMapRes = applicationMode.iconRes = app.getResources().getIdentifier(iconResName, "drawable", app.getPackageName()); int iconMapRes = app.getResources().getIdentifier(iconResName.replace("ic_", "map_"), "drawable", app.getPackageName());
applicationMode.iconMapRes = app.getResources().getIdentifier(iconResName.replace("ic_", "map_"), "drawable", app.getPackageName()); if (iconRes != 0 && iconMapRes != 0) {
applicationMode.iconResName = iconResName;
applicationMode.iconRes = iconRes;
applicationMode.iconMapRes = iconMapRes;
}
} catch (Exception e) { } catch (Exception e) {
// return R.drawable.map_world_globe_dark; // return R.drawable.map_world_globe_dark;
} }