MainSettingsFragment->ConfigureProfileFragment for every profile.

This commit is contained in:
Dima-1 2019-11-28 17:20:33 +02:00
parent 4812fa58f4
commit 913559a40a
3 changed files with 7 additions and 2 deletions

View file

@ -2092,7 +2092,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
String fragmentName = pref.getFragment(); String fragmentName = pref.getFragment();
Fragment fragment = Fragment.instantiate(this, fragmentName); Fragment fragment = Fragment.instantiate(this, fragmentName);
if (caller instanceof BaseSettingsFragment) { if (caller instanceof BaseSettingsFragment) {
fragment.setArguments(((BaseSettingsFragment) caller).buildArguments()); fragment.setArguments(((BaseSettingsFragment) caller).buildArguments(pref.getKey()));
} }
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.replace(R.id.fragmentContainer, fragment, fragment.getClass().getName()) .replace(R.id.fragmentContainer, fragment, fragment.getClass().getName())

View file

@ -319,8 +319,12 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
} }
public Bundle buildArguments() { public Bundle buildArguments() {
return buildArguments(appMode.getStringKey());
}
public Bundle buildArguments(String key) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(APP_MODE_KEY, appMode.getStringKey()); args.putString(APP_MODE_KEY, key);
return args; return args;
} }

View file

@ -115,6 +115,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
pref.setSummary(getAppModeDescription(getContext(), applicationMode)); pref.setSummary(getAppModeDescription(getContext(), applicationMode));
pref.setChecked(isAppProfileEnabled); pref.setChecked(isAppProfileEnabled);
pref.setLayoutResource(R.layout.preference_with_descr_dialog_and_switch); pref.setLayoutResource(R.layout.preference_with_descr_dialog_and_switch);
pref.setFragment(ConfigureProfileFragment.class.getName());
preferenceCategory.addPreference(pref); preferenceCategory.addPreference(pref);
} }
} }