Skip to content

Commit

Permalink
plusonelabs#287 Reorder list of Calendars and Tasks immediately after…
Browse files Browse the repository at this point in the history
… a calendar/task selection/deselection
  • Loading branch information
yvolk committed Oct 8, 2019
1 parent 641528e commit 19cabcc
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ private void loadActiveSources() {
if(!(savedActiveSources.equals(activeSourcesNew))) {
savedActiveSources = activeSourcesNew;
Log.i(this.getClass().getSimpleName(), this.toString() + "\nLoaded " + savedActiveSources.size());
showActiveSources();
showAllSources(activeSourcesNew);
}
}

public void showActiveSources() {
private void showAllSources(List<EventSource> activeSources) {
getPreferenceScreen().removeAll();
for (EventSource saved: savedActiveSources) {
for (EventSource saved: activeSources) {
addAsPreference(saved, true);
}
for (EventSource available : EventProviderType.getAvailableSources()) {
if (!savedActiveSources.contains(available)) {
if (!activeSources.contains(available)) {
addAsPreference(available, false);
}
}
Expand Down Expand Up @@ -147,6 +147,7 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen
EventSource source = EventSource.fromStoredString(preference.getExtras().getString(SOURCE_ID));
clickedSources.remove(source);
clickedSources.add(source); // last clicked is the last in the list
showAllSources(getSelectedSources());
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
Expand Down

0 comments on commit 19cabcc

Please sign in to comment.