Fix transport context menu
This commit is contained in:
parent
bda783d934
commit
1a9df71765
5 changed files with 44 additions and 11 deletions
|
@ -609,8 +609,12 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
|
|
||||||
public void onSingleTapOnMap() {
|
public void onSingleTapOnMap() {
|
||||||
if (menuController == null || !menuController.handleSingleTapOnMap()) {
|
if (menuController == null || !menuController.handleSingleTapOnMap()) {
|
||||||
|
if (menuController != null && !menuController.isClosable()) {
|
||||||
|
hide();
|
||||||
|
} else {
|
||||||
updateMapCenter(null);
|
updateMapCenter(null);
|
||||||
close();
|
close();
|
||||||
|
}
|
||||||
if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn()) {
|
if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn()) {
|
||||||
mapActivity.getMapLayers().getMapQuickActionLayer().refreshLayer();
|
mapActivity.getMapLayers().getMapQuickActionLayer().refreshLayer();
|
||||||
}
|
}
|
||||||
|
@ -994,6 +998,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
return menuController == null || menuController.fabVisible();
|
return menuController == null || menuController.fabVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isClosable() {
|
||||||
|
return menuController == null || menuController.isClosable();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean buttonsVisible() {
|
public boolean buttonsVisible() {
|
||||||
return menuController == null || menuController.buttonsVisible();
|
return menuController == null || menuController.buttonsVisible();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class MenuBuilder {
|
||||||
private LatLon latLon;
|
private LatLon latLon;
|
||||||
private boolean hidden;
|
private boolean hidden;
|
||||||
private boolean showNearestWiki = false;
|
private boolean showNearestWiki = false;
|
||||||
|
private boolean showOnlinePhotos = true;
|
||||||
protected List<Amenity> nearestWiki = new ArrayList<>();
|
protected List<Amenity> nearestWiki = new ArrayList<>();
|
||||||
private List<OsmandPlugin> menuPlugins = new ArrayList<>();
|
private List<OsmandPlugin> menuPlugins = new ArrayList<>();
|
||||||
private CardsRowBuilder onlinePhotoCardsRow;
|
private CardsRowBuilder onlinePhotoCardsRow;
|
||||||
|
@ -207,6 +208,14 @@ public class MenuBuilder {
|
||||||
this.showNearestWiki = showNearestWiki;
|
this.showNearestWiki = showNearestWiki;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowOnlinePhotos() {
|
||||||
|
return showOnlinePhotos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowOnlinePhotos(boolean showOnlinePhotos) {
|
||||||
|
this.showOnlinePhotos = showOnlinePhotos;
|
||||||
|
}
|
||||||
|
|
||||||
public void setShowNearestWiki(boolean showNearestWiki, long objectId) {
|
public void setShowNearestWiki(boolean showNearestWiki, long objectId) {
|
||||||
this.objectId = objectId;
|
this.objectId = objectId;
|
||||||
this.showNearestWiki = showNearestWiki;
|
this.showNearestWiki = showNearestWiki;
|
||||||
|
@ -228,7 +237,9 @@ public class MenuBuilder {
|
||||||
buildPlainMenuItems(view);
|
buildPlainMenuItems(view);
|
||||||
}
|
}
|
||||||
buildInternal(view);
|
buildInternal(view);
|
||||||
|
if (showOnlinePhotos) {
|
||||||
buildNearestPhotosRow(view);
|
buildNearestPhotosRow(view);
|
||||||
|
}
|
||||||
buildPluginRows(view);
|
buildPluginRows(view);
|
||||||
buildAfter(view);
|
buildAfter(view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,6 +348,10 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isClosable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return !displayDistanceDirection();
|
return !displayDistanceDirection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class TransportRouteController extends MenuController {
|
||||||
final TransportStopRoute transportRoute) {
|
final TransportStopRoute transportRoute) {
|
||||||
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
||||||
this.transportRoute = transportRoute;
|
this.transportRoute = transportRoute;
|
||||||
|
builder.setShowOnlinePhotos(false);
|
||||||
toolbarController = new ContextMenuToolbarController(this);
|
toolbarController = new ContextMenuToolbarController(this);
|
||||||
toolbarController.setTitle(getNameStr());
|
toolbarController.setTitle(getNameStr());
|
||||||
toolbarController.setOnBackButtonClickListener(new OnClickListener() {
|
toolbarController.setOnBackButtonClickListener(new OnClickListener() {
|
||||||
|
@ -83,6 +84,10 @@ public class TransportRouteController extends MenuController {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isClosable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean buttonsVisible() {
|
public boolean buttonsVisible() {
|
||||||
|
@ -157,12 +162,13 @@ public class TransportRouteController extends MenuController {
|
||||||
MapContextMenu menu = getMapActivity().getContextMenu();
|
MapContextMenu menu = getMapActivity().getContextMenu();
|
||||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
|
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
|
||||||
getMapActivity().getString(R.string.transport_Stop), name);
|
getMapActivity().getString(R.string.transport_Stop), name);
|
||||||
resetRoute();
|
|
||||||
menu.show(stop.getLocation(), pd, stop);
|
//resetRoute();
|
||||||
WeakReference<MapContextMenuFragment> rr = menu.findMenuFragment();
|
LatLon stopLocation = stop.getLocation();
|
||||||
if (rr != null && rr.get() != null) {
|
getMapActivity().getMyApplication().getSettings()
|
||||||
rr.get().centerMarkerLocation();
|
.setMapLocationToShow(stopLocation.getLatitude(), stopLocation.getLongitude(),
|
||||||
}
|
15, pd, false, stop);
|
||||||
|
MapActivity.launchMapActivityMoveToTop(getMapActivity());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -756,9 +756,13 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
if (movementListener.onTouchEvent(event)) {
|
if (movementListener.onTouchEvent(event)) {
|
||||||
if (menu.isVisible()) {
|
if (menu.isVisible()) {
|
||||||
|
if (!menu.isClosable()) {
|
||||||
|
menu.hide();
|
||||||
|
} else {
|
||||||
menu.updateMapCenter(null);
|
menu.updateMapCenter(null);
|
||||||
menu.close();
|
menu.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (multiSelectionMenu.isVisible()) {
|
if (multiSelectionMenu.isVisible()) {
|
||||||
multiSelectionMenu.hide();
|
multiSelectionMenu.hide();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue