Small fixes with widgets visibility
This commit is contained in:
parent
0de7638afd
commit
f66efd6e3e
6 changed files with 24 additions and 28 deletions
|
@ -71,7 +71,6 @@ import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
||||||
import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener;
|
import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener;
|
||||||
import net.osmand.plus.views.layers.MapControlsLayer;
|
|
||||||
import net.osmand.plus.widgets.IconPopupMenu;
|
import net.osmand.plus.widgets.IconPopupMenu;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -115,7 +114,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
private OptionsCard optionsCard;
|
private OptionsCard optionsCard;
|
||||||
|
|
||||||
private TrackChartPoints trackChartPoints;
|
private TrackChartPoints trackChartPoints;
|
||||||
private MapControlsLayer.MapHudButton layersHud;
|
|
||||||
|
|
||||||
private int menuTitleHeight;
|
private int menuTitleHeight;
|
||||||
|
|
||||||
|
@ -197,7 +195,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
view.setOnLongClickListener(closeOnLongTap);
|
|
||||||
bottomNav = view.findViewById(R.id.bottom_navigation);
|
bottomNav = view.findViewById(R.id.bottom_navigation);
|
||||||
routeMenuTopShadowAll = view.findViewById(R.id.route_menu_top_shadow_all);
|
routeMenuTopShadowAll = view.findViewById(R.id.route_menu_top_shadow_all);
|
||||||
headerTitle = view.findViewById(R.id.title);
|
headerTitle = view.findViewById(R.id.title);
|
||||||
|
@ -221,15 +218,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnLongClickListener closeOnLongTap = new View.OnLongClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View view) {
|
|
||||||
dismiss();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void updateHeader() {
|
private void updateHeader() {
|
||||||
if (menuType == TrackMenuType.OPTIONS) {
|
if (menuType == TrackMenuType.OPTIONS) {
|
||||||
headerTitle.setText(menuType.titleId);
|
headerTitle.setText(menuType.titleId);
|
||||||
|
|
|
@ -324,7 +324,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
hideVisibleMenues();
|
||||||
LatLon pointLatLon = tileBox.getLatLonFromPixel(point.x, point.y);
|
LatLon pointLatLon = tileBox.getLatLonFromPixel(point.x, point.y);
|
||||||
menu.show(pointLatLon, null, null);
|
menu.show(pointLatLon, null, null);
|
||||||
|
|
||||||
|
|
|
@ -859,10 +859,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible();
|
boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible();
|
||||||
boolean trackMenuFragmentOpened = false;
|
|
||||||
if (mapActivity.getTrackMenuFragment() != null && mapActivity.getTrackMenuFragment().isVisible()) {
|
|
||||||
trackMenuFragmentOpened = true;
|
|
||||||
}
|
|
||||||
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
||||||
boolean showRouteCalculationControls = routePlanningMode ||
|
boolean showRouteCalculationControls = routePlanningMode ||
|
||||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||||
|
@ -875,18 +871,19 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
boolean showBottomMenuButtons = (showRouteCalculationControls || !routeFollowingMode)
|
boolean showBottomMenuButtons = (showRouteCalculationControls || !routeFollowingMode)
|
||||||
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode()
|
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode()
|
||||||
&& !isInPlanRouteMode() && !contextMenuOpened && !isInChoosingRoutesMode()
|
&& !isInPlanRouteMode() && !contextMenuOpened && !isInChoosingRoutesMode()
|
||||||
&& !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode();
|
&& !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode()
|
||||||
|
&& !isInTrackMenuMode();
|
||||||
routePlanningBtn.updateVisibility(showBottomMenuButtons);
|
routePlanningBtn.updateVisibility(showBottomMenuButtons);
|
||||||
menuControl.updateVisibility(showBottomMenuButtons);
|
menuControl.updateVisibility(showBottomMenuButtons);
|
||||||
|
|
||||||
boolean showZoomButtons = !routeDialogOpened && !contextMenuOpened && !isInTrackAppearanceMode()
|
boolean showZoomButtons = !routeDialogOpened && !contextMenuOpened && !isInTrackAppearanceMode()
|
||||||
&& (!isInGpxApproximationMode() || !isPotrait())
|
&& !isInTrackMenuMode() && (!isInGpxApproximationMode() || !isPotrait())
|
||||||
&& !isInFollowTrackMode() && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !portrait);
|
&& !isInFollowTrackMode() && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !portrait);
|
||||||
mapZoomIn.updateVisibility(showZoomButtons);
|
mapZoomIn.updateVisibility(showZoomButtons);
|
||||||
mapZoomOut.updateVisibility(showZoomButtons);
|
mapZoomOut.updateVisibility(showZoomButtons);
|
||||||
|
|
||||||
boolean forceHideCompass = routeDialogOpened || trackDialogOpened || trackMenuFragmentOpened || isInMeasurementToolMode()
|
boolean forceHideCompass = routeDialogOpened || trackDialogOpened || isInMeasurementToolMode()
|
||||||
|| isInPlanRouteMode() || contextMenuOpened || isInChoosingRoutesMode()
|
|| isInPlanRouteMode() || contextMenuOpened || isInChoosingRoutesMode() || isInTrackMenuMode()
|
||||||
|| isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode();
|
|| isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode();
|
||||||
compassHud.forceHideCompass = forceHideCompass;
|
compassHud.forceHideCompass = forceHideCompass;
|
||||||
compassHud.updateVisibility(!forceHideCompass && shouldShowCompass());
|
compassHud.updateVisibility(!forceHideCompass && shouldShowCompass());
|
||||||
|
@ -896,9 +893,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
if (layersHud.setIconResId(appMode.getIconRes())) {
|
if (layersHud.setIconResId(appMode.getIconRes())) {
|
||||||
layersHud.update(app, isNight);
|
layersHud.update(app, isNight);
|
||||||
}
|
}
|
||||||
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !trackMenuFragmentOpened && !contextMenuOpened
|
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !contextMenuOpened
|
||||||
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode()
|
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode()
|
||||||
&& !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode();
|
&& !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode()
|
||||||
|
&& !isInTrackMenuMode();
|
||||||
layersHud.updateVisibility(showTopButtons);
|
layersHud.updateVisibility(showTopButtons);
|
||||||
quickSearchHud.updateVisibility(showTopButtons);
|
quickSearchHud.updateVisibility(showTopButtons);
|
||||||
|
|
||||||
|
@ -1025,7 +1023,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
||||||
boolean visible = !(tracked && rh.isFollowingMode()) && (!isInGpxApproximationMode() || !isPotrait());
|
boolean visible = !(tracked && rh.isFollowingMode()) && (!isInGpxApproximationMode() || !isPotrait());
|
||||||
backToLocationControl.updateVisibility(visible && !dialogOpened && !isInPlanRouteMode()
|
backToLocationControl.updateVisibility(visible && !dialogOpened && !isInPlanRouteMode()
|
||||||
&& !isInTrackAppearanceMode() && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !isInFollowTrackMode() || !isPotrait()));
|
&& !isInTrackAppearanceMode() && !isInTrackMenuMode()
|
||||||
|
&& (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !isInFollowTrackMode() || !isPotrait()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||||
|
@ -1348,6 +1347,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
return mapActivity.getMapLayers().getMeasurementToolLayer().isTapsDisabled();
|
return mapActivity.getMapLayers().getMeasurementToolLayer().isTapsDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInTrackMenuMode() {
|
||||||
|
return mapActivity.getTrackMenuFragment() != null && mapActivity.getTrackMenuFragment().isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isInChoosingRoutesMode() {
|
private boolean isInChoosingRoutesMode() {
|
||||||
return MapRouteInfoMenu.chooseRoutesVisible;
|
return MapRouteInfoMenu.chooseRoutesVisible;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
private final ContextMenuLayer contextMenuLayer;
|
private final ContextMenuLayer contextMenuLayer;
|
||||||
private final MeasurementToolLayer measurementToolLayer;
|
private final MeasurementToolLayer measurementToolLayer;
|
||||||
private final MapMarkersLayer mapMarkersLayer;
|
private final MapMarkersLayer mapMarkersLayer;
|
||||||
|
private final MapControlsLayer mapControlsLayer;
|
||||||
private final GPXLayer gpxLayer;
|
private final GPXLayer gpxLayer;
|
||||||
private ImageView contextMarker;
|
private ImageView contextMarker;
|
||||||
private final MapActivity mapActivity;
|
private final MapActivity mapActivity;
|
||||||
|
@ -88,6 +89,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
measurementToolLayer = mapActivity.getMapLayers().getMeasurementToolLayer();
|
measurementToolLayer = mapActivity.getMapLayers().getMeasurementToolLayer();
|
||||||
mapMarkersLayer = mapActivity.getMapLayers().getMapMarkersLayer();
|
mapMarkersLayer = mapActivity.getMapLayers().getMapMarkersLayer();
|
||||||
gpxLayer = mapActivity.getMapLayers().getGpxLayer();
|
gpxLayer = mapActivity.getMapLayers().getGpxLayer();
|
||||||
|
mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -423,6 +425,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
measurementToolLayer.isInMeasurementMode() ||
|
measurementToolLayer.isInMeasurementMode() ||
|
||||||
mapMarkersLayer.isInPlanRouteMode() ||
|
mapMarkersLayer.isInPlanRouteMode() ||
|
||||||
gpxLayer.isInTrackAppearanceMode() ||
|
gpxLayer.isInTrackAppearanceMode() ||
|
||||||
|
mapControlsLayer.isInTrackMenuMode() ||
|
||||||
mapRouteInfoMenu.isVisible() ||
|
mapRouteInfoMenu.isVisible() ||
|
||||||
MapRouteInfoMenu.chooseRoutesVisible ||
|
MapRouteInfoMenu.chooseRoutesVisible ||
|
||||||
MapRouteInfoMenu.waypointsVisible ||
|
MapRouteInfoMenu.waypointsVisible ||
|
||||||
|
|
|
@ -1235,6 +1235,7 @@ public class MapInfoWidgetsFactory {
|
||||||
boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && map.getContextMenu().shouldShowTopControls()
|
boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && map.getContextMenu().shouldShowTopControls()
|
||||||
&& map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive()
|
&& map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive()
|
||||||
&& !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
&& !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
||||||
|
&& !map.getMapLayers().getMapControlsLayer().isInTrackMenuMode()
|
||||||
&& !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible
|
&& !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible
|
||||||
&& !MapRouteInfoMenu.followTrackVisible;
|
&& !MapRouteInfoMenu.followTrackVisible;
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,14 @@ import android.widget.TextView;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.UiUtilities;
|
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
|
||||||
import net.osmand.plus.mapmarkers.MapMarker;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarker;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.DirectionDrawable;
|
import net.osmand.plus.views.DirectionDrawable;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
|
@ -193,7 +193,8 @@ public class MapMarkersWidgetsFactory {
|
||||||
|| map.isTopToolbarActive()
|
|| map.isTopToolbarActive()
|
||||||
|| !map.getContextMenu().shouldShowTopControls()
|
|| !map.getContextMenu().shouldShowTopControls()
|
||||||
|| map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
|| map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
||||||
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) {
|
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()
|
||||||
|
|| map.getMapLayers().getMapControlsLayer().isInTrackMenuMode()) {
|
||||||
updateVisibility(false);
|
updateVisibility(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue