Merge pull request #8314 from osmandapp/Fix_icons

Add check for icon res name
This commit is contained in:
vshcherb 2020-01-24 17:19:58 +01:00 committed by GitHub
commit 3c14725377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -254,9 +254,13 @@ public class ApplicationMode {
public ApplicationModeBuilder icon(Context app, String iconResName) {
try {
applicationMode.iconResName = iconResName;
applicationMode.iconMapRes = applicationMode.iconRes = app.getResources().getIdentifier(iconResName, "drawable", app.getPackageName());
applicationMode.iconMapRes = app.getResources().getIdentifier(iconResName.replace("ic_", "map_"), "drawable", app.getPackageName());
int iconRes = app.getResources().getIdentifier(iconResName, "drawable", app.getPackageName());
int 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) {
// return R.drawable.map_world_globe_dark;
}