From f81673d047b496bb651c84ec6621f338edfb58bc Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 13 Jan 2021 17:11:46 +0200 Subject: [PATCH 1/6] My Place: GPX Context menu --- .../net/osmand/plus/activities/MapActivity.java | 6 ++++++ .../net/osmand/plus/track/TrackMenuFragment.java | 16 +++++++++++++++- .../plus/views/layers/ContextMenuLayer.java | 5 +++++ .../plus/views/layers/MapControlsLayer.java | 16 ++++++++++------ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index e41792225b..be0d93dd8d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -140,6 +140,7 @@ import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenTyp import net.osmand.plus.settings.fragments.ConfigureProfileFragment; import net.osmand.plus.settings.fragments.DataStorageFragment; import net.osmand.plus.track.TrackAppearanceFragment; +import net.osmand.plus.track.TrackMenuFragment; import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint; import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.OsmAndMapLayersView; @@ -2222,6 +2223,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven return getFragment(SnapTrackWarningFragment.TAG); } + @NonNull + public TrackMenuFragment getTrackMenuFragment() { + return getFragment(TrackMenuFragment.TAG); + } + public void backToConfigureProfileFragment() { FragmentManager fragmentManager = getSupportFragmentManager(); int backStackEntryCount = fragmentManager.getBackStackEntryCount(); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 595c456858..2896eb48cd 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -58,6 +58,7 @@ import net.osmand.plus.myplaces.TrackActivityFragmentAdapter; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener; import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; +import net.osmand.plus.views.layers.MapControlsLayer; import net.osmand.plus.widgets.IconPopupMenu; import net.osmand.util.Algorithms; @@ -84,6 +85,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card private BottomNavigationView bottomNav; private TrackMenuType menuType = TrackMenuType.TRACK; private SegmentsCard segmentsCard; + private MapControlsLayer.MapHudButton layersHud; private int menuTitleHeight; @@ -170,6 +172,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); if (view != null) { + view.setOnLongClickListener(closeOnLongTap); bottomNav = view.findViewById(R.id.bottom_navigation); routeMenuTopShadowAll = view.findViewById(R.id.route_menu_top_shadow_all); TextView title = view.findViewById(R.id.title); @@ -179,6 +182,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card if (isPortrait()) { updateCardsLayout(); } + setupCards(); setupButtons(view); enterTrackAppearanceMode(); @@ -187,6 +191,15 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card return view; } + private View.OnLongClickListener closeOnLongTap = new View.OnLongClickListener() { + + @Override + public boolean onLongClick(View view) { + dismiss(); + return true; + } + }; + private void setupCards() { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { @@ -237,6 +250,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card public void onDestroyView() { super.onDestroyView(); exitTrackAppearanceMode(); + updateStatusBarColor(); } private void enterTrackAppearanceMode() { @@ -550,7 +564,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card @Override public void gpxSavingFinished(Exception errorMessage) { if (selectedGpxFile != null) { - List groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}); + List groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}); if (groups != null) { selectedGpxFile.setDisplayGroups(groups, app); selectedGpxFile.processPoints(app); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java index cc017d23ac..8236ac5651 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java @@ -805,6 +805,7 @@ public class ContextMenuLayer extends OsmandMapLayer { return true; } else if (selectedObjects.size() > 1) { + hideVisibleMenues(); selectedObjectContextMenuProvider = null; showContextMenuForSelectedObjects(pointLatLon, selectedObjects); return true; @@ -1036,6 +1037,10 @@ public class ContextMenuLayer extends OsmandMapLayer { } private boolean hideVisibleMenues() { + if (activity.getTrackMenuFragment() != null) { + activity.getTrackMenuFragment().dismiss(); + return true; + } if (multiSelectionMenu.isVisible()) { multiSelectionMenu.hide(); return true; diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java index b2697cecf2..a200d786fb 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java @@ -44,10 +44,6 @@ import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.OsmAndLocationSimulation; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.settings.backend.OsmandPreference; -import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.plus.settings.backend.CommonPreference; -import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper.TargetPoint; @@ -60,13 +56,17 @@ import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; +import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType; import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmAndAppCustomization; +import net.osmand.plus.settings.backend.OsmandPreference; +import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.views.OsmandMapLayer; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.corenative.NativeCoreContext; @@ -859,6 +859,10 @@ public class MapControlsLayer extends OsmandMapLayer { } boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode(); boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible(); + boolean trackMenuFragmentOpened = false; + if (mapActivity.getTrackMenuFragment() != null && mapActivity.getTrackMenuFragment().isVisible()) { + trackMenuFragmentOpened = true; + } boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls(); boolean showRouteCalculationControls = routePlanningMode || ((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode); @@ -881,7 +885,7 @@ public class MapControlsLayer extends OsmandMapLayer { mapZoomIn.updateVisibility(showZoomButtons); mapZoomOut.updateVisibility(showZoomButtons); - boolean forceHideCompass = routeDialogOpened || trackDialogOpened || isInMeasurementToolMode() + boolean forceHideCompass = routeDialogOpened || trackDialogOpened || trackMenuFragmentOpened || isInMeasurementToolMode() || isInPlanRouteMode() || contextMenuOpened || isInChoosingRoutesMode() || isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode(); compassHud.forceHideCompass = forceHideCompass; @@ -892,7 +896,7 @@ public class MapControlsLayer extends OsmandMapLayer { if (layersHud.setIconResId(appMode.getIconRes())) { layersHud.update(app, isNight); } - boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !contextMenuOpened + boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !trackMenuFragmentOpened && !contextMenuOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode() && !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode(); layersHud.updateVisibility(showTopButtons); From bf398ef0cc407a4a3762f136ea16811233d557db Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 17 Jan 2021 13:31:37 +0200 Subject: [PATCH 2/6] Fix selected announcement time --- .../plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java index 5a9db79381..cf04e66580 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java @@ -134,6 +134,7 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet tvIntervalsDescr = rootView.findViewById(R.id.tv_interval_descr); seekBarArrival.setOnSeekBarChangeListener(this); + seekBarArrival.setProgress(selectedEntryIndex); seekBarArrival.setMax(listPreference.getEntries().length - 1); rootView.findViewById(R.id.description_container).setOnClickListener(new View.OnClickListener() { @Override From bf5de1a4e2c2d60ba92817c31822de97b33e403a Mon Sep 17 00:00:00 2001 From: Naumov Dmitry Date: Sun, 17 Jan 2021 16:54:17 +0500 Subject: [PATCH 3/6] Fix #10517 --- .../src/main/java/net/osmand/util/MapUtils.java | 4 ++-- .../osmand/plus/mapcontextmenu/other/ShareMenu.java | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java b/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java index d4731dcd8d..15c3364007 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java @@ -333,8 +333,8 @@ public class MapUtils { }); } - public static String buildGeoUrl(double latitude, double longitude, int zoom) { - return "geo:" + ((float) latitude) + "," + ((float) longitude) + "?z=" + zoom; + public static String buildGeoUrl(String latitude, String longitude, int zoom) { + return "geo:" + latitude + "," + longitude + "?z=" + zoom; } // Examples diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java index aba6ca8277..02dbc66d33 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.core.text.TextUtilsCompat; import androidx.core.view.ViewCompat; +import net.osmand.LocationConvert; import net.osmand.data.LatLon; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; @@ -99,10 +100,13 @@ public class ShareMenu extends BaseMenuController { if (mapActivity == null) { return; } + String lat = LocationConvert.convertLatitude(latLon.getLatitude(), LocationConvert.FORMAT_DEGREES, false); + String lon = LocationConvert.convertLongitude(latLon.getLongitude(), LocationConvert.FORMAT_DEGREES, false); + lat = lat.substring(0, lat.length() - 1); + lon = lon.substring(0, lon.length() - 1); final int zoom = mapActivity.getMapView().getZoom(); - final String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom); - final String httpUrl = "https://osmand.net/go?lat=" + ((float) latLon.getLatitude()) - + "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom; + final String geoUrl = MapUtils.buildGeoUrl(lat, lon, zoom); + final String httpUrl = "https://osmand.net/go?lat=" + lat + "&lon=" + lon + "&z=" + zoom; StringBuilder sb = new StringBuilder(); if (!Algorithms.isEmpty(title)) { sb.append(title).append("\n"); From e9a3a61f2e7a630fde7647aa3ff58b4dd6132448 Mon Sep 17 00:00:00 2001 From: Naumov Dmitry Date: Sun, 17 Jan 2021 15:30:30 +0500 Subject: [PATCH 4/6] Fix #10464 --- .../osmand/plus/download/DownloadOsmandIndexesHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java index f6381b3552..d77245cecb 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java @@ -148,11 +148,12 @@ public class DownloadOsmandIndexesHelper { String date = ""; long dateModified = System.currentTimeMillis(); try { - ApplicationInfo appInfo = pm.getApplicationInfo(OsmandApplication.class.getPackage().getName(), 0); + OsmandApplication app = settings.getContext(); + ApplicationInfo appInfo = pm.getApplicationInfo(app.getPackageName(), 0); dateModified = new File(appInfo.sourceDir).lastModified(); date = AndroidUtils.formatDate((Context) settings.getContext(), dateModified); } catch (NameNotFoundException e) { - //do nothing... + log.error(e); } List mapping = getBundledAssets(amanager); for (AssetEntry asset : mapping) { From f66efd6e3eb74a697af71231550e511040881011 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 17 Jan 2021 15:04:43 +0200 Subject: [PATCH 5/6] Small fixes with widgets visibility --- .../osmand/plus/track/TrackMenuFragment.java | 12 --------- .../plus/views/layers/ContextMenuLayer.java | 2 +- .../plus/views/layers/MapControlsLayer.java | 25 +++++++++++-------- .../views/layers/MapQuickActionLayer.java | 3 +++ .../mapwidgets/MapInfoWidgetsFactory.java | 1 + .../mapwidgets/MapMarkersWidgetsFactory.java | 9 ++++--- 6 files changed, 24 insertions(+), 28 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 5a88970302..03f8ab374a 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -71,7 +71,6 @@ import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener; import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; -import net.osmand.plus.views.layers.MapControlsLayer; import net.osmand.plus.widgets.IconPopupMenu; import net.osmand.util.Algorithms; @@ -115,7 +114,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card private OptionsCard optionsCard; private TrackChartPoints trackChartPoints; - private MapControlsLayer.MapHudButton layersHud; private int menuTitleHeight; @@ -197,7 +195,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); if (view != null) { - view.setOnLongClickListener(closeOnLongTap); bottomNav = view.findViewById(R.id.bottom_navigation); routeMenuTopShadowAll = view.findViewById(R.id.route_menu_top_shadow_all); headerTitle = view.findViewById(R.id.title); @@ -221,15 +218,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card return view; } - private View.OnLongClickListener closeOnLongTap = new View.OnLongClickListener() { - - @Override - public boolean onLongClick(View view) { - dismiss(); - return true; - } - }; - private void updateHeader() { if (menuType == TrackMenuType.OPTIONS) { headerTitle.setText(menuType.titleId); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java index 8236ac5651..48dcc7fb6e 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java @@ -324,7 +324,7 @@ public class ContextMenuLayer extends OsmandMapLayer { } return false; } - + hideVisibleMenues(); LatLon pointLatLon = tileBox.getLatLonFromPixel(point.x, point.y); menu.show(pointLatLon, null, null); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java index a200d786fb..5bea819018 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java @@ -859,10 +859,6 @@ public class MapControlsLayer extends OsmandMapLayer { } boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode(); boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible(); - boolean trackMenuFragmentOpened = false; - if (mapActivity.getTrackMenuFragment() != null && mapActivity.getTrackMenuFragment().isVisible()) { - trackMenuFragmentOpened = true; - } boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls(); boolean showRouteCalculationControls = routePlanningMode || ((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode); @@ -875,18 +871,19 @@ public class MapControlsLayer extends OsmandMapLayer { boolean showBottomMenuButtons = (showRouteCalculationControls || !routeFollowingMode) && !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened && !isInChoosingRoutesMode() - && !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode(); + && !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode() + && !isInTrackMenuMode(); routePlanningBtn.updateVisibility(showBottomMenuButtons); menuControl.updateVisibility(showBottomMenuButtons); boolean showZoomButtons = !routeDialogOpened && !contextMenuOpened && !isInTrackAppearanceMode() - && (!isInGpxApproximationMode() || !isPotrait()) + && !isInTrackMenuMode() && (!isInGpxApproximationMode() || !isPotrait()) && !isInFollowTrackMode() && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !portrait); mapZoomIn.updateVisibility(showZoomButtons); mapZoomOut.updateVisibility(showZoomButtons); - boolean forceHideCompass = routeDialogOpened || trackDialogOpened || trackMenuFragmentOpened || isInMeasurementToolMode() - || isInPlanRouteMode() || contextMenuOpened || isInChoosingRoutesMode() + boolean forceHideCompass = routeDialogOpened || trackDialogOpened || isInMeasurementToolMode() + || isInPlanRouteMode() || contextMenuOpened || isInChoosingRoutesMode() || isInTrackMenuMode() || isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode(); compassHud.forceHideCompass = forceHideCompass; compassHud.updateVisibility(!forceHideCompass && shouldShowCompass()); @@ -896,9 +893,10 @@ public class MapControlsLayer extends OsmandMapLayer { if (layersHud.setIconResId(appMode.getIconRes())) { layersHud.update(app, isNight); } - boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !trackMenuFragmentOpened && !contextMenuOpened + boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !contextMenuOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode() - && !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode(); + && !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode() + && !isInTrackMenuMode(); layersHud.updateVisibility(showTopButtons); quickSearchHud.updateVisibility(showTopButtons); @@ -1025,7 +1023,8 @@ public class MapControlsLayer extends OsmandMapLayer { boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation(); boolean visible = !(tracked && rh.isFollowingMode()) && (!isInGpxApproximationMode() || !isPotrait()); backToLocationControl.updateVisibility(visible && !dialogOpened && !isInPlanRouteMode() - && !isInTrackAppearanceMode() && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !isInFollowTrackMode() || !isPotrait())); + && !isInTrackAppearanceMode() && !isInTrackMenuMode() + && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !isInFollowTrackMode() || !isPotrait())); } public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { @@ -1348,6 +1347,10 @@ public class MapControlsLayer extends OsmandMapLayer { return mapActivity.getMapLayers().getMeasurementToolLayer().isTapsDisabled(); } + public boolean isInTrackMenuMode() { + return mapActivity.getTrackMenuFragment() != null && mapActivity.getTrackMenuFragment().isVisible(); + } + private boolean isInChoosingRoutesMode() { return MapRouteInfoMenu.chooseRoutesVisible; } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapQuickActionLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapQuickActionLayer.java index 0353776edb..4ba977235e 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapQuickActionLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapQuickActionLayer.java @@ -59,6 +59,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe private final ContextMenuLayer contextMenuLayer; private final MeasurementToolLayer measurementToolLayer; private final MapMarkersLayer mapMarkersLayer; + private final MapControlsLayer mapControlsLayer; private final GPXLayer gpxLayer; private ImageView contextMarker; private final MapActivity mapActivity; @@ -88,6 +89,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe measurementToolLayer = mapActivity.getMapLayers().getMeasurementToolLayer(); mapMarkersLayer = mapActivity.getMapLayers().getMapMarkersLayer(); gpxLayer = mapActivity.getMapLayers().getGpxLayer(); + mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer(); } @Override @@ -423,6 +425,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe measurementToolLayer.isInMeasurementMode() || mapMarkersLayer.isInPlanRouteMode() || gpxLayer.isInTrackAppearanceMode() || + mapControlsLayer.isInTrackMenuMode() || mapRouteInfoMenu.isVisible() || MapRouteInfoMenu.chooseRoutesVisible || MapRouteInfoMenu.waypointsVisible || diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index fca0ae429e..6e14e1164f 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -1235,6 +1235,7 @@ public class MapInfoWidgetsFactory { boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && map.getContextMenu().shouldShowTopControls() && map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive() && !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode() + && !map.getMapLayers().getMapControlsLayer().isInTrackMenuMode() && !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible && !MapRouteInfoMenu.followTrackVisible; diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java index e2b127867b..a38de7d17b 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java @@ -8,14 +8,14 @@ import android.widget.TextView; import net.osmand.Location; import net.osmand.data.LatLon; 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.R; +import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; +import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.DirectionDrawable; import net.osmand.plus.views.OsmandMapLayer.DrawSettings; @@ -193,7 +193,8 @@ public class MapMarkersWidgetsFactory { || map.isTopToolbarActive() || !map.getContextMenu().shouldShowTopControls() || map.getMapLayers().getGpxLayer().isInTrackAppearanceMode() - || map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) { + || map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode() + || map.getMapLayers().getMapControlsLayer().isInTrackMenuMode()) { updateVisibility(false); return; } From eb5606256031ed6f1c2924bf2e174a8d358a011a Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 17 Jan 2021 15:16:17 +0200 Subject: [PATCH 6/6] Fix possible npe --- OsmAnd/src/net/osmand/plus/track/OptionsCard.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/track/OptionsCard.java b/OsmAnd/src/net/osmand/plus/track/OptionsCard.java index 1ed533922c..e042a6ab6b 100644 --- a/OsmAnd/src/net/osmand/plus/track/OptionsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/OptionsCard.java @@ -82,7 +82,10 @@ public class OptionsCard extends BaseCard { items.add(createShareItem()); if (fileAvailable) { - items.add(createUploadOsmItem()); + BaseBottomSheetItem uploadOsmItem = createUploadOsmItem(); + if (uploadOsmItem != null) { + items.add(uploadOsmItem); + } items.add(createDividerItem()); items.add(createEditItem()); items.add(createRenameItem());