diff --git a/OsmAnd/res/color/bottom_navigation_color_selector.xml b/OsmAnd/res/color/bottom_navigation_color_selector.xml
new file mode 100644
index 0000000000..d1537744a1
--- /dev/null
+++ b/OsmAnd/res/color/bottom_navigation_color_selector.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/OsmAnd/res/layout/fragment_map_markers_dialog.xml b/OsmAnd/res/layout/fragment_map_markers_dialog.xml
new file mode 100644
index 0000000000..f07f3a3c15
--- /dev/null
+++ b/OsmAnd/res/layout/fragment_map_markers_dialog.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/layout/map_marker_item_new.xml b/OsmAnd/res/layout/map_marker_item_new.xml
index f3531437eb..db101331d0 100644
--- a/OsmAnd/res/layout/map_marker_item_new.xml
+++ b/OsmAnd/res/layout/map_marker_item_new.xml
@@ -4,62 +4,44 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="56dp"
+ android:background="?attr/bg_color"
android:descendantFocusability="blocksDescendants">
-
+ android:background="?attr/selectableItemBackground">
-
-
+ android:textSize="@dimen/default_sub_text_size"
+ android:visibility="gone"/>
-
-
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical|end"
+ android:layout_marginBottom="16dp"
+ android:layout_marginLeft="14dp"
+ android:layout_marginRight="14dp"
+ android:layout_marginTop="16dp"
+ android:background="?attr/selectableItemBackground"
+ android:focusableInTouchMode="true"
+ tools:src="@drawable/ic_overflow_menu_white"/>
-
\ No newline at end of file
+
+
+
+
+
diff --git a/OsmAnd/res/menu/map_markers_bottom_navigation.xml b/OsmAnd/res/menu/map_markers_bottom_navigation.xml
new file mode 100644
index 0000000000..5751b155b0
--- /dev/null
+++ b/OsmAnd/res/menu/map_markers_bottom_navigation.xml
@@ -0,0 +1,12 @@
+
+
diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
index febf7a53ed..b727621a62 100644
--- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
@@ -105,6 +105,36 @@ public class MapMarkersHelper {
result = 31 * result + colorIndex;
return result;
}
+
+ public static int getColorId(int colorIndex) {
+ int colorId;
+ switch (colorIndex) {
+ case 0:
+ colorId = R.color.marker_blue;
+ break;
+ case 1:
+ colorId = R.color.marker_green;
+ break;
+ case 2:
+ colorId = R.color.marker_orange;
+ break;
+ case 3:
+ colorId = R.color.marker_red;
+ break;
+ case 4:
+ colorId = R.color.marker_yellow;
+ break;
+ case 5:
+ colorId = R.color.marker_teal;
+ break;
+ case 6:
+ colorId = R.color.marker_purple;
+ break;
+ default:
+ colorId = R.color.marker_blue;
+ }
+ return colorId;
+ }
}
public MapMarkersHelper(OsmandApplication ctx) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index cebfc913d3..8187f17f61 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -48,6 +48,7 @@ import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.liveupdates.OsmLiveActivity;
+import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
@@ -623,6 +624,18 @@ public class MapActivityActions implements DialogProvider {
return false;
}
}).createItem());
+
+ optionsMenuHelper.addItem(new ItemBuilder().setTitle("New map markers")
+ .setIcon(R.drawable.ic_action_flag_dark)
+ .setListener(new ContextMenuAdapter.ItemClickListener() {
+ @Override
+ public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked) {
+ app.logEvent(mapActivity, "drawer_markers_open");
+ MapActivity.clearPrevActivityIntent();
+ MapMarkersDialogFragment.showInstance(mapActivity);
+ return true;
+ }
+ }).createItem());
} else {
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.waypoints, mapActivity)
.setIcon(R.drawable.ic_action_intermediate)
diff --git a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java
index 4d8c4a35e0..35823dfcba 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java
@@ -43,7 +43,6 @@ import net.osmand.plus.views.DirectionDrawable;
import net.osmand.plus.views.controls.DynamicListView;
import net.osmand.plus.views.controls.ListDividerShape;
import net.osmand.plus.views.controls.StableArrayAdapter;
-import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import java.io.File;
@@ -784,37 +783,7 @@ public class MapMarkerDialogHelper {
}
public static Drawable getMapMarkerIcon(OsmandApplication app, int colorIndex) {
- return app.getIconsCache().getIcon(R.drawable.ic_action_flag_dark, getMapMarkerColorId(colorIndex));
- }
-
- public static int getMapMarkerColorId(int colorIndex) {
- int colorId;
- switch (colorIndex) {
- case 0:
- colorId = R.color.marker_blue;
- break;
- case 1:
- colorId = R.color.marker_green;
- break;
- case 2:
- colorId = R.color.marker_orange;
- break;
- case 3:
- colorId = R.color.marker_red;
- break;
- case 4:
- colorId = R.color.marker_yellow;
- break;
- case 5:
- colorId = R.color.marker_teal;
- break;
- case 6:
- colorId = R.color.marker_purple;
- break;
- default:
- colorId = R.color.marker_blue;
- }
- return colorId;
+ return app.getIconsCache().getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(colorIndex));
}
public void updateLocation(ListView listView, boolean compassChanged) {
@@ -896,7 +865,7 @@ public class MapMarkerDialogHelper {
WptPt wpt = new WptPt();
wpt.lat = marker.getLatitude();
wpt.lon = marker.getLongitude();
- wpt.setColor(mapActivity.getResources().getColor(getMapMarkerColorId(marker.colorIndex)));
+ wpt.setColor(mapActivity.getResources().getColor(MapMarker.getColorId(marker.colorIndex)));
wpt.name = marker.getOnlyName();
//wpt.link = r.getFileName();
//wpt.time = r.getFile().lastModified();
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java
new file mode 100644
index 0000000000..e8263c6cb9
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java
@@ -0,0 +1,143 @@
+package net.osmand.plus.mapmarkers;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.DialogFragment;
+import android.support.v4.app.Fragment;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import net.osmand.Location;
+import net.osmand.data.LatLon;
+import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
+import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.base.MapViewTrackingUtilities;
+import net.osmand.plus.dashboard.DashLocationFragment;
+import net.osmand.plus.mapmarkers.adapters.MapMarkersActiveAdapter;
+import net.osmand.plus.mapmarkers.adapters.MapMarkersActiveAdapter.MapMarkersActiveAdapterListener;
+import net.osmand.util.MapUtils;
+
+public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener {
+
+ private MapMarkersActiveAdapter adapter;
+ private Location location;
+ private Float heading;
+ private boolean locationUpdateStarted;
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ final RecyclerView recyclerView = new RecyclerView(getContext());
+ recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+ final MapActivity mapActivity = (MapActivity) getActivity();
+
+ adapter = new MapMarkersActiveAdapter(mapActivity);
+ adapter.setAdapterListener(new MapMarkersActiveAdapterListener() {
+ @Override
+ public void onItemClick(View view) {
+ int pos = recyclerView.indexOfChild(view);
+ MapMarker marker = adapter.getItem(pos);
+ mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(),
+ 15, marker.getPointDescription(mapActivity), true, marker);
+ MapActivity.launchMapActivityMoveToTop(mapActivity);
+ ((DialogFragment) getParentFragment()).dismiss();
+ }
+ });
+ recyclerView.setAdapter(adapter);
+
+ return recyclerView;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ adapter.setScreenOrientation(DashLocationFragment.getScreenOrientation(getActivity()));
+ startLocationUpdate();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ stopLocationUpdate();
+ }
+
+ @Override
+ public void updateLocation(Location location) {
+ boolean newLocation = this.location == null && location != null;
+ boolean locationChanged = this.location != null && location != null
+ && this.location.getLatitude() != location.getLatitude()
+ && this.location.getLongitude() != location.getLongitude();
+ if (newLocation || locationChanged) {
+ this.location = location;
+ updateLocationUi();
+ }
+ }
+
+ @Override
+ public void updateCompassValue(float value) {
+ // 99 in next line used to one-time initialize arrows (with reference vs. fixed-north direction)
+ // on non-compass devices
+ float lastHeading = heading != null ? heading : 99;
+ heading = value;
+ if (Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
+ updateLocationUi();
+ } else {
+ heading = lastHeading;
+ }
+ }
+
+ private OsmandApplication getMyApplication() {
+ if (getActivity() != null) {
+ return ((MapActivity) getActivity()).getMyApplication();
+ }
+ return null;
+ }
+
+ private void updateLocationUi() {
+ final MapActivity mapActivity = (MapActivity) getActivity();
+ if (mapActivity != null) {
+ mapActivity.getMyApplication().runInUIThread(new Runnable() {
+ @Override
+ public void run() {
+ if (location == null) {
+ location = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
+ }
+ MapViewTrackingUtilities utilities = mapActivity.getMapViewTrackingUtilities();
+ boolean useCenter = !(utilities.isMapLinkedToLocation() && location != null);
+
+ adapter.setUseCenter(useCenter);
+ adapter.setLocation(useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude()));
+ adapter.setHeading(useCenter ? -mapActivity.getMapRotate() : heading);
+ adapter.notifyDataSetChanged();
+ }
+ });
+ }
+ }
+
+ void startLocationUpdate() {
+ OsmandApplication app = getMyApplication();
+ if (app != null && !locationUpdateStarted) {
+ locationUpdateStarted = true;
+ app.getLocationProvider().removeCompassListener(app.getLocationProvider().getNavigationInfo());
+ app.getLocationProvider().addCompassListener(this);
+ app.getLocationProvider().addLocationListener(this);
+ updateLocationUi();
+ }
+ }
+
+ void stopLocationUpdate() {
+ OsmandApplication app = getMyApplication();
+ if (app != null && locationUpdateStarted) {
+ locationUpdateStarted = false;
+ app.getLocationProvider().removeLocationListener(this);
+ app.getLocationProvider().removeCompassListener(this);
+ app.getLocationProvider().addCompassListener(app.getLocationProvider().getNavigationInfo());
+ }
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
new file mode 100644
index 0000000000..4b689e261b
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
@@ -0,0 +1,121 @@
+package net.osmand.plus.mapmarkers;
+
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.design.widget.BottomNavigationView;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v7.widget.Toolbar;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Toast;
+
+import net.osmand.plus.LockableViewPager;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandSettings;
+import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragment {
+
+ public static final String TAG = "MapMarkersDialogFragment";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ OsmandApplication app = getMyApplication();
+ boolean isLightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
+ int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
+ setStyle(STYLE_NO_FRAME, themeId);
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
+ View mainView = inflater.inflate(R.layout.fragment_map_markers_dialog, container);
+
+ Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.map_markers_toolbar);
+ toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
+ toolbar.setNavigationOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+ mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Toast.makeText(getContext(), "Options", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ final LockableViewPager viewPager = mainView.findViewById(R.id.map_markers_view_pager);
+ viewPager.setSwipeLocked(true);
+ final MapMarkersViewPagerAdapter adapter = new MapMarkersViewPagerAdapter(getChildFragmentManager());
+ viewPager.setAdapter(adapter);
+
+ BottomNavigationView bottomNav = mainView.findViewById(R.id.map_markers_bottom_navigation);
+ bottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
+ @Override
+ public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
+ switch (menuItem.getItemId()) {
+ case R.id.action_active:
+ ((MapMarkersActiveFragment) adapter.getItem(0)).startLocationUpdate();
+ viewPager.setCurrentItem(0);
+ return true;
+ case R.id.action_history:
+ ((MapMarkersActiveFragment) adapter.getItem(0)).stopLocationUpdate();
+ viewPager.setCurrentItem(1);
+ return true;
+ }
+ return false;
+ }
+ });
+
+ return mainView;
+ }
+
+ private OsmandApplication getMyApplication() {
+ return (OsmandApplication) getActivity().getApplication();
+ }
+
+ public static boolean showInstance(@NonNull MapActivity mapActivity) {
+ try {
+ if (mapActivity.isActivityDestroyed()) {
+ return false;
+ }
+ MapMarkersDialogFragment fragment = new MapMarkersDialogFragment();
+ fragment.show(mapActivity.getSupportFragmentManager(), TAG);
+ return true;
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+
+ private class MapMarkersViewPagerAdapter extends FragmentPagerAdapter {
+
+ private final List fragments;
+
+ MapMarkersViewPagerAdapter(FragmentManager fm) {
+ super(fm);
+ fragments = Arrays.asList(new MapMarkersActiveFragment(), new MapMarkersHistoryFragment());
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ return fragments.get(position);
+ }
+
+ @Override
+ public int getCount() {
+ return fragments.size();
+ }
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java
new file mode 100644
index 0000000000..1667047172
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java
@@ -0,0 +1,20 @@
+package net.osmand.plus.mapmarkers;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class MapMarkersHistoryFragment extends Fragment {
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ TextView textView = new TextView(getContext());
+ textView.setText("history fragment");
+ return textView;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkerItemViewHolder.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkerItemViewHolder.java
new file mode 100644
index 0000000000..8775a599f9
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkerItemViewHolder.java
@@ -0,0 +1,33 @@
+package net.osmand.plus.mapmarkers.adapters;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import net.osmand.plus.R;
+
+public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
+
+ final ImageView iconDirection;
+ final ImageView iconReorder;
+ final ImageView icon;
+ final TextView title;
+ final TextView distance;
+ final TextView point;
+ final TextView description;
+ final ImageButton options;
+
+ public MapMarkerItemViewHolder(View view) {
+ super(view);
+ iconDirection = (ImageView) view.findViewById(R.id.map_marker_direction_icon);
+ iconReorder = (ImageView) view.findViewById(R.id.map_marker_reorder_icon);
+ icon = (ImageView) view.findViewById(R.id.map_marker_icon);
+ title = (TextView) view.findViewById(R.id.map_marker_title);
+ distance = (TextView) view.findViewById(R.id.map_marker_distance);
+ point = (TextView) view.findViewById(R.id.map_marker_point_text_view);
+ description = (TextView) view.findViewById(R.id.map_marker_description);
+ options = (ImageButton) view.findViewById(R.id.map_marker_options_button);
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
new file mode 100644
index 0000000000..c188105548
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
@@ -0,0 +1,103 @@
+package net.osmand.plus.mapmarkers.adapters;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+
+import net.osmand.data.LatLon;
+import net.osmand.plus.IconsCache;
+import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.dashboard.DashLocationFragment;
+
+import java.util.List;
+
+public class MapMarkersActiveAdapter extends RecyclerView.Adapter {
+
+ private MapActivity mapActivity;
+ private List markers;
+ private MapMarkersActiveAdapterListener listener;
+
+ private LatLon location;
+ private Float heading;
+ private boolean useCenter;
+ private int screenOrientation;
+
+ public MapMarkersActiveAdapter(MapActivity mapActivity) {
+ this.mapActivity = mapActivity;
+ markers = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers();
+ }
+
+ public void setAdapterListener(MapMarkersActiveAdapterListener listener) {
+ this.listener = listener;
+ }
+
+ public void setLocation(LatLon location) {
+ this.location = location;
+ }
+
+ public void setHeading(Float heading) {
+ this.heading = heading;
+ }
+
+ public void setUseCenter(boolean useCenter) {
+ this.useCenter = useCenter;
+ }
+
+ public void setScreenOrientation(int screenOrientation) {
+ this.screenOrientation = screenOrientation;
+ }
+
+ @Override
+ public MapMarkerItemViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
+ View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_new, viewGroup, false);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ listener.onItemClick(view);
+ }
+ });
+ return new MapMarkerItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(MapMarkerItemViewHolder holder, int pos) {
+ IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
+ MapMarker marker = markers.get(pos);
+
+ holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
+ holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ return false;
+ }
+ });
+
+ int color = MapMarker.getColorId(marker.colorIndex);
+ holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, color));
+
+ holder.title.setText(marker.getName(mapActivity));
+
+ DashLocationFragment.updateLocationView(useCenter, location,
+ heading, holder.iconDirection, holder.distance,
+ marker.getLatitude(), marker.getLongitude(),
+ screenOrientation, mapActivity.getMyApplication(), mapActivity);
+ }
+
+ @Override
+ public int getItemCount() {
+ return markers.size();
+ }
+
+ public MapMarker getItem(int position) {
+ return markers.get(position);
+ }
+
+ public interface MapMarkersActiveAdapterListener {
+
+ void onItemClick(View view);
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java
index 78dc836f2f..9cce9c0a6d 100644
--- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java
+++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java
@@ -17,7 +17,6 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.helpers.AndroidUiHelper;
-import net.osmand.plus.helpers.MapMarkerDialogHelper;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.DirectionDrawable;
@@ -251,7 +250,7 @@ public class MapMarkersWidgetsFactory {
} else {
dd = (DirectionDrawable) arrowImg.getDrawable();
}
- dd.setImage(R.drawable.ic_arrow_marker_diretion, MapMarkerDialogHelper.getMapMarkerColorId(marker.colorIndex));
+ dd.setImage(R.drawable.ic_arrow_marker_diretion, MapMarker.getColorId(marker.colorIndex));
if (heading != null && loc != null) {
dd.setAngle(mes[1] - heading + 180 + screenOrientation);
}
@@ -365,7 +364,7 @@ public class MapMarkersWidgetsFactory {
setImageDrawable(map.getMyApplication().getIconsCache()
.getIcon(isNight() ? R.drawable.widget_marker_night : R.drawable.widget_marker_day,
R.drawable.widget_marker_triangle,
- MapMarkerDialogHelper.getMapMarkerColorId(marker.colorIndex)));
+ MapMarker.getColorId(marker.colorIndex)));
cachedMarkerColorIndex = marker.colorIndex;
cachedNightMode = isNight();
res = true;