From 19cabccba39041fa75ef19619aab02f593dad82f Mon Sep 17 00:00:00 2001 From: Yuri Volkov Date: Tue, 8 Oct 2019 19:47:44 +0300 Subject: [PATCH] #287 Reorder list of Calendars and Tasks immediately after a calendar/task selection/deselection --- .../prefs/EventSourcesPreferencesFragment.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/andstatus/todoagenda/prefs/EventSourcesPreferencesFragment.java b/app/src/main/java/org/andstatus/todoagenda/prefs/EventSourcesPreferencesFragment.java index 3b6d8584..8e0e03c2 100644 --- a/app/src/main/java/org/andstatus/todoagenda/prefs/EventSourcesPreferencesFragment.java +++ b/app/src/main/java/org/andstatus/todoagenda/prefs/EventSourcesPreferencesFragment.java @@ -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 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); } } @@ -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); }