diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java b/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java index a97fa7dfde..b0cffe7c0c 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectMultipleProfilesBottomSheet.java @@ -34,14 +34,12 @@ public class SelectMultipleProfilesBottomSheet extends BasePreferenceBottomSheet public static final String DISABLED_KEYS = "disabled_keys"; private List profiles = new ArrayList<>(); - private Map compoundButtons = new HashMap<>(); private List selectedProfiles; private List disabledProfiles; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - compoundButtons.clear(); Bundle args = getArguments(); if (savedInstanceState != null) { readBundle(savedInstanceState); @@ -66,19 +64,6 @@ public class SelectMultipleProfilesBottomSheet extends BasePreferenceBottomSheet } } - @Override - public void onResume() { - super.onResume(); - for (ProfileDataObject profile : profiles) { - String key = profile.getStringKey(); - boolean selected = selectedProfiles.contains(key); - CompoundButton cb = compoundButtons.get(key); - if (cb != null) { - cb.setChecked(selected); - } - } - } - @Override public void createMenuItems(Bundle savedInstanceState) { items.add(new TitleItem(getString(R.string.application_profiles))); @@ -118,7 +103,8 @@ public class SelectMultipleProfilesBottomSheet extends BasePreferenceBottomSheet ivIcon.setImageDrawable(drawableIcon); UiUtilities.setupCompoundButton(nightMode, ContextCompat.getColor(app, enable ? activeColorId : disableColorId), compoundButton); - compoundButtons.put(profile.getStringKey(), compoundButton); + compoundButton.setSaveEnabled(false); + compoundButton.setChecked(profile.isSelected()); View.OnClickListener l = !enable ? null : new View.OnClickListener() { @Override