mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-31 19:20:34 +00:00
fix checking off checklist items
This commit is contained in:
parent
c24af7f8a0
commit
7194ca1e59
1 changed files with 6 additions and 13 deletions
|
|
@ -100,7 +100,12 @@ public abstract class ChecklistedViewHolder extends BaseTaskViewHolder implement
|
|||
// Populate the data into the template view using the data object
|
||||
textView.setText(item.getText());
|
||||
checkbox.setChecked(item.getCompleted());
|
||||
checkbox.setOnCheckedChangeListener(this);
|
||||
checkbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
ChecklistCheckedCommand event = new ChecklistCheckedCommand();
|
||||
event.task = task;
|
||||
event.item = item;
|
||||
EventBus.getDefault().post(event);
|
||||
});
|
||||
RelativeLayout checkboxHolder = (RelativeLayout) itemView.findViewById(R.id.checkBoxHolder);
|
||||
expandCheckboxTouchArea(checkboxHolder, checkbox);
|
||||
this.checklistView.addView(itemView);
|
||||
|
|
@ -149,18 +154,6 @@ public abstract class ChecklistedViewHolder extends BaseTaskViewHolder implement
|
|||
// maybe a refactor is needed here
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
} else {
|
||||
View v = (View) buttonView.getParent();
|
||||
while (v.getParent().equals(this.checklistView)) {
|
||||
v = (View) v.getParent();
|
||||
}
|
||||
Integer position = ((ViewGroup) v.getParent()).indexOfChild(v);
|
||||
if (task.checklist.size() > position && isChecked != task.checklist.get(position).getCompleted()) {
|
||||
ChecklistCheckedCommand event = new ChecklistCheckedCommand();
|
||||
event.task = task;
|
||||
event.item = task.getChecklist().get(position);
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue