This commit is contained in:
nazar-kutz 2021-03-15 10:58:40 +02:00
parent efca3719e5
commit bf2469a05d
3 changed files with 16 additions and 1 deletions

View file

@ -40,6 +40,7 @@ public class AnimateDraggingMapThread {
private double targetFloatZoom = 0; private double targetFloatZoom = 0;
private boolean isAnimatingZoom; private boolean isAnimatingZoom;
private boolean isAnimatingMapMove;
public AnimateDraggingMapThread(OsmandMapTileView tileView) { public AnimateDraggingMapThread(OsmandMapTileView tileView) {
this.tileView = tileView; this.tileView = tileView;
@ -158,6 +159,7 @@ public class AnimateDraggingMapThread {
@Override @Override
public void run() { public void run() {
isAnimatingMapMove = true;
setTargetValues(zoom, zoomFP, finalLat, finalLon); setTargetValues(zoom, zoomFP, finalLat, finalLon);
boolean animateZoom = finalZoom != null && (zoom != startZoom || startZoomFP != 0); boolean animateZoom = finalZoom != null && (zoom != startZoom || startZoomFP != 0);
@ -171,6 +173,7 @@ public class AnimateDraggingMapThread {
} }
animatingMoveInThread(mMoveX, mMoveY, NAV_ANIMATION_TIME, notifyListener, null); animatingMoveInThread(mMoveX, mMoveY, NAV_ANIMATION_TIME, notifyListener, null);
isAnimatingMapMove = false;
} }
}); });
} }
@ -217,6 +220,7 @@ public class AnimateDraggingMapThread {
@Override @Override
public void run() { public void run() {
isAnimatingMapMove = true;
setTargetValues(endZoom, 0, finalLat, finalLon); setTargetValues(endZoom, 0, finalLat, finalLon);
if (moveZoom != startZoom) { if (moveZoom != startZoom) {
@ -243,6 +247,7 @@ public class AnimateDraggingMapThread {
tileView.setFractionalZoom(endZoom, 0, notifyListener); tileView.setFractionalZoom(endZoom, 0, notifyListener);
pendingRotateAnimation(); pendingRotateAnimation();
isAnimatingMapMove = false;
} }
}); });
} }
@ -373,6 +378,10 @@ public class AnimateDraggingMapThread {
return isAnimatingZoom; return isAnimatingZoom;
} }
public boolean isAnimatingMapMove() {
return isAnimatingMapMove;
}
public void startZooming(final int zoomEnd, final double zoomPart, final boolean notifyListener) { public void startZooming(final int zoomEnd, final double zoomPart, final boolean notifyListener) {
boolean doNotUseAnimations = tileView.getSettings().DO_NOT_USE_ANIMATIONS.get(); boolean doNotUseAnimations = tileView.getSettings().DO_NOT_USE_ANIMATIONS.get();
final float animationTime = doNotUseAnimations ? 0 : ZOOM_ANIMATION_TIME; final float animationTime = doNotUseAnimations ? 0 : ZOOM_ANIMATION_TIME;

View file

@ -727,6 +727,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
return animatedDraggingThread.isAnimatingZoom(); return animatedDraggingThread.isAnimatingZoom();
} }
public boolean isAnimatingMapMove() {
return animatedDraggingThread.isAnimatingMapMove();
}
@SuppressLint("WrongCall") @SuppressLint("WrongCall")
public void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings) { public void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings) {
if (mapRenderer == null) { if (mapRenderer == null) {

View file

@ -253,7 +253,9 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
lastCheckMapZoom = zoom; lastCheckMapZoom = zoom;
if (app.getSettings().SHOW_DOWNLOAD_MAP_DIALOG.get() if (app.getSettings().SHOW_DOWNLOAD_MAP_DIALOG.get()
&& zoom >= ZOOM_MIN_TO_SHOW_DOWNLOAD_DIALOG && zoom <= ZOOM_MAX_TO_SHOW_DOWNLOAD_DIALOG && zoom >= ZOOM_MIN_TO_SHOW_DOWNLOAD_DIALOG
&& zoom <= ZOOM_MAX_TO_SHOW_DOWNLOAD_DIALOG
&& !view.isAnimatingMapMove()
&& currentObjects != null) { && currentObjects != null) {
Map<WorldRegion, BinaryMapDataObject> selectedObjects = new LinkedHashMap<>(); Map<WorldRegion, BinaryMapDataObject> selectedObjects = new LinkedHashMap<>();