Merge pull request #10605 from osmandapp/master

update test branch
This commit is contained in:
Hardy 2021-01-17 19:48:44 +01:00 committed by GitHub
commit a018220a3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 56 additions and 22 deletions

View file

@ -333,8 +333,8 @@ public class MapUtils {
}); });
} }
public static String buildGeoUrl(double latitude, double longitude, int zoom) { public static String buildGeoUrl(String latitude, String longitude, int zoom) {
return "geo:" + ((float) latitude) + "," + ((float) longitude) + "?z=" + zoom; return "geo:" + latitude + "," + longitude + "?z=" + zoom;
} }
// Examples // Examples

View file

@ -139,6 +139,7 @@ import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenTyp
import net.osmand.plus.settings.fragments.ConfigureProfileFragment; import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
import net.osmand.plus.settings.fragments.DataStorageFragment; import net.osmand.plus.settings.fragments.DataStorageFragment;
import net.osmand.plus.track.TrackAppearanceFragment; import net.osmand.plus.track.TrackAppearanceFragment;
import net.osmand.plus.track.TrackMenuFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint; import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmAndMapLayersView; import net.osmand.plus.views.OsmAndMapLayersView;
@ -2219,6 +2220,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(SnapTrackWarningFragment.TAG); return getFragment(SnapTrackWarningFragment.TAG);
} }
@NonNull
public TrackMenuFragment getTrackMenuFragment() {
return getFragment(TrackMenuFragment.TAG);
}
public void backToConfigureProfileFragment() { public void backToConfigureProfileFragment() {
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentManager fragmentManager = getSupportFragmentManager();
int backStackEntryCount = fragmentManager.getBackStackEntryCount(); int backStackEntryCount = fragmentManager.getBackStackEntryCount();

View file

@ -148,11 +148,12 @@ public class DownloadOsmandIndexesHelper {
String date = ""; String date = "";
long dateModified = System.currentTimeMillis(); long dateModified = System.currentTimeMillis();
try { 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(); dateModified = new File(appInfo.sourceDir).lastModified();
date = AndroidUtils.formatDate((Context) settings.getContext(), dateModified); date = AndroidUtils.formatDate((Context) settings.getContext(), dateModified);
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
//do nothing... log.error(e);
} }
List<AssetEntry> mapping = getBundledAssets(amanager); List<AssetEntry> mapping = getBundledAssets(amanager);
for (AssetEntry asset : mapping) { for (AssetEntry asset : mapping) {

View file

@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
import androidx.core.text.TextUtilsCompat; import androidx.core.text.TextUtilsCompat;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import net.osmand.LocationConvert;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -99,10 +100,13 @@ public class ShareMenu extends BaseMenuController {
if (mapActivity == null) { if (mapActivity == null) {
return; 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 int zoom = mapActivity.getMapView().getZoom();
final String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom); final String geoUrl = MapUtils.buildGeoUrl(lat, lon, zoom);
final String httpUrl = "https://osmand.net/go?lat=" + ((float) latLon.getLatitude()) final String httpUrl = "https://osmand.net/go?lat=" + lat + "&lon=" + lon + "&z=" + zoom;
+ "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (!Algorithms.isEmpty(title)) { if (!Algorithms.isEmpty(title)) {
sb.append(title).append("\n"); sb.append(title).append("\n");

View file

@ -134,6 +134,7 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
tvIntervalsDescr = rootView.findViewById(R.id.tv_interval_descr); tvIntervalsDescr = rootView.findViewById(R.id.tv_interval_descr);
seekBarArrival.setOnSeekBarChangeListener(this); seekBarArrival.setOnSeekBarChangeListener(this);
seekBarArrival.setProgress(selectedEntryIndex);
seekBarArrival.setMax(listPreference.getEntries().length - 1); seekBarArrival.setMax(listPreference.getEntries().length - 1);
rootView.findViewById(R.id.description_container).setOnClickListener(new View.OnClickListener() { rootView.findViewById(R.id.description_container).setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -82,7 +82,10 @@ public class OptionsCard extends BaseCard {
items.add(createShareItem()); items.add(createShareItem());
if (fileAvailable) { if (fileAvailable) {
items.add(createUploadOsmItem()); BaseBottomSheetItem uploadOsmItem = createUploadOsmItem();
if (uploadOsmItem != null) {
items.add(uploadOsmItem);
}
items.add(createDividerItem()); items.add(createDividerItem());
items.add(createEditItem()); items.add(createEditItem());
items.add(createRenameItem()); items.add(createRenameItem());

View file

@ -208,6 +208,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
params.gravity = Gravity.BOTTOM | Gravity.START; params.gravity = Gravity.BOTTOM | Gravity.START;
bottomNav.setLayoutParams(params); bottomNav.setLayoutParams(params);
} }
setupCards(); setupCards();
updateHeader(); updateHeader();
setupButtons(view); setupButtons(view);
@ -295,6 +296,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
exitTrackAppearanceMode(); exitTrackAppearanceMode();
updateStatusBarColor();
} }
@Override @Override

View file

@ -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);
@ -805,6 +805,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
return true; return true;
} else if (selectedObjects.size() > 1) { } else if (selectedObjects.size() > 1) {
hideVisibleMenues();
selectedObjectContextMenuProvider = null; selectedObjectContextMenuProvider = null;
showContextMenuForSelectedObjects(pointLatLon, selectedObjects); showContextMenuForSelectedObjects(pointLatLon, selectedObjects);
return true; return true;
@ -1036,6 +1037,10 @@ public class ContextMenuLayer extends OsmandMapLayer {
} }
private boolean hideVisibleMenues() { private boolean hideVisibleMenues() {
if (activity.getTrackMenuFragment() != null) {
activity.getTrackMenuFragment().dismiss();
return true;
}
if (multiSelectionMenu.isVisible()) { if (multiSelectionMenu.isVisible()) {
multiSelectionMenu.hide(); multiSelectionMenu.hide();
return true; return true;

View file

@ -44,10 +44,6 @@ import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmAndLocationSimulation; import net.osmand.plus.OsmAndLocationSimulation;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; 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.R;
import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint; 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.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType; import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
import net.osmand.plus.settings.backend.ApplicationMode; 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.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.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.corenative.NativeCoreContext; import net.osmand.plus.views.corenative.NativeCoreContext;
@ -871,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 || 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());
@ -894,7 +895,8 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !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);
@ -1021,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) {
@ -1344,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;
} }

View file

@ -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 ||

View file

@ -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;

View file

@ -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;
} }