diff --git a/OsmAnd/res/layout/fragment_direction_indication_dialog.xml b/OsmAnd/res/layout/fragment_direction_indication_dialog.xml
new file mode 100644
index 0000000000..8956511f91
--- /dev/null
+++ b/OsmAnd/res/layout/fragment_direction_indication_dialog.xml
@@ -0,0 +1,366 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml
index a928c35100..1cc118a1f1 100644
--- a/OsmAnd/res/values-large/sizes.xml
+++ b/OsmAnd/res/values-large/sizes.xml
@@ -126,6 +126,9 @@
15dp
84dp
+ 330dp
+ 105dp
+
78dp
15dp
diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml
index aacd678beb..9718ebcbd5 100644
--- a/OsmAnd/res/values/sizes.xml
+++ b/OsmAnd/res/values/sizes.xml
@@ -189,6 +189,9 @@
10dp
56dp
+ 220dp
+ 70dp
+
52dp
10dp
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 03c1a5fe9d..0b91142364 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,10 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ A line connecting your location to locations of the active markers will be shown on the map.
+ One or two arrows indicating the direction to the active markers will be shown on the map.
+ Choose how you\'d like to view the distance to the active markers.
+ Choose how many direction indicators you\'d like to see.
Digits quantity
Right
Left
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index d527ba556a..9d132f9343 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -1315,6 +1315,8 @@ public class OsmandSettings {
public final OsmandPreference USE_MAP_MARKERS = new BooleanPreference("use_map_markers", true).makeGlobal().cache();
+ public final OsmandPreference MARKERS_DISTANCE_INDICATION_ENABLED = new BooleanPreference("markers_distance_indication_enabled", true).makeGlobal();
+
public final CommonPreference MAP_MARKERS_MODE =
new EnumIntPreference<>("map_markers_mode", MapMarkersMode.TOOLBAR, MapMarkersMode.values());
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/DirectionIndicationDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/DirectionIndicationDialogFragment.java
new file mode 100644
index 0000000000..6f0de05412
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/DirectionIndicationDialogFragment.java
@@ -0,0 +1,132 @@
+package net.osmand.plus.mapmarkers;
+
+import android.app.Activity;
+import android.content.res.ColorStateList;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.content.ContextCompat;
+import android.support.v4.widget.CompoundButtonCompat;
+import android.support.v7.widget.Toolbar;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CompoundButton;
+import android.widget.ImageView;
+import android.widget.RadioButton;
+
+import net.osmand.plus.OsmandSettings;
+import net.osmand.plus.OsmandSettings.MapMarkersMode;
+import net.osmand.plus.OsmandSettings.OsmandPreference;
+import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.base.BaseOsmAndDialogFragment;
+
+public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment {
+
+ public final static String TAG = "DirectionIndicationDialogFragment";
+
+ private View mainView;
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ final OsmandSettings settings = getSettings();
+
+ mainView = inflater.inflate(R.layout.fragment_direction_indication_dialog, container);
+
+ Toolbar toolbar = mainView.findViewById(R.id.toolbar);
+ toolbar.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back));
+ toolbar.setNavigationOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+
+ final CompoundButton distanceIndicationToggle = (CompoundButton) mainView.findViewById(R.id.distance_indication_switch);
+ distanceIndicationToggle.setChecked(settings.MARKERS_DISTANCE_INDICATION_ENABLED.get());
+ mainView.findViewById(R.id.distance_indication_row).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ updateChecked(settings.MARKERS_DISTANCE_INDICATION_ENABLED, distanceIndicationToggle);
+ updateSelection();
+ }
+ });
+
+ updateSelection();
+
+ final CompoundButton showArrowsToggle = (CompoundButton) mainView.findViewById(R.id.show_arrows_switch);
+ showArrowsToggle.setChecked(settings.SHOW_ARROWS_TO_FIRST_MARKERS.get());
+ mainView.findViewById(R.id.show_arrows_row).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ updateChecked(settings.SHOW_ARROWS_TO_FIRST_MARKERS, showArrowsToggle);
+ }
+ });
+
+ final CompoundButton showLinesToggle = (CompoundButton) mainView.findViewById(R.id.show_guide_line_switch);
+ showLinesToggle.setChecked(settings.SHOW_LINES_TO_FIRST_MARKERS.get());
+ mainView.findViewById(R.id.show_guide_line_row).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ updateChecked(settings.SHOW_LINES_TO_FIRST_MARKERS, showLinesToggle);
+ }
+ });
+
+ return mainView;
+ }
+
+ @Override
+ protected Drawable getContentIcon(int id) {
+ return getIcon(id, getSettings().isLightContent() ? R.color.icon_color : R.color.ctx_menu_info_text_dark);
+ }
+
+ private MapActivity getMapActivity() {
+ Activity activity = getActivity();
+ if (activity != null && activity instanceof MapActivity) {
+ return (MapActivity) activity;
+ }
+ return null;
+ }
+
+ private void updateChecked(OsmandPreference setting, CompoundButton button) {
+ boolean newState = !setting.get();
+ setting.set(newState);
+ button.setChecked(newState);
+ if (getMapActivity() != null) {
+ getMapActivity().refreshMap();
+ }
+ }
+
+ private void updateSelection() {
+ OsmandSettings settings = getSettings();
+ MapMarkersMode mode = settings.MAP_MARKERS_MODE.get();
+ boolean distanceIndicationEnabled = settings.MARKERS_DISTANCE_INDICATION_ENABLED.get();
+ boolean topBar = mode == MapMarkersMode.TOOLBAR;
+ boolean widget = mode == MapMarkersMode.WIDGETS;
+ updateIcon(R.id.top_bar_icon, R.drawable.ic_action_device_topbar, topBar && distanceIndicationEnabled);
+ updateIcon(R.id.widget_icon, R.drawable.ic_action_device_widget, widget && distanceIndicationEnabled);
+ updateRadioButton(R.id.top_bar_radio_button, topBar, distanceIndicationEnabled);
+ updateRadioButton(R.id.widget_radio_button, widget, distanceIndicationEnabled);
+ }
+
+ private void updateIcon(int imageViewId, int drawableId, boolean active) {
+ ImageView iv = (ImageView) mainView.findViewById(imageViewId);
+ iv.setBackgroundDrawable(active
+ ? getIcon(R.drawable.ic_action_device_top, R.color.dashboard_blue)
+ : getContentIcon(R.drawable.ic_action_device_top));
+ iv.setImageDrawable(active
+ ? getIcon(drawableId, R.color.osmand_orange)
+ : getContentIcon(drawableId));
+ }
+
+ private void updateRadioButton(int radioButtonId, boolean checked, boolean active) {
+ boolean night = !getSettings().isLightContent();
+ RadioButton rb = (RadioButton) mainView.findViewById(radioButtonId);
+ rb.setChecked(checked);
+ int colorId = active ? night ? R.color.osmand_orange : R.color.dashboard_blue
+ : night ? R.color.ctx_menu_info_text_dark : R.color.icon_color;
+ CompoundButtonCompat.setButtonTintList(rb, ColorStateList.valueOf(ContextCompat.getColor(getContext(), colorId)));
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
index d34c5e5356..79da3d63c0 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
@@ -245,10 +245,8 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
@Override
public void showDirectionOnClick() {
if (mapActivity != null) {
- ShowDirectionBottomSheetDialogFragment fragment = new ShowDirectionBottomSheetDialogFragment();
- fragment.setUsedOnMap(false);
- fragment.setListener(createShowDirectionFragmentListener());
- fragment.show(mapActivity.getSupportFragmentManager(), ShowDirectionBottomSheetDialogFragment.TAG);
+ DirectionIndicationDialogFragment fragment = new DirectionIndicationDialogFragment();
+ fragment.show(mapActivity.getSupportFragmentManager(), DirectionIndicationDialogFragment.TAG);
}
}