Fix map zoom update for analyze track

This commit is contained in:
Vitaliy 2020-06-17 17:20:59 +03:00
parent e225ad7b03
commit 80381c1c22

View file

@ -23,6 +23,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
public static final String TAG = "TrackDetailsMenuFragment";
@ -91,7 +92,14 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
});
}
updateInfo(false);
MapContextMenu contextMenu = mapActivity.getContextMenu();
final boolean forceFitTrackOnMap;
if (contextMenu.isActive()) {
forceFitTrackOnMap = !(contextMenu.getPointDescription() != null && contextMenu.getPointDescription().isGpxPoint());
} else {
forceFitTrackOnMap = true;
}
updateInfo(forceFitTrackOnMap);
ViewTreeObserver vto = mainView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@ -105,7 +113,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
obs.removeGlobalOnLayoutListener(this);
}
if (getMapActivity() != null) {
updateInfo(false);
updateInfo(forceFitTrackOnMap);
}
}
});