mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 10:11:58 +00:00
correctly update task lists when filtering
This commit is contained in:
parent
b113917c01
commit
6c8f394d94
2 changed files with 20 additions and 13 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue