Newly created profile set active on Save

This commit is contained in:
madwasp79 2019-05-15 10:15:22 +03:00
parent b2f84d502e
commit e91ef8babe
3 changed files with 4 additions and 4 deletions

View file

@ -534,6 +534,4 @@ public class ApplicationMode {
ApplicationMode.saveCustomModeToSettings(app.getSettings()); ApplicationMode.saveCustomModeToSettings(app.getSettings());
} }
} }

View file

@ -42,9 +42,11 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void updateItemsList(List<ApplicationMode> newList) { public void updateItemsList(List<ApplicationMode> newList, Set<ApplicationMode> selectedItems) {
items.clear(); items.clear();
this.selectedItems.clear();
items.addAll(newList); items.addAll(newList);
this.selectedItems.addAll(selectedItems);
notifyDataSetChanged(); notifyDataSetChanged();
} }

View file

@ -143,7 +143,7 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
allAppModes = ApplicationMode.allPossibleValues(); allAppModes = ApplicationMode.allPossibleValues();
allAppModes.remove(ApplicationMode.DEFAULT); allAppModes.remove(ApplicationMode.DEFAULT);
adapter.updateItemsList(allAppModes); adapter.updateItemsList(allAppModes, new LinkedHashSet<>(ApplicationMode.values(getMyApplication())));
} }
static ArrayList<BaseProfile> getBaseProfiles(Context ctx) { static ArrayList<BaseProfile> getBaseProfiles(Context ctx) {