correctly update task lists when filtering

This commit is contained in:
Phillip Thelen 2017-04-06 18:57:36 +02:00
parent b113917c01
commit 6c8f394d94
2 changed files with 20 additions and 13 deletions

View file

@ -160,7 +160,14 @@ public class TasksFragment extends BaseMainFragment {
dialog.setTaskType(taskType, activeTaskFilters.get(taskType));
dialog.setListener((activeTaskFilter, activeTags) -> {
activeTaskFilters.put(taskType, activeTaskFilter);
int activePos = viewPager.getCurrentItem();
if (activePos >= 1) {
viewFragmentsDictionary.get(activePos-1).recyclerAdapter.filter();
}
getActiveFragment().setActiveFilter(activeTaskFilter);
if (activePos < viewPager.getAdapter().getCount()) {
viewFragmentsDictionary.get(activePos+1).recyclerAdapter.filter();
}
taskFilterHelper.setTags(activeTags);
});
dialog.show();

View file

@ -134,23 +134,23 @@ public class TaskFilterDialog extends AlertDialog implements RadioGroup.OnChecke
}
private void createTagViews() {
ColorStateList colorStateList = new ColorStateList(
new int[][]{
new int[]{-android.R.attr.state_checked}, //disabled
new int[]{android.R.attr.state_checked} //enabled
},
new int[] {
Color.GRAY, //disabled
ContextCompat.getColor(getContext(), R.color.brand_400) //enabled
}
);
for (Tag tag : tags) {
AppCompatCheckBox tagCheckbox = new AppCompatCheckBox(getContext());
tagCheckbox.setText(tag.getName());
tagCheckbox.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);
ColorStateList colorStateList = new ColorStateList(
new int[][]{
new int[]{-android.R.attr.state_checked}, //disabled
new int[]{android.R.attr.state_checked} //enabled
},
new int[] {
Color.GRAY, //disabled
ContextCompat.getColor(getContext(), R.color.brand_400) //enabled
}
);
CompoundButtonCompat.setButtonTintList(tagCheckbox, colorStateList);
tagCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) {