Fix route details dismiss on tap
This commit is contained in:
parent
46b88489a3
commit
5e591194c0
4 changed files with 33 additions and 1 deletions
|
@ -267,7 +267,7 @@ public class TransportStopController extends MenuController {
|
|||
List<TransportStop> transportStops = findTransportStopsAt(app, loc.getLatitude(), loc.getLongitude(), SHOW_STOPS_RADIUS_METERS);
|
||||
if (transportStops != null) {
|
||||
for (TransportStop stop : transportStops) {
|
||||
if (localStop == null && transportStop.getLocation().equals(stop.getLocation()) && transportStop.getName().equals(stop.getName())) {
|
||||
if (localStop == null && transportStop.equals(stop)) {
|
||||
localStop = stop;
|
||||
} else {
|
||||
stopAggregated.addNearbyTransportStop(stop);
|
||||
|
|
|
@ -99,6 +99,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
private boolean wasDrawerDisabled;
|
||||
private int currentMenuState;
|
||||
private int routesCount;
|
||||
private boolean paused;
|
||||
|
||||
private boolean publicTransportMode;
|
||||
private boolean needAdjustMap;
|
||||
|
@ -209,6 +210,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
paused = false;
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
|
||||
|
@ -223,6 +225,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
paused = true;
|
||||
MapRouteInfoMenu.chooseRoutesVisible = false;
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
|
@ -262,6 +265,10 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
return getIcon(id, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);
|
||||
}
|
||||
|
||||
public boolean isPaused() {
|
||||
return paused;
|
||||
}
|
||||
|
||||
public void analyseOnMap(LatLon location, GpxDisplayItem gpxItem) {
|
||||
OsmandApplication app = requireMyApplication();
|
||||
final OsmandSettings settings = app.getSettings();
|
||||
|
|
|
@ -1890,6 +1890,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public WeakReference<MapRouteInfoMenuFragment> findMenuFragment() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
|
@ -1901,6 +1902,18 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public WeakReference<ChooseRouteFragment> findChooseRouteFragment() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(ChooseRouteFragment.TAG);
|
||||
if (fragment instanceof ChooseRouteFragment && !((ChooseRouteFragment) fragment).isPaused()) {
|
||||
return new WeakReference<>((ChooseRouteFragment) fragment);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void showLocationOnMap(MapActivity mapActivity, double latitude, double longitude) {
|
||||
RotatedTileBox tb = mapActivity.getMapView().getCurrentRotatedTileBox().copy();
|
||||
int tileBoxWidthPx = 0;
|
||||
|
|
|
@ -59,12 +59,14 @@ import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
|||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||
import net.osmand.plus.render.MapRenderRepositories;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
|
||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -962,6 +964,16 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
boolean processed = hideVisibleMenues();
|
||||
processed |= menu.onSingleTapOnMap();
|
||||
if (!processed && MapRouteInfoMenu.chooseRoutesVisible) {
|
||||
WeakReference<ChooseRouteFragment> chooseRouteFragmentRef = activity.getMapRouteInfoMenu().findChooseRouteFragment();
|
||||
if (chooseRouteFragmentRef != null) {
|
||||
ChooseRouteFragment chooseRouteFragment = chooseRouteFragmentRef.get();
|
||||
if (chooseRouteFragment != null) {
|
||||
chooseRouteFragment.dismiss();
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!processed && activity.getMyApplication().getSettings().MAP_EMPTY_STATE_ALLOWED.get()) {
|
||||
activity.getMapLayers().getMapControlsLayer().switchMapControlsVisibility(true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue