From 1ef58750037cb8b3be1ff67af7226439abac2312 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Fri, 13 Dec 2019 16:54:04 -0600 Subject: [PATCH] Fix sort animation --- .../com/todoroo/astrid/activity/MainActivity.java | 12 +++++------- app/src/main/java/org/tasks/dialogs/SortDialog.java | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/activity/MainActivity.java b/app/src/main/java/com/todoroo/astrid/activity/MainActivity.java index d32a2ca43..39c0135a8 100644 --- a/app/src/main/java/com/todoroo/astrid/activity/MainActivity.java +++ b/app/src/main/java/com/todoroo/astrid/activity/MainActivity.java @@ -44,7 +44,6 @@ import org.tasks.BuildConfig; import org.tasks.LocalBroadcastManager; import org.tasks.R; import org.tasks.activities.TagSettingsActivity; -import org.tasks.analytics.Tracker; import org.tasks.billing.Inventory; import org.tasks.dialogs.SortDialog; import org.tasks.fragments.CommentBarFragment; @@ -63,7 +62,6 @@ import org.tasks.ui.NavigationDrawerFragment; import org.tasks.ui.PriorityControlSet; import org.tasks.ui.RemoteListFragment; import org.tasks.ui.TaskListViewModel; -import org.tasks.ui.Toaster; public class MainActivity extends InjectingAppCompatActivity implements TaskListFragment.TaskListFragmentCallbackHandler, @@ -90,12 +88,10 @@ public class MainActivity extends InjectingAppCompatActivity @Inject DefaultFilterProvider defaultFilterProvider; @Inject Theme theme; @Inject ThemeCache themeCache; - @Inject Tracker tracker; @Inject TaskDao taskDao; @Inject LocalBroadcastManager localBroadcastManager; @Inject TaskCreator taskCreator; @Inject PlayServices playServices; - @Inject Toaster toaster; @Inject Inventory inventory; @BindView(R.id.drawer_layout) @@ -155,7 +151,7 @@ public class MainActivity extends InjectingAppCompatActivity } @Override - protected void onSaveInstanceState(Bundle outState) { + protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(EXTRA_FILTER, filter); @@ -474,9 +470,11 @@ public class MainActivity extends InjectingAppCompatActivity } @Override - public void sortChanged() { + public void sortChanged(boolean reload) { localBroadcastManager.broadcastRefresh(); - openTaskListFragment(filter); + if (reload) { + openTaskListFragment(filter); + } } @Override diff --git a/app/src/main/java/org/tasks/dialogs/SortDialog.java b/app/src/main/java/org/tasks/dialogs/SortDialog.java index 2baefc8a5..6066732e2 100644 --- a/app/src/main/java/org/tasks/dialogs/SortDialog.java +++ b/app/src/main/java/org/tasks/dialogs/SortDialog.java @@ -123,15 +123,15 @@ public class SortDialog extends InjectingDialogFragment { private void setSelection(boolean reverse) { preferences.setBoolean(R.string.p_reverse_sort, reverse); - final boolean isManual = manualEnabled && selectedIndex == 0; - + boolean wasManual = preferences.isManualSort(); + boolean isManual = manualEnabled && selectedIndex == 0; preferences.setBoolean(R.string.p_manual_sort, isManual); if (!isManual) { preferences.setSortMode(getSortMode(manualEnabled ? selectedIndex : selectedIndex + 1)); } - callback.sortChanged(); + callback.sortChanged(wasManual != isManual); } private int getIndex(int sortMode) { @@ -177,6 +177,6 @@ public class SortDialog extends InjectingDialogFragment { public interface SortDialogCallback { - void sortChanged(); + void sortChanged(boolean reload); } }