Revert "Hide context menu on map pan"

This reverts commit 3cb6162e54.
This commit is contained in:
Alexey Kulish 2018-10-19 12:56:57 +03:00
parent 57b38cd642
commit 721a8ba0e2
4 changed files with 11 additions and 57 deletions

View file

@ -862,10 +862,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
boolean night = app.getDaynightHelper().isNightModeForMapControls();
boolean quickSearchTopBar = getTopToolbarController(TopToolbarControllerType.QUICK_SEARCH) != null;
boolean contextMenuTopBar = getTopToolbarController(TopToolbarControllerType.CONTEXT_MENU) != null;
boolean contextTopBar = getTopToolbarController(TopToolbarControllerType.CONTEXT) != null;
boolean mapTopBar = findViewById(R.id.map_top_bar).getVisibility() == View.VISIBLE;
boolean markerTopBar = findViewById(R.id.map_markers_top_bar).getVisibility() == View.VISIBLE;
if (((quickSearchTopBar || mapTopBar) && mapControlsVisible) || contextMenuTopBar || contextTopBar) {
if (((quickSearchTopBar || mapTopBar) && mapControlsVisible) || contextMenuTopBar) {
colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light;
} else if (markerTopBar && mapControlsVisible) {
colorId = R.color.status_bar_dark;

View file

@ -76,7 +76,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private PointDescription pointDescription;
private Object object;
private MenuController menuController;
private ContextToolbarController toolbarController;
private LatLon mapCenter;
private int mapPosition = 0;
@ -126,25 +125,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
public MapContextMenu() {
toolbarController = new ContextToolbarController();
toolbarController.setOnBackButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show();
}
});
toolbarController.setOnTitleClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show();
}
});
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
close();
}
});
}
@Nullable
@ -464,19 +444,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
init(latLon, pointDescription, object);
}
private void showToolbar() {
if (mapActivity != null) {
toolbarController.setTitle(getTitleStr());
mapActivity.showTopToolbar(toolbarController);
}
}
private void hideToolbar() {
if (mapActivity != null) {
mapActivity.hideTopToolbar(toolbarController);
}
}
public void onFragmentResume() {
if (active && displayDistanceDirection()) {
updateLocation(false, true, false);
@ -511,7 +478,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
if (menuController != null) {
menuController.setActive(false);
}
hideToolbar();
mapActivity.refreshMap();
}
}
@ -536,9 +502,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
fragmentRef.get().dismissMenu();
result = true;
}
if (active) {
showToolbar();
}
}
return result;
}
@ -789,6 +752,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
if (fragmentRef != null) {
fragmentRef.get().refreshTitle();
}
if (searchDoneAction != null) {
if (searchDoneAction.dlg != null) {
try {
@ -802,13 +766,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
searchDoneAction.run();
searchDoneAction = null;
}
if (active) {
toolbarController.setTitle(getTitleStr());
if (mapActivity != null
&& mapActivity.getTopToolbarController(TopToolbarControllerType.CONTEXT) != null) {
mapActivity.refreshMap();
}
}
}
@Nullable
@ -1410,12 +1367,4 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private abstract class MenuAction implements Runnable {
protected ProgressDialog dlg;
}
public static class ContextToolbarController extends TopToolbarController {
public ContextToolbarController() {
super(TopToolbarControllerType.CONTEXT);
}
}
}

View file

@ -1028,7 +1028,14 @@ public class ContextMenuLayer extends OsmandMapLayer {
public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) {
if (movementListener.onTouchEvent(event)) {
if (menu.isVisible()) {
if (!menu.isClosable()) {
menu.hide();
} else {
menu.updateMapCenter(null);
menu.close();
}
}
if (multiSelectionMenu.isVisible()) {
multiSelectionMenu.hide();
}

View file

@ -55,8 +55,7 @@ public class MapInfoWidgetsFactory {
CONTEXT_MENU,
TRACK_DETAILS,
DISCOUNT,
MEASUREMENT_TOOL,
CONTEXT
MEASUREMENT_TOOL
}
public TextInfoWidget createAltitudeControl(final MapActivity map) {