diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 08fdbd3758..eec1aaff56 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -843,8 +843,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven } if (intent.hasExtra(EditProfileFragment.OPEN_SETTINGS)) { String settingsType = intent.getStringExtra(EditProfileFragment.OPEN_SETTINGS); + String appMode = intent.getStringExtra(EditProfileFragment.SELECTED_ITEM); if (EditProfileFragment.OPEN_CONFIG_PROFILE.equals(settingsType)) { - BaseSettingsFragment.showInstance(this, SettingsScreenType.CONFIGURE_PROFILE); + BaseSettingsFragment.showInstance(this, SettingsScreenType.CONFIGURE_PROFILE, ApplicationMode.valueOfStringKey(appMode, null)); } setIntent(null); } diff --git a/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java b/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java index 36fcf7ba64..e529e5fc74 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java +++ b/OsmAnd/src/net/osmand/plus/profiles/EditProfileFragment.java @@ -369,16 +369,13 @@ public class EditProfileFragment extends BaseOsmAndFragment { if (dataChanged) { needSaveDialog(); } else if (getSettings() != null) { - activateMode(mode); - getSettings().APPLICATION_MODE.set(mode); - if (activity instanceof EditProfileActivity) { Intent i = new Intent(getActivity(), MapActivity.class); i.putExtra(OPEN_SETTINGS, OPEN_CONFIG_PROFILE); i.putExtra(SELECTED_ITEM, profile.stringKey); startActivity(i); } else { - BaseSettingsFragment.showInstance(activity, SettingsScreenType.CONFIGURE_PROFILE); + BaseSettingsFragment.showInstance(activity, SettingsScreenType.CONFIGURE_PROFILE, ApplicationMode.valueOfStringKey(profile.stringKey, null)); } } } diff --git a/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java b/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java index 361da5a374..89abd68987 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java @@ -304,7 +304,11 @@ public class ConfigureProfileFragment extends BaseSettingsFragment { try { FragmentManager fragmentManager = activity.getSupportFragmentManager(); if (fragmentManager != null) { - settings.APPLICATION_MODE.set(getSelectedAppMode()); + ApplicationMode selectedMode = getSelectedAppMode(); + if (!ApplicationMode.values(app).contains(selectedMode)) { + ApplicationMode.changeProfileAvailability(selectedMode, true, app); + } + settings.APPLICATION_MODE.set(selectedMode); fragmentManager.beginTransaction() .remove(this) .addToBackStack(TAG) diff --git a/OsmAnd/src/net/osmand/plus/settings/GlobalSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/GlobalSettingsFragment.java index cd07a69928..2058f32bdd 100644 --- a/OsmAnd/src/net/osmand/plus/settings/GlobalSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/GlobalSettingsFragment.java @@ -98,8 +98,6 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send if (app == null) { return; } - ApplicationMode selectedMode = getSelectedAppMode(); - ApplicationMode[] appModes = ApplicationMode.values(app).toArray(new ApplicationMode[0]); String[] entries = new String[appModes.length]; String[] entryValues = new String[appModes.length]; @@ -109,7 +107,7 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send } ListPreferenceEx defaultApplicationMode = (ListPreferenceEx) findPreference(settings.DEFAULT_APPLICATION_MODE.getId()); - defaultApplicationMode.setIcon(getContentIcon(selectedMode.getIconRes())); + defaultApplicationMode.setIcon(getContentIcon(settings.DEFAULT_APPLICATION_MODE.get().getIconRes())); defaultApplicationMode.setEntries(entries); defaultApplicationMode.setEntryValues(entryValues); }