From e988174ea50ed7d1c1a0353d19057b847efe16f7 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Thu, 23 May 2019 14:35:54 +0300 Subject: [PATCH] route profile enum changes --- .../osmand/plus/profiles/EditProfileFragment.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java b/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java index e4698c90b3..33819c86be 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java +++ b/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java @@ -55,7 +55,6 @@ import net.osmand.plus.routing.RouteProvider.RouteService; import net.osmand.plus.widgets.OsmandTextFieldBoxes; import net.osmand.router.GeneralRouter; import net.osmand.util.Algorithms; -import org.apache.commons.lang3.EnumUtils; import org.apache.commons.logging.Log; import studio.carbonylgroup.textfieldboxes.ExtendedEditText; @@ -710,7 +709,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 +748,18 @@ public class EditProfileFragment extends BaseOsmAndFragment { public int getIconRes() { return iconRes; } + + private static final List 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 {