diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 8130a58d69..1eca37b058 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -63,6 +63,7 @@ import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.StartPlanRouteBottomSheet; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.osmedit.dialogs.DismissRouteBottomSheetFragment; +import net.osmand.plus.profiles.ProfileDataUtils; import net.osmand.plus.profiles.RoutingProfileDataObject; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu; import net.osmand.plus.routepreparationmenu.WaypointsFragment; @@ -736,7 +737,7 @@ public class MapActivityActions implements DialogProvider { String modeDescription; - Map profilesObjects = RoutingProfileDataObject.getRoutingProfiles(app); + Map profilesObjects = ProfileDataUtils.getRoutingProfiles(app); for (final ApplicationMode appMode : activeModes) { if (appMode.isCustomProfile()) { modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_user_string)); @@ -1045,7 +1046,7 @@ public class MapActivityActions implements DialogProvider { //switch profile button ApplicationMode currentMode = app.getSettings().APPLICATION_MODE.get(); String modeDescription; - Map profilesObjects = RoutingProfileDataObject.getRoutingProfiles(app); + Map profilesObjects = ProfileDataUtils.getRoutingProfiles(app); if (currentMode.isCustomProfile()) { modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_user_string)); } else { diff --git a/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java b/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java index c03564c1b3..db9422859a 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/PluginInstalledBottomSheetDialog.java @@ -15,7 +15,7 @@ import androidx.fragment.app.FragmentManager; import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; -import net.osmand.plus.profiles.ProfileDataObject; +import net.osmand.plus.profiles.ProfileDataUtils; import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; @@ -221,7 +221,7 @@ public class PluginInstalledBottomSheetDialog extends MenuBottomSheetDialogFragm final BottomSheetItemWithCompoundButton[] appModeItem = new BottomSheetItemWithCompoundButton[1]; appModeItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder() .setChecked(ApplicationMode.values(app).contains(mode)) - .setDescription(ProfileDataObject.getAppModeDescription(app, mode)) + .setDescription(ProfileDataUtils.getAppModeDescription(app, mode)) .setTitle(mode.toHumanString()) .setIcon(getActiveIcon(mode.getIconRes())) .setLayoutId(R.layout.bottom_sheet_item_with_descr_and_switch_56dp) diff --git a/OsmAnd/src/net/osmand/plus/profiles/ConfigureProfileMenuAdapter.java b/OsmAnd/src/net/osmand/plus/profiles/ConfigureProfileMenuAdapter.java index 2f7c3a1e19..a2e024f860 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/ConfigureProfileMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/profiles/ConfigureProfileMenuAdapter.java @@ -104,7 +104,7 @@ public class ConfigureProfileMenuAdapter extends AbstractProfileMenuAdapter { @@ -73,28 +64,4 @@ public class ProfileDataObject implements Comparable { return this.name.compareToIgnoreCase(another.name); } - public static List getDataObjects(OsmandApplication app, - List appModes) { - List profiles = new ArrayList<>(); - for (ApplicationMode mode : appModes) { - String description = mode.getDescription(); - if (Algorithms.isEmpty(description)) { - description = getAppModeDescription(app, mode); - } - profiles.add(new ProfileDataObject(mode.toHumanString(), description, - mode.getStringKey(), mode.getIconRes(), false, mode.getIconColorInfo())); - } - return profiles; - } - - public static String getAppModeDescription(Context ctx, ApplicationMode mode) { - String description; - if (mode.isCustomProfile()) { - description = ctx.getString(R.string.profile_type_user_string); - } else { - description = ctx.getString(R.string.profile_type_osmand_string); - } - - return description; - } } diff --git a/OsmAnd/src/net/osmand/plus/profiles/ProfileDataUtils.java b/OsmAnd/src/net/osmand/plus/profiles/ProfileDataUtils.java new file mode 100644 index 0000000000..4cbc9b1940 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/profiles/ProfileDataUtils.java @@ -0,0 +1,136 @@ +package net.osmand.plus.profiles; + +import android.content.Context; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.R; +import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.router.GeneralRouter; +import net.osmand.router.RoutingConfiguration; +import net.osmand.util.Algorithms; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ProfileDataUtils { + + public static final String OSMAND_NAVIGATION = "osmand_navigation"; + + public static List getDataObjects(OsmandApplication app, + List appModes) { + List profiles = new ArrayList<>(); + for (ApplicationMode mode : appModes) { + String description = mode.getDescription(); + if (Algorithms.isEmpty(description)) { + description = getAppModeDescription(app, mode); + } + profiles.add(new ProfileDataObject(mode.toHumanString(), description, + mode.getStringKey(), mode.getIconRes(), false, mode.getIconColorInfo())); + } + return profiles; + } + + public static String getAppModeDescription(Context ctx, ApplicationMode mode) { + String description; + if (mode.isCustomProfile()) { + description = ctx.getString(R.string.profile_type_user_string); + } else { + description = ctx.getString(R.string.profile_type_osmand_string); + } + + return description; + } + + public static List getSortedRoutingProfiles(OsmandApplication app) { + List result = new ArrayList<>(); + Map> routingProfilesByFileNames = getRoutingProfilesByFileNames(app); + List fileNames = new ArrayList<>(routingProfilesByFileNames.keySet()); + Collections.sort(fileNames, new Comparator() { + @Override + public int compare(String s, String t1) { + return s.equals(OSMAND_NAVIGATION) ? -1 : t1.equals(OSMAND_NAVIGATION) ? 1 : s.compareToIgnoreCase(t1); + } + }); + for (String fileName : fileNames) { + List routingProfilesFromFile = routingProfilesByFileNames.get(fileName); + if (routingProfilesFromFile != null) { + Collections.sort(routingProfilesFromFile); + result.addAll(routingProfilesFromFile); + } + } + return result; + } + + public static Map> getRoutingProfilesByFileNames(OsmandApplication app) { + Map> result = new HashMap<>(); + for (final RoutingProfileDataObject profile : getRoutingProfiles(app).values()) { + String fileName = profile.getFileName() != null ? profile.getFileName() : OSMAND_NAVIGATION; + if (result.containsKey(fileName)) { + result.get(fileName).add(profile); + } else { + result.put(fileName, new ArrayList() { + { add(profile); } + }); + } + } + return result; + } + + public static Map getRoutingProfiles(OsmandApplication context) { + Map profilesObjects = new HashMap<>(); + profilesObjects.put(RoutingProfileDataObject.RoutingProfilesResources.STRAIGHT_LINE_MODE.name(), new RoutingProfileDataObject( + RoutingProfileDataObject.RoutingProfilesResources.STRAIGHT_LINE_MODE.name(), + context.getString(RoutingProfileDataObject.RoutingProfilesResources.STRAIGHT_LINE_MODE.getStringRes()), + context.getString(R.string.special_routing_type), + RoutingProfileDataObject.RoutingProfilesResources.STRAIGHT_LINE_MODE.getIconRes(), + false, null)); + profilesObjects.put(RoutingProfileDataObject.RoutingProfilesResources.DIRECT_TO_MODE.name(), new RoutingProfileDataObject( + RoutingProfileDataObject.RoutingProfilesResources.DIRECT_TO_MODE.name(), + context.getString(RoutingProfileDataObject.RoutingProfilesResources.DIRECT_TO_MODE.getStringRes()), + context.getString(R.string.special_routing_type), + RoutingProfileDataObject.RoutingProfilesResources.DIRECT_TO_MODE.getIconRes(), + false, null)); + if (context.getBRouterService() != null) { + profilesObjects.put(RoutingProfileDataObject.RoutingProfilesResources.BROUTER_MODE.name(), new RoutingProfileDataObject( + RoutingProfileDataObject.RoutingProfilesResources.BROUTER_MODE.name(), + context.getString(RoutingProfileDataObject.RoutingProfilesResources.BROUTER_MODE.getStringRes()), + context.getString(R.string.third_party_routing_type), + RoutingProfileDataObject.RoutingProfilesResources.BROUTER_MODE.getIconRes(), + false, null)); + } + + List disabledRouterNames = OsmandPlugin.getDisabledRouterNames(); + for (RoutingConfiguration.Builder builder : context.getAllRoutingConfigs()) { + collectRoutingProfilesFromConfig(context, builder, profilesObjects, disabledRouterNames); + } + return profilesObjects; + } + + private static void collectRoutingProfilesFromConfig(OsmandApplication app, RoutingConfiguration.Builder builder, + Map profilesObjects, List disabledRouterNames) { + for (Map.Entry entry : builder.getAllRouters().entrySet()) { + String routerKey = entry.getKey(); + GeneralRouter router = entry.getValue(); + if (!routerKey.equals("geocoding") && !disabledRouterNames.contains(router.getFilename())) { + int iconRes = R.drawable.ic_action_gdirections_dark; + String name = router.getProfileName(); + String description = app.getString(R.string.osmand_default_routing); + String fileName = router.getFilename(); + if (!Algorithms.isEmpty(fileName)) { + description = fileName; + } else if (RoutingProfileDataObject.RoutingProfilesResources.isRpValue(name.toUpperCase())) { + iconRes = RoutingProfileDataObject.RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes(); + name = app.getString(RoutingProfileDataObject.RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes()); + } + profilesObjects.put(routerKey, new RoutingProfileDataObject(routerKey, name, description, + iconRes, false, fileName)); + } + } + } + +} diff --git a/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java b/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java index a9e69f8917..ab808de360 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java +++ b/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java @@ -1,22 +1,12 @@ package net.osmand.plus.profiles; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; -import net.osmand.router.GeneralRouter; -import net.osmand.router.RoutingConfiguration; -import net.osmand.util.Algorithms; import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; import java.util.List; -import java.util.Map; public class RoutingProfileDataObject extends ProfileDataObject { - public static final String OSMAND_NAVIGATION = "osmand_navigation"; private String fileName; @@ -70,90 +60,4 @@ public class RoutingProfileDataObject extends ProfileDataObject { } } - public static List getSortedRoutingProfiles(OsmandApplication app) { - List result = new ArrayList<>(); - Map> routingProfilesByFileNames = getRoutingProfilesByFileNames(app); - List fileNames = new ArrayList<>(routingProfilesByFileNames.keySet()); - Collections.sort(fileNames, new Comparator() { - @Override - public int compare(String s, String t1) { - return s.equals(OSMAND_NAVIGATION) ? -1 : t1.equals(OSMAND_NAVIGATION) ? 1 : s.compareToIgnoreCase(t1); - } - }); - for (String fileName : fileNames) { - List routingProfilesFromFile = routingProfilesByFileNames.get(fileName); - if (routingProfilesFromFile != null) { - Collections.sort(routingProfilesFromFile); - result.addAll(routingProfilesFromFile); - } - } - return result; - } - - public static Map> getRoutingProfilesByFileNames(OsmandApplication app) { - Map> result = new HashMap<>(); - for (final RoutingProfileDataObject profile : getRoutingProfiles(app).values()) { - String fileName = profile.getFileName() != null ? profile.getFileName() : OSMAND_NAVIGATION; - if (result.containsKey(fileName)) { - result.get(fileName).add(profile); - } else { - result.put(fileName, new ArrayList() { - { add(profile); } - }); - } - } - return result; - } - - public static Map getRoutingProfiles(OsmandApplication context) { - Map profilesObjects = new HashMap<>(); - profilesObjects.put(RoutingProfilesResources.STRAIGHT_LINE_MODE.name(), new RoutingProfileDataObject( - RoutingProfilesResources.STRAIGHT_LINE_MODE.name(), - context.getString(RoutingProfilesResources.STRAIGHT_LINE_MODE.getStringRes()), - context.getString(R.string.special_routing_type), - RoutingProfilesResources.STRAIGHT_LINE_MODE.getIconRes(), - false, null)); - profilesObjects.put(RoutingProfilesResources.DIRECT_TO_MODE.name(), new RoutingProfileDataObject( - RoutingProfilesResources.DIRECT_TO_MODE.name(), - context.getString(RoutingProfilesResources.DIRECT_TO_MODE.getStringRes()), - context.getString(R.string.special_routing_type), - RoutingProfilesResources.DIRECT_TO_MODE.getIconRes(), - false, null)); - if (context.getBRouterService() != null) { - profilesObjects.put(RoutingProfilesResources.BROUTER_MODE.name(), new RoutingProfileDataObject( - RoutingProfilesResources.BROUTER_MODE.name(), - context.getString(RoutingProfilesResources.BROUTER_MODE.getStringRes()), - context.getString(R.string.third_party_routing_type), - RoutingProfilesResources.BROUTER_MODE.getIconRes(), - false, null)); - } - - List disabledRouterNames = OsmandPlugin.getDisabledRouterNames(); - for (RoutingConfiguration.Builder builder : context.getAllRoutingConfigs()) { - collectRoutingProfilesFromConfig(context, builder, profilesObjects, disabledRouterNames); - } - return profilesObjects; - } - - private static void collectRoutingProfilesFromConfig(OsmandApplication app, RoutingConfiguration.Builder builder, - Map profilesObjects, List disabledRouterNames) { - for (Map.Entry entry : builder.getAllRouters().entrySet()) { - String routerKey = entry.getKey(); - GeneralRouter router = entry.getValue(); - if (!routerKey.equals("geocoding") && !disabledRouterNames.contains(router.getFilename())) { - int iconRes = R.drawable.ic_action_gdirections_dark; - String name = router.getProfileName(); - String description = app.getString(R.string.osmand_default_routing); - String fileName = router.getFilename(); - if (!Algorithms.isEmpty(fileName)) { - description = fileName; - } else if (RoutingProfilesResources.isRpValue(name.toUpperCase())) { - iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes(); - name = app.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes()); - } - profilesObjects.put(routerKey, new RoutingProfileDataObject(routerKey, name, description, - iconRes, false, fileName)); - } - } - } } diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java b/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java index 04c160afdb..7687f3386b 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java @@ -55,7 +55,7 @@ public class SelectMultipleProfilesBottomSheet extends BasePreferenceBottomSheet private void refreshProfiles(OsmandApplication app) { profiles.clear(); List appModes = ApplicationMode.allPossibleValues(); - profiles.addAll(ProfileDataObject.getDataObjects(app, appModes)); + profiles.addAll(ProfileDataUtils.getDataObjects(app, appModes)); for (ProfileDataObject profile : profiles) { String key = profile.getStringKey(); profile.setSelected(selectedProfiles.contains(key)); diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheet.java b/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheet.java index 268f689313..eaf99b9503 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheet.java @@ -331,16 +331,17 @@ public class SelectProfileBottomSheet extends BasePreferenceBottomSheet { profiles.clear(); switch (dialogMode) { case BASE_PROFILE: - List appModes = ApplicationMode.values(app, false, ApplicationMode.DEFAULT); - profiles.addAll(ProfileDataObject.getDataObjects(app, appModes)); + List appModes = new ArrayList<>(ApplicationMode.allPossibleValues()); + appModes.remove(ApplicationMode.DEFAULT); + profiles.addAll(ProfileDataUtils.getDataObjects(app, appModes)); break; case NAVIGATION_PROFILE: - profiles.addAll(RoutingProfileDataObject.getSortedRoutingProfiles(app)); + profiles.addAll(ProfileDataUtils.getSortedRoutingProfiles(app)); break; case DEFAULT_PROFILE: - profiles.addAll(ProfileDataObject.getDataObjects(app, ApplicationMode.values(app))); + profiles.addAll(ProfileDataUtils.getDataObjects(app, ApplicationMode.values(app))); break; } } @@ -366,8 +367,7 @@ public class SelectProfileBottomSheet extends BasePreferenceBottomSheet { fragment.setArguments(args); fragment.setUsedOnMap(usedOnMap); fragment.setTargetFragment(target, 0); - FragmentManager fm = activity.getSupportFragmentManager(); - fm.beginTransaction().add(fragment, TAG).commitAllowingStateLoss(); + fragment.show(activity.getSupportFragmentManager(), TAG); } public interface OnSelectProfileCallback { diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectProfileMenuAdapter.java b/OsmAnd/src/net/osmand/plus/profiles/SelectProfileMenuAdapter.java index e4e67d123c..205f608c9a 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SelectProfileMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectProfileMenuAdapter.java @@ -98,7 +98,7 @@ public class SelectProfileMenuAdapter extends AbstractProfileMenuAdapter values(OsmandApplication app, - boolean onlyActive, - ApplicationMode ... exclude) { - List appModes = new ArrayList<>(onlyActive ? values(app) : allPossibleValues()); - if (exclude != null && exclude.length > 0) { - for (ApplicationMode m : exclude) { - appModes.remove(m); - } - } - return appModes; - } - public static List values(OsmandApplication app) { if (customizationListener == null) { customizationListener = new OsmAndAppCustomization.OsmAndAppCustomizationListener() { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 15573fd567..31c081ae23 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -736,7 +736,7 @@ public class OsmandSettings { public final OsmandPreference LAST_FAV_CATEGORY_ENTERED = new StringPreference(this, "last_fav_category", "").makeGlobal(); - public final OsmandPreference USE_LAST_APPLICATION_MODE_BY_DEFAULT = new BooleanPreference(this, "use_last_application_mode_by_default", false).makeGlobal(); + public final OsmandPreference USE_LAST_APPLICATION_MODE_BY_DEFAULT = new BooleanPreference(this, "use_last_application_mode_by_default", false).makeGlobal().makeShared(); public final OsmandPreference LAST_USED_APPLICATION_MODE = new StringPreference(this, "last_used_application_mode", ApplicationMode.DEFAULT.getStringKey()).makeGlobal().makeShared(); diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ResetProfilePrefsBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ResetProfilePrefsBottomSheet.java index baa4507e5a..e9317533bc 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ResetProfilePrefsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ResetProfilePrefsBottomSheet.java @@ -12,7 +12,7 @@ import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; -import net.osmand.plus.profiles.ProfileDataObject; +import net.osmand.plus.profiles.ProfileDataUtils; import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -48,7 +48,7 @@ public class ResetProfilePrefsBottomSheet extends BasePreferenceBottomSheet { .setChecked(true) .setCompoundButtonColorId(profileColor) .setButtonTintList(ColorStateList.valueOf(getResolvedColor(profileColor))) - .setDescription(ProfileDataObject.getAppModeDescription(ctx, mode)) + .setDescription(ProfileDataUtils.getAppModeDescription(ctx, mode)) .setIcon(getIcon(mode.getIconRes(), profileColor)) .setTitle(mode.toHumanString()) .setBackground(new LayerDrawable(layers)) diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java index 18c55f9260..f7ae122851 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java @@ -20,7 +20,7 @@ import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.profiles.ProfileDataObject; +import net.osmand.plus.profiles.ProfileDataUtils; import net.osmand.plus.profiles.SelectProfileBottomSheet; import net.osmand.plus.profiles.SelectProfileBottomSheet.DialogMode; import net.osmand.plus.profiles.SelectProfileBottomSheet.OnSelectProfileCallback; @@ -155,7 +155,7 @@ public class MainSettingsFragment extends BaseSettingsFragment implements OnSele private void setupConfigureProfilePref() { ApplicationMode selectedMode = app.getSettings().APPLICATION_MODE.get(); String title = selectedMode.toHumanString(); - String profileType = ProfileDataObject.getAppModeDescription(getContext(), selectedMode); + String profileType = ProfileDataUtils.getAppModeDescription(getContext(), selectedMode); Preference configureProfile = findPreference(CONFIGURE_PROFILE); configureProfile.setIcon(getAppProfilesIcon(selectedMode, true)); configureProfile.setTitle(title); @@ -193,7 +193,7 @@ public class MainSettingsFragment extends BaseSettingsFragment implements OnSele pref.setIcon(getAppProfilesIcon(applicationMode, isAppProfileEnabled)); pref.setTitle(applicationMode.toHumanString()); - pref.setSummary(ProfileDataObject.getAppModeDescription(getContext(), applicationMode)); + pref.setSummary(ProfileDataUtils.getAppModeDescription(getContext(), applicationMode)); pref.setChecked(isAppProfileEnabled); pref.setLayoutResource(R.layout.preference_with_descr_dialog_and_switch); pref.setFragment(ConfigureProfileFragment.class.getName()); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/NavigationFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/NavigationFragment.java index 2b504003a9..0720dc7714 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/NavigationFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/NavigationFragment.java @@ -10,6 +10,7 @@ import androidx.preference.Preference; import androidx.preference.SwitchPreferenceCompat; import net.osmand.plus.measurementtool.MeasurementToolFragment; +import net.osmand.plus.profiles.ProfileDataUtils; import net.osmand.plus.routepreparationmenu.RouteOptionsBottomSheet; import net.osmand.plus.routepreparationmenu.RouteOptionsBottomSheet.DialogMode; import net.osmand.plus.settings.backend.ApplicationMode; @@ -40,7 +41,7 @@ public class NavigationFragment extends BaseSettingsFragment implements OnSelect @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - routingProfileDataObjects = RoutingProfileDataObject.getRoutingProfiles(app); + routingProfileDataObjects = ProfileDataUtils.getRoutingProfiles(app); setupOnBackPressedCallback(); } @@ -174,7 +175,7 @@ public class NavigationFragment extends BaseSettingsFragment implements OnSelect @Override public void onProfileSelected(Bundle args) { if (args.getBoolean(IS_PROFILE_IMPORTED_ARG)) { - routingProfileDataObjects = RoutingProfileDataObject.getRoutingProfiles(app); + routingProfileDataObjects = ProfileDataUtils.getRoutingProfiles(app); } updateRoutingProfile(args.getString(PROFILE_KEY_ARG)); }