diff --git a/OsmAnd/res/menu/route_step_menu.xml b/OsmAnd/res/menu/route_step_menu.xml new file mode 100644 index 0000000000..d4fad37613 --- /dev/null +++ b/OsmAnd/res/menu/route_step_menu.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 7f1f3a461c..0af3c8388f 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1876,4 +1876,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A Play sound on photo shot Choose whether to play a sound when shooting photos Invalid format: %s + Mark as next + Show on map diff --git a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsActivity.java b/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsActivity.java index ddc2cc7e11..a18679cf75 100644 --- a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsActivity.java +++ b/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsActivity.java @@ -7,10 +7,7 @@ import android.content.DialogInterface; import android.os.Bundle; import android.text.format.DateFormat; import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; +import android.view.*; import android.widget.*; import com.actionbarsherlock.app.SherlockFragmentActivity; import net.osmand.plus.GPXUtilities; @@ -22,7 +19,7 @@ import java.io.File; import java.util.*; /** - * Created by Barsik on 13.06.2014. + * Created by Bars on 13.06.2014. */ public class RouteStepsActivity extends SherlockFragmentActivity { @@ -45,8 +42,6 @@ public class RouteStepsActivity extends SherlockFragmentActivity { private List pointsStartState; - private PointItemAdapter adapter; - @Override protected void onCreate(Bundle savedInstanceState) { super.setContentView(R.layout.route_steps_main); @@ -88,14 +83,30 @@ public class RouteStepsActivity extends SherlockFragmentActivity { } } - adapter = new PointItemAdapter(this,R.layout.route_point_info, pointItemsList); - ListView listView = (ListView) findViewById(R.id.pointsListView); + PointItemAdapter adapter = new PointItemAdapter(this, R.layout.route_point_info, pointItemsList); + final ListView listView = (ListView) findViewById(R.id.pointsListView); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, int i, long l) { + final PopupMenu menu = new PopupMenu(RouteStepsActivity.this, view); + menu.getMenuInflater().inflate(R.menu.route_step_menu, menu.getMenu()); + + menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + if (menuItem.getTitle().equals("Mark as next")){ + + } else { + + } + return true; + } + }); + + menu.show(); } }); } @@ -108,13 +119,12 @@ public class RouteStepsActivity extends SherlockFragmentActivity { Map map = gpx.getExtensionsToRead(); if (map.containsKey(CURRENT_ROUTE_KEY)) { String routeName = map.get(CURRENT_ROUTE_KEY); - int i = 0; + for (GPXUtilities.Route route : gpx.routes) { if (route.name.equals(routeName)) { currentRoute = route; return; } - i++; } } currentRoute = gpx.routes.get(0);