From 913559a40ad9b403fc4d88f9cb5b68b6d20a8f46 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Thu, 28 Nov 2019 17:20:33 +0200 Subject: [PATCH] MainSettingsFragment->ConfigureProfileFragment for every profile. --- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 2 +- .../src/net/osmand/plus/settings/BaseSettingsFragment.java | 6 +++++- .../src/net/osmand/plus/settings/MainSettingsFragment.java | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index b344304e6a..3c97df19c7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -2092,7 +2092,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven String fragmentName = pref.getFragment(); Fragment fragment = Fragment.instantiate(this, fragmentName); if (caller instanceof BaseSettingsFragment) { - fragment.setArguments(((BaseSettingsFragment) caller).buildArguments()); + fragment.setArguments(((BaseSettingsFragment) caller).buildArguments(pref.getKey())); } getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentContainer, fragment, fragment.getClass().getName()) diff --git a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java index 4317ebefe4..75c29cb377 100644 --- a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java @@ -319,8 +319,12 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } public Bundle buildArguments() { + return buildArguments(appMode.getStringKey()); + } + + public Bundle buildArguments(String key) { Bundle args = new Bundle(); - args.putString(APP_MODE_KEY, appMode.getStringKey()); + args.putString(APP_MODE_KEY, key); return args; } diff --git a/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java index 001be21ebe..23fca293e3 100644 --- a/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java @@ -115,6 +115,7 @@ public class MainSettingsFragment extends BaseSettingsFragment { pref.setSummary(getAppModeDescription(getContext(), applicationMode)); pref.setChecked(isAppProfileEnabled); pref.setLayoutResource(R.layout.preference_with_descr_dialog_and_switch); + pref.setFragment(ConfigureProfileFragment.class.getName()); preferenceCategory.addPreference(pref); } }