diff --git a/OsmAnd/res/drawable/tour_bg.xml b/OsmAnd/res/drawable/tour_bg.xml index e60cc59b73..1a94704092 100644 --- a/OsmAnd/res/drawable/tour_bg.xml +++ b/OsmAnd/res/drawable/tour_bg.xml @@ -2,7 +2,5 @@ - \ No newline at end of file diff --git a/OsmAnd/res/layout/sherpafy_list_tour_item.xml b/OsmAnd/res/layout/sherpafy_list_tour_item.xml index 6decc6f550..91ef2786f3 100644 --- a/OsmAnd/res/layout/sherpafy_list_tour_item.xml +++ b/OsmAnd/res/layout/sherpafy_list_tour_item.xml @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - + vlp = waypointHelper.getVisibleLocationPoints(); + List vlp = waypointHelper.getAllVisibleLocationPoints(); long locationPointsModified = waypointHelper.getLocationPointsModified(); if (locationPointsModified != uiModified) { uiModified = locationPointsModified; @@ -70,7 +75,7 @@ public class WaypointDialogHelper { all.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - showAllDialog(); + showAllDialog(waypointHelper.getAllVisibleLocationPoints()); } }); @@ -185,8 +190,95 @@ public class WaypointDialogHelper { }.execute(reachedView); } - public void showAllDialog(){ - final List visibleLocationPoints = waypointHelper.getVisibleLocationPoints(); + public void showWaypointsSettingsDialog(){ + final List points = getItemsList(waypointHelper.getAllVisibleLocationPoints()); + + final ArrayAdapter listAdapter = new ArrayAdapter(mapActivity, R.layout.waypoint_reached, R.id.title, + points) { + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + // User super class to create the View + View v = convertView; + if (v == null) { + if (points.get(position) instanceof LocationPoint){ + v = mapActivity.getLayoutInflater().inflate(R.layout.waypoint_reached, null); + int vl = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, mapActivity.getResources() + .getDisplayMetrics()); + final LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(vl, vl); + ll.setMargins(vl / 4, vl / 4, vl / 4, vl / 4); + v.findViewById(R.id.waypoint_icon).setLayoutParams(ll); + } else if (points.get(position) instanceof String){ + String header = (String)points.get(position); + v = mapActivity.getLayoutInflater().inflate(R.layout.waypoint_header, null); + TextView headerText = (TextView) v.findViewById(R.id.header_text); + headerText.setText(header); + ImageButton allpoints = (ImageButton) v.findViewById(R.id.all_points); + if (header.equals(FAVORITES)){ + allpoints.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showAllDialog(waypointHelper.getVisibleFavorites()); + } + }); + } else if (header.equals(TARGETS)){ + allpoints.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showAllDialog(waypointHelper.getVisibleTargets()); + } + }); + } else if (header.equals(GPX_WAYPOINTS)){ + allpoints.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showAllDialog(waypointHelper.getVisibleGpxPoints()); + } + }); + } else if (header.equals(POI)){ + allpoints.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showAllDialog(waypointHelper.getVisiblePOI()); + } + }); + } + } + + } + updatePointInfoView(v, (LocationPoint)getItem(position)); + TextView text = (TextView) v.findViewById(R.id.waypoint_text); + text.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showOnMap((LocationPoint)points.get(position)); + } + }); + + View remove = v.findViewById(R.id.info_close); + ((ImageButton) remove).setImageDrawable(mapActivity.getResources().getDrawable( + app.getSettings().isLightContent()? R.drawable.ic_action_gremove_light: + R.drawable.ic_action_gremove_dark)); + remove.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + LocationPoint point = waypointHelper.getAllVisibleLocationPoints().get(position); + remove(point); + waypointHelper.removeVisibleLocationPoint(point); + notifyDataSetChanged(); + } + }); + + return v; + } + + }; + } + + private List getItemsList(List visibleLocationPoints) { + return null; + } + + public void showAllDialog(final List visibleLocationPoints){ final ArrayAdapter listAdapter = new ArrayAdapter(mapActivity, R.layout.waypoint_reached, R.id.title, visibleLocationPoints) { @Override @@ -217,7 +309,7 @@ public class WaypointDialogHelper { remove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - LocationPoint point = waypointHelper.getVisibleLocationPoints().get(position); + LocationPoint point = waypointHelper.getAllVisibleLocationPoints().get(position); remove(point); waypointHelper.removeVisibleLocationPoint(point); notifyDataSetChanged(); diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index b96bbe9f50..4896779c4d 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -1,7 +1,9 @@ package net.osmand.plus.helpers; import net.osmand.Location; +import net.osmand.data.FavouritePoint; import net.osmand.data.LocationPoint; +import net.osmand.plus.GPXUtilities; import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmandApplication; import net.osmand.util.MapUtils; @@ -41,10 +43,38 @@ public class WaypointHelper { } - public List getVisibleLocationPoints() { + public List getAllVisibleLocationPoints() { return visibleLocationPoints; } + public List getVisibleFavorites() { + List points = new ArrayList(); + for (LocationPoint point : visibleLocationPoints){ + if (point instanceof FavouritePoint){ + points.add(point); + } + } + return points; + } + + public List getVisibleGpxPoints() { + List points = new ArrayList(); + for (LocationPoint point : visibleLocationPoints){ + if (point instanceof GPXUtilities.WptPt){ + points.add(point); + } + } + return points; + } + + public List getVisiblePOI() { + return null; + } + + public List getVisibleTargets() { + return null; + } + public void locationChanged(Location location) { app.getAppCustomization(); lastKnownLocation = location; diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java index 742c08e3e8..92c4f12ce8 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java @@ -306,7 +306,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization { @Override public void prepareLocationMenu(final MapActivity mapActivity, ContextMenuAdapter adapter) { - filter(adapter, R.string.context_menu_item_directions_to, + filter(adapter, R.string.pause_navigation, R.string.continue_navigation, R.string.context_menu_item_directions_to, R.string.context_menu_item_destination_point, R.string.context_menu_item_search, R.string.context_menu_item_share_location/*, R.string.context_menu_item_add_favorite*/); MapActivityLayers layers = mapActivity.getMapLayers(); diff --git a/OsmAnd/src/net/osmand/plus/views/CustomImageView.java b/OsmAnd/src/net/osmand/plus/views/CustomImageView.java deleted file mode 100644 index 5f3a1fec94..0000000000 --- a/OsmAnd/src/net/osmand/plus/views/CustomImageView.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.osmand.plus.views; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Path; -import android.graphics.RectF; -import android.util.AttributeSet; -import android.widget.ImageView; - -/** - * Created by Denis on 13.08.2014. - */ -public class CustomImageView extends ImageView { - - public static float radius = 13.0f; - - public CustomImageView(Context context) { - super(context); - } - - public CustomImageView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public CustomImageView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void onDraw(Canvas canvas) { - //float radius = 36.0f; - Path clipPath = new Path(); - RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight()); - clipPath.addRoundRect(rect, radius, radius, Path.Direction.CW); - canvas.clipPath(clipPath); - super.onDraw(canvas); - } -}