Merge branch 'master' of github.com:osmandapp/Osmand
This commit is contained in:
commit
2e330482f6
3 changed files with 111 additions and 66 deletions
|
@ -296,9 +296,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
if (click != null) {
|
||||
click.onContextMenuClick(listAdapter, standardId, which, false);
|
||||
} else if (standardId == R.string.context_menu_item_last_intermediate_point) {
|
||||
getMyApplication().getTargetPointsHelper().navigateToPoint(new LatLon(latitude, longitude),
|
||||
true, getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
||||
mapActivity.getContextMenu().getPointDescription());
|
||||
mapActivity.getContextMenu().addAsLastIntermediate();
|
||||
} else if (standardId == R.string.context_menu_item_search) {
|
||||
Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
||||
intent.putExtra(SearchActivity.SEARCH_LAT, latitude);
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
|
|||
import net.osmand.plus.mapcontextmenu.editors.PointEditor;
|
||||
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
||||
import net.osmand.plus.views.ContextMenuLayer;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
|
@ -415,6 +416,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
}
|
||||
|
||||
public void fabPressed() {
|
||||
callMenuAction(true, new MenuAction() {
|
||||
@Override
|
||||
public void run() {
|
||||
hide();
|
||||
final TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
if (targets.getIntermediatePoints().isEmpty()) {
|
||||
|
@ -452,35 +456,21 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
bld.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
bld.show();
|
||||
}
|
||||
// mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void buttonWaypointPressed() {
|
||||
if (pointDescription.isDestination()) {
|
||||
mapActivity.getMapActions().editWaypoints();
|
||||
} else {
|
||||
MenuAction addAsTargetAction = new MenuAction() {
|
||||
callMenuAction(true, new MenuAction() {
|
||||
@Override
|
||||
public void run() {
|
||||
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
|
||||
pointDescription);
|
||||
}
|
||||
};
|
||||
|
||||
if (searchingAddress) {
|
||||
addAsTargetAction.dlg = new ProgressDialog(mapActivity);
|
||||
addAsTargetAction.dlg.setTitle("");
|
||||
addAsTargetAction.dlg.setMessage(addressNotKnownStr);
|
||||
addAsTargetAction.dlg.setButton(Dialog.BUTTON_NEGATIVE, mapActivity.getResources().getString(R.string.shared_string_skip), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
cancelSearch = true;
|
||||
}
|
||||
});
|
||||
addAsTargetAction.dlg.show();
|
||||
searchDoneAction = addAsTargetAction;
|
||||
} else {
|
||||
addAsTargetAction.run();
|
||||
}
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
@ -489,12 +479,17 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
if (object != null && object instanceof FavouritePoint) {
|
||||
getFavoritePointEditor().edit((FavouritePoint) object);
|
||||
} else {
|
||||
callMenuAction(true, new MenuAction() {
|
||||
@Override
|
||||
public void run() {
|
||||
String title = getTitleStr();
|
||||
if (pointDescription.isFavorite() || title.equals(addressNotKnownStr)) {
|
||||
title = "";
|
||||
}
|
||||
getFavoritePointEditor().add(latLon, title);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void buttonSharePressed() {
|
||||
|
@ -516,6 +511,59 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
mapActivity.getMapActions().contextMenuPoint(latLon.getLatitude(), latLon.getLongitude(), menuAdapter, object);
|
||||
}
|
||||
|
||||
private void callMenuAction(boolean waitForAddress, MenuAction addAsTargetAction) {
|
||||
if (searchingAddress && waitForAddress) {
|
||||
addAsTargetAction.dlg = new ProgressDialog(mapActivity);
|
||||
addAsTargetAction.dlg.setTitle("");
|
||||
addAsTargetAction.dlg.setMessage(addressNotKnownStr);
|
||||
addAsTargetAction.dlg.setButton(Dialog.BUTTON_NEGATIVE, mapActivity.getResources().getString(R.string.shared_string_skip), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
cancelSearch = true;
|
||||
}
|
||||
});
|
||||
addAsTargetAction.dlg.show();
|
||||
searchDoneAction = addAsTargetAction;
|
||||
} else {
|
||||
addAsTargetAction.run();
|
||||
}
|
||||
}
|
||||
|
||||
public void addAsLastIntermediate() {
|
||||
callMenuAction(true, new MenuAction() {
|
||||
@Override
|
||||
public void run() {
|
||||
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon,
|
||||
true, mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
||||
pointDescription);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setAsStartPoint(final boolean openRouteInfoMenu) {
|
||||
callMenuAction(true, new MenuAction() {
|
||||
@Override
|
||||
public void run() {
|
||||
mapActivity.getMyApplication().getTargetPointsHelper().setStartPoint(latLon, true, pointDescription);
|
||||
if (openRouteInfoMenu) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setAsTargetPoint(final boolean openRouteInfoMenu) {
|
||||
callMenuAction(true, new MenuAction() {
|
||||
@Override
|
||||
public void run() {
|
||||
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon, true, -1, pointDescription);
|
||||
if (openRouteInfoMenu) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addWptPt() {
|
||||
String title = getTitleStr();
|
||||
if (pointDescription.isWpt() || title.equals(addressNotKnownStr)) {
|
||||
|
|
|
@ -90,13 +90,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
if (selectFromMapTouch) {
|
||||
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
|
||||
selectFromMapTouch = false;
|
||||
if (selectFromMapForTarget) {
|
||||
getTargets().navigateToPoint(latlon, true, -1);
|
||||
} else {
|
||||
getTargets().setStartPoint(latlon, true, null);
|
||||
}
|
||||
contextMenu.showMinimized(latlon, null, null);
|
||||
show();
|
||||
if (selectFromMapForTarget) {
|
||||
contextMenu.setAsTargetPoint(true);
|
||||
} else {
|
||||
contextMenu.setAsStartPoint(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue