From 7de3b2dd9626adb39c4fa895ba870eb9caa7b70a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 4 Jul 2010 21:09:26 +0000 Subject: [PATCH] add transport navigation git-svn-id: https://osmand.googlecode.com/svn/trunk@281 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/ToDoConstants.java | 2 +- OsmAnd/res/layout/search_transport.xml | 16 +- .../layout/search_transport_route_item.xml | 16 + OsmAnd/res/values-ru-rRU/strings.xml | 21 +- OsmAnd/res/values/strings.xml | 19 +- .../com/osmand/TransportIndexRepository.java | 38 +- .../osmand/activities/EditingPOIActivity.java | 2 +- .../com/osmand/activities/MapActivity.java | 5 +- .../search/SearchTransportActivity.java | 412 ++++++++++++++++-- 9 files changed, 460 insertions(+), 71 deletions(-) create mode 100644 OsmAnd/res/layout/search_transport_route_item.xml diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index b6505229df..c24b67434a 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -26,7 +26,7 @@ public class ToDoConstants { // Fix some missing turns in CloudMade (for secondary roads wo name). Add them (if dist to prev/next turn > 150m) [dacha] // 33. Build transport locations. Create transport index (transport-stops) (investigate) // DONE : Load transport routes in swing, init - // TODO : add intermediate points, add menu for stops (show map) + // TODO : add show on map key stops, update current stop with gps, add transport activity to map (remove tab) // 66. Transport routing (show next stop, total distance, show stop get out). diff --git a/OsmAnd/res/layout/search_transport.xml b/OsmAnd/res/layout/search_transport.xml index e006db035f..3d6b6b1ad9 100644 --- a/OsmAnd/res/layout/search_transport.xml +++ b/OsmAnd/res/layout/search_transport.xml @@ -2,13 +2,21 @@ + android:layout_height="fill_parent" android:id="@+id/RootLayout"> - - + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/search_transport_route_item.xml b/OsmAnd/res/layout/search_transport_route_item.xml new file mode 100644 index 0000000000..c5b8355679 --- /dev/null +++ b/OsmAnd/res/layout/search_transport_route_item.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values-ru-rRU/strings.xml b/OsmAnd/res/values-ru-rRU/strings.xml index fac35b6b4d..01b976f225 100644 --- a/OsmAnd/res/values-ru-rRU/strings.xml +++ b/OsmAnd/res/values-ru-rRU/strings.xml @@ -1,5 +1,20 @@ + Остановка + остановок + Искать транспорт (нет цели) + Искать {0} маршрут + нету + Искать маршрут после + Искать маршрут до + Остановить поиск + Выберите остановку + идти после + идти до + остановок в пути + Длина пути + Транспорт + OK Показать остановки транспорта на карте Показать транспорт Навигационное приложение OsmAnd @@ -56,7 +71,7 @@ Маршрут Приложение Gps status не найдено GPS статус - Рабочие часы: + Рабочие часы : Открытие пакета правок Закрытие пакета правок Сохранения объекта @@ -71,7 +86,7 @@ Загрузка POI Ошибка во время сохранения пути в gpx - Ошибка прокладки маршрута: + Ошибка прокладки маршрута : Ошибка во время прокладки маршрута Пустой путь рассчитан Проложен новый путь, расстояние : @@ -211,7 +226,7 @@ Отмена ПрименитьДобавитьНетВведите имя точки Избранная -Точка \'{0}\' была успешно добавлена к Избранным. +Точка \'\'{0}\'\' была успешно добавлена к Избранным. Контекстное меню Идти к diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 69d7fb5a46..b8673ca765 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,7 +1,20 @@ + Stop + stops + Searching transport (no target) + Searching for {0} route + none + Search route after + Search route before + Finish search + Choose stop to go out + to go after + to go before + stops to pass + Route distance Transport - + OK Show public transport stops on map Show transport stops Navigation application OsmAnd @@ -94,7 +107,7 @@ See osmand.googlecode.com. Use online routing Input osm password User password - Specify osm settings: show bugs, osm login + Specify osm settings : show bugs, osm login Specify monitor settings : save track Specify data settings : language, update data Specify map settings : rotation, poi filter @@ -214,7 +227,7 @@ See osmand.googlecode.com. Cancel ApplyAddNoInput name of favourite point Favourite -Favourite point \'{0}\' was added successfully. +Favourite point \'\'{0}\'\' was added successfully. Context menu Navigate to diff --git a/OsmAnd/src/com/osmand/TransportIndexRepository.java b/OsmAnd/src/com/osmand/TransportIndexRepository.java index 6d438b6d2a..6885980410 100644 --- a/OsmAnd/src/com/osmand/TransportIndexRepository.java +++ b/OsmAnd/src/com/osmand/TransportIndexRepository.java @@ -257,7 +257,7 @@ public class TransportIndexRepository extends BaseLocationIndexRepository distanceToLoc = new LinkedHashMap(); + Map distanceToLoc = new LinkedHashMap(); Cursor query = db.rawQuery(sql.toString(), new String[] {}); if (query.moveToFirst()) { @@ -280,18 +280,15 @@ public class TransportIndexRepository extends BaseLocationIndexRepository() { @Override public int compare(RouteInfoLocation object1, RouteInfoLocation object2) { - return object1.getDistToLocation() - object2.getDistToLocation(); + int x = (int) (MapUtils.getDistance(loc, object1.getStart().getLocation()) + object1.getDistToLocation()); + int y = (int) (MapUtils.getDistance(loc, object2.getStart().getLocation()) + object2.getDistToLocation()); + return x - y; } }); @@ -344,7 +344,9 @@ public class TransportIndexRepository extends BaseLocationIndexRepository 3) { float d = location.distanceTo(locationLayer.getLastKnownLocation()); long time = location.getTime() - locationLayer.getLastKnownLocation().getTime(); diff --git a/OsmAnd/src/com/osmand/activities/search/SearchTransportActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchTransportActivity.java index 0332167c92..dfe9a064e5 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchTransportActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchTransportActivity.java @@ -3,12 +3,15 @@ */ package com.osmand.activities.search; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import android.app.AlertDialog; import android.app.ListActivity; import android.app.AlertDialog.Builder; +import android.content.DialogInterface; +import android.graphics.Typeface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -16,6 +19,7 @@ import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.ProgressBar; @@ -41,9 +45,8 @@ public class SearchTransportActivity extends ListActivity { private Button searchTransportLevel; - private TransportStopAdapter stopsAdapter; - private LatLon lastKnownMapLocation; - private LatLon locationToGo; + + private TextView searchArea; private TransportIndexRepository repo; @@ -51,10 +54,18 @@ public class SearchTransportActivity extends ListActivity { private final static int initialZoom = 17; private int zoom = initialZoom; private ProgressBar progress; + private Thread thread; + // TODO test when these args null + private LatLon lastKnownMapLocation; + private LatLon destinationLocation; + private TransportStopAdapter stopsAdapter; + private TransportRouteAdapter intermediateListAdapater; + private static List lastEditedRoute = new ArrayList(); + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -66,7 +77,7 @@ public class SearchTransportActivity extends ListActivity { public void onClick(View v) { if(isSearchFurtherAvailable()){ zoom --; - searchFurther(); + searchTransport(); } } }); @@ -74,8 +85,28 @@ public class SearchTransportActivity extends ListActivity { progress.setVisibility(View.INVISIBLE); stopsAdapter = new TransportStopAdapter(new ArrayList()); setListAdapter(stopsAdapter); - searchArea.setText(getSearchArea()); + + + ListView intermediateList = (ListView) findViewById(R.id.listView); + intermediateListAdapater = new TransportRouteAdapter(lastEditedRoute); + intermediateList.setAdapter(intermediateListAdapater); + intermediateListAdapater.add(null); + lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(this); + destinationLocation = OsmandSettings.getPointToNavigate(this); + searchTransport(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + lastEditedRoute.clear(); + for(int i= 0; i< intermediateListAdapater.getCount(); i++){ + RouteInfoLocation item = intermediateListAdapater.getItem(i); + if(item != null){ + lastEditedRoute.add(item); + } + } } public String getSearchArea(){ @@ -85,40 +116,45 @@ public class SearchTransportActivity extends ListActivity { return zoom >= finalZoom; } - public void searchFurther(){ + public void searchTransport(){ // use progress + stopsAdapter.clear(); searchTransportLevel.setEnabled(false); - if (lastKnownMapLocation != null) { - List rs = ResourceManager.getResourceManager().searchTransportRepositories(lastKnownMapLocation.getLatitude(), - lastKnownMapLocation.getLongitude()); + searchArea.setText(getSearchArea()); + boolean routeCalculated = isRouteCalculated(); + if (!routeCalculated && getLocationToStart() != null) { + final LatLon locationToStart = getLocationToStart(); + final LatLon locationToGo = getLocationToGo(); + List rs = ResourceManager.getResourceManager().searchTransportRepositories(locationToStart.getLatitude(), + locationToStart.getLongitude()); if(!rs.isEmpty()){ repo = rs.get(0); progress.setVisibility(View.VISIBLE); - new Thread(new Runnable(){ - @Override - public void run() { - List res = repo.searchTransportRouteStops(lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude(), - locationToGo, zoom); - updateUIList(res); - } - },"SearchingTransport").start(); //$NON-NLS-1$ + synchronized (this) { + final Thread previousThread = thread; + thread = new Thread(new Runnable() { + @Override + public void run() { + if (previousThread != null) { + try { + previousThread.join(); + } catch (InterruptedException e) { + } + } + List res = repo.searchTransportRouteStops(locationToStart.getLatitude(), locationToStart + .getLongitude(), locationToGo, zoom); + updateUIList(res); + } + }, "SearchingTransport"); //$NON-NLS-1$ + thread.start(); + } + } else { repo = null; - stopsAdapter.clear(); } - } else { - stopsAdapter.clear(); } } - @Override - protected void onResume() { - super.onResume(); - lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(this); - locationToGo = OsmandSettings.getPointToNavigate(this); - searchFurther(); - } - protected void updateUIList(final List stopsList){ runOnUiThread(new Runnable(){ @Override @@ -131,34 +167,211 @@ public class SearchTransportActivity extends ListActivity { }); } - - public void onListItemClick(ListView parent, View v, int position, long id) { - RouteInfoLocation item = ((TransportStopAdapter)getListAdapter()).getItem(position); - Builder builder = new AlertDialog.Builder(this); - List items = new ArrayList(); - List stops = item.getDirection() ? item.getRoute().getForwardStops() : item.getRoute().getBackwardStops(); - for(TransportStop st : stops){ - String n = st.getName(OsmandSettings.usingEnglishNames(this)); - if(locationToGo != null){ - n += " - [" + MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToGo, st.getLocation())) +"]"; //$NON-NLS-1$ //$NON-NLS-2$ - } else { - n = MapUtils.getFormattedDistance((int) MapUtils.getDistance(lastKnownMapLocation, st.getLocation())) +" - " + n; //$NON-NLS-1$ + public String getInformation(RouteInfoLocation route, List stops, int position, boolean part){ + StringBuilder text = new StringBuilder(200); + double dist = 0; + int ind = 0; + int stInd = stops.size(); + int eInd = stops.size(); + for (TransportStop s : stops) { + if (s == route.getStart()) { + stInd = ind; + } else if (s == route.getStop()) { + eInd = ind; } - items.add(n); + if (ind > stInd && ind <= eInd) { + dist += MapUtils.getDistance(stops.get(ind - 1).getLocation(), s.getLocation()); + } + ind++; } - // TODO show menu mark as intermediate mark on map - builder.setItems(items.toArray(new String[items.size()]), null); - builder.show(); + text.append(getString(R.string.transport_route_distance)).append(" ").append(MapUtils.getFormattedDistance((int) dist)); //$NON-NLS-1$/ + if(!part){ + text.append(", ").append(getString(R.string.transport_stops_to_pass)).append(" ").append(eInd - stInd); //$NON-NLS-1$ //$NON-NLS-2$ + String before = MapUtils.getFormattedDistance((int) MapUtils.getDistance(getEndStop(position - 1), route.getStart().getLocation())); + String after = MapUtils.getFormattedDistance((int) MapUtils.getDistance(getStartStop(position + 1), route.getStop().getLocation())); + text.append(", ").append(getString(R.string.transport_to_go_before)).append(" ").append(before).append(", "); //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-1$ + text.append(getString(R.string.transport_to_go_after)).append(" ").append(after); //$NON-NLS-1$ + } + + return text.toString(); } + public void onListItemClick(ListView parent, View v, int position, long id) { + final RouteInfoLocation item = ((TransportStopAdapter)getListAdapter()).getItem(position); + Builder builder = new AlertDialog.Builder(this); + List items = new ArrayList(); + final List stops = item.getDirection() ? item.getRoute().getForwardStops() : item.getRoute().getBackwardStops(); + LatLon locationToGo = getLocationToGo(); + LatLon locationToStart = getLocationToStart(); + builder.setTitle(getString(R.string.transport_stop_to_go_out)+"\n"+getInformation(item, stops, getCurrentRouteLocation(), true)); //$NON-NLS-1$ + int ind = 0; + for(TransportStop st : stops){ + StringBuilder n = new StringBuilder(50); + n.append(ind++); + if(st == item.getStop()){ + n.append("!! "); //$NON-NLS-1$ + } else { + n.append(". "); //$NON-NLS-1$ + } + String name = st.getName(OsmandSettings.usingEnglishNames(this)); + if(locationToGo != null){ + n.append(name).append(" - ["); //$NON-NLS-1$ + n.append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToGo, st.getLocation()))).append("]"); //$NON-NLS-1$ + } else { + n.append("[").append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToStart, st.getLocation()))).append("] - "); //$NON-NLS-1$ //$NON-NLS-2$ + n.append(name); + } + items.add(n.toString()); + } + builder.setItems(items.toArray(new String[items.size()]), new DialogInterface.OnClickListener(){ + + @Override + public void onClick(DialogInterface dialog, int which) { + int i = which; + if(i >= 0){ + TransportStop stop = stops.get(i); + showContextMenuOnStop(stop, item, i); + } + } + + }); + builder.show(); + } + + + public void showContextMenuOnStop(final TransportStop stop, final RouteInfoLocation route, final int stopInd) { + Builder b = new AlertDialog.Builder(this); + b.setItems(new String[] { getString(R.string.transport_finish_search), getString(R.string.transport_search_before), getString(R.string.transport_search_after) }, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + int currentRouteCalculation = getCurrentRouteLocation(); + route.setStop(stop); + route.setStopNumbers(stopInd); + if (which == 0) { + intermediateListAdapater.insert(route, currentRouteCalculation); + intermediateListAdapater.remove(null); + currentRouteCalculation = -1; + } else if (which == 1) { + intermediateListAdapater.insert(route, currentRouteCalculation + 1); + } else if (which == 2) { + intermediateListAdapater.insert(route, currentRouteCalculation); + } + // layout + zoom = initialZoom; + searchTransport(); + } + + }); + b.show(); + } + + public void showContextMenuOnRoute(final RouteInfoLocation route, final int routeInd) { + Builder b = new AlertDialog.Builder(this); + List stops = route.getDirection() ? route.getRoute().getForwardStops() : route.getRoute().getBackwardStops(); + boolean en = OsmandSettings.isUsingInternetToDownloadTiles(this); + + String info = getInformation(route, stops, routeInd, false); + StringBuilder txt = new StringBuilder(300); + txt.append(info); + boolean start = false; + for(TransportStop s : stops){ + if(s == route.getStart()){ + start = true; + } + if(start){ + txt.append("\n").append(getString(R.string.transport_Stop)).append(" : ").append(s.getName(en)); //$NON-NLS-1$ //$NON-NLS-2$ + } + if(s == route.getStop()){ + break; + } + } + + b.setMessage(txt.toString()); + b.setPositiveButton(getString(R.string.default_buttons_ok), null); + b.setNeutralButton(getString(R.string.transport_search_before), new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog, int which) { + int toInsert = routeInd; + int c = getCurrentRouteLocation(); + if(c >= 0 && c < routeInd){ + toInsert --; + } + intermediateListAdapater.remove(null); + intermediateListAdapater.insert(null, routeInd); + zoom = initialZoom; + searchTransport(); + } + }); + b.setNegativeButton(getString(R.string.transport_search_after), new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog, int which) { + int toInsert = routeInd; + int c = getCurrentRouteLocation(); + if(c > routeInd || c == -1){ + toInsert ++; + } + intermediateListAdapater.remove(null); + intermediateListAdapater.insert(null, toInsert); + zoom = initialZoom; + searchTransport(); + } + }); + b.show(); + } + + public int getCurrentRouteLocation(){ + return intermediateListAdapater.getPosition(null); + } + + public boolean isRouteCalculated(){ + return getCurrentRouteLocation() == -1; + } + + public LatLon getLocationToStart() { + return getEndStop(getCurrentRouteLocation() - 1); + } + + public LatLon getLocationToGo() { + return getStartStop(getCurrentRouteLocation() + 1); + } + + // TODO always check for null + public LatLon getStartStop(int position){ + if(position == intermediateListAdapater.getCount()){ + return destinationLocation; + } + RouteInfoLocation item = intermediateListAdapater.getItem(position); + if(item == null){ + return getStartStop(position + 1); + } + return item.getStart().getLocation(); + } + + + // TODO always check for null + public LatLon getEndStop(int position){ + if(position == -1){ + return lastKnownMapLocation; + } + RouteInfoLocation item = intermediateListAdapater.getItem(position); + if(item == null){ + return getEndStop(position -1); + } + return item.getStop().getLocation(); + } + class TransportStopAdapter extends ArrayAdapter { + private List model; + TransportStopAdapter(List list) { super(SearchTransportActivity.this, R.layout.search_transport_list_item, list); - this.setNotifyOnChange(false); + model = list; } public void setNewModel(List stopsList) { + this.model = stopsList; setNotifyOnChange(false); ((TransportStopAdapter) getListAdapter()).clear(); for (RouteInfoLocation obj : stopsList) { @@ -167,6 +380,10 @@ public class SearchTransportActivity extends ListActivity { this.notifyDataSetChanged(); setNotifyOnChange(true); } + + public List getModel() { + return model; + } public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; @@ -174,6 +391,9 @@ public class SearchTransportActivity extends ListActivity { LayoutInflater inflater = getLayoutInflater(); row = inflater.inflate(R.layout.search_transport_list_item, parent, false); } + LatLon locationToGo = getLocationToGo(); + LatLon locationToStart = getLocationToStart(); + TextView label = (TextView) row.findViewById(R.id.label); TextView distanceLabel = (TextView) row.findViewById(R.id.distance); ImageView icon = (ImageView) row.findViewById(R.id.search_icon); @@ -183,24 +403,120 @@ public class SearchTransportActivity extends ListActivity { StringBuilder labelW = new StringBuilder(150); labelW.append(route.getType()).append(" ").append(route.getRef()); //$NON-NLS-1$ labelW.append(" - ["); //$NON-NLS-1$ + if (locationToGo != null) { labelW.append(MapUtils.getFormattedDistance(stop.getDistToLocation())); } else { - labelW.append("none"); + labelW.append(getString(R.string.transport_search_none)); } labelW.append("]\n").append(route.getName(OsmandSettings.usingEnglishNames(SearchTransportActivity.this))); //$NON-NLS-1$ label.setText(labelW.toString()); // TODO icons - if (locationToGo == null || stop.getDistToLocation() < 400) { + if (locationToGo != null && stop.getDistToLocation() < 400) { icon.setImageResource(R.drawable.poi); } else { icon.setImageResource(R.drawable.closed_poi); } - int dist = (int) (MapUtils.getDistance(stop.getStart().getLocation(), lastKnownMapLocation)); + int dist = (int) (MapUtils.getDistance(stop.getStart().getLocation(), locationToStart)); distanceLabel.setText(" " + MapUtils.getFormattedDistance(dist)); //$NON-NLS-1$ return (row); } } + + + class TransportRouteAdapter extends ArrayAdapter { + TransportRouteAdapter(List list) { + super(SearchTransportActivity.this, R.layout.search_transport_route_item, list); + } + + public View getView(final int position, View convertView, ViewGroup parent) { + View row = convertView; + int currentRouteLocation = getCurrentRouteLocation(); + if(position == currentRouteLocation){ + TextView text = new TextView(getContext()); + LatLon st = getStartStop(position + 1); + LatLon end = getEndStop(position - 1); + + if(st != null){ + int dist = (int) MapUtils.getDistance(st, end); + text.setText(MessageFormat.format(getString(R.string.transport_searching_route), MapUtils.getFormattedDistance(dist))); + } else { + text.setText(getString(R.string.transport_searching_transport)); + } + text.setTextSize(21); + text.setTypeface(null, Typeface.ITALIC); + text.setOnClickListener(new View.OnClickListener(){ + + @Override + public void onClick(View v) { + if(intermediateListAdapater.getCount() > 1){ + intermediateListAdapater.remove(null); + searchTransport(); + } + + } + + }); + return text; + } + + if (row == null || row instanceof TextView) { + LayoutInflater inflater = getLayoutInflater(); + row = inflater.inflate(R.layout.search_transport_route_item, parent, false); + } + final RouteInfoLocation info = getItem(position); + TextView label = (TextView) row.findViewById(R.id.label); + ImageButton icon = (ImageButton) row.findViewById(R.id.remove); + + TransportRoute route = info.getRoute(); + icon.setVisibility(View.VISIBLE); + StringBuilder labelW = new StringBuilder(150); + labelW.append(route.getType()).append(" ").append(route.getRef()); //$NON-NLS-1$ + boolean en = OsmandSettings.usingEnglishNames(SearchTransportActivity.this); + labelW.append(" : ").append(info.getStart().getName(en)).append(" - ").append(info.getStop().getName(en)); //$NON-NLS-1$ //$NON-NLS-2$ + // additional information if route is calculated + if (currentRouteLocation == -1) { + labelW.append(" ("); //$NON-NLS-1$ + labelW.append(info.getStopNumbers()).append(" ").append(getString(R.string.transport_stops)).append(", "); //$NON-NLS-1$ //$NON-NLS-2$ + int startDist = (int) MapUtils.getDistance(getEndStop(position - 1), info.getStart().getLocation()); + labelW.append(getString(R.string.transport_to_go_before)).append(" ").append(MapUtils.getFormattedDistance(startDist)); //$NON-NLS-1$ + if (position == getCount() - 1) { + int endDist = (int) MapUtils.getDistance(getStartStop(position + 1), info.getStop().getLocation()); + labelW.append(", ").append(getString(R.string.transport_to_go_after)).append(" ").append(MapUtils.getFormattedDistance(endDist)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + labelW.append(")"); //$NON-NLS-1$ + + } + label.setText(labelW.toString()); + icon.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + int p = position; + intermediateListAdapater.remove(null); + if(!isRouteCalculated() && getCurrentRouteLocation() < p){ + p--; + } + intermediateListAdapater.insert(null, p); + intermediateListAdapater.remove(info); + intermediateListAdapater.notifyDataSetChanged(); + zoom = initialZoom; + searchTransport(); + + } + + }); + View.OnClickListener clickListener = new View.OnClickListener(){ + @Override + public void onClick(View v) { + showContextMenuOnRoute(info, position); + } + + }; + label.setOnClickListener(clickListener); + return row; + } + } }