Fixes, context menu: added waypoint and fab actions

This commit is contained in:
Alexey Kulish 2015-10-15 15:56:24 +03:00
parent e632e2d1cc
commit a8351b51b0
8 changed files with 181 additions and 139 deletions

View file

@ -105,21 +105,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="54dp"> android:layout_height="54dp">
<ImageButton
android:id="@+id/context_menu_route_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?attr/dashboard_button"
android:scaleType="center"
android:src="@drawable/map_directions"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/>
<ImageButton <ImageButton
android:id="@+id/context_menu_fav_button" android:id="@+id/context_menu_fav_button"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -135,6 +120,21 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/> android:background="?attr/dashboard_divider"/>
<ImageButton
android:id="@+id/context_menu_route_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?attr/dashboard_button"
android:scaleType="center"
android:src="@drawable/map_action_waypoints"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/>
<ImageButton <ImageButton
android:id="@+id/context_menu_share_button" android:id="@+id/context_menu_share_button"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -179,6 +179,9 @@ public class PointDescription implements Serializable {
return POINT_TYPE_PHOTO_NOTE.equals(type); return POINT_TYPE_PHOTO_NOTE.equals(type);
} }
public boolean isDestination() {
return POINT_TYPE_TARGET.equals(type);
}
@Override @Override
public int hashCode() { public int hashCode() {

View file

@ -92,7 +92,7 @@ public class MapActivityActions implements DialogProvider {
} }
public void shareLocation(double latitude, double longitude) { public void shareLocation(double latitude, double longitude) {
enhance(dialogBundle,latitude,longitude,mapActivity.getMapView().getZoom()); enhance(dialogBundle, latitude, longitude, mapActivity.getMapView().getZoom());
new ShareLocation(mapActivity).run(); new ShareLocation(mapActivity).run();
} }
@ -140,7 +140,7 @@ public class MapActivityActions implements DialogProvider {
targets.navigateToPoint(new LatLon(latitude, longitude), true, targets.navigateToPoint(new LatLon(latitude, longitude), true,
dest ? -1 : targets.getIntermediatePoints().size(), dest ? -1 : targets.getIntermediatePoints().size(),
mapActivity.getContextMenu().getPointDescription()); mapActivity.getContextMenu().getPointDescription());
if(targets.getIntermediatePoints().size() > 0) { if (targets.getIntermediatePoints().size() > 0) {
openIntermediatePointsDialog(); openIntermediatePointsDialog();
} }
} }
@ -149,6 +149,27 @@ public class MapActivityActions implements DialogProvider {
builder.create().show(); builder.create().show();
} }
public void directionTo(double latitude, double longitude) {
final TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
targets.navigateToPoint(new LatLon(latitude, longitude), true, -1, null);
enterRoutePlanningMode(null, null, false);
}
public void addAsWaypoint(double latitude, double longitude) {
TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
boolean destination = (targets.getPointToNavigate() == null);
targets.navigateToPoint(new LatLon(latitude, longitude), true,
destination ? -1 : targets.getIntermediatePoints().size(),
mapActivity.getContextMenu().getPointDescription());
openIntermediateEditPointsDialog();
}
public void editWaypoints() {
openIntermediateEditPointsDialog();
}
private Bundle enhance(Bundle aBundle, double latitude, double longitude, String name) { private Bundle enhance(Bundle aBundle, double latitude, double longitude, String name) {
aBundle.putDouble(KEY_LATITUDE, latitude); aBundle.putDouble(KEY_LATITUDE, latitude);
aBundle.putDouble(KEY_LONGITUDE, longitude); aBundle.putDouble(KEY_LONGITUDE, longitude);
@ -435,31 +456,10 @@ public class MapActivityActions implements DialogProvider {
private void enterRoutePlanningModeImpl(GPXFile gpxFile, LatLon from, PointDescription fromName) { private void enterRoutePlanningModeImpl(GPXFile gpxFile, LatLon from, PointDescription fromName) {
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
ApplicationMode selected = settings.APPLICATION_MODE.get();
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
TargetPointsHelper targets = app.getTargetPointsHelper(); TargetPointsHelper targets = app.getTargetPointsHelper();
if( selected != ApplicationMode.DEFAULT) {
mode = selected;
} else if (mode == ApplicationMode.DEFAULT) {
mode = ApplicationMode.CAR;
if(settings.LAST_ROUTING_APPLICATION_MODE != null &&
settings.LAST_ROUTING_APPLICATION_MODE != ApplicationMode.DEFAULT) {
mode = settings.LAST_ROUTING_APPLICATION_MODE;
}
if(from != null && targets.getPointToNavigate() != null) {
double dist = MapUtils.getDistance(from, targets.getPointToNavigate().getLatitude(),
targets.getPointToNavigate().getLongitude());
if(dist >= 50000 && mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
mode = ApplicationMode.CAR ;
} else if(dist >= 300000 && mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
mode = ApplicationMode.CAR ;
} else if(dist < 2000 && mode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
mode = ApplicationMode.PEDESTRIAN ;
}
}
}
ApplicationMode mode = getRouteMode(from);
app.getSettings().APPLICATION_MODE.set(mode); app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode); app.getRoutingHelper().setAppMode(mode);
app.initVoiceCommandPlayer(mapActivity); app.initVoiceCommandPlayer(mapActivity);
@ -481,7 +481,35 @@ public class MapActivityActions implements DialogProvider {
app.showToastMessage(R.string.route_is_too_long); app.showToastMessage(R.string.route_is_too_long);
} }
} }
public ApplicationMode getRouteMode(LatLon from) {
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
ApplicationMode selected = settings.APPLICATION_MODE.get();
OsmandApplication app = mapActivity.getMyApplication();
TargetPointsHelper targets = app.getTargetPointsHelper();
if( selected != ApplicationMode.DEFAULT) {
mode = selected;
} else if (mode == ApplicationMode.DEFAULT) {
mode = ApplicationMode.CAR;
if(settings.LAST_ROUTING_APPLICATION_MODE != null &&
settings.LAST_ROUTING_APPLICATION_MODE != ApplicationMode.DEFAULT) {
mode = settings.LAST_ROUTING_APPLICATION_MODE;
}
if(from != null && targets.getPointToNavigate() != null) {
double dist = MapUtils.getDistance(from, targets.getPointToNavigate().getLatitude(),
targets.getPointToNavigate().getLongitude());
if(dist >= 50000 && mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
mode = ApplicationMode.CAR ;
} else if(dist >= 300000 && mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
mode = ApplicationMode.CAR ;
} else if(dist < 2000 && mode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
mode = ApplicationMode.PEDESTRIAN ;
}
}
}
return mode;
}
public void contextMenuPoint(final double latitude, final double longitude){ public void contextMenuPoint(final double latitude, final double longitude){
contextMenuPoint(latitude, longitude, null, null); contextMenuPoint(latitude, longitude, null, null);
} }
@ -491,17 +519,17 @@ public class MapActivityActions implements DialogProvider {
builder.setMessage(R.string.context_menu_item_update_map_confirm); builder.setMessage(R.string.context_menu_item_update_map_confirm);
builder.setNegativeButton(R.string.shared_string_cancel, null); builder.setNegativeButton(R.string.shared_string_cancel, null);
final OsmandMapTileView mapView = mapActivity.getMapView(); final OsmandMapTileView mapView = mapActivity.getMapView();
builder.setPositiveButton(R.string.context_menu_item_update_map, new DialogInterface.OnClickListener(){ builder.setPositiveButton(R.string.context_menu_item_update_map, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
int zoom = args.getInt(KEY_ZOOM); int zoom = args.getInt(KEY_ZOOM);
BaseMapLayer mainLayer = mapView.getMainLayer(); BaseMapLayer mainLayer = mapView.getMainLayer();
if(!(mainLayer instanceof MapTileLayer) || !((MapTileLayer) mainLayer).isVisible()){ if (!(mainLayer instanceof MapTileLayer) || !((MapTileLayer) mainLayer).isVisible()) {
AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show(); AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
return; return;
} }
final ITileSource mapSource = ((MapTileLayer) mainLayer).getMap(); final ITileSource mapSource = ((MapTileLayer) mainLayer).getMap();
if(mapSource == null || !mapSource.couldBeDownloadedFromInternet()){ if (mapSource == null || !mapSource.couldBeDownloadedFromInternet()) {
AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show(); AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
return; return;
} }
@ -511,17 +539,17 @@ public class MapActivityActions implements DialogProvider {
int top = (int) Math.floor(tilesRect.top); int top = (int) Math.floor(tilesRect.top);
int width = (int) (Math.ceil(tilesRect.right) - left); int width = (int) (Math.ceil(tilesRect.right) - left);
int height = (int) (Math.ceil(tilesRect.bottom) - top); int height = (int) (Math.ceil(tilesRect.bottom) - top);
for (int i = 0; i <width; i++) { for (int i = 0; i < width; i++) {
for (int j = 0; j< height; j++) { for (int j = 0; j < height; j++) {
((OsmandApplication)mapActivity.getApplication()).getResourceManager(). ((OsmandApplication) mapActivity.getApplication()).getResourceManager().
clearTileImageForMap(null, mapSource, i + left, j + top, zoom); clearTileImageForMap(null, mapSource, i + left, j + top, zoom);
} }
} }
mapView.refreshMap(); mapView.refreshMap();
} }
}); });
return builder.create(); return builder.create();
} }
@ -746,7 +774,11 @@ public class MapActivityActions implements DialogProvider {
public void openIntermediatePointsDialog(){ public void openIntermediatePointsDialog(){
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS); mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
} }
public void openIntermediateEditPointsDialog(){
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
}
private TargetPointsHelper getTargets() { private TargetPointsHelper getTargets() {
return mapActivity.getMyApplication().getTargetPointsHelper(); return mapActivity.getMyApplication().getTargetPointsHelper();
} }

View file

@ -128,17 +128,13 @@ public class BaseDownloadActivity extends ActionBarProgressActivity {
} }
public ItemsListBuilder getItemsBuilder(String regionId, boolean voicePromptsOnly) { public ItemsListBuilder getItemsBuilder(String regionId, boolean voicePromptsOnly) {
if (downloadListIndexThread.getResourcesLock().tryLock()) { if (downloadListIndexThread.getResourcesByRegions().size() > 0) {
try { ItemsListBuilder builder = new ItemsListBuilder(getMyApplication(), regionId, downloadListIndexThread.getResourcesByRegions(),
ItemsListBuilder builder = new ItemsListBuilder(getMyApplication(), regionId, downloadListIndexThread.getResourcesByRegions(), downloadListIndexThread.getVoiceRecItems(), downloadListIndexThread.getVoiceTTSItems());
downloadListIndexThread.getVoiceRecItems(), downloadListIndexThread.getVoiceTTSItems()); if (!voicePromptsOnly) {
if (!voicePromptsOnly) { return builder.build();
return builder.build(); } else {
} else { return builder;
return builder;
}
} finally {
downloadListIndexThread.getResourcesLock().unlock();
} }
} else { } else {
return null; return null;
@ -146,12 +142,8 @@ public class BaseDownloadActivity extends ActionBarProgressActivity {
} }
public List<IndexItem> getIndexItemsByRegion(WorldRegion region) { public List<IndexItem> getIndexItemsByRegion(WorldRegion region) {
if (downloadListIndexThread.getResourcesLock().tryLock()) { if (downloadListIndexThread.getResourcesByRegions().size() > 0) {
try { return new LinkedList<>(downloadListIndexThread.getResourcesByRegions().get(region).values());
return new LinkedList<>(downloadListIndexThread.getResourcesByRegions().get(region).values());
} finally {
downloadListIndexThread.getResourcesLock().unlock();
}
} else { } else {
return new LinkedList<>(); return new LinkedList<>();
} }

View file

@ -52,7 +52,6 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;
@SuppressLint("NewApi") @SuppressLint("NewApi")
public class DownloadIndexesThread { public class DownloadIndexesThread {
@ -74,7 +73,12 @@ public class DownloadIndexesThread {
private List<IndexItem> voiceRecItems = new LinkedList<>(); private List<IndexItem> voiceRecItems = new LinkedList<>();
private List<IndexItem> voiceTTSItems = new LinkedList<>(); private List<IndexItem> voiceTTSItems = new LinkedList<>();
private final ReentrantLock resourcesLock = new ReentrantLock(); private class DownloadIndexesResult {
Map<WorldRegion, Map<String, IndexItem>> resourcesByRegions = new HashMap<>();
List<IndexItem> voiceRecItems = new LinkedList<>();
List<IndexItem> voiceTTSItems = new LinkedList<>();
IndexFileList indexFiles = null;
}
DatabaseHelper dbHelper; DatabaseHelper dbHelper;
@ -86,10 +90,6 @@ public class DownloadIndexesThread {
dbHelper = new DatabaseHelper(app); dbHelper = new DatabaseHelper(app);
} }
public ReentrantLock getResourcesLock() {
return resourcesLock;
}
public DatabaseHelper getDbHelper() { public DatabaseHelper getDbHelper() {
return dbHelper; return dbHelper;
} }
@ -169,56 +169,51 @@ public class DownloadIndexesThread {
return voiceTTSItems; return voiceTTSItems;
} }
private boolean prepareData(List<IndexItem> resources) { private boolean prepareData(List<IndexItem> resources,
resourcesLock.lock(); Map<WorldRegion, Map<String, IndexItem>> resourcesByRegions,
try { List<IndexItem> voiceRecItems, List<IndexItem> voiceTTSItems) {
List<IndexItem> resourcesInRepository;
List<IndexItem> resourcesInRepository; if (resources != null) {
if (resources != null) { resourcesInRepository = resources;
resourcesInRepository = resources; } else {
} else { resourcesInRepository = DownloadActivity.downloadListIndexThread.getCachedIndexFiles();
resourcesInRepository = DownloadActivity.downloadListIndexThread.getCachedIndexFiles();
}
if (resourcesInRepository == null) {
return false;
}
resourcesByRegions.clear();
voiceRecItems.clear();
voiceTTSItems.clear();
for (WorldRegion region : app.getWorldRegion().getFlattenedSubregions()) {
processRegion(resourcesInRepository, false, region);
}
processRegion(resourcesInRepository, true, app.getWorldRegion());
final Collator collator = OsmAndCollator.primaryCollator();
final OsmandRegions osmandRegions = app.getRegions();
Collections.sort(voiceRecItems, new Comparator<IndexItem>() {
@Override
public int compare(IndexItem lhs, IndexItem rhs) {
return collator.compare(lhs.getVisibleName(app.getApplicationContext(), osmandRegions),
rhs.getVisibleName(app.getApplicationContext(), osmandRegions));
}
});
Collections.sort(voiceTTSItems, new Comparator<IndexItem>() {
@Override
public int compare(IndexItem lhs, IndexItem rhs) {
return collator.compare(lhs.getVisibleName(app.getApplicationContext(), osmandRegions),
rhs.getVisibleName(app.getApplicationContext(), osmandRegions));
}
});
return true;
} finally {
resourcesLock.unlock();
} }
if (resourcesInRepository == null) {
return false;
}
for (WorldRegion region : app.getWorldRegion().getFlattenedSubregions()) {
processRegion(resourcesInRepository, resourcesByRegions, voiceRecItems, voiceTTSItems, false, region);
}
processRegion(resourcesInRepository, resourcesByRegions, voiceRecItems, voiceTTSItems, true, app.getWorldRegion());
final Collator collator = OsmAndCollator.primaryCollator();
final OsmandRegions osmandRegions = app.getRegions();
Collections.sort(voiceRecItems, new Comparator<IndexItem>() {
@Override
public int compare(IndexItem lhs, IndexItem rhs) {
return collator.compare(lhs.getVisibleName(app.getApplicationContext(), osmandRegions),
rhs.getVisibleName(app.getApplicationContext(), osmandRegions));
}
});
Collections.sort(voiceTTSItems, new Comparator<IndexItem>() {
@Override
public int compare(IndexItem lhs, IndexItem rhs) {
return collator.compare(lhs.getVisibleName(app.getApplicationContext(), osmandRegions),
rhs.getVisibleName(app.getApplicationContext(), osmandRegions));
}
});
return true;
} }
private void processRegion(List<IndexItem> resourcesInRepository, boolean processVoiceFiles, WorldRegion region) { private void processRegion(List<IndexItem> resourcesInRepository, Map<WorldRegion,
Map<String, IndexItem>> resourcesByRegions,
List<IndexItem> voiceRecItems, List<IndexItem> voiceTTSItems,
boolean processVoiceFiles, WorldRegion region) {
String downloadsIdPrefix = region.getDownloadsIdPrefix(); String downloadsIdPrefix = region.getDownloadsIdPrefix();
Map<String, IndexItem> regionResources = new HashMap<>(); Map<String, IndexItem> regionResources = new HashMap<>();
@ -531,8 +526,8 @@ public class DownloadIndexesThread {
public void runReloadIndexFiles() { public void runReloadIndexFiles() {
checkRunning(); checkRunning();
final BasicProgressAsyncTask<Void, Void, IndexFileList> inst final BasicProgressAsyncTask<Void, Void, DownloadIndexesResult> inst
= new BasicProgressAsyncTask<Void, Void, IndexFileList>(ctx) { = new BasicProgressAsyncTask<Void, Void, DownloadIndexesResult>(ctx) {
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
@ -542,18 +537,24 @@ public class DownloadIndexesThread {
} }
@Override @Override
protected IndexFileList doInBackground(Void... params) { protected DownloadIndexesResult doInBackground(Void... params) {
DownloadIndexesResult result = new DownloadIndexesResult();
IndexFileList indexFileList = DownloadOsmandIndexesHelper.getIndexesList(ctx); IndexFileList indexFileList = DownloadOsmandIndexesHelper.getIndexesList(ctx);
result.indexFiles = indexFileList;
if (indexFileList != null) { if (indexFileList != null) {
updateLoadedFiles(); updateLoadedFiles();
prepareFilesToUpdate(); prepareFilesToUpdate();
prepareData(indexFileList.getIndexFiles()); prepareData(indexFileList.getIndexFiles(), result.resourcesByRegions, result.voiceRecItems, result.voiceTTSItems);
} }
return indexFileList; return result;
} }
protected void onPostExecute(IndexFileList result) { protected void onPostExecute(DownloadIndexesResult result) {
indexFiles = result; indexFiles = result.indexFiles;
resourcesByRegions = result.resourcesByRegions;
voiceRecItems = result.voiceRecItems;
voiceTTSItems = result.voiceTTSItems;
if (indexFiles != null && uiActivity != null) { if (indexFiles != null && uiActivity != null) {
boolean basemapExists = uiActivity.getMyApplication().getResourceManager().containsBasemap(); boolean basemapExists = uiActivity.getMyApplication().getResourceManager().containsBasemap();
IndexItem basemap = indexFiles.getBasemap(); IndexItem basemap = indexFiles.getBasemap();

View file

@ -164,8 +164,8 @@ public class ItemsListBuilder {
List<IndexItem> voiceRecItems, List<IndexItem> voiceTTSItems) { List<IndexItem> voiceRecItems, List<IndexItem> voiceTTSItems) {
this.app = app; this.app = app;
this.resourcesByRegions = resourcesByRegions; this.resourcesByRegions = resourcesByRegions;
this.voiceRecItems = new LinkedList<>(voiceRecItems); this.voiceRecItems = voiceRecItems;
this.voiceTTSItems = new LinkedList<>(voiceTTSItems); this.voiceTTSItems = voiceTTSItems;
regionMapItems = new LinkedList<>(); regionMapItems = new LinkedList<>();
allResourceItems = new LinkedList<>(); allResourceItems = new LinkedList<>();

View file

@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.View; import android.view.View;
import net.osmand.Location; import net.osmand.Location;
@ -318,8 +319,21 @@ public class MapContextMenu {
}); });
} }
public void buttonNavigatePressed() { public int getFabIconId() {
mapActivity.getMapActions().showNavigationContextMenuPoint(latLon.getLatitude(), latLon.getLongitude()); return mapActivity.getMapActions().getRouteMode(latLon).getSmallIconDark();
}
public void fabPressed() {
mapActivity.getMapActions().directionTo(latLon.getLatitude(), latLon.getLongitude());
}
public void buttonWaypointPressed() {
if (pointDescription.isDestination()) {
mapActivity.getMapActions().editWaypoints();
} else {
mapActivity.getMapActions().addAsWaypoint(latLon.getLatitude(), latLon.getLongitude());
}
close();
} }
public void buttonFavoritePressed() { public void buttonFavoritePressed() {

View file

@ -30,6 +30,7 @@ import android.widget.TextView;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
@ -286,23 +287,22 @@ public class MapContextMenuFragment extends Fragment {
// FAB // FAB
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view); fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
//fabView.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark, fabView.setImageDrawable(iconsCache.getIcon(menu.getFabIconId()));
// light ? R.color.icon_color_light : R.color.dash_search_icon_dark));
fabView.setOnClickListener(new View.OnClickListener() { fabView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
menu.buttonNavigatePressed(); menu.fabPressed();
} }
}); });
// Action buttons // Action buttons
final ImageButton buttonNavigate = (ImageButton) view.findViewById(R.id.context_menu_route_button); final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button);
buttonNavigate.setImageDrawable(iconsCache.getIcon(R.drawable.map_directions, buttonWaypoint.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_waypoints,
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
buttonNavigate.setOnClickListener(new View.OnClickListener() { buttonWaypoint.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
menu.buttonNavigatePressed(); menu.buttonWaypointPressed();
} }
}); });