Don't need the custom filters hack in swipe mode anymore, clear filter override on fragment startup

pull/14/head
Sam Bosley 12 years ago
parent 5c669f0b0e
commit ab2c5e01bd

@ -260,7 +260,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
@Override
public void setupTasklistFragmentWithFilterAndCustomTaskList(Filter filter, Bundle extras, Class<?> customTaskList) {
if (swipeIsEnabled()) {
tlfPager.showFilterWithCustomTaskList(filter, customTaskList);
tlfPager.showFilter(filter);
tlfPager.forceReload(); // Hack to force reload of current page
} else {
super.setupTasklistFragmentWithFilterAndCustomTaskList(filter, extras, customTaskList);

@ -388,6 +388,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
} else {
filter = CoreFilterExposer.buildInboxFilter(getResources());
}
filter.setFilterQueryOverride(null);
isInbox = CoreFilterExposer.isInbox(filter);
setUpTaskList();

@ -22,7 +22,6 @@ import com.todoroo.astrid.api.FilterWithCustomIntent;
public class TaskListFragmentPagerAdapter extends FragmentStatePagerAdapter implements FilterDataSourceChangedListener {
private final HashMap<Integer, Fragment> positionToFragment;
private final HashMap<Filter, Class<?>> customTaskLists;
private final FilterAdapter filterAdapter; // Shares an adapter instance with the filter list fragment
@ -31,7 +30,6 @@ public class TaskListFragmentPagerAdapter extends FragmentStatePagerAdapter impl
this.filterAdapter = filterAdapter;
filterAdapter.setDataSourceChangedListener(this);
positionToFragment = new HashMap<Integer, Fragment>();
customTaskLists = new HashMap<Filter, Class<?>>();
}
@Override
@ -97,18 +95,9 @@ public class TaskListFragmentPagerAdapter extends FragmentStatePagerAdapter impl
return filterAdapter.getCount();
}
public void setCustomTaskListForFilter(Filter f, Class<?> customTaskList) {
customTaskLists.put(f, customTaskList);
notifyDataSetChanged();
}
public void clearCustomTaskListForFilter(Filter f) {
customTaskLists.remove(f);
}
private Fragment getFragmentForFilter(Filter filter) {
Bundle extras = getExtrasForFilter(filter);
Class<?> customList = customTaskLists.get(filter);
Class<?> customList = null;
if (AstridActivity.shouldUseSubtasksFragmentForFilter(filter))
customList = AstridActivity.subtasksClassForFilter(filter);
return TaskListFragment.instantiateWithFilterAndExtras(filter, extras, customList);

@ -59,12 +59,6 @@ public class TaskListFragmentPager extends ViewPager {
showFilter(adapter.addOrLookup(f));
}
public void showFilterWithCustomTaskList(Filter f, Class<?> customTaskList) {
TaskListFragmentPagerAdapter adapter = (TaskListFragmentPagerAdapter) getAdapter();
adapter.setCustomTaskListForFilter(f, customTaskList);
showFilter(adapter.addOrLookup(f));
}
/**
* Show the filter at the supplied index, with animation
* @param index

Loading…
Cancel
Save