expand check_box clickable area

This commit is contained in:
veliymolfar 2020-02-21 18:51:12 +02:00
parent 321aa96846
commit a28d9f84c4
2 changed files with 22 additions and 7 deletions

View file

@ -64,12 +64,24 @@
android:layout_marginBottom="@dimen/content_padding"
android:background="?attr/list_divider" />
<net.osmand.view.ThreeStateCheckbox
android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:focusable="false" />
<FrameLayout
android:id="@+id/check_box_container"
android:layout_width="@dimen/acceptable_touch_radius"
android:layout_height="@dimen/acceptable_touch_radius"
android:layout_marginEnd="@dimen/text_margin_small"
android:layout_marginRight="@dimen/text_margin_small"
android:background="?attr/selectableItemBackgroundBorderless">
<net.osmand.view.ThreeStateCheckbox
android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:enabled="false"
android:focusable="false" />
</FrameLayout>
</LinearLayout>

View file

@ -7,6 +7,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@ -74,6 +75,7 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
TextView titleTv = group.findViewById(R.id.title_tv);
TextView subTextTv = group.findViewById(R.id.sub_text_tv);
final ThreeStateCheckbox checkBox = group.findViewById(R.id.check_box);
FrameLayout checkBoxContainer = group.findViewById(R.id.check_box_container);
ImageView expandIv = group.findViewById(R.id.explist_indicator);
View lineDivider = group.findViewById(R.id.divider);
View cardTopDivider = group.findViewById(R.id.card_top_divider);
@ -100,9 +102,10 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
}
checkBox.setState(contains ? MISC : UNCHECKED);
}
checkBox.setOnClickListener(new View.OnClickListener() {
checkBoxContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checkBox.performClick();
if (checkBox.getState() == CHECKED) {
for (Object object : listItems) {
if (!dataToOperate.contains(object)) {