diff --git a/OsmAnd/res/layout/drawer_list_poi_header.xml b/OsmAnd/res/layout/drawer_list_poi_header.xml
new file mode 100644
index 0000000000..0f462512f2
--- /dev/null
+++ b/OsmAnd/res/layout/drawer_list_poi_header.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/drawer_list_waypoint.xml b/OsmAnd/res/layout/drawer_list_waypoint.xml
new file mode 100644
index 0000000000..9ca14edfe4
--- /dev/null
+++ b/OsmAnd/res/layout/drawer_list_waypoint.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/drawer_list_waypoint_sub_header.xml b/OsmAnd/res/layout/drawer_list_waypoint_sub_header.xml
new file mode 100644
index 0000000000..752ded6d26
--- /dev/null
+++ b/OsmAnd/res/layout/drawer_list_waypoint_sub_header.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
index 0998e3b48f..156dc27491 100644
--- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
@@ -14,7 +14,19 @@ import android.view.ViewGroup;
import android.widget.CompoundButton.OnCheckedChangeListener;
public class ContextMenuAdapter {
-
+
+ public void clearAll() {
+ items.clear();
+ isCategory.clear();
+ itemNames.clear();
+ listeners.clear();
+ selectedList.clear();
+ layoutIds.clear();
+ iconList.clear();
+ iconListLight.clear();
+ itemDescription.clear();
+ }
+
public interface OnContextMenuClick {
//boolean return type needed to desribe if drawer needed to be close or not
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked);
@@ -24,6 +36,7 @@ public class ContextMenuAdapter {
private View anchor;
private int defaultLayoutId = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ?
R.layout.list_menu_item : R.layout.list_menu_item_native;
+ private ArrayAdapter listAdapter;
final TIntArrayList items = new TIntArrayList();
final TIntArrayList isCategory = new TIntArrayList();
final ArrayList itemNames = new ArrayList();
@@ -70,6 +83,12 @@ public class ContextMenuAdapter {
itemNames.set(pos, str);
}
+ public void notifyDataSetChanged(){
+ if (listAdapter != null){
+ listAdapter.notifyDataSetChanged();
+ }
+ }
+
public void setItemDescription(int pos, String str) {
itemDescription.set(pos, str);
}
@@ -127,6 +146,7 @@ public class ContextMenuAdapter {
int pos = -1;
String description = "";
private OnContextMenuClick listener;
+ boolean enabled = false;
private Item() {
}
@@ -188,6 +208,10 @@ public class ContextMenuAdapter {
return this;
}
+ public Item enabled(boolean checked) {
+ this.enabled = checked;
+ return this;
+ }
}
public String[] getItemNames() {
@@ -217,7 +241,7 @@ public class ContextMenuAdapter {
public ListAdapter createListAdapter(final Activity activity, final boolean holoLight) {
final int padding = (int) (12 * activity.getResources().getDisplayMetrics().density + 0.5f);
final int layoutId = defaultLayoutId;
- ListAdapter listadapter = new ArrayAdapter(activity, layoutId, R.id.title,
+ listAdapter = new ArrayAdapter(activity, layoutId, R.id.title,
getItemNames()) {
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
@@ -246,26 +270,51 @@ public class ContextMenuAdapter {
tv.setTypeface(null);
}
- final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item));
- if(selectedList.get(position) != -1) {
- ch.setOnCheckedChangeListener(null);
- ch.setVisibility(View.VISIBLE);
- ch.setChecked(selectedList.get(position) > 0);
- ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
-
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- OnContextMenuClick ca = getClickAdapter(position);
- if(ca != null) {
- ca.onContextMenuClick(getElementId(position), position, isChecked);
+ if (v.findViewById(R.id.check_item) instanceof CheckBox){
+ final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item));
+
+ if(selectedList.get(position) != -1) {
+ ch.setOnCheckedChangeListener(null);
+ ch.setVisibility(View.VISIBLE);
+ ch.setChecked(selectedList.get(position) > 0);
+ ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ OnContextMenuClick ca = getClickAdapter(position);
+ if(ca != null) {
+ ca.onContextMenuClick(getElementId(position), position, isChecked);
+ }
}
- }
- });
- ch.setVisibility(View.VISIBLE);
- } else if (ch != null) {
- ch.setVisibility(View.GONE);
+ });
+ ch.setVisibility(View.VISIBLE);
+ } else if (ch != null) {
+ ch.setVisibility(View.GONE);
+ }
+ } else if (v.findViewById(R.id.check_item) instanceof Switch) {
+ final Switch ch = (Switch) v.findViewById(R.id.check_item);
+
+ if(selectedList.get(position) != -1) {
+ ch.setOnCheckedChangeListener(null);
+ ch.setVisibility(View.VISIBLE);
+ ch.setChecked(selectedList.get(position) > 0);
+ ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ OnContextMenuClick ca = getClickAdapter(position);
+ if(ca != null) {
+ ca.onContextMenuClick(getElementId(position), position, isChecked);
+ }
+ }
+ });
+ ch.setVisibility(View.VISIBLE);
+ } else if (ch != null) {
+ ch.setVisibility(View.GONE);
+ }
}
+
String itemDescr = getItemDescr(position);
if (v.findViewById(R.id.descr) != null){
((TextView)v.findViewById(R.id.descr)).setText(itemDescr);
@@ -273,7 +322,7 @@ public class ContextMenuAdapter {
return v;
}
};
- return listadapter;
+ return listAdapter;
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index f3577f5579..3d01927984 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -898,8 +898,8 @@ public class MapActivityActions implements DialogProvider {
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
final List deletedPoints = new ArrayList();
- ArrayAdapter