Fix sort animation

gtask_related_email
Alex Baker 5 years ago
parent 72101b2ebb
commit 1ef5875003

@ -44,7 +44,6 @@ import org.tasks.BuildConfig;
import org.tasks.LocalBroadcastManager; import org.tasks.LocalBroadcastManager;
import org.tasks.R; import org.tasks.R;
import org.tasks.activities.TagSettingsActivity; import org.tasks.activities.TagSettingsActivity;
import org.tasks.analytics.Tracker;
import org.tasks.billing.Inventory; import org.tasks.billing.Inventory;
import org.tasks.dialogs.SortDialog; import org.tasks.dialogs.SortDialog;
import org.tasks.fragments.CommentBarFragment; import org.tasks.fragments.CommentBarFragment;
@ -63,7 +62,6 @@ import org.tasks.ui.NavigationDrawerFragment;
import org.tasks.ui.PriorityControlSet; import org.tasks.ui.PriorityControlSet;
import org.tasks.ui.RemoteListFragment; import org.tasks.ui.RemoteListFragment;
import org.tasks.ui.TaskListViewModel; import org.tasks.ui.TaskListViewModel;
import org.tasks.ui.Toaster;
public class MainActivity extends InjectingAppCompatActivity public class MainActivity extends InjectingAppCompatActivity
implements TaskListFragment.TaskListFragmentCallbackHandler, implements TaskListFragment.TaskListFragmentCallbackHandler,
@ -90,12 +88,10 @@ public class MainActivity extends InjectingAppCompatActivity
@Inject DefaultFilterProvider defaultFilterProvider; @Inject DefaultFilterProvider defaultFilterProvider;
@Inject Theme theme; @Inject Theme theme;
@Inject ThemeCache themeCache; @Inject ThemeCache themeCache;
@Inject Tracker tracker;
@Inject TaskDao taskDao; @Inject TaskDao taskDao;
@Inject LocalBroadcastManager localBroadcastManager; @Inject LocalBroadcastManager localBroadcastManager;
@Inject TaskCreator taskCreator; @Inject TaskCreator taskCreator;
@Inject PlayServices playServices; @Inject PlayServices playServices;
@Inject Toaster toaster;
@Inject Inventory inventory; @Inject Inventory inventory;
@BindView(R.id.drawer_layout) @BindView(R.id.drawer_layout)
@ -155,7 +151,7 @@ public class MainActivity extends InjectingAppCompatActivity
} }
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putParcelable(EXTRA_FILTER, filter); outState.putParcelable(EXTRA_FILTER, filter);
@ -474,9 +470,11 @@ public class MainActivity extends InjectingAppCompatActivity
} }
@Override @Override
public void sortChanged() { public void sortChanged(boolean reload) {
localBroadcastManager.broadcastRefresh(); localBroadcastManager.broadcastRefresh();
openTaskListFragment(filter); if (reload) {
openTaskListFragment(filter);
}
} }
@Override @Override

@ -123,15 +123,15 @@ public class SortDialog extends InjectingDialogFragment {
private void setSelection(boolean reverse) { private void setSelection(boolean reverse) {
preferences.setBoolean(R.string.p_reverse_sort, 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); preferences.setBoolean(R.string.p_manual_sort, isManual);
if (!isManual) { if (!isManual) {
preferences.setSortMode(getSortMode(manualEnabled ? selectedIndex : selectedIndex + 1)); preferences.setSortMode(getSortMode(manualEnabled ? selectedIndex : selectedIndex + 1));
} }
callback.sortChanged(); callback.sortChanged(wasManual != isManual);
} }
private int getIndex(int sortMode) { private int getIndex(int sortMode) {
@ -177,6 +177,6 @@ public class SortDialog extends InjectingDialogFragment {
public interface SortDialogCallback { public interface SortDialogCallback {
void sortChanged(); void sortChanged(boolean reload);
} }
} }

Loading…
Cancel
Save