diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java index 4cf5339958..9a74eb64e4 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java @@ -78,7 +78,9 @@ public class OsmEditsAdapter extends ArrayAdapter { holder.selectCheckBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - selectItem(holder.selectCheckBox, child); + if (listener != null) { + listener.onItemSelect(child, holder.selectCheckBox.isChecked()); + } } }); } else { @@ -100,9 +102,7 @@ public class OsmEditsAdapter extends ArrayAdapter { @Override public void onClick(View v) { if (selectionMode) { - CheckBox checkBox = holder.selectCheckBox; - checkBox.setChecked(!checkBox.isChecked()); - selectItem(checkBox, child); + holder.selectCheckBox.performClick(); } else { if (listener != null) { listener.onItemShowMap(child); @@ -114,17 +114,6 @@ public class OsmEditsAdapter extends ArrayAdapter { return view; } - private void selectItem(CheckBox checkBox, OsmPoint note) { - if (checkBox.isChecked()) { - selectedOsmEdits.add(note); - } else { - selectedOsmEdits.remove(note); - } - if (listener != null) { - listener.onItemSelect(note); - } - } - private class OsmEditViewHolder { View mainView; ImageView icon; @@ -143,7 +132,7 @@ public class OsmEditsAdapter extends ArrayAdapter { public interface OsmEditsAdapterListener { - void onItemSelect(OsmPoint point); + void onItemSelect(OsmPoint point, boolean checked); void onItemShowMap(OsmPoint point); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 2012e83927..9016018e1e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -361,7 +361,12 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo listAdapter.setSelectedOsmEdits(osmEditsSelected); listAdapter.setAdapterListener(new OsmEditsAdapter.OsmEditsAdapterListener() { @Override - public void onItemSelect(OsmPoint point) { + public void onItemSelect(OsmPoint point, boolean checked) { + if (checked) { + osmEditsSelected.add(point); + } else { + osmEditsSelected.remove(point); + } updateSelectionMode(actionMode); }