Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
594aecb30c
1 changed files with 27 additions and 31 deletions
|
@ -60,7 +60,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
public static final float MARKER_PADDING_DP = 20f;
|
public static final float MARKER_PADDING_DP = 20f;
|
||||||
public static final float MARKER_PADDING_X_DP = 50f;
|
public static final float MARKER_PADDING_X_DP = 50f;
|
||||||
public static final float SKIP_HALF_SCREEN_STATE_KOEF = .21f;
|
public static final float SKIP_HALF_SCREEN_STATE_KOEF = .21f;
|
||||||
public static final int ZOOM_IN_STANDARD = 16;
|
public static final int ZOOM_IN_STANDARD = 17;
|
||||||
|
|
||||||
private View view;
|
private View view;
|
||||||
private View mainView;
|
private View mainView;
|
||||||
|
@ -93,6 +93,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
private OsmandMapTileView map;
|
private OsmandMapTileView map;
|
||||||
private LatLon mapCenter;
|
private LatLon mapCenter;
|
||||||
|
private int mapZoom;
|
||||||
private int origMarkerX;
|
private int origMarkerX;
|
||||||
private int origMarkerY;
|
private int origMarkerY;
|
||||||
private boolean customMapCenter;
|
private boolean customMapCenter;
|
||||||
|
@ -152,6 +153,10 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
origMarkerX = box.getCenterPixelX();
|
origMarkerX = box.getCenterPixelX();
|
||||||
origMarkerY = box.getCenterPixelY();
|
origMarkerY = box.getCenterPixelY();
|
||||||
}
|
}
|
||||||
|
mapZoom = menu.getMapZoom();
|
||||||
|
if (mapZoom == 0) {
|
||||||
|
mapZoom = map.getZoom();
|
||||||
|
}
|
||||||
|
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
|
|
||||||
|
@ -252,34 +257,11 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
private float velocityY;
|
private float velocityY;
|
||||||
private float maxVelocityY;
|
private float maxVelocityY;
|
||||||
|
|
||||||
private boolean hasMoved;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
|
||||||
if (singleTapDetector.onTouchEvent(event)) {
|
if (singleTapDetector.onTouchEvent(event)) {
|
||||||
moving = false;
|
moving = false;
|
||||||
int posY = getViewY();
|
|
||||||
if (!centered) {
|
|
||||||
if (!zoomIn && menu.supportZoomIn()) {
|
|
||||||
LatLon centerLatLon = map.getCurrentRotatedTileBox().getCenterLatLon();
|
|
||||||
if (centerLatLon.equals(menu.getLatLon())) {
|
|
||||||
zoomIn = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
centerMarkerLocation();
|
|
||||||
} else if (!zoomIn && menu.supportZoomIn()) {
|
|
||||||
int fZoom = getZoom();
|
|
||||||
zoomIn = true;
|
|
||||||
if (fZoom < ZOOM_IN_STANDARD) {
|
|
||||||
AnimateDraggingMapThread thread = map.getAnimatedDraggingThread();
|
|
||||||
thread.startZooming(ZOOM_IN_STANDARD,
|
|
||||||
map.getZoomFractionalPart(), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hasMoved) {
|
|
||||||
applyPosY(posY, false, false, 0, 0);
|
|
||||||
}
|
|
||||||
openMenuHalfScreen();
|
openMenuHalfScreen();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +275,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
hasMoved = false;
|
|
||||||
dy = event.getY();
|
dy = event.getY();
|
||||||
dyMain = getViewY();
|
dyMain = getViewY();
|
||||||
velocity = VelocityTracker.obtain();
|
velocity = VelocityTracker.obtain();
|
||||||
|
@ -305,7 +286,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
if (moving) {
|
if (moving) {
|
||||||
hasMoved = true;
|
|
||||||
float y = event.getY();
|
float y = event.getY();
|
||||||
float newY = getViewY() + (y - dy);
|
float newY = getViewY() + (y - dy);
|
||||||
setViewY((int) newY, false, false);
|
setViewY((int) newY, false, false);
|
||||||
|
@ -783,12 +763,20 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
if (!menu.isActive()) {
|
||||||
if (mapCenter != null) {
|
if (mapCenter != null) {
|
||||||
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
if (mapZoom == 0) {
|
||||||
|
mapZoom = map.getZoom();
|
||||||
}
|
}
|
||||||
|
//map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
||||||
|
//map.setIntZoom(mapZoom);
|
||||||
|
AnimateDraggingMapThread thread = map.getAnimatedDraggingThread();
|
||||||
|
thread.startMoving(mapCenter.getLatitude(), mapCenter.getLongitude(), mapZoom, true);
|
||||||
|
}
|
||||||
|
|
||||||
menu.setMapCenter(null);
|
menu.setMapCenter(null);
|
||||||
menu.setMapZoom(0);
|
menu.setMapZoom(0);
|
||||||
//getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(true);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildMenu() {
|
public void rebuildMenu() {
|
||||||
|
@ -1269,6 +1257,14 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doBeforeMenuStateChange(int previousState, int newState) {
|
private void doBeforeMenuStateChange(int previousState, int newState) {
|
||||||
|
if (newState == MenuState.HALF_SCREEN) {
|
||||||
|
centered = true;
|
||||||
|
if (!zoomIn && menu.supportZoomIn()) {
|
||||||
|
if (getZoom() < ZOOM_IN_STANDARD) {
|
||||||
|
zoomIn = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doAfterMenuStateChange(int previousState, int newState) {
|
private void doAfterMenuStateChange(int previousState, int newState) {
|
||||||
|
|
Loading…
Reference in a new issue