route profile enum changes

This commit is contained in:
madwasp79 2019-05-23 14:35:54 +03:00
parent b2803a779c
commit fa33bfb621

View file

@ -710,7 +710,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
int iconRes = R.drawable.ic_action_gdirections_dark;
String name = e.getValue().getProfileName();
String description = context.getString(R.string.osmand_default_routing);
if (EnumUtils.isValidEnum(RoutingProfilesResources.class, name.toUpperCase())){
if (RoutingProfilesResources.isRpValue(name.toUpperCase())){
iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes();
name = context
.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes());
@ -749,6 +749,18 @@ public class EditProfileFragment extends BaseOsmAndFragment {
public int getIconRes() {
return iconRes;
}
private static final List<String> rpValues = new ArrayList<>();
static {
for (RoutingProfilesResources rpr : RoutingProfilesResources.values()) {
rpValues.add(rpr.name());
}
}
public static boolean isRpValue(String value) {
return rpValues.contains(value);
}
}
private class ApplicationProfileObject {