mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
added touch delegate to checkbox on daily/todo items.
This commit is contained in:
parent
20e8af1c97
commit
de9432404e
3 changed files with 17 additions and 0 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}">
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.graphics.Rect;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.TouchDelegate;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
|
@ -362,6 +364,8 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
super(itemView);
|
||||
checklistIndicatorWrapper.setOnClickListener(this);
|
||||
checkbox.setOnCheckedChangeListener(this);
|
||||
expandCheckboxTouchArea(checkboxHolder, checkbox);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -446,6 +450,17 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void expandCheckboxTouchArea(final View expandedView, final View checkboxView){
|
||||
expandedView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Rect rect = new Rect();
|
||||
expandedView.getHitRect(rect);
|
||||
expandedView.setTouchDelegate(new TouchDelegate(rect, checkboxView));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class DailyViewHolder extends ChecklistedViewHolder {
|
||||
|
|
|
|||
Loading…
Reference in a new issue