Fix enabling edited profile as current app mode
This commit is contained in:
parent
124cc6590f
commit
b3fe910193
4 changed files with 9 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue