mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-19 12:18:59 +00:00
Made the relativelayout holder of the task checkbox react to click events
This commit is contained in:
parent
433bebf109
commit
b5165752df
3 changed files with 17 additions and 2 deletions
|
|
@ -26,6 +26,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<RelativeLayout
|
||||
android:id="@+id/checkBoxHolder"
|
||||
android:layout_width="@dimen/button_width"
|
||||
android:layout_height="match_parent"
|
||||
app:backgroundColor="@{daily.isDisplayedActive(offset) ? daily.getLightTaskColor : @color/task_gray}">
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<RelativeLayout
|
||||
android:id="@+id/checkBoxHolder"
|
||||
android:layout_width="@dimen/button_width"
|
||||
android:layout_height="match_parent"
|
||||
app:backgroundColor="@{todo.completed ? @color/task_gray : todo.getLightTaskColor}">
|
||||
|
|
|
|||
|
|
@ -344,6 +344,9 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
|
||||
public class ChecklistedViewHolder extends ViewHolder<Task> implements CompoundButton.OnCheckedChangeListener {
|
||||
|
||||
@Bind(R.id.checkBoxHolder)
|
||||
RelativeLayout checkboxHolder;
|
||||
|
||||
@Bind(R.id.checkBox)
|
||||
CheckBox checkbox;
|
||||
|
||||
|
|
@ -443,6 +446,16 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected View.OnClickListener checkboxHolderClickListener() {
|
||||
return new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
checkbox.setChecked(!checkbox.isChecked());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class DailyViewHolder extends ChecklistedViewHolder {
|
||||
|
|
@ -453,12 +466,11 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
super(itemView);
|
||||
|
||||
binding = DataBindingUtil.bind(itemView);
|
||||
|
||||
checkboxHolder.setOnClickListener(checkboxHolderClickListener());
|
||||
checkbox.setOnCheckedChangeListener(this);
|
||||
binding.setOffset(dailyResetOffset);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void bindHolder(Task habitItem, int position) {
|
||||
super.bindHolder(habitItem, position);
|
||||
|
|
@ -481,6 +493,7 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
public TodoViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
checkboxHolder.setOnClickListener(checkboxHolderClickListener());
|
||||
binding = DataBindingUtil.bind(itemView);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue