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.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,10 +470,12 @@ public class MainActivity extends InjectingAppCompatActivity
}
@Override
public void sortChanged() {
public void sortChanged(boolean reload) {
localBroadcastManager.broadcastRefresh();
if (reload) {
openTaskListFragment(filter);
}
}
@Override
public void onSupportActionModeStarted(@NonNull ActionMode mode) {

@ -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);
}
}

Loading…
Cancel
Save