fix tag filtering.

This commit is contained in:
Phillip Thelen 2015-12-09 16:39:40 +01:00
parent 070f625aaa
commit abc22f070c
2 changed files with 8 additions and 1 deletions

View file

@ -32,6 +32,10 @@ public class TagsHelper {
return this.tagsId;
}
public boolean isTagChecked(String tagID) {
return this.tagsId.contains(tagID);
}
public List<Task> filter(List<Task> tasks) {
List<Task> filtered = new ArrayList<Task>();
for (Task t : tasks) {

View file

@ -161,7 +161,9 @@ public class TasksFragment extends BaseFragment implements OnCheckedChangeListen
filterDrawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
viewPager.setCurrentItem(0);
this.tagsHelper = new TagsHelper();
if (this.tagsHelper == null) {
this.tagsHelper = new TagsHelper();
}
loadTaskLists();
@ -462,6 +464,7 @@ public class TasksFragment extends BaseFragment implements OnCheckedChangeListen
filterDrawer.addItem(new SwitchDrawerItem()
.withName(t.getName())
.withTag(t)
.withChecked(this.tagsHelper.isTagChecked(t.getId()))
.withOnCheckedChangeListener(this)
);
}