diff --git a/OsmAnd/res/layout/fragment_add_waypoint_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_add_waypoint_bottom_sheet_dialog.xml
new file mode 100644
index 0000000000..4fccb2edb8
--- /dev/null
+++ b/OsmAnd/res/layout/fragment_add_waypoint_bottom_sheet_dialog.xml
@@ -0,0 +1,263 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/layout/map_context_menu_fragment.xml b/OsmAnd/res/layout/map_context_menu_fragment.xml
index 60d0136612..0da95fecc0 100644
--- a/OsmAnd/res/layout/map_context_menu_fragment.xml
+++ b/OsmAnd/res/layout/map_context_menu_fragment.xml
@@ -91,7 +91,7 @@
android:layout_height= "wrap_content"
android:layout_marginBottom="@dimen/context_menu_direction_margin"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
- android:gravity="center_vertical"
+ android:gravity="top"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp"
@@ -615,7 +615,7 @@
android:layout_height="@dimen/dashboard_map_toolbar"
android:layout_marginLeft="4dp"
android:layout_marginStart="4dp"
- android:alpha="1">
+ android:alpha="0">
+ Current
+ Adds the last stop along the route
+ Adds the first stop on the route
+ Move destination up, and create destination
Show closed notes
Show/Hide OSM Notes on the map.
GPX - suitable for export to JOSM or other OSM editors.
diff --git a/OsmAnd/src/net/osmand/plus/LockableScrollView.java b/OsmAnd/src/net/osmand/plus/LockableScrollView.java
index 395f295973..46cc4e46bd 100644
--- a/OsmAnd/src/net/osmand/plus/LockableScrollView.java
+++ b/OsmAnd/src/net/osmand/plus/LockableScrollView.java
@@ -36,7 +36,7 @@ public class LockableScrollView extends ScrollView {
return super.onTouchEvent(ev);
}
// only continue to handle the touch event if scrolling enabled
- return mScrollable;
+ return false;
default:
return super.onTouchEvent(ev);
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java
index f359311486..ec9534021a 100644
--- a/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java
@@ -90,7 +90,6 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity
private static final Log log = PlatformUtil.getLog(SearchByNameAbstractActivity.class);
private static final int NAVIGATE_TO = 3;
- private static final int ADD_WAYPOINT = 4;
private static final int SHOW_ON_MAP = 5;
private static final int ADD_TO_FAVORITE = 6;
@@ -571,9 +570,6 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity
} else if (mode == NAVIGATE_TO) {
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(),
searchPoint.getLongitude(), ai.getHistoryName());
- } else if (mode == ADD_WAYPOINT) {
- DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(),
- searchPoint.getLongitude(), ai.getHistoryName());
} else if (mode == SHOW_ON_MAP) {
showOnMap(searchPoint, ai);
}
diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
index 0a3687b8e3..59d3d52d56 100644
--- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
@@ -80,14 +80,12 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
}
if (AndroidUiHelper.isOrientationPortrait(activity)) {
- AndroidUtils.setBackground(activity, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
+ mainView.setBackgroundResource(getPortraitBgResId());
} else {
if (screenHeight - statusBarHeight - mainView.getHeight() >= getResources().getDimension(R.dimen.bottom_sheet_content_padding_small)) {
- AndroidUtils.setBackground(activity, mainView, nightMode,
- R.drawable.bg_bottom_sheet_topsides_landscape_light, R.drawable.bg_bottom_sheet_topsides_landscape_dark);
+ mainView.setBackgroundResource(getLandscapeTopsidesBgResId());
} else {
- AndroidUtils.setBackground(activity, mainView, nightMode,
- R.drawable.bg_bottom_sheet_sides_landscape_light, R.drawable.bg_bottom_sheet_sides_landscape_dark);
+ mainView.setBackgroundResource(getLandscapeSidesBgResId());
}
}
@@ -101,6 +99,21 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
});
}
+ @DrawableRes
+ protected int getPortraitBgResId() {
+ return nightMode ? R.drawable.bg_bottom_menu_dark : R.drawable.bg_bottom_menu_light;
+ }
+
+ @DrawableRes
+ protected int getLandscapeTopsidesBgResId() {
+ return nightMode ? R.drawable.bg_bottom_sheet_topsides_landscape_dark : R.drawable.bg_bottom_sheet_topsides_landscape_light;
+ }
+
+ @DrawableRes
+ protected int getLandscapeSidesBgResId() {
+ return nightMode ? R.drawable.bg_bottom_sheet_sides_landscape_dark : R.drawable.bg_bottom_sheet_sides_landscape_light;
+ }
+
protected boolean isNightMode() {
if (usedOnMap) {
return getMyApplication().getDaynightHelper().isNightModeForMapControls();
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
new file mode 100644
index 0000000000..777c454622
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
@@ -0,0 +1,160 @@
+package net.osmand.plus.dialogs;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.os.Bundle;
+import android.support.annotation.DrawableRes;
+import android.support.annotation.Nullable;
+import android.support.v4.content.ContextCompat;
+import android.view.ContextThemeWrapper;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import net.osmand.data.LatLon;
+import net.osmand.data.PointDescription;
+import net.osmand.plus.R;
+import net.osmand.plus.TargetPointsHelper;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.base.MenuBottomSheetDialogFragment;
+
+public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
+
+ public static final String TAG = "AddWaypointBottomSheetDialogFragment";
+ public static final String LAT_KEY = "latitude";
+ public static final String LON_KEY = "longitude";
+ public static final String POINT_DESCRIPTION_KEY = "point_description";
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ Bundle args = getArguments();
+ final LatLon latLon = new LatLon(args.getDouble(LAT_KEY), args.getDouble(LON_KEY));
+ final PointDescription name = PointDescription.deserializeFromString(args.getString(POINT_DESCRIPTION_KEY), latLon);
+ final TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
+
+ final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
+ final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
+ R.layout.fragment_add_waypoint_bottom_sheet_dialog, container);
+
+ ((TextView) mainView.findViewById(R.id.current_dest_text_view))
+ .setText(getCurrentDestinationName(targetPointsHelper.getPointToNavigate()));
+
+ ((ImageView) mainView.findViewById(R.id.current_dest_icon))
+ .setImageDrawable(getBackgroundIcon(R.drawable.ic_action_point_destination));
+ ((ImageView) mainView.findViewById(R.id.subsequent_dest_icon)).setImageDrawable(getSubsequentDestIcon());
+ ((ImageView) mainView.findViewById(R.id.first_interm_dest_icon)).setImageDrawable(getFirstIntermDestIcon());
+ ((ImageView) mainView.findViewById(R.id.last_interm_dest_icon)).setImageDrawable(getLastIntermDistIcon());
+
+ View.OnClickListener onClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ int id = v.getId();
+ if (id == R.id.replace_dest_row) {
+ targetPointsHelper.navigateToPoint(latLon, true, -1, name);
+ } else if (id == R.id.subsequent_dest_row) {
+ targetPointsHelper.navigateToPoint(latLon, true,
+ targetPointsHelper.getIntermediatePoints().size() + 1, name);
+ } else if (id == R.id.first_intermediate_dest_row) {
+ targetPointsHelper.navigateToPoint(latLon, true, 0, name);
+ } else if (id == R.id.last_intermediate_dest_row) {
+ targetPointsHelper.navigateToPoint(latLon, true, targetPointsHelper.getIntermediatePoints().size(), name);
+ }
+ dismiss();
+ }
+ };
+
+ mainView.findViewById(R.id.replace_dest_row).setOnClickListener(onClickListener);
+ mainView.findViewById(R.id.subsequent_dest_row).setOnClickListener(onClickListener);
+ mainView.findViewById(R.id.first_intermediate_dest_row).setOnClickListener(onClickListener);
+ mainView.findViewById(R.id.last_intermediate_dest_row).setOnClickListener(onClickListener);
+ mainView.findViewById(R.id.cancel_row).setOnClickListener(onClickListener);
+
+ if (nightMode) {
+ int dividerColor = ContextCompat.getColor(getContext(), R.color.route_info_bottom_view_bg_dark);
+ mainView.findViewById(R.id.current_dest_divider).setBackgroundColor(dividerColor);
+ mainView.findViewById(R.id.cancel_divider).setBackgroundColor(dividerColor);
+ }
+
+ setupHeightAndBackground(mainView, R.id.scroll_view);
+
+ return mainView;
+ }
+
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ super.onDismiss(dialog);
+ closeContextMenu();
+ }
+
+ @Override
+ protected Drawable getActiveIcon(@DrawableRes int id) {
+ return getIcon(id, nightMode ? R.color.ctx_menu_direction_color_dark : R.color.map_widget_blue);
+ }
+
+ @Override
+ protected int getPortraitBgResId() {
+ return nightMode ? R.drawable.bg_additional_menu_dark : R.drawable.bg_bottom_menu_light;
+ }
+
+ @Override
+ protected int getLandscapeTopsidesBgResId() {
+ return nightMode ? R.drawable.bg_additional_menu_topsides_dark : R.drawable.bg_bottom_sheet_topsides_landscape_light;
+ }
+
+ @Override
+ protected int getLandscapeSidesBgResId() {
+ return nightMode ? R.drawable.bg_additional_menu_sides_dark : R.drawable.bg_bottom_sheet_sides_landscape_light;
+ }
+
+ private Drawable getBackgroundIcon(@DrawableRes int resId) {
+ return getIcon(resId, R.color.searchbar_text_hint_light);
+ }
+
+ private LayerDrawable getLayerDrawable(@DrawableRes int bgIdRes, @DrawableRes int icIdRes) {
+ return new LayerDrawable(new Drawable[]{getBackgroundIcon(bgIdRes), getActiveIcon(icIdRes)});
+ }
+
+ private LayerDrawable getSubsequentDestIcon() {
+ return getLayerDrawable(R.drawable.ic_action_route_subsequent_destination,
+ R.drawable.ic_action_route_subsequent_destination_point);
+ }
+
+ private LayerDrawable getFirstIntermDestIcon() {
+ return getLayerDrawable(R.drawable.ic_action_route_first_intermediate,
+ R.drawable.ic_action_route_first_intermediate_point);
+ }
+
+ private LayerDrawable getLastIntermDistIcon() {
+ return getLayerDrawable(R.drawable.ic_action_route_last_intermediate,
+ R.drawable.ic_action_route_last_intermediate_point);
+ }
+
+ private String getCurrentDestinationName(@Nullable TargetPointsHelper.TargetPoint finish) {
+ Context ctx = getContext();
+ StringBuilder builder = new StringBuilder(ctx.getString(R.string.shared_string_current));
+ builder.append(": ");
+ if (finish != null) {
+ if (finish.getOnlyName().length() > 0) {
+ builder.append(finish.getOnlyName());
+ } else {
+ builder.append(ctx.getString(R.string.route_descr_map_location));
+ builder.append(" ");
+ builder.append(ctx.getString(R.string.route_descr_lat_lon, finish.getLatitude(), finish.getLongitude()));
+ }
+ }
+ return builder.toString();
+ }
+
+ private void closeContextMenu() {
+ Activity activity = getActivity();
+ if (activity instanceof MapActivity) {
+ ((MapActivity) activity).getContextMenu().close();
+ }
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java b/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java
index 6e711241d9..65852a05d0 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java
@@ -2,7 +2,9 @@ package net.osmand.plus.dialogs;
import android.app.Activity;
import android.content.DialogInterface;
+import android.os.Bundle;
import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.PopupMenu;
import net.osmand.data.LatLon;
@@ -45,38 +47,17 @@ public class DirectionsDialogs {
MapActivity.launchMapActivityMoveToTop(act);
}
}
-
- public static void addWaypointDialogAndLaunchMap(final Activity act, final double lat, final double lon, final PointDescription name) {
- final OsmandApplication ctx = (OsmandApplication) act.getApplication();
- final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
+
+ public static void addWaypointDialogAndLaunchMap(final AppCompatActivity act, final double lat, final double lon, final PointDescription name) {
+ final TargetPointsHelper targetPointsHelper = ((OsmandApplication) act.getApplication()).getTargetPointsHelper();
if (targetPointsHelper.getPointToNavigate() != null) {
- AlertDialog.Builder builder = new AlertDialog.Builder(act);
- builder.setTitle(R.string.new_destination_point_dialog);
- builder.setItems(
- new String[] { act.getString(R.string.replace_destination_point),
- act.getString(R.string.keep_and_add_destination_point),
- act.getString(R.string.add_as_first_destination_point), act.getString(R.string.add_as_last_destination_point) },
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == 0) {
- targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, -1, name);
- closeContextMenu(act);
- } else if (which == 1) {
- targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true,
- targetPointsHelper.getIntermediatePoints().size() + 1, name);
- closeContextMenu(act);
- } else if (which == 2) {
- targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, 0, name);
- closeContextMenu(act);
- } else {
- targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, targetPointsHelper.getIntermediatePoints().size(), name);
- closeContextMenu(act);
- }
- MapActivity.launchMapActivityMoveToTop(act);
- }
- });
- builder.show();
+ Bundle args = new Bundle();
+ args.putDouble(AddWaypointBottomSheetDialogFragment.LAT_KEY, lat);
+ args.putDouble(AddWaypointBottomSheetDialogFragment.LON_KEY, lon);
+ args.putString(AddWaypointBottomSheetDialogFragment.POINT_DESCRIPTION_KEY, PointDescription.serializeToString(name));
+ AddWaypointBottomSheetDialogFragment fragment = new AddWaypointBottomSheetDialogFragment();
+ fragment.setArguments(args);
+ fragment.show(act.getSupportFragmentManager(), AddWaypointBottomSheetDialogFragment.TAG);
} else {
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, -1, name);
closeContextMenu(act);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index a1ea75009b..312d4eeb86 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -20,6 +20,7 @@ import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
@@ -29,6 +30,7 @@ import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.OverScroller;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -82,6 +84,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private View toolbarBackButton;
private TextView toolbarTextView;
private View topButtonContainer;
+ private LockableScrollView menuScrollView;
private View zoomButtonsView;
private ImageButton zoomInButtonView;
@@ -292,13 +295,24 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private float dy;
private float dyMain;
private float mDownY;
+
+ private int minimumVelocity;
+ private int maximumVelocity;
private VelocityTracker velocityTracker;
+ private OverScroller scroller;
+
private boolean slidingUp;
private boolean slidingDown;
- private float maxVelocityY;
private boolean hasMoved;
+ {
+ scroller = new OverScroller(getContext());
+ final ViewConfiguration configuration = ViewConfiguration.get(getContext());
+ minimumVelocity = configuration.getScaledMinimumFlingVelocity();
+ maximumVelocity = configuration.getScaledMaximumFlingVelocity();
+ }
+
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -330,7 +344,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
dy = event.getY();
dyMain = getViewY();
- maxVelocityY = 0;
initOrResetVelocityTracker();
velocityTracker.addMovement(event);
break;
@@ -354,14 +367,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
mainView.setLayoutParams(lp);
mainView.requestLayout();
- if (velocityTracker != null) {
- velocityTracker.addMovement(event);
- velocityTracker.computeCurrentVelocity(1000);
- float velocityY = Math.abs(velocityTracker.getYVelocity());
- if (velocityY > maxVelocityY) {
- maxVelocityY = velocityY;
- }
- }
+ float newEventY = newY - (dyMain - dy);
+ MotionEvent ev = MotionEvent.obtain(event.getDownTime(), event.getEventTime(), event.getAction(),
+ event.getX(), newEventY, event.getMetaState());
+
+ initVelocityTrackerIfNotExists();
+ velocityTracker.addMovement(ev);
updateToolbar();
updateTopButton();
@@ -374,10 +385,28 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
moving = false;
int currentY = getViewY();
- slidingUp = Math.abs(maxVelocityY) > 500 && (currentY - dyMain) < -50;
- slidingDown = Math.abs(maxVelocityY) > 500 && (currentY - dyMain) > 50;
+ final VelocityTracker velocityTracker = this.velocityTracker;
+ velocityTracker.computeCurrentVelocity(1000, maximumVelocity);
+ int initialVelocity = (int) velocityTracker.getYVelocity();
- boolean skipScreenState = Math.abs(currentY - dyMain) > skipScreenStateLimit;
+ if ((Math.abs(initialVelocity) > minimumVelocity)) {
+
+ scroller.abortAnimation();
+ scroller.fling(0, currentY, 0, initialVelocity, 0, 0,
+ viewHeight - menuFullHeightMax,
+ minHalfY,
+ 0, 0);
+ currentY = scroller.getFinalY();
+ scroller.abortAnimation();
+
+ slidingUp = initialVelocity < -2000;
+ slidingDown = initialVelocity > 2000;
+ } else {
+ slidingUp = false;
+ slidingDown = false;
+ }
+
+ boolean skipScreenState = Math.abs(getViewY() - dyMain) > skipScreenStateLimit;
changeMenuState(currentY, skipScreenState, slidingUp, slidingDown);
}
recycleVelocityTracker();
@@ -399,6 +428,13 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
}
+ private void initVelocityTrackerIfNotExists() {
+ if (velocityTracker == null) {
+ velocityTracker = VelocityTracker.obtain();
+ velocityTracker.clear();
+ }
+ }
+
private void recycleVelocityTracker() {
if (velocityTracker != null) {
velocityTracker.recycle();
@@ -732,8 +768,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
int oldMenuState = menu.getCurrentMenuState();
if (!menu.isLandscapeLayout()) {
- if (slidingDown && !skipScreenState && oldMenuState == MenuState.FULL_SCREEN
- && currentY < (-menuTitleHeight + menuButtonsHeight)) {
+ if (slidingDown && oldMenuState == MenuState.FULL_SCREEN && getViewY() < getFullScreenTopPosY()) {
slidingDown = false;
}
if (menuBottomViewHeight > 0 && slidingUp) {
@@ -798,9 +833,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void applyPosY(final int currentY, final boolean needCloseMenu, boolean needMapAdjust,
final int previousMenuState, final int newMenuState, int dZoom) {
- final int posY = getPosY(currentY, needCloseMenu);
- if (currentY != posY || dZoom != 0) {
- if (posY < currentY) {
+ final int posY = getPosY(currentY, needCloseMenu, previousMenuState);
+ if (getViewY() != posY || dZoom != 0) {
+ if (posY < getViewY()) {
updateMainViewLayout(posY);
}
@@ -1428,12 +1463,19 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
return viewHeight - menuTitleHeight;
}
+ private int getFullScreenTopPosY() {
+ return -menuTitleHeight + menuButtonsHeight + bottomToolbarPosY;
+ }
private int getPosY() {
return getPosY(CURRENT_Y_UNDEFINED, false);
}
private int getPosY(final int currentY, boolean needCloseMenu) {
+ return getPosY(currentY, needCloseMenu, 0);
+ }
+
+ private int getPosY(final int currentY, boolean needCloseMenu, int previousState) {
if (needCloseMenu) {
return screenHeight;
}
@@ -1462,12 +1504,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (menu.isLandscapeLayout()) {
minPosY = topScreenPosY;
} else {
- minPosY = -menuTitleHeight + menuButtonsHeight + bottomToolbarPosY;
+ minPosY = getFullScreenTopPosY();
}
if (maxPosY > minPosY) {
maxPosY = minPosY;
}
- if (currentY > minPosY) {
+ if (currentY > minPosY || previousState != MenuState.FULL_SCREEN) {
posY = minPosY;
} else if (currentY < maxPosY) {
posY = maxPosY;
@@ -1478,7 +1520,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (menu.isLandscapeLayout()) {
posY = topScreenPosY;
} else {
- posY = -menuTitleHeight + menuButtonsHeight + bottomToolbarPosY;
+ posY = getFullScreenTopPosY();
}
}
break;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
index df8894343f..af3f4ad44b 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
@@ -162,7 +162,7 @@ public abstract class MenuController extends BaseMenuController implements Colla
@Override
public void onCollapseExpand(boolean collapsed) {
if (mapContextMenu != null) {
- mapContextMenu.updateMenuUI();
+ mapContextMenu.updateLayout();
}
}