diff --git a/OsmAnd/res/layout/map_context_menu_fragment.xml b/OsmAnd/res/layout/map_context_menu_fragment.xml
index 1924bf56a3..c55c77ca81 100644
--- a/OsmAnd/res/layout/map_context_menu_fragment.xml
+++ b/OsmAnd/res/layout/map_context_menu_fragment.xml
@@ -166,20 +166,71 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+ Show on Top Bar
Mark passed
can be imported as Favorites points, or as track file.
Import as GPX file
diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
index 4307c25421..cc1964d0e4 100644
--- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
@@ -795,6 +795,16 @@ public class MapMarkersHelper {
}
}
+ public void moveMarkerToTop(MapMarker marker) {
+ int i = mapMarkers.indexOf(marker);
+ if (i != -1 && mapMarkers.size() > 1) {
+ mapMarkers.remove(i);
+ mapMarkers.add(0, marker);
+ reorderActiveMarkersIfNeeded();
+ refresh();
+ }
+ }
+
public void moveMapMarker(MapMarker marker, LatLon latLon) {
if (marker != null) {
LatLon point = new LatLon(latLon.getLatitude(), latLon.getLongitude());
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
index 916fb34fb6..3d989f1929 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
@@ -1035,6 +1035,14 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
}
+ public TitleButtonController getLeftSubtitleButtonController() {
+ if (menuController != null) {
+ return menuController.getLeftSubtitleButtonController();
+ } else {
+ return null;
+ }
+ }
+
public TitleButtonController getLeftDownloadButtonController() {
if (menuController != null) {
return menuController.getLeftDownloadButtonController();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index b0d958737e..9a6b0b6808 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -175,6 +175,18 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
}
});
+ // Left subtitle button
+ final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
+ leftSubtitleButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
+ if (leftSubtitleButtonController != null) {
+ leftSubtitleButtonController.buttonPressed();
+ }
+ }
+ });
+
// Left download button
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left);
leftDownloadButton.setOnClickListener(new View.OnClickListener() {
@@ -686,14 +698,17 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController();
+ TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
TitleProgressController titleProgressController = menu.getTitleProgressController();
// Title buttons
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
+ boolean showTitleDivider = leftSubtitleButtonController != null;
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
titleButtonsContainer.setVisibility(showTitleButtonsContainer ? View.VISIBLE : View.GONE);
+ view.findViewById(R.id.title_divider).setVisibility(showTitleDivider ? View.VISIBLE : View.GONE);
// Left title button
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
@@ -745,6 +760,21 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
topRightTitleButton.setVisibility(View.GONE);
}
+ // Left subtitle button
+ final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
+ if (leftSubtitleButtonController != null) {
+ leftSubtitleButton.setText(leftSubtitleButtonController.caption);
+ leftSubtitleButton.setVisibility(leftSubtitleButtonController.visible ? View.VISIBLE : View.GONE);
+
+ Drawable leftIcon = leftSubtitleButtonController.getLeftIcon();
+ if (leftIcon != null) {
+ leftSubtitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
+ leftSubtitleButton.setCompoundDrawablePadding(dpToPx(4f));
+ }
+ } else {
+ leftSubtitleButton.setVisibility(View.GONE);
+ }
+
// Download buttons
boolean showDownloadButtonsContainer =
((leftDownloadButtonController != null && leftDownloadButtonController.visible)
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
index bd07191281..69a05d95ab 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
@@ -99,6 +99,7 @@ public abstract class MenuController extends BaseMenuController {
protected TitleButtonController leftTitleButtonController;
protected TitleButtonController rightTitleButtonController;
protected TitleButtonController topRightTitleButtonController;
+ protected TitleButtonController leftSubtitleButtonController;
protected TitleButtonController leftDownloadButtonController;
protected TitleButtonController rightDownloadButtonController;
@@ -322,6 +323,10 @@ public abstract class MenuController extends BaseMenuController {
return topRightTitleButtonController;
}
+ public TitleButtonController getLeftSubtitleButtonController() {
+ return leftSubtitleButtonController;
+ }
+
public TitleButtonController getLeftDownloadButtonController() {
return leftDownloadButtonController;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
index ac25b91059..fcda2dcae1 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
@@ -21,6 +21,7 @@ public class MapMarkerMenuController extends MenuController {
this.mapMarker = mapMarker;
builder.setShowNearestWiki(true);
final MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
+
leftTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
@@ -31,6 +32,16 @@ public class MapMarkerMenuController extends MenuController {
leftTitleButtonController.needColorizeIcon = false;
leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed);
leftTitleButtonController.leftIconId = isLight() ? R.drawable.passed_icon_light : R.drawable.passed_icon_dark;
+
+ leftSubtitleButtonController = new TitleButtonController() {
+ @Override
+ public void buttonPressed() {
+ markersHelper.moveMarkerToTop(getMapMarker());
+ getMapActivity().getContextMenu().close();
+ }
+ };
+ leftSubtitleButtonController.needColorizeIcon = false;
+ leftSubtitleButtonController.caption = getMapActivity().getString(R.string.show_on_top_bar);
}
@Override