Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-14 20:46:18 +02:00
commit 86aecd4e6c
52 changed files with 709 additions and 315 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/marker_circle_background_on_map_n"
android:insetBottom="11dp"
android:insetLeft="11dp"
android:insetRight="11dp"
android:insetTop="11dp"/>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/marker_circle_background_p"
android:insetBottom="11dp"
android:insetLeft="11dp"
android:insetRight="11dp"
android:insetTop="11dp">
</inset>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/marker_circle_background_top_bar_p_with_inset" android:state_pressed="true"/>
<item android:drawable="@drawable/marker_circle_background_top_bar_n_with_inset"/>
</selector>

View file

@ -80,11 +80,11 @@
<ImageButton <ImageButton
android:id="@+id/marker_btn_ok" android:id="@+id/marker_btn_ok"
android:contentDescription="@string/shared_string_remove" android:contentDescription="@string/move_to_history"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="48dp" android:layout_height="50dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="@drawable/marker_circle_background_top_bar_with_inset"
android:src="@drawable/ic_action_done"/> tools:src="@drawable/ic_action_marker_passed"/>
<ImageButton <ImageButton
android:id="@+id/marker_btn_more" android:id="@+id/marker_btn_more"
@ -92,7 +92,7 @@
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_overflow_menu_white"/> android:src="@drawable/ic_action_markers_list"/>
</LinearLayout> </LinearLayout>
@ -157,12 +157,12 @@
</LinearLayout> </LinearLayout>
<ImageButton <ImageButton
android:id="@+id/marker_btn_ok_2dn" android:id="@+id/marker_btn_ok_2nd"
android:contentDescription="@string/shared_string_remove" android:contentDescription="@string/move_to_history"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="48dp" android:layout_height="50dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="@drawable/marker_circle_background_top_bar_with_inset"
android:src="@drawable/ic_action_done"/> tools:src="@drawable/ic_action_marker_passed"/>
<ImageButton <ImageButton
android:id="@+id/marker_btn_more_2nd" android:id="@+id/marker_btn_more_2nd"
@ -170,7 +170,7 @@
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_overflow_menu_white"/> android:src="@drawable/ic_action_markers_list"/>
</LinearLayout> </LinearLayout>

View file

@ -51,7 +51,7 @@
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"/> osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>

View file

@ -45,15 +45,15 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<TextView <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/map_marker_title" android:id="@+id/map_marker_title"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textStyle="bold"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:textColor="?android:textColorPrimary"
tools:text="Bloemstraat 179"/> tools:text="Bloemstraat 179"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
@ -61,11 +61,10 @@
android:id="@+id/map_marker_passed_info" android:id="@+id/map_marker_passed_info"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end"
android:textSize="@dimen/default_list_text_size"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="Passed: July 28"/> tools:text="Passed: July 28"/>
</LinearLayout> </LinearLayout>

View file

@ -90,13 +90,14 @@
android:text="@string/show_direction" android:text="@string/show_direction"
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:id="@+id/show_direction_text_view" android:id="@+id/show_direction_text_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:maxLines="1" android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:textSize="@dimen/default_list_text_size"
tools:textColor="@color/map_widget_blue_pressed" tools:textColor="@color/map_widget_blue_pressed"
tools:text="Top bar"/> tools:text="Top bar"/>
</LinearLayout> </LinearLayout>
@ -199,6 +200,7 @@
</LinearLayout> </LinearLayout>
<View <View
android:id="@+id/move_all_to_history_divider"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginBottom="@dimen/measurement_tool_bottom_divider_margin_bottom" android:layout_marginBottom="@dimen/measurement_tool_bottom_divider_margin_bottom"

View file

@ -3,7 +3,6 @@
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/bg_color" android:background="?attr/bg_color"
android:orientation="vertical"> android:orientation="vertical">

View file

@ -208,14 +208,16 @@
tools:background="@drawable/ic_action_device_top" tools:background="@drawable/ic_action_device_top"
tools:src="@drawable/ic_action_device_topbar"/> tools:src="@drawable/ic_action_device_topbar"/>
<TextView <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/top_bar_text" android:id="@+id/top_bar_text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:text="@string/shared_string_topbar" android:text="@string/shared_string_topbar"
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton <RadioButton
android:id="@+id/top_bar_radio_button" android:id="@+id/top_bar_radio_button"
@ -255,14 +257,16 @@
tools:background="@drawable/ic_action_device_top" tools:background="@drawable/ic_action_device_top"
tools:src="@drawable/ic_action_device_widget"/> tools:src="@drawable/ic_action_device_widget"/>
<TextView <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/widget_text" android:id="@+id/widget_text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:text="@string/shared_string_widgets" android:text="@string/shared_string_widgets"
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton <RadioButton
android:id="@+id/widget_radio_button" android:id="@+id/widget_radio_button"
@ -301,14 +305,16 @@
android:layout_marginRight="@dimen/bottom_sheet_icon_margin" android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:background="@drawable/ic_action_device_top"/> tools:background="@drawable/ic_action_device_top"/>
<TextView <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/none_text" android:id="@+id/none_text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:text="@string/shared_string_none" android:text="@string/shared_string_none"
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton <RadioButton
android:id="@+id/none_radio_button" android:id="@+id/none_radio_button"
@ -340,7 +346,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/shared_string_cancel" android:text="@string/shared_string_close"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons" android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"

View file

@ -351,11 +351,11 @@
<ImageButton <ImageButton
android:id="@+id/marker_btn_ok" android:id="@+id/marker_btn_ok"
android:contentDescription="@string/shared_string_remove" android:contentDescription="@string/move_to_history"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="@drawable/marker_circle_background_top_bar_with_inset"
android:src="@drawable/ic_action_done"/> tools:src="@drawable/ic_action_marker_passed"/>
<ImageButton <ImageButton
android:id="@+id/marker_btn_more" android:id="@+id/marker_btn_more"
@ -363,7 +363,7 @@
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_overflow_menu_white"/> android:src="@drawable/ic_action_markers_list"/>
</LinearLayout> </LinearLayout>
@ -433,12 +433,12 @@
</RelativeLayout> </RelativeLayout>
<ImageButton <ImageButton
android:id="@+id/marker_btn_ok_2dn" android:id="@+id/marker_btn_ok_2nd"
android:contentDescription="@string/shared_string_remove" android:contentDescription="@string/move_to_history"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="48dp" android:layout_height="50dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="@drawable/marker_circle_background_top_bar_with_inset"
android:src="@drawable/ic_action_done"/> tools:src="@drawable/ic_action_marker_passed"/>
</LinearLayout> </LinearLayout>

View file

@ -79,15 +79,28 @@
<TextView <TextView
android:id="@+id/waypoint_desc_text" android:id="@+id/waypoint_desc_text"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_weight="1"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/secondary_text_dark" android:textColor="@color/secondary_text_dark"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:visibility="gone"
android:id="@+id/date_group_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout> </LinearLayout>

View file

@ -149,6 +149,11 @@
tools:background="@drawable/marker_circle_background_dark_with_inset" tools:background="@drawable/marker_circle_background_dark_with_inset"
tools:src="@drawable/ic_action_marker_passed"/> tools:src="@drawable/ic_action_marker_passed"/>
<FrameLayout
android:id="@+id/check_box_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CheckBox <CheckBox
android:id="@+id/map_marker_check_box" android:id="@+id/map_marker_check_box"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -157,9 +162,10 @@
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:background="@null"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"/> tools:visibility="visible"/>
</FrameLayout>
</LinearLayout> </LinearLayout>
<View <View

View file

@ -1,17 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:focusable="true"
android:focusableInTouchMode="true"/>
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:id="@+id/name_text_box" android:id="@+id/name_text_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/shared_string_name"
android:paddingEnd="@dimen/bottom_sheet_content_padding" android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding" android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding" android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding" android:paddingStart="@dimen/bottom_sheet_content_padding">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/shared_string_name">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/name_edit_text" android:id="@+id/name_edit_text"

View file

@ -1,8 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:focusable="true"
android:focusableInTouchMode="true"/>
<net.osmand.plus.OsmandTextFieldBoxes <net.osmand.plus.OsmandTextFieldBoxes
android:id="@+id/name_text_box" android:id="@+id/name_text_box"
@ -12,7 +19,7 @@
android:paddingLeft="@dimen/bottom_sheet_content_padding" android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding" android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding" android:paddingStart="@dimen/bottom_sheet_content_padding"
osmand:labelText="@string/shared_string_name"> app:labelText="@string/shared_string_name">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText <studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/name_edit_text" android:id="@+id/name_edit_text"

View file

@ -124,4 +124,7 @@
<dimen name="bottom_sheet_image_text_margin_start">15dp</dimen> <dimen name="bottom_sheet_image_text_margin_start">15dp</dimen>
<dimen name="bottom_sheet_selected_item_title_height">84dp</dimen> <dimen name="bottom_sheet_selected_item_title_height">84dp</dimen>
<dimen name="map_markers_recycler_view_padding_bottom">78dp</dimen>
<dimen name="map_markers_recycler_view_padding_top">15dp</dimen>
</resources> </resources>

View file

@ -188,4 +188,7 @@
<dimen name="measurement_tool_bottom_divider_margin_start">64dp</dimen> <dimen name="measurement_tool_bottom_divider_margin_start">64dp</dimen>
<dimen name="bottom_sheet_image_text_margin_start">10dp</dimen> <dimen name="bottom_sheet_image_text_margin_start">10dp</dimen>
<dimen name="bottom_sheet_selected_item_title_height">56dp</dimen> <dimen name="bottom_sheet_selected_item_title_height">56dp</dimen>
<dimen name="map_markers_recycler_view_padding_bottom">52dp</dimen>
<dimen name="map_markers_recycler_view_padding_top">10dp</dimen>
</resources> </resources>

View file

@ -9,6 +9,10 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="show_map">Show map</string>
<string name="route_is_calculated">Route is calculated</string>
<string name="round_trip">Round trip</string>
<string name="plan_route_no_markers_toast">You must add at least one marker to use this function.</string>
<string name="osn_modify_dialog_error">Exception occurred: note was not modified</string> <string name="osn_modify_dialog_error">Exception occurred: note was not modified</string>
<string name="osn_modify_dialog_title">Modify note</string> <string name="osn_modify_dialog_title">Modify note</string>
<string name="context_menu_item_modify_note">Modify OSM note</string> <string name="context_menu_item_modify_note">Modify OSM note</string>

View file

@ -1280,13 +1280,6 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> MAP_ONLINE_DATA = new BooleanPreference("map_online_data", false).makeGlobal(); public final CommonPreference<Boolean> MAP_ONLINE_DATA = new BooleanPreference("map_online_data", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> SHOW_DESTINATION_ARROW = new BooleanPreference("show_destination_arrow", false).makeProfile();
{
SHOW_DESTINATION_ARROW.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
}
public final CommonPreference<String> CONTOUR_LINES_ZOOM = new StringPreference("contour_lines_zoom", null).makeGlobal().cache(); public final CommonPreference<String> CONTOUR_LINES_ZOOM = new StringPreference("contour_lines_zoom", null).makeGlobal().cache();
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name

View file

@ -49,6 +49,7 @@ import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.liveupdates.OsmLiveActivity; import net.osmand.plus.liveupdates.OsmLiveActivity;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder; import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
@ -365,12 +366,14 @@ public class MapActivityActions implements DialogProvider {
mapActivity.getRoutingHelper().setGpxParams(params); mapActivity.getRoutingHelper().setGpxParams(params);
settings.FOLLOW_THE_GPX_ROUTE.set(result.path); settings.FOLLOW_THE_GPX_ROUTE.set(result.path);
if (!ps.isEmpty()) { if (!ps.isEmpty()) {
Location loc = ps.get(ps.size() - 1); Location startLoc = ps.get(0);
Location finishLoc = ps.get(ps.size() - 1);
TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper(); TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper();
tg.navigateToPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, -1); tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1);
if (tg.getPointToStart() == null) { if (startLoc != finishLoc) {
loc = ps.get(0); tg.setStartPoint(new LatLon(startLoc.getLatitude(), startLoc.getLongitude()), false, null);
tg.setStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, null); } else {
tg.clearStartPoint(false);
} }
} }
} }
@ -496,6 +499,11 @@ public class MapActivityActions implements DialogProvider {
} }
public ApplicationMode getRouteMode(LatLon from) { public ApplicationMode getRouteMode(LatLon from) {
MarkersPlanRouteContext planRouteContext = mapActivity.getMyApplication().getMapMarkersHelper().getPlanRouteContext();
if (planRouteContext.isNavigationFromMarkers() && planRouteContext.getSnappedMode() != ApplicationMode.DEFAULT) {
planRouteContext.setNavigationFromMarkers(false);
return planRouteContext.getSnappedMode();
}
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get(); ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
ApplicationMode selected = settings.APPLICATION_MODE.get(); ApplicationMode selected = settings.APPLICATION_MODE.get();
if (selected != ApplicationMode.DEFAULT) { if (selected != ApplicationMode.DEFAULT) {

View file

@ -414,7 +414,7 @@ public class MapMarkerDialogHelper {
v = mapActivity.getLayoutInflater().inflate(R.layout.map_marker_item, null); v = mapActivity.getLayoutInflater().inflate(R.layout.map_marker_item, null);
} }
updateMapMarkerInfo(mapActivity, v, loc, heading, useCenter, nightMode, screenOrientation, updateMapMarkerInfo(mapActivity, v, loc, heading, useCenter, nightMode, screenOrientation,
selectionMode, helperCallbacks, marker); selectionMode, helperCallbacks, marker, false);
final View more = v.findViewById(R.id.all_points); final View more = v.findViewById(R.id.all_points);
final View move = v.findViewById(R.id.info_move); final View move = v.findViewById(R.id.info_move);
final View remove = v.findViewById(R.id.info_close); final View remove = v.findViewById(R.id.info_close);
@ -467,7 +467,7 @@ public class MapMarkerDialogHelper {
Float heading, boolean useCenter, boolean nightMode, Float heading, boolean useCenter, boolean nightMode,
int screenOrientation, boolean selectionMode, int screenOrientation, boolean selectionMode,
final MapMarkersDialogHelperCallbacks helperCallbacks, final MapMarkersDialogHelperCallbacks helperCallbacks,
final MapMarker marker) { final MapMarker marker, boolean showDateAndGroup) {
TextView text = (TextView) localView.findViewById(R.id.waypoint_text); TextView text = (TextView) localView.findViewById(R.id.waypoint_text);
TextView textShadow = (TextView) localView.findViewById(R.id.waypoint_text_shadow); TextView textShadow = (TextView) localView.findViewById(R.id.waypoint_text_shadow);
TextView textDist = (TextView) localView.findViewById(R.id.waypoint_dist); TextView textDist = (TextView) localView.findViewById(R.id.waypoint_dist);
@ -476,6 +476,7 @@ public class MapMarkerDialogHelper {
TextView waypointDeviation = (TextView) localView.findViewById(R.id.waypoint_deviation); TextView waypointDeviation = (TextView) localView.findViewById(R.id.waypoint_deviation);
TextView descText = (TextView) localView.findViewById(R.id.waypoint_desc_text); TextView descText = (TextView) localView.findViewById(R.id.waypoint_desc_text);
final CheckBox checkBox = (CheckBox) localView.findViewById(R.id.checkbox); final CheckBox checkBox = (CheckBox) localView.findViewById(R.id.checkbox);
TextView dateGroupText = (TextView) localView.findViewById(R.id.date_group_text);
if (text == null || textDist == null || arrow == null || waypointIcon == null if (text == null || textDist == null || arrow == null || waypointIcon == null
|| waypointDeviation == null || descText == null) { || waypointDeviation == null || descText == null) {
@ -538,6 +539,26 @@ public class MapMarkerDialogHelper {
descText.setVisibility(View.GONE); descText.setVisibility(View.GONE);
if (showDateAndGroup) {
Date date = new Date(marker.creationDate);
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
}
month = month.replaceAll("\\.", "");
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
String desc = month + " " + day;
String markerGroupName = marker.groupName;
if (markerGroupName != null) {
if (markerGroupName.equals("")) {
markerGroupName = app.getString(R.string.shared_string_favorites);
}
desc += "" + markerGroupName;
}
dateGroupText.setVisibility(View.VISIBLE);
dateGroupText.setText(desc);
}
if (selectionMode) { if (selectionMode) {
checkBox.setChecked(marker.selected); checkBox.setChecked(marker.selected);
checkBox.setVisibility(View.VISIBLE); checkBox.setVisibility(View.VISIBLE);
@ -824,7 +845,7 @@ public class MapMarkerDialogHelper {
View v = listView.getChildAt(i - listView.getFirstVisiblePosition()); View v = listView.getChildAt(i - listView.getFirstVisiblePosition());
if (obj == marker) { if (obj == marker) {
updateMapMarkerInfo(mapActivity, v, loc, heading, useCenter, nightMode, updateMapMarkerInfo(mapActivity, v, loc, heading, useCenter, nightMode,
screenOrientation, selectionMode, helperCallbacks, marker); screenOrientation, selectionMode, helperCallbacks, marker, false);
} }
} }
} catch (Exception e) { } catch (Exception e) {

View file

@ -78,6 +78,10 @@ public class MenuBuilder {
private CardsRowBuilder onlinePhotoCardsRow; private CardsRowBuilder onlinePhotoCardsRow;
private List<AbstractCard> onlinePhotoCards; private List<AbstractCard> onlinePhotoCards;
private String preferredMapLang;
private String preferredMapAppLang;
private boolean transliterateNames;
public class PlainMenuItem { public class PlainMenuItem {
private int iconId; private int iconId;
private String text; private String text;
@ -185,6 +189,25 @@ public class MenuBuilder {
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
this.app = mapActivity.getMyApplication(); this.app = mapActivity.getMyApplication();
this.plainMenuItems = new LinkedList<>(); this.plainMenuItems = new LinkedList<>();
preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
preferredMapAppLang = preferredMapLang;
if (Algorithms.isEmpty(preferredMapAppLang)) {
preferredMapAppLang = app.getLanguage();
}
transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
}
public String getPreferredMapLang() {
return preferredMapLang;
}
public String getPreferredMapAppLang() {
return preferredMapAppLang;
}
public boolean isTransliterateNames() {
return transliterateNames;
} }
public MapActivity getMapActivity() { public MapActivity getMapActivity() {
@ -661,7 +684,7 @@ public class MenuBuilder {
wikiButton.setPadding(dpToPx(14f), 0, dpToPx(14f), 0); wikiButton.setPadding(dpToPx(14f), 0, dpToPx(14f), 0);
wikiButton.setTextColor(app.getResources() wikiButton.setTextColor(app.getResources()
.getColor(light ? R.color.color_dialog_buttons_light : R.color.color_dialog_buttons_dark)); .getColor(light ? R.color.color_dialog_buttons_light : R.color.color_dialog_buttons_dark));
wikiButton.setText(wiki.getName()); wikiButton.setText(wiki.getName(preferredMapAppLang, transliterateNames));
wikiButton.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL); wikiButton.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
wikiButton.setSingleLine(true); wikiButton.setSingleLine(true);
@ -683,10 +706,6 @@ public class MenuBuilder {
protected boolean processNearstWiki() { protected boolean processNearstWiki() {
if (showNearestWiki && latLon != null) { if (showNearestWiki && latLon != null) {
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
if (Algorithms.isEmpty(preferredLang)) {
preferredLang = app.getLanguage();
}
QuadRect rect = MapUtils.calculateLatLonBbox( QuadRect rect = MapUtils.calculateLatLonBbox(
latLon.getLatitude(), latLon.getLongitude(), 250); latLon.getLatitude(), latLon.getLongitude(), 250);
nearestWiki = app.getResourceManager().searchAmenities( nearestWiki = app.getResourceManager().searchAmenities(
@ -711,16 +730,14 @@ public class MenuBuilder {
} }
}); });
Long id = objectId; Long id = objectId;
if (id != 0) {
List<Amenity> wikiList = new ArrayList<>(); List<Amenity> wikiList = new ArrayList<>();
for (Amenity wiki : nearestWiki) { for (Amenity wiki : nearestWiki) {
String lng = wiki.getContentLanguage("content", preferredLang, "en"); String lng = wiki.getContentLanguage("content", preferredMapAppLang, "en");
if (wiki.getId().equals(id) || (!lng.equals("en") && !lng.equals(preferredLang))) { if (wiki.getId().equals(id) || (!lng.equals("en") && !lng.equals(preferredMapAppLang))) {
wikiList.add(wiki); wikiList.add(wiki);
} }
} }
nearestWiki.removeAll(wikiList); nearestWiki.removeAll(wikiList);
}
return true; return true;
} }
return false; return false;

View file

@ -119,6 +119,18 @@ public abstract class MenuController extends BaseMenuController {
this.builder.setLight(isLight()); this.builder.setLight(isLight());
} }
public String getPreferredMapLang() {
return builder.getPreferredMapLang();
}
public String getPreferredMapAppLang() {
return builder.getPreferredMapAppLang();
}
public boolean isTransliterateNames() {
return builder.isTransliterateNames();
}
public void setMapContextMenu(MapContextMenu mapContextMenu) { public void setMapContextMenu(MapContextMenu mapContextMenu) {
this.mapContextMenu = mapContextMenu; this.mapContextMenu = mapContextMenu;
builder.setMapContextMenu(mapContextMenu); builder.setMapContextMenu(mapContextMenu);

View file

@ -278,10 +278,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
public void buildInternal(View view) { public void buildInternal(View view) {
boolean hasWiki = false; boolean hasWiki = false;
MapPoiTypes poiTypes = app.getPoiTypes(); MapPoiTypes poiTypes = app.getPoiTypes();
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); String preferredLang = getPreferredMapAppLang();
if (Algorithms.isEmpty(preferredLang)) {
preferredLang = app.getLanguage();
}
List<AmenityInfoRow> infoRows = new LinkedList<>(); List<AmenityInfoRow> infoRows = new LinkedList<>();
List<AmenityInfoRow> descriptions = new LinkedList<>(); List<AmenityInfoRow> descriptions = new LinkedList<>();

View file

@ -11,7 +11,6 @@ import net.osmand.data.TransportStop;
import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiFilter; import net.osmand.osm.PoiFilter;
import net.osmand.osm.PoiType; import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
@ -84,7 +83,7 @@ public class AmenityMenuController extends MenuController {
return getLeftIconId(amenity); return getLeftIconId(amenity);
} }
public static int getLeftIconId(Amenity amenity) { private static int getLeftIconId(Amenity amenity) {
String id = null; String id = null;
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType()); PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
if (st != null) { if (st != null) {
@ -107,8 +106,9 @@ public class AmenityMenuController extends MenuController {
@Override @Override
public String getNameStr() { public String getNameStr() {
OsmandSettings settings = getMapActivity().getMyApplication().getSettings(); return amenity.getName(
return amenity.getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get()); amenity.getType().isWiki() ? getPreferredMapAppLang() : getPreferredMapLang(),
isTransliterateNames());
} }
@Override @Override

View file

@ -62,7 +62,7 @@ public class RenderedObjectMenuController extends MenuController {
if (!Algorithms.isEmpty(renderedObject.getName()) && !isStartingWithRTLChar(renderedObject.getName())) { if (!Algorithms.isEmpty(renderedObject.getName()) && !isStartingWithRTLChar(renderedObject.getName())) {
return renderedObject.getName(); return renderedObject.getName();
} else if (renderedObject.getTags().size() > 0) { } else if (renderedObject.getTags().size() > 0) {
String lang = getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get().toLowerCase(); String lang = getPreferredMapLang().toLowerCase();
String name = ""; String name = "";
if (!Algorithms.isEmpty(lang)) { if (!Algorithms.isEmpty(lang)) {
name = renderedObject.getTags().get("name:" + lang); name = renderedObject.getTags().get("name:" + lang);

View file

@ -59,7 +59,14 @@ public class HistoryMarkerMenuBottomSheetDialogFragment extends BottomSheetDialo
long markerVisitedDate = arguments.getLong(MARKER_VISITED_DATE); long markerVisitedDate = arguments.getLong(MARKER_VISITED_DATE);
((TextView) mainView.findViewById(R.id.map_marker_title)).setText(markerName); ((TextView) mainView.findViewById(R.id.map_marker_title)).setText(markerName);
((ImageView) mainView.findViewById(R.id.map_marker_icon)).setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(markerColorIndex))); ((ImageView) mainView.findViewById(R.id.map_marker_icon)).setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(markerColorIndex)));
((TextView) mainView.findViewById(R.id.map_marker_passed_info)).setText(getString(R.string.passed, new SimpleDateFormat("MMM dd", Locale.getDefault()).format(new Date(markerVisitedDate)))); Date date = new Date(markerVisitedDate);
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
}
month = month.replaceAll("\\.", "");
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
((TextView) mainView.findViewById(R.id.map_marker_passed_info)).setText(getString(R.string.passed, month + " " + day));
mainView.findViewById(R.id.make_active_row).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.make_active_row).setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -127,7 +127,7 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
convertView = getMapActivity().getLayoutInflater().inflate(R.layout.map_marker_item, null); convertView = getMapActivity().getLayoutInflater().inflate(R.layout.map_marker_item, null);
} }
MapMarkerDialogHelper.updateMapMarkerInfo(getContext(), convertView, loc, heading, MapMarkerDialogHelper.updateMapMarkerInfo(getContext(), convertView, loc, heading,
useCenter, nightMode, screenOrientation, false, null, marker); useCenter, nightMode, screenOrientation, false, null, marker, true);
final View remove = convertView.findViewById(R.id.info_close); final View remove = convertView.findViewById(R.id.info_close);
remove.setVisibility(View.GONE); remove.setVisibility(View.GONE);
AndroidUtils.setListItemBackground(getMapActivity(), convertView, nightMode); AndroidUtils.setListItemBackground(getMapActivity(), convertView, nightMode);

View file

@ -11,7 +11,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
@ -19,6 +18,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener; import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.plus.dashboard.DashLocationFragment;
@ -40,8 +40,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final RecyclerView recyclerView = new RecyclerView(getContext()); final RecyclerView recyclerView = new RecyclerView(getContext());
final MapActivity mapActivity = (MapActivity) getActivity(); final MapActivity mapActivity = (MapActivity) getActivity();
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setClipToPadding(false); recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

@ -16,6 +16,7 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import net.osmand.plus.LockableViewPager; import net.osmand.plus.LockableViewPager;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
@ -38,6 +39,10 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
public static final String TAG = "MapMarkersDialogFragment"; public static final String TAG = "MapMarkersDialogFragment";
private static final int ACTIVE_MARKERS_POSITION = 0;
private static final int GROUPS_POSITION = 1;
private static final int HISTORY_MARKERS_POSITION = 2;
private MapMarkersActiveFragment activeFragment; private MapMarkersActiveFragment activeFragment;
private MapMarkersGroupsFragment groupsFragment; private MapMarkersGroupsFragment groupsFragment;
private MapMarkersHistoryFragment historyFragment; private MapMarkersHistoryFragment historyFragment;
@ -120,6 +125,11 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
public void onClick(View view) { public void onClick(View view) {
OptionsBottomSheetDialogFragment fragment = new OptionsBottomSheetDialogFragment(); OptionsBottomSheetDialogFragment fragment = new OptionsBottomSheetDialogFragment();
fragment.setListener(createOptionsFragmentListener()); fragment.setListener(createOptionsFragmentListener());
Bundle args = new Bundle();
int pos = viewPager.getCurrentItem();
args.putBoolean(OptionsBottomSheetDialogFragment.SHOW_SORT_BY_ROW, pos == ACTIVE_MARKERS_POSITION);
args.putBoolean(OptionsBottomSheetDialogFragment.SHOW_MOVE_ALL_TO_HISTORY_ROW, pos != HISTORY_MARKERS_POSITION);
fragment.setArguments(args);
fragment.show(getChildFragmentManager(), OptionsBottomSheetDialogFragment.TAG); fragment.show(getChildFragmentManager(), OptionsBottomSheetDialogFragment.TAG);
} }
}); });
@ -140,36 +150,36 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
switch (menuItem.getItemId()) { switch (menuItem.getItemId()) {
case R.id.action_active: case R.id.action_active:
activeFragment.startLocationUpdate(); activeFragment.startLocationUpdate();
if (viewPager.getCurrentItem() != 0) { groupsFragment.stopLocationUpdate();
if (viewPager.getCurrentItem() != ACTIVE_MARKERS_POSITION) {
hideSnackbar(); hideSnackbar();
activeFragment.updateAdapter(); activeFragment.updateAdapter();
historyFragment.hideSnackbar(); historyFragment.hideSnackbar();
groupsFragment.hideSnackbar(); groupsFragment.hideSnackbar();
} }
viewPager.setCurrentItem(0); viewPager.setCurrentItem(ACTIVE_MARKERS_POSITION);
optionsButton.setVisibility(View.VISIBLE);
return true; return true;
case R.id.action_groups: case R.id.action_groups:
activeFragment.stopLocationUpdate(); activeFragment.stopLocationUpdate();
if (viewPager.getCurrentItem() != 1) { groupsFragment.startLocationUpdate();
if (viewPager.getCurrentItem() != GROUPS_POSITION) {
hideSnackbar(); hideSnackbar();
groupsFragment.updateAdapter(); groupsFragment.updateAdapter();
activeFragment.hideSnackbar(); activeFragment.hideSnackbar();
historyFragment.hideSnackbar(); historyFragment.hideSnackbar();
} }
viewPager.setCurrentItem(1); viewPager.setCurrentItem(GROUPS_POSITION);
optionsButton.setVisibility(View.GONE);
return true; return true;
case R.id.action_history: case R.id.action_history:
activeFragment.stopLocationUpdate(); activeFragment.stopLocationUpdate();
if (viewPager.getCurrentItem() != 2) { groupsFragment.stopLocationUpdate();
if (viewPager.getCurrentItem() != HISTORY_MARKERS_POSITION) {
hideSnackbar(); hideSnackbar();
historyFragment.updateAdapter(); historyFragment.updateAdapter();
groupsFragment.hideSnackbar(); groupsFragment.hideSnackbar();
activeFragment.hideSnackbar(); activeFragment.hideSnackbar();
} }
viewPager.setCurrentItem(2); viewPager.setCurrentItem(HISTORY_MARKERS_POSITION);
optionsButton.setVisibility(View.GONE);
return true; return true;
} }
return false; return false;
@ -190,48 +200,75 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
@Override @Override
public void sortByOnClick() { public void sortByOnClick() {
if (mapActivity != null) {
OrderByBottomSheetDialogFragment fragment = new OrderByBottomSheetDialogFragment(); OrderByBottomSheetDialogFragment fragment = new OrderByBottomSheetDialogFragment();
fragment.setListener(createOrderByFragmentListener()); fragment.setListener(createOrderByFragmentListener());
fragment.show(mapActivity.getSupportFragmentManager(), OrderByBottomSheetDialogFragment.TAG); fragment.show(mapActivity.getSupportFragmentManager(), OrderByBottomSheetDialogFragment.TAG);
} }
}
@Override @Override
public void showDirectionOnClick() { public void showDirectionOnClick() {
if (mapActivity != null) {
ShowDirectionBottomSheetDialogFragment fragment = new ShowDirectionBottomSheetDialogFragment(); ShowDirectionBottomSheetDialogFragment fragment = new ShowDirectionBottomSheetDialogFragment();
fragment.setListener(createShowDirectionFragmentListener()); fragment.setListener(createShowDirectionFragmentListener());
fragment.show(mapActivity.getSupportFragmentManager(), ShowDirectionBottomSheetDialogFragment.TAG); fragment.show(mapActivity.getSupportFragmentManager(), ShowDirectionBottomSheetDialogFragment.TAG);
} }
}
@Override @Override
public void coordinateInputOnClick() { public void coordinateInputOnClick() {
if (mapActivity != null) {
CoordinateInputDialogFragment.showInstance(mapActivity); CoordinateInputDialogFragment.showInstance(mapActivity);
} }
}
@Override @Override
public void buildRouteOnClick() { public void buildRouteOnClick() {
if (mapActivity != null) {
if (mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers().isEmpty()) {
Toast.makeText(mapActivity, getString(R.string.plan_route_no_markers_toast), Toast.LENGTH_SHORT).show();
} else {
PlanRouteFragment.showInstance(mapActivity); PlanRouteFragment.showInstance(mapActivity);
dismiss(); dismiss();
} }
}
}
@Override @Override
public void saveAsNewTrackOnClick() { public void saveAsNewTrackOnClick() {
if (mapActivity != null) {
if (mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers().isEmpty()) {
Toast.makeText(mapActivity, getString(R.string.plan_route_no_markers_toast), Toast.LENGTH_SHORT).show();
} else {
SaveAsTrackBottomSheetDialogFragment fragment = new SaveAsTrackBottomSheetDialogFragment(); SaveAsTrackBottomSheetDialogFragment fragment = new SaveAsTrackBottomSheetDialogFragment();
fragment.setListener(createSaveAsTrackFragmentListener()); fragment.setListener(createSaveAsTrackFragmentListener());
fragment.show(mapActivity.getSupportFragmentManager(), SaveAsTrackBottomSheetDialogFragment.TAG); fragment.show(mapActivity.getSupportFragmentManager(), SaveAsTrackBottomSheetDialogFragment.TAG);
} }
}
}
@Override @Override
public void moveAllToHistoryOnClick() { public void moveAllToHistoryOnClick() {
if (mapActivity != null) {
final MapMarkersHelper helper = mapActivity.getMyApplication().getMapMarkersHelper(); final MapMarkersHelper helper = mapActivity.getMyApplication().getMapMarkersHelper();
final List<MapMarkersHelper.MapMarker> markers = new ArrayList<>(helper.getMapMarkers()); final List<MapMarkersHelper.MapMarker> markers = new ArrayList<>(helper.getMapMarkers());
helper.moveAllActiveMarkersToHistory(); helper.moveAllActiveMarkersToHistory();
if (viewPager.getCurrentItem() == ACTIVE_MARKERS_POSITION) {
activeFragment.updateAdapter(); activeFragment.updateAdapter();
} else {
groupsFragment.updateAdapter();
}
snackbar = Snackbar.make(viewPager, R.string.all_markers_moved_to_history, Snackbar.LENGTH_LONG) snackbar = Snackbar.make(viewPager, R.string.all_markers_moved_to_history, Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() { .setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
helper.restoreMarkersFromHistory(markers); helper.restoreMarkersFromHistory(markers);
if (viewPager.getCurrentItem() == ACTIVE_MARKERS_POSITION) {
activeFragment.updateAdapter(); activeFragment.updateAdapter();
} else {
groupsFragment.updateAdapter();
}
} }
}); });
View snackBarView = snackbar.getView(); View snackBarView = snackbar.getView();
@ -239,6 +276,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark)); tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
}
}; };
} }
@ -252,6 +290,8 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
mapActivity.getMapLayers().getMapWidgetRegistry().updateMapMarkersMode(mapActivity); mapActivity.getMapLayers().getMapWidgetRegistry().updateMapMarkersMode(mapActivity);
activeFragment.setShowDirectionEnabled(showDirectionEnabled); activeFragment.setShowDirectionEnabled(showDirectionEnabled);
activeFragment.updateAdapter(); activeFragment.updateAdapter();
groupsFragment.updateAdapter();
historyFragment.updateAdapter();
} }
}; };
} }

View file

@ -20,7 +20,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
@ -56,10 +55,16 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
final MapActivity mapActivity = (MapActivity) getActivity(); final MapActivity mapActivity = (MapActivity) getActivity();
final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent(); final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
final RecyclerView recyclerView = new RecyclerView(getContext()); final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setClipToPadding(false); recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
compassUpdateAllowed = newState == RecyclerView.SCROLL_STATE_IDLE;
}
});
backgroundPaint.setColor(ContextCompat.getColor(getActivity(), night ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light)); backgroundPaint.setColor(ContextCompat.getColor(getActivity(), night ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light));
backgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE); backgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE);

View file

@ -20,7 +20,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -75,8 +74,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
} }
final RecyclerView recyclerView = new RecyclerView(getContext()); final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setClipToPadding(false); recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

@ -41,6 +41,8 @@ public class MarkersPlanRouteContext {
private boolean progressBarVisible; private boolean progressBarVisible;
private boolean fragmentVisible; private boolean fragmentVisible;
private boolean markersListOpened; private boolean markersListOpened;
private boolean adjustMapOnStart = true;
private boolean navigationFromMarkers;
Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedToRoadPoints() { Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedToRoadPoints() {
return snappedToRoadPoints; return snappedToRoadPoints;
@ -50,7 +52,7 @@ public class MarkersPlanRouteContext {
return snapTrkSegment; return snapTrkSegment;
} }
ApplicationMode getSnappedMode() { public ApplicationMode getSnappedMode() {
return snappedMode; return snappedMode;
} }
@ -90,12 +92,28 @@ public class MarkersPlanRouteContext {
this.markersListOpened = markersListOpened; this.markersListOpened = markersListOpened;
} }
public boolean isAdjustMapOnStart() {
return adjustMapOnStart;
}
public void setAdjustMapOnStart(boolean adjustMapOnStart) {
this.adjustMapOnStart = adjustMapOnStart;
}
public boolean isNavigationFromMarkers() {
return navigationFromMarkers;
}
public void setNavigationFromMarkers(boolean navigationFromMarkers) {
this.navigationFromMarkers = navigationFromMarkers;
}
public MarkersPlanRouteContext(OsmandApplication app) { public MarkersPlanRouteContext(OsmandApplication app) {
this.app = app; this.app = app;
} }
void cancelSnapToRoad() { void cancelSnapToRoad() {
listener.hideProgressBar(); listener.hideProgressBar(true);
snapToRoadPairsToCalculate.clear(); snapToRoadPairsToCalculate.clear();
if (calculationProgress != null) { if (calculationProgress != null) {
calculationProgress.isCancelled = true; calculationProgress.isCancelled = true;
@ -132,11 +150,7 @@ public class MarkersPlanRouteContext {
} }
} }
void recreateSnapTrkSegment() { void recreateSnapTrkSegment(boolean adjustMap) {
recreateSnapTrkSegment(true);
}
private void recreateSnapTrkSegment(boolean adjustMap) {
snapTrkSegment.points.clear(); snapTrkSegment.points.clear();
List<WptPt> points = getPointsToCalculate(); List<WptPt> points = getPointsToCalculate();
if (snappedMode == ApplicationMode.DEFAULT) { if (snappedMode == ApplicationMode.DEFAULT) {
@ -249,7 +263,7 @@ public class MarkersPlanRouteContext {
app.runInUIThread(new Runnable() { app.runInUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
listener.hideProgressBar(); listener.hideProgressBar(false);
} }
}); });
} }
@ -265,7 +279,7 @@ public class MarkersPlanRouteContext {
void updateProgress(int progress); void updateProgress(int progress);
void hideProgressBar(); void hideProgressBar(boolean canceled);
void refresh(); void refresh();

View file

@ -26,14 +26,26 @@ import net.osmand.plus.helpers.AndroidUiHelper;
public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment { public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment {
public final static String TAG = "OptionsBottomSheetDialogFragment"; public final static String TAG = "OptionsBottomSheetDialogFragment";
public final static String SHOW_SORT_BY_ROW = "show_sort_by_row";
public final static String SHOW_MOVE_ALL_TO_HISTORY_ROW = "show_move_to_history_row";
private MarkerOptionsFragmentListener listener; private MarkerOptionsFragmentListener listener;
private boolean portrait; private boolean portrait;
private boolean showSortBy;
private boolean showMoveAllToHistory;
public void setListener(MarkerOptionsFragmentListener listener) { public void setListener(MarkerOptionsFragmentListener listener) {
this.listener = listener; this.listener = listener;
} }
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
showSortBy = args == null || args.getBoolean(SHOW_SORT_BY_ROW, true);
showMoveAllToHistory = args == null || args.getBoolean(SHOW_MOVE_ALL_TO_HISTORY_ROW, true);
}
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -76,7 +88,11 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
((TextView) mainView.findViewById(R.id.show_direction_text_view)).setTextColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.color_dialog_buttons_dark : R.color.map_widget_blue_pressed)); ((TextView) mainView.findViewById(R.id.show_direction_text_view)).setTextColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.color_dialog_buttons_dark : R.color.map_widget_blue_pressed));
((TextView) mainView.findViewById(R.id.show_direction_text_view)).setText(getMyApplication().getSettings().MAP_MARKERS_MODE.get().toHumanString(getActivity())); ((TextView) mainView.findViewById(R.id.show_direction_text_view)).setText(getMyApplication().getSettings().MAP_MARKERS_MODE.get().toHumanString(getActivity()));
mainView.findViewById(R.id.sort_by_row).setOnClickListener(new View.OnClickListener() { View sortByRow = mainView.findViewById(R.id.sort_by_row);
if (!showSortBy) {
sortByRow.setVisibility(View.GONE);
} else {
sortByRow.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (listener != null) { if (listener != null) {
@ -85,6 +101,7 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
dismiss(); dismiss();
} }
}); });
}
mainView.findViewById(R.id.show_direction_row).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.show_direction_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -121,7 +138,12 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
dismiss(); dismiss();
} }
}); });
mainView.findViewById(R.id.move_all_to_history_row).setOnClickListener(new View.OnClickListener() { View moveAllToHistoryRow = mainView.findViewById(R.id.move_all_to_history_row);
if (!showMoveAllToHistory) {
mainView.findViewById(R.id.move_all_to_history_divider).setVisibility(View.GONE);
moveAllToHistoryRow.setVisibility(View.GONE);
} else {
moveAllToHistoryRow.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (listener != null) { if (listener != null) {
@ -130,6 +152,7 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
dismiss(); dismiss();
} }
}); });
}
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

View file

@ -7,6 +7,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
@ -62,6 +63,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT; import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
public class PlanRouteFragment extends Fragment implements OsmAndLocationListener { public class PlanRouteFragment extends Fragment implements OsmAndLocationListener {
@ -108,9 +110,19 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
} }
@Override @Override
public void hideProgressBar() { public void hideProgressBar(boolean canceled) {
mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE); mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE);
planRouteContext.setProgressBarVisible(false); planRouteContext.setProgressBarVisible(false);
if (!canceled && portrait && planRouteContext.isMarkersListOpened()) {
Snackbar.make(mainView, getString(R.string.route_is_calculated) + ":", Snackbar.LENGTH_LONG)
.setAction(R.string.show_map, new View.OnClickListener() {
@Override
public void onClick(View view) {
showHideMarkersList();
}
})
.show();
}
} }
@Override @Override
@ -268,7 +280,12 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
private int toPosition; private int toPosition;
@Override @Override
public void onItemClick(View view) { public void onDisableRoundTripClick() {
roundTripOnClick();
}
@Override
public void onCheckBoxClick(View view) {
int pos = markersRv.getChildAdapterPosition(view); int pos = markersRv.getChildAdapterPosition(view);
if (pos == RecyclerView.NO_POSITION) { if (pos == RecyclerView.NO_POSITION) {
return; return;
@ -282,10 +299,26 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
marker.selected = !marker.selected; marker.selected = !marker.selected;
markersHelper.updateMapMarker(marker, false); markersHelper.updateMapMarker(marker, false);
} }
adapter.calculateStartAndFinishPos(); adapter.reloadData();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
updateSelectButton(); updateSelectButton();
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment(false);
}
@Override
public void onItemClick(View v) {
int pos = markersRv.getChildAdapterPosition(v);
if (pos == RecyclerView.NO_POSITION) {
return;
}
Object item = adapter.getItem(pos);
if (item instanceof Location) {
Location loc = (Location) item;
moveMapToPosition(loc.getLatitude(), loc.getLongitude());
} else if (item instanceof MapMarker) {
MapMarker marker = (MapMarker) item;
moveMapToPosition(marker.getLatitude(), marker.getLongitude());
}
} }
@Override @Override
@ -297,23 +330,23 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override @Override
public void onDragEnded(RecyclerView.ViewHolder holder) { public void onDragEnded(RecyclerView.ViewHolder holder) {
toPosition = holder.getAdapterPosition(); toPosition = holder.getAdapterPosition();
if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) { if (toPosition >= 0 && fromPosition >= 0) {
mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded(); mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded();
mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
mapActivity.refreshMap(); mapActivity.refreshMap();
adapter.calculateStartAndFinishPos(); adapter.reloadData();
try { try {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} catch (Exception e) { } catch (Exception e) {
// to avoid crash because of: // to avoid crash because of:
// java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling // java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
} }
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment(false);
} }
} }
}); });
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; markersRv.setPadding(0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_top),
markersRv.setPadding(0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 10 : 15), 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 8 : 12)); 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
markersRv.setClipToPadding(false); markersRv.setClipToPadding(false);
markersRv.setLayoutManager(new LinearLayoutManager(getContext())); markersRv.setLayoutManager(new LinearLayoutManager(getContext()));
markersRv.setAdapter(adapter); markersRv.setAdapter(adapter);
@ -398,6 +431,18 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance); return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
} }
private void moveMapToPosition(double lat, double lon) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
OsmandMapTileView view = mapActivity.getMapView();
view.getAnimatedDraggingThread().startMoving(lat, lon, view.getZoom(), true);
if (planRouteContext.isMarkersListOpened()) {
planRouteContext.setAdjustMapOnStart(false);
showHideMarkersList();
}
}
}
private SnapToRoadFragmentListener createSnapToRoadFragmentListener() { private SnapToRoadFragmentListener createSnapToRoadFragmentListener() {
return new SnapToRoadFragmentListener() { return new SnapToRoadFragmentListener() {
@Override @Override
@ -408,13 +453,17 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override @Override
public void onApplicationModeItemClick(ApplicationMode mode) { public void onApplicationModeItemClick(ApplicationMode mode) {
if (planRouteContext.getSnappedMode() != mode) { if (planRouteContext.getSnappedMode() != mode) {
boolean defaultMode = mode == ApplicationMode.DEFAULT;
MapMarkersLayer layer = getMapMarkersLayer(); MapMarkersLayer layer = getMapMarkersLayer();
if (layer != null) { if (layer != null) {
layer.setDefaultAppMode(mode == ApplicationMode.DEFAULT); layer.setDefaultAppMode(defaultMode);
}
if (defaultMode) {
planRouteContext.cancelSnapToRoad();
} }
planRouteContext.getSnappedToRoadPoints().clear(); planRouteContext.getSnappedToRoadPoints().clear();
planRouteContext.setSnappedMode(mode); planRouteContext.setSnappedMode(mode);
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment(false);
setupAppModesBtn(); setupAppModesBtn();
} }
} }
@ -475,6 +524,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
targetPointsHelper.clearStartPoint(false); targetPointsHelper.clearStartPoint(false);
targetPointsHelper.clearPointToNavigate(false); targetPointsHelper.clearPointToNavigate(false);
} }
planRouteContext.setNavigationFromMarkers(true);
dismiss(); dismiss();
mapActivity.getMapLayers().getMapControlsLayer().doRoute(hasTargets); mapActivity.getMapLayers().getMapControlsLayer().doRoute(hasTargets);
} }
@ -482,11 +532,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override @Override
public void makeRoundTripOnClick() { public void makeRoundTripOnClick() {
if (mapActivity != null) { roundTripOnClick();
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
settings.ROUTE_MAP_MARKERS_ROUND_TRIP.set(!settings.ROUTE_MAP_MARKERS_ROUND_TRIP.get());
planRouteContext.recreateSnapTrkSegment();
}
} }
@Override @Override
@ -507,13 +553,25 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
markersHelper.reverseActiveMarkersOrder(); markersHelper.reverseActiveMarkersOrder();
adapter.reloadData(); adapter.reloadData();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment(false);
} }
} }
}; };
} }
private void roundTripOnClick() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
settings.ROUTE_MAP_MARKERS_ROUND_TRIP.set(!settings.ROUTE_MAP_MARKERS_ROUND_TRIP.get());
adapter.reloadData();
adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment(false);
}
}
private void selectAllOnClick() { private void selectAllOnClick() {
boolean adjustMap = false;
int activeMarkersCount = markersHelper.getMapMarkers().size(); int activeMarkersCount = markersHelper.getMapMarkers().size();
if (selectedCount == activeMarkersCount && markersHelper.isStartFromMyLocation()) { if (selectedCount == activeMarkersCount && markersHelper.isStartFromMyLocation()) {
markersHelper.deselectAllActiveMarkers(); markersHelper.deselectAllActiveMarkers();
@ -523,10 +581,11 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
markersHelper.selectAllActiveMarkers(); markersHelper.selectAllActiveMarkers();
markersHelper.setStartFromMyLocation(true); markersHelper.setStartFromMyLocation(true);
selectedCount = activeMarkersCount; selectedCount = activeMarkersCount;
adjustMap = true;
} }
adapter.calculateStartAndFinishPos(); adapter.reloadData();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment(adjustMap);
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
mapActivity.refreshMap(); mapActivity.refreshMap();
@ -575,12 +634,11 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
OsmandMapTileView tileView = mapActivity.getMapView(); OsmandMapTileView tileView = mapActivity.getMapView();
previousMapPosition = tileView.getMapPosition(); previousMapPosition = tileView.getMapPosition();
if (!portrait) { tileView.setMapPosition(portrait ? MIDDLE_TOP_CONSTANT : LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
tileView.setMapPosition(LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
}
selectedCount = mapActivity.getMyApplication().getMapMarkersHelper().getSelectedMarkersCount(); selectedCount = mapActivity.getMyApplication().getMapMarkersHelper().getSelectedMarkersCount();
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment(planRouteContext.isAdjustMapOnStart());
planRouteContext.setAdjustMapOnStart(true);
mapActivity.refreshMap(); mapActivity.refreshMap();
updateSelectButton(); updateSelectButton();
} }
@ -729,6 +787,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
mapActivity.getMapLayers().getMapMarkersLayer().setRoute(planRouteContext.getSnapTrkSegment()); mapActivity.getMapLayers().getMapMarkersLayer().setRoute(planRouteContext.getSnapTrkSegment());
mapActivity.refreshMap();
if (adjustMap) { if (adjustMap) {
showRouteOnMap(planRouteContext.getSnapTrkSegment().points); showRouteOnMap(planRouteContext.getSnapTrkSegment().points);
} }
@ -767,7 +826,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
int tileBoxHeightPx = 0; int tileBoxHeightPx = 0;
if (portrait) { if (portrait) {
tileBoxHeightPx = 3 * (tb.getPixHeight() - mainView.getHeight() - toolbarHeight) / 4; tileBoxHeightPx = 3 * (tb.getPixHeight() - toolbarHeight) / 4;
} else { } else {
tileBoxWidthPx = tb.getPixWidth() - mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_land_width); tileBoxWidthPx = tb.getPixWidth() - mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_land_width);
} }
@ -866,7 +925,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res); mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res);
adapter.reloadData(); adapter.reloadData();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment(false);
} }
}.execute(); }.execute();
} }

View file

@ -1,6 +1,7 @@
package net.osmand.plus.mapmarkers; package net.osmand.plus.mapmarkers;
import android.app.Activity; import android.app.Activity;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -26,6 +27,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BottomSheetDialogFragment; import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFragment { public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFragment {
@ -208,6 +210,7 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
int iconBgColor = check ? R.color.dashboard_blue : R.color.on_map_icon_color; int iconBgColor = check ? R.color.dashboard_blue : R.color.on_map_icon_color;
int iconColor = check ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue; int iconColor = check ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue;
int textColor = ContextCompat.getColor(getContext(), check ? (night ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue) : night ? R.color.color_white : R.color.color_black); int textColor = ContextCompat.getColor(getContext(), check ? (night ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue) : night ? R.color.color_white : R.color.color_black);
Typeface typeface = FontCache.getFont(getContext(), check ? "fonts/Roboto-Medium.ttf" : "fonts/Roboto-Regular.ttf");
switch (mode) { switch (mode) {
case TOOLBAR: case TOOLBAR:
((RadioButton) mainView.findViewById(R.id.top_bar_radio_button)).setChecked(check); ((RadioButton) mainView.findViewById(R.id.top_bar_radio_button)).setChecked(check);
@ -217,7 +220,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else { } else {
mainView.findViewById(R.id.top_bar_row_frame).setBackgroundResource(0); mainView.findViewById(R.id.top_bar_row_frame).setBackgroundResource(0);
} }
((TextView) mainView.findViewById(R.id.top_bar_text)).setTextColor(textColor); TextView topBarText = (TextView) mainView.findViewById(R.id.top_bar_text);
topBarText.setTextColor(textColor);
topBarText.setTypeface(typeface);
topBarIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor)); topBarIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
topBarIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_topbar, iconColor)); topBarIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_topbar, iconColor));
break; break;
@ -229,7 +234,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else { } else {
mainView.findViewById(R.id.widget_row_frame).setBackgroundResource(0); mainView.findViewById(R.id.widget_row_frame).setBackgroundResource(0);
} }
((TextView) mainView.findViewById(R.id.widget_text)).setTextColor(textColor); TextView widgetText = (TextView) mainView.findViewById(R.id.widget_text);
widgetText.setTextColor(textColor);
widgetText.setTypeface(typeface);
widgetIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor)); widgetIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
widgetIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_widget, iconColor)); widgetIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_widget, iconColor));
break; break;
@ -241,7 +248,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else { } else {
mainView.findViewById(R.id.none_row_frame).setBackgroundResource(0); mainView.findViewById(R.id.none_row_frame).setBackgroundResource(0);
} }
((TextView) mainView.findViewById(R.id.none_text)).setTextColor(textColor); TextView noneText = (TextView) mainView.findViewById(R.id.none_text);
noneText.setTextColor(textColor);
noneText.setTypeface(typeface);
noneIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor)); noneIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
break; break;
} }

View file

@ -25,6 +25,7 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
final View rightPointSpace; final View rightPointSpace;
final TextView description; final TextView description;
public final ImageButton optionsBtn; public final ImageButton optionsBtn;
final View checkBoxContainer;
final CheckBox checkBox; final CheckBox checkBox;
final View divider; final View divider;
final View bottomShadow; final View bottomShadow;
@ -45,6 +46,7 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
rightPointSpace = view.findViewById(R.id.map_marker_right_point_space); rightPointSpace = view.findViewById(R.id.map_marker_right_point_space);
description = (TextView) view.findViewById(R.id.map_marker_description); description = (TextView) view.findViewById(R.id.map_marker_description);
optionsBtn = (ImageButton) view.findViewById(R.id.map_marker_options_button); optionsBtn = (ImageButton) view.findViewById(R.id.map_marker_options_button);
checkBoxContainer = view.findViewById(R.id.check_box_container);
checkBox = (CheckBox) view.findViewById(R.id.map_marker_check_box); checkBox = (CheckBox) view.findViewById(R.id.map_marker_check_box);
divider = view.findViewById(R.id.divider); divider = view.findViewById(R.id.divider);
bottomShadow = view.findViewById(R.id.bottom_shadow); bottomShadow = view.findViewById(R.id.bottom_shadow);

View file

@ -155,7 +155,8 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
if (month.length() > 1) { if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1); month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
} }
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date); month = month.replaceAll("\\.", "");
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
descr = month + " " + day; descr = month + " " + day;
} }
holder.description.setText(descr); holder.description.setText(descr);

View file

@ -237,7 +237,8 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
if (month.length() > 1) { if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1); month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
} }
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date); month = month.replaceAll("\\.", "");
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
itemViewHolder.description.setText(app.getString(R.string.passed, month + " " + day)); itemViewHolder.description.setText(app.getString(R.string.passed, month + " " + day));
} else { } else {
itemViewHolder.point.setVisibility(View.GONE); itemViewHolder.point.setVisibility(View.GONE);

View file

@ -129,8 +129,17 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
if (month.length() > 1) { if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1); month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
} }
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date); month = month.replaceAll("\\.", "");
itemViewHolder.description.setText(app.getString(R.string.passed, month + " " + day)); String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
String desc = app.getString(R.string.passed, month + " " + day);
String markerGroupName = marker.groupName;
if (markerGroupName != null) {
if (markerGroupName.equals("")) {
markerGroupName = app.getString(R.string.shared_string_favorites);
}
desc += "" + markerGroupName;
}
itemViewHolder.description.setText(desc);
itemViewHolder.optionsBtn.setBackgroundDrawable(app.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset)); itemViewHolder.optionsBtn.setBackgroundDrawable(app.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reset_to_default_dark)); itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reset_to_default_dark));

View file

@ -4,6 +4,7 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.view.MotionEventCompat; import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.Pair; import android.util.Pair;
import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@ -35,6 +36,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter { implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter {
private static final int LOCATION_ITEM_ID = 0; private static final int LOCATION_ITEM_ID = 0;
private static final int ROUND_TRIP_FINISH_ITEM_ID = 1;
private MapActivity mapActivity; private MapActivity mapActivity;
private List<Object> items = new LinkedList<>(); private List<Object> items = new LinkedList<>();
@ -51,6 +53,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints; private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints;
private boolean inRoundTrip;
private boolean showRoundTripItem;
private boolean inDragAndDrop;
public void setAdapterListener(MapMarkersListAdapterListener listener) { public void setAdapterListener(MapMarkersListAdapterListener listener) {
this.listener = listener; this.listener = listener;
} }
@ -63,6 +69,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
locDescription = new PointDescription(PointDescription.POINT_TYPE_MY_LOCATION, locDescription = new PointDescription(PointDescription.POINT_TYPE_MY_LOCATION,
mapActivity.getString(R.string.shared_string_location)); mapActivity.getString(R.string.shared_string_location));
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
inRoundTrip = mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get();
reloadData(); reloadData();
} }
@ -88,27 +95,55 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
boolean firstMarkerItem = showLocationItem ? pos == 1 : pos == 0; boolean firstMarkerItem = showLocationItem ? pos == 1 : pos == 0;
boolean lastMarkerItem = pos == getItemCount() - 1; boolean lastMarkerItem = pos == getItemCount() - 1;
boolean start = pos == startPos; boolean start = pos == startPos;
boolean finish = pos == finishPos && startPos != finishPos; final boolean finish = pos == finishPos && startPos != finishPos;
boolean firstSelectedMarker = pos == firstSelectedMarkerPos; boolean firstSelectedMarker = pos == firstSelectedMarkerPos;
boolean roundTripFinishItem = finish && showRoundTripItem;
boolean useLocation = app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem; boolean useLocation = app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem;
MapMarker marker = locationItem ? null : (MapMarker) getItem(pos); MapMarker marker = null;
Location location = null;
Object item = getItem(pos);
if (item instanceof Location) {
location = (Location) item;
} else {
marker = (MapMarker) item;
}
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light)); holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black)); holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black));
holder.title.setText(locationItem ? mapActivity.getString(R.string.shared_string_my_location) : marker.getName(mapActivity)); holder.title.setText(location != null ? mapActivity.getString(R.string.shared_string_my_location) : marker.getName(mapActivity));
holder.iconDirection.setVisibility(View.GONE); holder.iconDirection.setVisibility(View.GONE);
holder.optionsBtn.setVisibility(View.GONE); holder.optionsBtn.setVisibility(roundTripFinishItem ? View.VISIBLE : View.GONE);
if (roundTripFinishItem) {
holder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark));
TypedValue outValue = new TypedValue();
mapActivity.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
holder.optionsBtn.setBackgroundResource(outValue.resourceId);
holder.optionsBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onDisableRoundTripClick();
}
});
}
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light)); holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
holder.divider.setVisibility(lastMarkerItem ? View.GONE : View.VISIBLE); holder.divider.setVisibility(lastMarkerItem ? View.GONE : View.VISIBLE);
holder.checkBox.setVisibility(View.VISIBLE); holder.checkBox.setVisibility(roundTripFinishItem ? View.GONE : View.VISIBLE);
if (!roundTripFinishItem) {
holder.checkBox.setOnClickListener(new View.OnClickListener() { holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
listener.onItemClick(holder.itemView); listener.onCheckBoxClick(holder.itemView);
} }
}); });
holder.checkBoxContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
holder.checkBox.performClick();
}
});
}
holder.bottomShadow.setVisibility(lastMarkerItem ? View.VISIBLE : View.GONE); holder.bottomShadow.setVisibility(lastMarkerItem ? View.VISIBLE : View.GONE);
holder.iconReorder.setVisibility(View.VISIBLE); holder.iconReorder.setVisibility(View.VISIBLE);
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder)); holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
@ -121,26 +156,28 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + ""); holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + "");
} }
boolean iconSettled = false; if (location != null) {
if ((start || finish) && !locationItem) { holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location));
int res = start ? R.drawable.ic_action_point_start : R.drawable.ic_action_point_destination; } else {
int res = start ? R.drawable.ic_action_point_start : (finish ? R.drawable.ic_action_point_destination : R.drawable.ic_action_flag_dark);
holder.icon.setImageDrawable(iconsCache.getIcon(res, MapMarker.getColorId(marker.colorIndex))); holder.icon.setImageDrawable(iconsCache.getIcon(res, MapMarker.getColorId(marker.colorIndex)));
iconSettled = true; }
if (locationItem || roundTripFinishItem) {
holder.iconReorder.setAlpha(.5f);
holder.iconReorder.setOnTouchListener(null);
} }
if (locationItem) { if (locationItem) {
holder.topDivider.setVisibility(View.VISIBLE); holder.topDivider.setVisibility(View.VISIBLE);
holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location));
holder.checkBox.setChecked(app.getMapMarkersHelper().isStartFromMyLocation()); holder.checkBox.setChecked(app.getMapMarkersHelper().isStartFromMyLocation());
holder.iconReorder.setAlpha(.5f);
holder.iconReorder.setOnTouchListener(null);
holder.distance.setVisibility(View.GONE); holder.distance.setVisibility(View.GONE);
holder.description.setText(locDescription.getName()); holder.description.setText(locDescription.getName());
} else if (roundTripFinishItem) {
holder.topDivider.setVisibility(View.GONE);
holder.description.setText(mapActivity.getString(R.string.round_trip));
} else { } else {
holder.topDivider.setVisibility((!showLocationItem && firstMarkerItem) ? View.VISIBLE : View.GONE); holder.topDivider.setVisibility((!showLocationItem && firstMarkerItem) ? View.VISIBLE : View.GONE);
if (!iconSettled) {
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex)));
}
holder.checkBox.setChecked(marker.selected); holder.checkBox.setChecked(marker.selected);
holder.iconReorder.setAlpha(1f); holder.iconReorder.setAlpha(1f);
@ -148,6 +185,12 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override @Override
public boolean onTouch(View view, MotionEvent event) { public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) { if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
inDragAndDrop = true;
if (showRoundTripItem) {
int roundTripItemPos = finishPos;
reloadData();
notifyItemRemoved(roundTripItemPos);
}
listener.onDragStarted(holder); listener.onDragStarted(holder);
} }
return false; return false;
@ -165,13 +208,13 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (month.length() > 1) { if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1); month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
} }
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date); String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
descr = month + " " + day; descr = month + " " + day;
} }
holder.description.setText(descr); holder.description.setText(descr);
} }
boolean showDistance = locationItem ? useLocation : marker.selected; boolean showDistance = !roundTripFinishItem && (locationItem ? useLocation : marker != null && marker.selected);
int visibility = showDistance ? View.VISIBLE : View.GONE; int visibility = showDistance ? View.VISIBLE : View.GONE;
holder.distance.setVisibility(visibility); holder.distance.setVisibility(visibility);
holder.point.setVisibility(visibility); holder.point.setVisibility(visibility);
@ -206,7 +249,13 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override @Override
public long getItemId(int position) { public long getItemId(int position) {
return position == 0 && showLocationItem ? LOCATION_ITEM_ID : getItem(position).hashCode(); if (showLocationItem && position == 0) {
return LOCATION_ITEM_ID;
}
if (showRoundTripItem && position == finishPos) {
return ROUND_TRIP_FINISH_ITEM_ID;
}
return getItem(position).hashCode();
} }
@Override @Override
@ -242,6 +291,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override @Override
public void onItemDismiss(RecyclerView.ViewHolder holder) { public void onItemDismiss(RecyclerView.ViewHolder holder) {
inDragAndDrop = false;
listener.onDragEnded(holder); listener.onDragEnded(holder);
} }
@ -263,12 +313,17 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
myLoc = app.getLocationProvider().getLastStaleKnownLocation(); myLoc = app.getLocationProvider().getLastStaleKnownLocation();
showLocationItem = myLoc != null; showLocationItem = myLoc != null;
inRoundTrip = app.getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get();
if (showLocationItem) { if (showLocationItem) {
lookupLocationAddress(app); lookupLocationAddress(app);
items.add(myLoc); items.add(myLoc);
} }
items.addAll(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers()); items.addAll(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers());
calculateStartAndFinishPos(); calculateStartAndFinishPos();
showRoundTripItem = inRoundTrip && !inDragAndDrop && startPos != -1;
if (showRoundTripItem) {
items.add(finishPos, items.get(startPos));
}
} }
private void lookupLocationAddress(OsmandApplication app) { private void lookupLocationAddress(OsmandApplication app) {
@ -291,7 +346,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
} }
} }
public void calculateStartAndFinishPos() { private void calculateStartAndFinishPos() {
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
boolean startCalculated = false; boolean startCalculated = false;
boolean finishCalculated = false; boolean finishCalculated = false;
@ -299,6 +354,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem) { if (app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem) {
startPos = 0; startPos = 0;
startCalculated = true; startCalculated = true;
if (inRoundTrip && !inDragAndDrop) {
finishPos = 1;
finishCalculated = true;
}
} }
for (int i = 0; i < items.size(); i++) { for (int i = 0; i < items.size(); i++) {
Object item = items.get(i); Object item = items.get(i);
@ -320,7 +379,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (item instanceof MapMarker) { if (item instanceof MapMarker) {
MapMarker m = (MapMarker) item; MapMarker m = (MapMarker) item;
if (m.selected) { if (m.selected) {
finishPos = i; finishPos = i + (inRoundTrip && !inDragAndDrop ? 1 : 0);
finishCalculated = true; finishCalculated = true;
break; break;
} }
@ -339,6 +398,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
public interface MapMarkersListAdapterListener { public interface MapMarkersListAdapterListener {
void onDisableRoundTripClick();
void onCheckBoxClick(View view);
void onItemClick(View view); void onItemClick(View view);
void onDragStarted(RecyclerView.ViewHolder holder); void onDragStarted(RecyclerView.ViewHolder holder);

View file

@ -91,6 +91,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
final private PointGPXAdapter adapter = new PointGPXAdapter(); final private PointGPXAdapter adapter = new PointGPXAdapter();
private GpxDisplayItemType[] filterTypes = { GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS }; private GpxDisplayItemType[] filterTypes = { GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS };
private boolean selectionMode = false; private boolean selectionMode = false;
private boolean addToMapMarkersMode = false;
private LinkedHashMap<GpxDisplayItemType, Set<GpxDisplayItem>> selectedItems = new LinkedHashMap<>(); private LinkedHashMap<GpxDisplayItemType, Set<GpxDisplayItem>> selectedItems = new LinkedHashMap<>();
private Set<Integer> selectedGroups = new LinkedHashSet<>(); private Set<Integer> selectedGroups = new LinkedHashSet<>();
private ActionMode actionMode; private ActionMode actionMode;
@ -468,6 +469,10 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
this.selectionMode = selectionMode; this.selectionMode = selectionMode;
} }
private void enableAddToMapMarkersMode(boolean addToMapMarkersMode) {
this.addToMapMarkersMode = addToMapMarkersMode;
}
private void enterDeleteMode() { private void enterDeleteMode() {
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() { actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
@ -587,12 +592,13 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
@Override @Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(ActionMode mode, Menu menu) {
enableSelectionMode(true);
if (getSettings().USE_MAP_MARKERS.get()) { if (getSettings().USE_MAP_MARKERS.get()) {
enableAddToMapMarkersMode(true);
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.shared_string_add_to_map_markers, createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.shared_string_add_to_map_markers,
R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
} else { } else {
enableSelectionMode(true);
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_destination_and_intermediate_points, createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_destination_and_intermediate_points,
R.drawable.ic_action_intermediate, R.drawable.ic_action_intermediate, R.drawable.ic_action_intermediate, R.drawable.ic_action_intermediate,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
@ -612,6 +618,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
@Override @Override
public void onDestroyActionMode(ActionMode mode) { public void onDestroyActionMode(ActionMode mode) {
enableSelectionMode(false); enableSelectionMode(false);
enableAddToMapMarkersMode(false);
adapter.notifyDataSetInvalidated(); adapter.notifyDataSetInvalidated();
} }
@ -777,7 +784,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
} }
} }
updateSelectionMode(actionMode); updateSelectionMode(actionMode);
} else { } else if (!addToMapMarkersMode) {
final GpxDisplayItem item = adapter.getChild(groupPosition, childPosition); final GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
if (item != null) { if (item != null) {
if (item.group.getGpx() != null) { if (item.group.getGpx() != null) {
@ -884,14 +891,15 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
@Override @Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
View row = convertView; View row = convertView;
final GpxDisplayGroup group = getGroup(groupPosition);
boolean checkBox = row != null && row.findViewById(R.id.toggle_item) instanceof CheckBox; boolean checkBox = row != null && row.findViewById(R.id.toggle_item) instanceof CheckBox;
boolean same = (selectionMode && checkBox) || (!selectionMode && !checkBox); boolean showCheckBox = selectionMode || (addToMapMarkersMode && group.getType() == GpxDisplayItemType.TRACK_POINTS);
boolean same = (showCheckBox && checkBox) || (!showCheckBox && !checkBox);
if (row == null || !same) { if (row == null || !same) {
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
row = inflater.inflate(R.layout.wpt_list_item_category, parent, false); row = inflater.inflate(R.layout.wpt_list_item_category, parent, false);
} }
row.setOnClickListener(null); row.setOnClickListener(null);
final GpxDisplayGroup group = getGroup(groupPosition);
row.findViewById(R.id.group_divider).setVisibility(groupPosition == 0 ? View.GONE : View.VISIBLE); row.findViewById(R.id.group_divider).setVisibility(groupPosition == 0 ? View.GONE : View.VISIBLE);
TextView label = (TextView) row.findViewById(R.id.category_name); TextView label = (TextView) row.findViewById(R.id.category_name);
TextView description = (TextView) row.findViewById(R.id.category_desc); TextView description = (TextView) row.findViewById(R.id.category_desc);
@ -903,7 +911,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
description.setText(getString(R.string.route_points_category_name)); description.setText(getString(R.string.route_points_category_name));
} }
if (selectionMode) { if (showCheckBox) {
final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item); final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item);
ch.setVisibility(View.VISIBLE); ch.setVisibility(View.VISIBLE);
ch.setChecked(selectedGroups.contains(groupPosition)); ch.setChecked(selectedGroups.contains(groupPosition));
@ -1049,8 +1057,10 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
}); });
} else { } else {
row.findViewById(R.id.icon).setVisibility(View.VISIBLE); row.findViewById(R.id.icon).setVisibility(View.VISIBLE);
if (addToMapMarkersMode) {
ch.setVisibility(View.GONE); ch.setVisibility(View.GONE);
} }
}
return row; return row;
} }

View file

@ -11,6 +11,9 @@ import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
public class OpenstreetmapLocalUtil implements OpenstreetmapUtil { public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
public final static Log LOG = PlatformUtil.getLog(OpenstreetmapLocalUtil.class); public final static Log LOG = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
@ -21,6 +24,18 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
this.plugin = plugin; this.plugin = plugin;
} }
private List<OnNodeCommittedListener> listeners = new ArrayList<>();
public void addNodeCommittedListener(OnNodeCommittedListener listener) {
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
public void removeNodeCommittedListener(OnNodeCommittedListener listener) {
listeners.remove(listener);
}
@Override @Override
public EntityInfo getEntityInfo(long id) { public EntityInfo getEntityInfo(long id) {
return null; return null;
@ -41,6 +56,9 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
} else { } else {
plugin.getDBPOI().addOpenstreetmap(p); plugin.getDBPOI().addOpenstreetmap(p);
} }
for (OnNodeCommittedListener listener : listeners) {
listener.onNoteCommitted();
}
return newNode; return newNode;
} }
@ -79,4 +97,8 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
public void closeChangeSet() { public void closeChangeSet() {
} }
public interface OnNodeCommittedListener {
void onNoteCommitted();
}
} }

View file

@ -61,7 +61,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class OsmEditsFragment extends OsmAndListFragment public class OsmEditsFragment extends OsmAndListFragment
implements SendPoiDialogFragment.ProgressDialogPoiUploader { implements SendPoiDialogFragment.ProgressDialogPoiUploader, OpenstreetmapLocalUtil.OnNodeCommittedListener {
OsmEditingPlugin plugin; OsmEditingPlugin plugin;
private OsmEditsAdapter listAdapter; private OsmEditsAdapter listAdapter;
@ -98,9 +98,15 @@ public class OsmEditsFragment extends OsmAndListFragment
updateSelectionTitle(actionMode); updateSelectionTitle(actionMode);
} }
}); });
plugin.getPoiModificationLocalUtil().addNodeCommittedListener(this);
return view; return view;
} }
@Override
public void onDestroyView() {
plugin.getPoiModificationLocalUtil().removeNodeCommittedListener(this);
super.onDestroyView();
}
public android.widget.ArrayAdapter<?> getAdapter() { public android.widget.ArrayAdapter<?> getAdapter() {
return listAdapter; return listAdapter;
@ -323,6 +329,10 @@ public class OsmEditsFragment extends OsmAndListFragment
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
fetchData();
}
private void fetchData() {
ArrayList<OsmPoint> dataPoints = new ArrayList<>(); ArrayList<OsmPoint> dataPoints = new ArrayList<>();
List<OpenstreetmapPoint> l1 = plugin.getDBPOI().getOpenstreetmapPoints(); List<OpenstreetmapPoint> l1 = plugin.getDBPOI().getOpenstreetmapPoints();
List<OsmNotesPoint> l2 = plugin.getDBBug().getOsmbugsPoints(); List<OsmNotesPoint> l2 = plugin.getDBBug().getOsmbugsPoints();
@ -351,7 +361,6 @@ public class OsmEditsFragment extends OsmAndListFragment
} else { } else {
listAdapter.setNewList(dataPoints); listAdapter.setNewList(dataPoints);
} }
} }
private void showBugDialog(final OsmNotesPoint point) { private void showBugDialog(final OsmNotesPoint point) {
@ -406,6 +415,16 @@ public class OsmEditsFragment extends OsmAndListFragment
} }
} }
@Override
public void onNoteCommitted() {
getMyApplication().runInUIThread(new Runnable() {
@Override
public void run() {
fetchData();
}
});
}
protected class OsmEditsAdapter extends ArrayAdapter<OsmPoint> { protected class OsmEditsAdapter extends ArrayAdapter<OsmPoint> {
private List<OsmPoint> dataPoints; private List<OsmPoint> dataPoints;

View file

@ -377,13 +377,13 @@ public class QuickActionFactory {
return R.drawable.ic_layer_bottom_dark; return R.drawable.ic_layer_bottom_dark;
case NavAddDestinationAction.TYPE: case NavAddDestinationAction.TYPE:
return R.drawable.ic_action_target; return R.drawable.ic_action_point_add_destination;
case NavAddFirstIntermediateAction.TYPE: case NavAddFirstIntermediateAction.TYPE:
return R.drawable.ic_action_intermediate; return R.drawable.ic_action_intermediate;
case NavReplaceDestinationAction.TYPE: case NavReplaceDestinationAction.TYPE:
return R.drawable.ic_action_target; return R.drawable.ic_action_point_add_destination;
case NavAutoZoomMapAction.TYPE: case NavAutoZoomMapAction.TYPE:
return R.drawable.ic_action_search_dark; return R.drawable.ic_action_search_dark;

View file

@ -81,11 +81,17 @@ public class NavStartStopAction extends QuickAction {
public int getIconRes(Context context) { public int getIconRes(Context context) {
if (context instanceof MapActivity) { if (context instanceof MapActivity) {
RoutingHelper helper = ((MapActivity) context).getRoutingHelper(); RoutingHelper helper = ((MapActivity) context).getRoutingHelper();
if (helper.isPauseNavigation() || helper.isFollowingMode()) { if (!helper.isRoutePlanningMode() && !helper.isFollowingMode()) {
return R.drawable.ic_action_target; return ((MapActivity) context).getMapActions().getRouteMode(null).getSmallIconDark();
} }
return R.drawable.ic_action_start_navigation; return helper.getAppMode().getSmallIconDark();
} }
return super.getIconRes(context); return super.getIconRes(context);
} }
@Override
public boolean isActionWithSlash(OsmandApplication application) {
RoutingHelper helper = application.getRoutingHelper();
return helper.isPauseNavigation() || helper.isFollowingMode();
}
} }

View file

@ -278,7 +278,6 @@ public class ShowHidePoiAction extends QuickAction {
final ContextMenuAdapter adapter = new ContextMenuAdapter(); final ContextMenuAdapter adapter = new ContextMenuAdapter();
final List<PoiUIFilter> list = new ArrayList<>(); final List<PoiUIFilter> list = new ArrayList<>();
list.add(poiFilters.getCustomPOIFilter());
for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) { for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) {
addFilterToList(adapter, list, f); addFilterToList(adapter, list, f);

View file

@ -11,6 +11,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.poi.PoiFiltersHelper; import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.resources.ResourceManager.ResourceListener; import net.osmand.plus.resources.ResourceManager.ResourceListener;
import net.osmand.search.SearchUICore; import net.osmand.search.SearchUICore;
import net.osmand.search.SearchUICore.SearchResultCollection; import net.osmand.search.SearchUICore.SearchResultCollection;
@ -86,7 +87,10 @@ public class QuickSearchHelper implements ResourceListener {
for(CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters()) { for(CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters()) {
core.addCustomSearchPoiFilter(udf, 0); core.addCustomSearchPoiFilter(udf, 0);
} }
core.addCustomSearchPoiFilter(poiFilters.getLocalWikiPOIFilter(), 1); PoiUIFilter localWikiPoiFilter = poiFilters.getLocalWikiPOIFilter();
if (localWikiPoiFilter != null) {
core.addCustomSearchPoiFilter(localWikiPoiFilter, 1);
}
core.addCustomSearchPoiFilter(poiFilters.getShowAllPOIFilter(), 1); core.addCustomSearchPoiFilter(poiFilters.getShowAllPOIFilter(), 1);
} }

View file

@ -66,7 +66,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private Paint bitmapPaintDestYellow; private Paint bitmapPaintDestYellow;
private Paint bitmapPaintDestTeal; private Paint bitmapPaintDestTeal;
private Paint bitmapPaintDestPurple; private Paint bitmapPaintDestPurple;
private Bitmap arrowLight;
private Bitmap arrowToDestination; private Bitmap arrowToDestination;
private Bitmap arrowShadow;
private float[] calculations = new float[2]; private float[] calculations = new float[2];
private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine"); private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine");
@ -116,7 +118,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
markerBitmapTeal = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_teal); markerBitmapTeal = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_teal);
markerBitmapPurple = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_purple); markerBitmapPurple = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_purple);
arrowToDestination = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_arrow_to_destination); arrowLight = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_direction_arrow_p1_light);
arrowToDestination = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_direction_arrow_p2_color);
arrowShadow = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_direction_arrow_p3_shadow);
bitmapPaintDestBlue = createPaintDest(R.color.marker_blue); bitmapPaintDestBlue = createPaintDest(R.color.marker_blue);
bitmapPaintDestGreen = createPaintDest(R.color.marker_green); bitmapPaintDestGreen = createPaintDest(R.color.marker_green);
bitmapPaintDestOrange = createPaintDest(R.color.marker_orange); bitmapPaintDestOrange = createPaintDest(R.color.marker_orange);
@ -125,10 +129,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
bitmapPaintDestTeal = createPaintDest(R.color.marker_teal); bitmapPaintDestTeal = createPaintDest(R.color.marker_teal);
bitmapPaintDestPurple = createPaintDest(R.color.marker_purple); bitmapPaintDestPurple = createPaintDest(R.color.marker_purple);
float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density;
textAttrs.paint.setTextSize(textSize);
textAttrs.paint2.setTextSize(textSize);
widgetsFactory = new MapMarkersWidgetsFactory(map); widgetsFactory = new MapMarkersWidgetsFactory(map);
contextMenuLayer = view.getLayerByClass(ContextMenuLayer.class); contextMenuLayer = view.getLayerByClass(ContextMenuLayer.class);
@ -210,6 +210,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
} }
if (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) { if (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) {
float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density * map.getMyApplication().getSettings().TEXT_SCALE.get();
textAttrs.paint.setTextSize(textSize);
textAttrs.paint2.setTextSize(textSize);
lineAttrs.updatePaints(view, nightMode, tileBox); lineAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.updatePaints(view, nightMode, tileBox); textAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.paint.setStyle(Paint.Style.FILL); textAttrs.paint.setStyle(Paint.Style.FILL);
@ -315,7 +319,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
final QuadPoint cp = tileBox.getCenterPixelPoint(); final QuadPoint cp = tileBox.getCenterPixelPoint();
canvas.rotate(bearing, cp.x, cp.y); canvas.rotate(bearing, cp.x, cp.y);
canvas.translate(-24 * tileBox.getDensity() + radiusBearing, -22 * tileBox.getDensity()); canvas.translate(-24 * tileBox.getDensity() + radiusBearing, -22 * tileBox.getDensity());
canvas.drawBitmap(arrowShadow, cp.x, cp.y, bitmapPaint);
canvas.drawBitmap(arrowToDestination, cp.x, cp.y, getMarkerDestPaint(marker.colorIndex)); canvas.drawBitmap(arrowToDestination, cp.x, cp.y, getMarkerDestPaint(marker.colorIndex));
canvas.drawBitmap(arrowLight, cp.x, cp.y, bitmapPaint);
canvas.restore(); canvas.restore();
} }
i++; i++;
@ -461,10 +467,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override @Override
public void setSelectedObject(Object o) { public void setSelectedObject(Object o) {
if (o instanceof MapMarker) {
map.getMyApplication().getMapMarkersHelper().moveMarkerToTop((MapMarker) o);
map.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
}
} }
@Override @Override

View file

@ -321,7 +321,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
app.getSettings().isLightContent() ? app.getSettings().isLightContent() ?
R.style.OsmandLightTheme : R.style.OsmandLightTheme :
R.style.OsmandDarkTheme); R.style.OsmandDarkTheme);
final String title = Algorithms.isEmpty(lang) ? a.getName() : a.getName(lang); final String title = Algorithms.isEmpty(preferredLang) ? a.getName() : a.getName(preferredLang);
LinearLayout ll = new LinearLayout(ctx); LinearLayout ll = new LinearLayout(ctx);
ll.setOrientation(LinearLayout.VERTICAL); ll.setOrientation(LinearLayout.VERTICAL);
@ -519,9 +519,17 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
@Override @Override
public PointDescription getObjectName(Object o) { public PointDescription getObjectName(Object o) {
if (o instanceof Amenity) { if (o instanceof Amenity) {
return new PointDescription(PointDescription.POINT_TYPE_POI, ((Amenity) o).getName( Amenity a = (Amenity) o;
view.getSettings().MAP_PREFERRED_LOCALE.get(), String preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
view.getSettings().MAP_TRANSLITERATE_NAMES.get())); String preferredMapAppLang = preferredMapLang;
if (Algorithms.isEmpty(preferredMapAppLang)) {
preferredMapAppLang = app.getLanguage();
}
boolean transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
return new PointDescription(PointDescription.POINT_TYPE_POI, a.getName(
a.getType().isWiki() ? preferredMapAppLang : preferredMapLang,
transliterateNames));
} }
return null; return null;
} }

View file

@ -38,7 +38,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
private Bitmap mStartPoint; private Bitmap mStartPoint;
private Bitmap mTargetPoint; private Bitmap mTargetPoint;
private Bitmap mIntermediatePoint; private Bitmap mIntermediatePoint;
private Bitmap mArrowToDestination;
private Paint mTextPaint; private Paint mTextPaint;
@ -68,7 +67,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
mStartPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_start_point); mStartPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_start_point);
mTargetPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_target_point); mTargetPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_target_point);
mIntermediatePoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_intermediate_point); mIntermediatePoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_intermediate_point);
mArrowToDestination = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_arrow_to_destination);
} }
@Override @Override
@ -126,27 +124,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
canvas.rotate(tb.getRotate(), locationX, locationY); canvas.rotate(tb.getRotate(), locationX, locationY);
} }
Iterator<TargetPoint> it = targetPoints.getIntermediatePoints().iterator();
if (it.hasNext()) {
pointToNavigate = it.next();
}
if (pointToNavigate != null && !isLocationVisible(tb, pointToNavigate)) {
boolean show = !mView.getApplication().getRoutingHelper().isRouteCalculated();
if (mView.getSettings().SHOW_DESTINATION_ARROW.isSet()) {
show = mView.getSettings().SHOW_DESTINATION_ARROW.get();
}
if (show) {
net.osmand.Location.distanceBetween(mView.getLatitude(), mView.getLongitude(),
pointToNavigate.getLatitude(), pointToNavigate.getLongitude(), mCalculations);
float bearing = mCalculations[1] - 90;
float radiusBearing = DIST_TO_SHOW * tb.getDensity();
final QuadPoint cp = tb.getCenterPixelPoint();
canvas.rotate(bearing, cp.x, cp.y);
canvas.translate(-24 * tb.getDensity() + radiusBearing, -22 * tb.getDensity());
canvas.drawBitmap(mArrowToDestination, cp.x, cp.y, mBitmapPaint);
}
}
} }
private float getPointX(RotatedTileBox tileBox, TargetPoint point) { private float getPointX(RotatedTileBox tileBox, TargetPoint point) {

View file

@ -15,11 +15,9 @@ import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.DirectionDrawable; import net.osmand.plus.views.DirectionDrawable;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
@ -75,7 +73,7 @@ public class MapMarkersWidgetsFactory {
addressText = (TextView) map.findViewById(R.id.map_marker_address); addressText = (TextView) map.findViewById(R.id.map_marker_address);
addressText2nd = (TextView) map.findViewById(R.id.map_marker_address_2nd); addressText2nd = (TextView) map.findViewById(R.id.map_marker_address_2nd);
okButton = (ImageButton) map.findViewById(R.id.marker_btn_ok); okButton = (ImageButton) map.findViewById(R.id.marker_btn_ok);
okButton2nd = (ImageButton) map.findViewById(R.id.marker_btn_ok_2dn); okButton2nd = (ImageButton) map.findViewById(R.id.marker_btn_ok_2nd);
moreButton = (ImageButton) map.findViewById(R.id.marker_btn_more); moreButton = (ImageButton) map.findViewById(R.id.marker_btn_more);
moreButton2nd = (ImageButton) map.findViewById(R.id.marker_btn_more_2nd); moreButton2nd = (ImageButton) map.findViewById(R.id.marker_btn_more_2nd);
@ -96,31 +94,33 @@ public class MapMarkersWidgetsFactory {
if (isLandscapeLayout() && helper.getMapMarkers().size() > 1) { if (isLandscapeLayout() && helper.getMapMarkers().size() > 1) {
moreButton.setVisibility(View.GONE); moreButton.setVisibility(View.GONE);
} else { } else {
moreButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_overflow_menu_white, R.color.marker_top_2nd_line_color)); moreButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_markers_list, R.color.marker_top_2nd_line_color));
moreButton.setOnClickListener(new View.OnClickListener() { moreButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
MapActivity.clearPrevActivityIntent(); MapActivity.clearPrevActivityIntent();
map.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAP_MARKERS); MapMarkersDialogFragment.showInstance(map);
} }
}); });
} }
if (moreButton2nd != null) { if (moreButton2nd != null) {
moreButton2nd.setImageDrawable(iconsCache.getIcon(R.drawable.ic_overflow_menu_white, R.color.marker_top_2nd_line_color)); moreButton2nd.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_markers_list, R.color.marker_top_2nd_line_color));
moreButton2nd.setOnClickListener(new View.OnClickListener() { moreButton2nd.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
MapActivity.clearPrevActivityIntent(); MapActivity.clearPrevActivityIntent();
map.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAP_MARKERS); MapMarkersDialogFragment.showInstance(map);
} }
}); });
} }
okButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_marker_passed, R.color.color_white));
okButton.setOnClickListener(new View.OnClickListener() { okButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
removeMarker(0); removeMarker(0);
} }
}); });
okButton2nd.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_marker_passed, R.color.color_white));
okButton2nd.setOnClickListener(new View.OnClickListener() { okButton2nd.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -200,7 +200,8 @@ public class MapMarkersWidgetsFactory {
|| MapRouteInfoMenu.isVisible() || MapRouteInfoMenu.isVisible()
|| addressTopBar.getVisibility() == View.VISIBLE || addressTopBar.getVisibility() == View.VISIBLE
|| map.isTopToolbarActive() || map.isTopToolbarActive()
|| !map.getContextMenu().shouldShowControls()) { || !map.getContextMenu().shouldShowControls()
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) {
updateVisibility(false); updateVisibility(false);
return; return;
} }

View file

@ -312,7 +312,6 @@ public class MapWidgetRegistry {
private void resetDefaultAppearance(ApplicationMode appMode) { private void resetDefaultAppearance(ApplicationMode appMode) {
// settings.SHOW_RULER.resetToDefault(); // settings.SHOW_RULER.resetToDefault();
settings.SHOW_DESTINATION_ARROW.resetToDefault();
settings.TRANSPARENT_MAP_THEME.resetToDefault(); settings.TRANSPARENT_MAP_THEME.resetToDefault();
settings.SHOW_STREET_NAME.resetToDefault(); settings.SHOW_STREET_NAME.resetToDefault();
settings.CENTER_POSITION_ON_MAP.resetToDefault(); settings.CENTER_POSITION_ON_MAP.resetToDefault();
@ -320,7 +319,6 @@ public class MapWidgetRegistry {
} }
public void addControlsAppearance(final MapActivity map, final ContextMenuAdapter cm, ApplicationMode mode) { public void addControlsAppearance(final MapActivity map, final ContextMenuAdapter cm, ApplicationMode mode) {
addControlId(map, cm, R.string.map_widget_show_destination_arrow, settings.SHOW_DESTINATION_ARROW);
addControlId(map, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME); addControlId(map, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME);
addControlId(map, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP); addControlId(map, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP);
if (mode != ApplicationMode.DEFAULT) { if (mode != ApplicationMode.DEFAULT) {