Switching filter modes in task list activity while swipe enabled is now handled correctly

pull/14/head
Sam Bosley 12 years ago
parent 8a4aa7b5eb
commit b9ebfa8740

@ -199,14 +199,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
extras.putParcelable(TaskListFragment.TOKEN_FILTER, savedFilter);
if (swipeIsEnabled()) {
FilterListFragment flf = getFilterListFragment();
if (flf == null)
throw new RuntimeException("Filterlist fragment was null, needs to exist to construct the fragment pager"); //$NON-NLS-1$
FilterAdapter adapter = flf.adapter;
tlfPager = (TaskListFragmentPager) findViewById(R.id.pager);
tlfPagerAdapter = new TaskListFragmentPagerAdapter(getSupportFragmentManager(), adapter);
tlfPager.setAdapter(tlfPagerAdapter);
tlfPager.setOnPageChangeListener(this);
setupPagerAdapter();
}
setupTasklistFragmentWithFilter(savedFilter, extras);
@ -223,6 +216,17 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
abTestEventReportingService.trackUserRetention(this);
}
private void setupPagerAdapter() {
FilterListFragment flf = getFilterListFragment();
if (flf == null)
throw new RuntimeException("Filterlist fragment was null, needs to exist to construct the fragment pager"); //$NON-NLS-1$
FilterAdapter adapter = flf.adapter;
tlfPager = (TaskListFragmentPager) findViewById(R.id.pager);
tlfPagerAdapter = new TaskListFragmentPagerAdapter(getSupportFragmentManager(), adapter);
tlfPager.setAdapter(tlfPagerAdapter);
tlfPager.setOnPageChangeListener(this);
}
protected int getHeaderView() {
return R.layout.header_nav_views;
}
@ -737,12 +741,19 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
personImage.setVisibility(View.GONE);
commentsButton.setVisibility(View.VISIBLE);
}
if (swipeIsEnabled()) {
setupPagerAdapter();
}
} else {
setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, R.id.filterlist_fragment_container,
filterModeSpec.getFilterListClass(), false, true);
}
onFilterItemClicked(getDefaultFilter());
if (swipeIsEnabled())
setListsTitle(tlfPagerAdapter.getPageTitle(0).toString());
if (fragmentLayout == LAYOUT_SINGLE)
listsNav.performClick();
}

Loading…
Cancel
Save