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

View file

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

View file

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

View file

@ -90,13 +90,14 @@
android:text="@string/show_direction"
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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textSize="@dimen/default_list_text_size"
tools:textColor="@color/map_widget_blue_pressed"
tools:text="Top bar"/>
</LinearLayout>
@ -199,6 +200,7 @@
</LinearLayout>
<View
android:id="@+id/move_all_to_history_divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/bg_color"
android:orientation="vertical">

View file

@ -208,14 +208,16 @@
tools:background="@drawable/ic_action_device_top"
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:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_topbar"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton
android:id="@+id/top_bar_radio_button"
@ -255,14 +257,16 @@
tools:background="@drawable/ic_action_device_top"
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:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_widgets"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton
android:id="@+id/widget_radio_button"
@ -301,14 +305,16 @@
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
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:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_none"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton
android:id="@+id/none_radio_button"
@ -340,7 +346,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_cancel"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"

View file

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

View file

@ -79,15 +79,28 @@
<TextView
android:id="@+id/waypoint_desc_text"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/secondary_text_dark"
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>

View file

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

View file

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

View file

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

View file

@ -123,5 +123,8 @@
<dimen name="measurement_tool_bottom_divider_margin_start">96dp</dimen>
<dimen name="bottom_sheet_image_text_margin_start">15dp</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>

View file

@ -188,4 +188,7 @@
<dimen name="measurement_tool_bottom_divider_margin_start">64dp</dimen>
<dimen name="bottom_sheet_image_text_margin_start">10dp</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>

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).
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_title">Modify 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
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();
// 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.liveupdates.OsmLiveActivity;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
@ -365,12 +366,14 @@ public class MapActivityActions implements DialogProvider {
mapActivity.getRoutingHelper().setGpxParams(params);
settings.FOLLOW_THE_GPX_ROUTE.set(result.path);
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();
tg.navigateToPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, -1);
if (tg.getPointToStart() == null) {
loc = ps.get(0);
tg.setStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, null);
tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1);
if (startLoc != finishLoc) {
tg.setStartPoint(new LatLon(startLoc.getLatitude(), startLoc.getLongitude()), false, null);
} else {
tg.clearStartPoint(false);
}
}
}
@ -496,6 +499,11 @@ public class MapActivityActions implements DialogProvider {
}
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 selected = settings.APPLICATION_MODE.get();
if (selected != ApplicationMode.DEFAULT) {

View file

@ -414,7 +414,7 @@ public class MapMarkerDialogHelper {
v = mapActivity.getLayoutInflater().inflate(R.layout.map_marker_item, null);
}
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 move = v.findViewById(R.id.info_move);
final View remove = v.findViewById(R.id.info_close);
@ -467,7 +467,7 @@ public class MapMarkerDialogHelper {
Float heading, boolean useCenter, boolean nightMode,
int screenOrientation, boolean selectionMode,
final MapMarkersDialogHelperCallbacks helperCallbacks,
final MapMarker marker) {
final MapMarker marker, boolean showDateAndGroup) {
TextView text = (TextView) localView.findViewById(R.id.waypoint_text);
TextView textShadow = (TextView) localView.findViewById(R.id.waypoint_text_shadow);
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 descText = (TextView) localView.findViewById(R.id.waypoint_desc_text);
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
|| waypointDeviation == null || descText == null) {
@ -538,6 +539,26 @@ public class MapMarkerDialogHelper {
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) {
checkBox.setChecked(marker.selected);
checkBox.setVisibility(View.VISIBLE);
@ -824,7 +845,7 @@ public class MapMarkerDialogHelper {
View v = listView.getChildAt(i - listView.getFirstVisiblePosition());
if (obj == marker) {
updateMapMarkerInfo(mapActivity, v, loc, heading, useCenter, nightMode,
screenOrientation, selectionMode, helperCallbacks, marker);
screenOrientation, selectionMode, helperCallbacks, marker, false);
}
}
} catch (Exception e) {

View file

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

View file

@ -119,6 +119,18 @@ public abstract class MenuController extends BaseMenuController {
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) {
this.mapContextMenu = mapContextMenu;
builder.setMapContextMenu(mapContextMenu);

View file

@ -278,10 +278,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
public void buildInternal(View view) {
boolean hasWiki = false;
MapPoiTypes poiTypes = app.getPoiTypes();
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
if (Algorithms.isEmpty(preferredLang)) {
preferredLang = app.getLanguage();
}
String preferredLang = getPreferredMapAppLang();
List<AmenityInfoRow> infoRows = 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.PoiFilter;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
@ -84,7 +83,7 @@ public class AmenityMenuController extends MenuController {
return getLeftIconId(amenity);
}
public static int getLeftIconId(Amenity amenity) {
private static int getLeftIconId(Amenity amenity) {
String id = null;
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
if (st != null) {
@ -107,8 +106,9 @@ public class AmenityMenuController extends MenuController {
@Override
public String getNameStr() {
OsmandSettings settings = getMapActivity().getMyApplication().getSettings();
return amenity.getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get());
return amenity.getName(
amenity.getType().isWiki() ? getPreferredMapAppLang() : getPreferredMapLang(),
isTransliterateNames());
}
@Override

View file

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

View file

@ -127,7 +127,7 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
convertView = getMapActivity().getLayoutInflater().inflate(R.layout.map_marker_item, null);
}
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);
remove.setVisibility(View.GONE);
AndroidUtils.setListItemBackground(getMapActivity(), convertView, nightMode);

View file

@ -11,7 +11,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
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.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MapViewTrackingUtilities;
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) {
final RecyclerView recyclerView = new RecyclerView(getContext());
final MapActivity mapActivity = (MapActivity) getActivity();
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

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

View file

@ -20,7 +20,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper;
@ -56,10 +55,16 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
final MapActivity mapActivity = (MapActivity) getActivity();
final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setClipToPadding(false);
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.setStyle(Paint.Style.FILL_AND_STROKE);

View file

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

View file

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

View file

@ -26,14 +26,26 @@ import net.osmand.plus.helpers.AndroidUiHelper;
public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment {
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 boolean portrait;
private boolean showSortBy;
private boolean showMoveAllToHistory;
public void setListener(MarkerOptionsFragmentListener 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
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -76,15 +88,20 @@ 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)).setText(getMyApplication().getSettings().MAP_MARKERS_MODE.get().toHumanString(getActivity()));
mainView.findViewById(R.id.sort_by_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.sortByOnClick();
View sortByRow = mainView.findViewById(R.id.sort_by_row);
if (!showSortBy) {
sortByRow.setVisibility(View.GONE);
} else {
sortByRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.sortByOnClick();
}
dismiss();
}
dismiss();
}
});
});
}
mainView.findViewById(R.id.show_direction_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -121,15 +138,21 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
dismiss();
}
});
mainView.findViewById(R.id.move_all_to_history_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.moveAllToHistoryOnClick();
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
public void onClick(View view) {
if (listener != null) {
listener.moveAllToHistoryOnClick();
}
dismiss();
}
dismiss();
}
});
});
}
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

View file

@ -7,6 +7,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
@ -62,6 +63,7 @@ import java.util.ArrayList;
import java.util.List;
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 {
@ -108,9 +110,19 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
}
@Override
public void hideProgressBar() {
public void hideProgressBar(boolean canceled) {
mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE);
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
@ -268,7 +280,12 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
private int toPosition;
@Override
public void onItemClick(View view) {
public void onDisableRoundTripClick() {
roundTripOnClick();
}
@Override
public void onCheckBoxClick(View view) {
int pos = markersRv.getChildAdapterPosition(view);
if (pos == RecyclerView.NO_POSITION) {
return;
@ -282,10 +299,26 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
marker.selected = !marker.selected;
markersHelper.updateMapMarker(marker, false);
}
adapter.calculateStartAndFinishPos();
adapter.reloadData();
adapter.notifyDataSetChanged();
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
@ -297,23 +330,23 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override
public void onDragEnded(RecyclerView.ViewHolder holder) {
toPosition = holder.getAdapterPosition();
if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) {
if (toPosition >= 0 && fromPosition >= 0) {
mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded();
mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
mapActivity.refreshMap();
adapter.calculateStartAndFinishPos();
adapter.reloadData();
try {
adapter.notifyDataSetChanged();
} catch (Exception e) {
// to avoid crash because of:
// 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, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 10 : 15), 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 8 : 12));
markersRv.setPadding(0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_top),
0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
markersRv.setClipToPadding(false);
markersRv.setLayoutManager(new LinearLayoutManager(getContext()));
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);
}
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() {
return new SnapToRoadFragmentListener() {
@Override
@ -408,13 +453,17 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override
public void onApplicationModeItemClick(ApplicationMode mode) {
if (planRouteContext.getSnappedMode() != mode) {
boolean defaultMode = mode == ApplicationMode.DEFAULT;
MapMarkersLayer layer = getMapMarkersLayer();
if (layer != null) {
layer.setDefaultAppMode(mode == ApplicationMode.DEFAULT);
layer.setDefaultAppMode(defaultMode);
}
if (defaultMode) {
planRouteContext.cancelSnapToRoad();
}
planRouteContext.getSnappedToRoadPoints().clear();
planRouteContext.setSnappedMode(mode);
planRouteContext.recreateSnapTrkSegment();
planRouteContext.recreateSnapTrkSegment(false);
setupAppModesBtn();
}
}
@ -475,6 +524,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
targetPointsHelper.clearStartPoint(false);
targetPointsHelper.clearPointToNavigate(false);
}
planRouteContext.setNavigationFromMarkers(true);
dismiss();
mapActivity.getMapLayers().getMapControlsLayer().doRoute(hasTargets);
}
@ -482,11 +532,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override
public void makeRoundTripOnClick() {
if (mapActivity != null) {
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
settings.ROUTE_MAP_MARKERS_ROUND_TRIP.set(!settings.ROUTE_MAP_MARKERS_ROUND_TRIP.get());
planRouteContext.recreateSnapTrkSegment();
}
roundTripOnClick();
}
@Override
@ -507,13 +553,25 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
markersHelper.reverseActiveMarkersOrder();
adapter.reloadData();
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() {
boolean adjustMap = false;
int activeMarkersCount = markersHelper.getMapMarkers().size();
if (selectedCount == activeMarkersCount && markersHelper.isStartFromMyLocation()) {
markersHelper.deselectAllActiveMarkers();
@ -523,10 +581,11 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
markersHelper.selectAllActiveMarkers();
markersHelper.setStartFromMyLocation(true);
selectedCount = activeMarkersCount;
adjustMap = true;
}
adapter.calculateStartAndFinishPos();
adapter.reloadData();
adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment();
planRouteContext.recreateSnapTrkSegment(adjustMap);
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.refreshMap();
@ -575,12 +634,11 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
OsmandMapTileView tileView = mapActivity.getMapView();
previousMapPosition = tileView.getMapPosition();
if (!portrait) {
tileView.setMapPosition(LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
}
tileView.setMapPosition(portrait ? MIDDLE_TOP_CONSTANT : LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
selectedCount = mapActivity.getMyApplication().getMapMarkersHelper().getSelectedMarkersCount();
planRouteContext.recreateSnapTrkSegment();
planRouteContext.recreateSnapTrkSegment(planRouteContext.isAdjustMapOnStart());
planRouteContext.setAdjustMapOnStart(true);
mapActivity.refreshMap();
updateSelectButton();
}
@ -729,6 +787,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.getMapLayers().getMapMarkersLayer().setRoute(planRouteContext.getSnapTrkSegment());
mapActivity.refreshMap();
if (adjustMap) {
showRouteOnMap(planRouteContext.getSnapTrkSegment().points);
}
@ -767,7 +826,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
int tileBoxHeightPx = 0;
if (portrait) {
tileBoxHeightPx = 3 * (tb.getPixHeight() - mainView.getHeight() - toolbarHeight) / 4;
tileBoxHeightPx = 3 * (tb.getPixHeight() - toolbarHeight) / 4;
} else {
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);
adapter.reloadData();
adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment();
planRouteContext.recreateSnapTrkSegment(false);
}
}.execute();
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.mapmarkers;
import android.app.Activity;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
@ -26,6 +27,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
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 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);
Typeface typeface = FontCache.getFont(getContext(), check ? "fonts/Roboto-Medium.ttf" : "fonts/Roboto-Regular.ttf");
switch (mode) {
case TOOLBAR:
((RadioButton) mainView.findViewById(R.id.top_bar_radio_button)).setChecked(check);
@ -217,7 +220,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else {
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.setImageDrawable(getIcon(R.drawable.ic_action_device_topbar, iconColor));
break;
@ -229,7 +234,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else {
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.setImageDrawable(getIcon(R.drawable.ic_action_device_widget, iconColor));
break;
@ -241,7 +248,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else {
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));
break;
}

View file

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

View file

@ -155,7 +155,8 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
if (month.length() > 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;
}
holder.description.setText(descr);

View file

@ -237,7 +237,8 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
if (month.length() > 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));
} else {
itemViewHolder.point.setVisibility(View.GONE);

View file

@ -129,8 +129,17 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
}
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date);
itemViewHolder.description.setText(app.getString(R.string.passed, month + " " + day));
month = month.replaceAll("\\.", "");
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.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.v7.widget.RecyclerView;
import android.util.Pair;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@ -35,6 +36,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter {
private static final int LOCATION_ITEM_ID = 0;
private static final int ROUND_TRIP_FINISH_ITEM_ID = 1;
private MapActivity mapActivity;
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 boolean inRoundTrip;
private boolean showRoundTripItem;
private boolean inDragAndDrop;
public void setAdapterListener(MapMarkersListAdapterListener listener) {
this.listener = listener;
}
@ -63,6 +69,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
locDescription = new PointDescription(PointDescription.POINT_TYPE_MY_LOCATION,
mapActivity.getString(R.string.shared_string_location));
this.mapActivity = mapActivity;
inRoundTrip = mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get();
reloadData();
}
@ -88,27 +95,55 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
boolean firstMarkerItem = showLocationItem ? pos == 1 : pos == 0;
boolean lastMarkerItem = pos == getItemCount() - 1;
boolean start = pos == startPos;
boolean finish = pos == finishPos && startPos != finishPos;
final boolean finish = pos == finishPos && startPos != finishPos;
boolean firstSelectedMarker = pos == firstSelectedMarkerPos;
boolean roundTripFinishItem = finish && showRoundTripItem;
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.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.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.setVisibility(lastMarkerItem ? View.GONE : View.VISIBLE);
holder.checkBox.setVisibility(View.VISIBLE);
holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onItemClick(holder.itemView);
}
});
holder.checkBox.setVisibility(roundTripFinishItem ? View.GONE : View.VISIBLE);
if (!roundTripFinishItem) {
holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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.iconReorder.setVisibility(View.VISIBLE);
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) + "");
}
boolean iconSettled = false;
if ((start || finish) && !locationItem) {
int res = start ? R.drawable.ic_action_point_start : R.drawable.ic_action_point_destination;
if (location != null) {
holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location));
} 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)));
iconSettled = true;
}
if (locationItem || roundTripFinishItem) {
holder.iconReorder.setAlpha(.5f);
holder.iconReorder.setOnTouchListener(null);
}
if (locationItem) {
holder.topDivider.setVisibility(View.VISIBLE);
holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location));
holder.checkBox.setChecked(app.getMapMarkersHelper().isStartFromMyLocation());
holder.iconReorder.setAlpha(.5f);
holder.iconReorder.setOnTouchListener(null);
holder.distance.setVisibility(View.GONE);
holder.description.setText(locDescription.getName());
} else if (roundTripFinishItem) {
holder.topDivider.setVisibility(View.GONE);
holder.description.setText(mapActivity.getString(R.string.round_trip));
} else {
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.iconReorder.setAlpha(1f);
@ -148,6 +185,12 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
inDragAndDrop = true;
if (showRoundTripItem) {
int roundTripItemPos = finishPos;
reloadData();
notifyItemRemoved(roundTripItemPos);
}
listener.onDragStarted(holder);
}
return false;
@ -165,13 +208,13 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (month.length() > 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;
}
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;
holder.distance.setVisibility(visibility);
holder.point.setVisibility(visibility);
@ -206,7 +249,13 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override
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
@ -242,6 +291,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override
public void onItemDismiss(RecyclerView.ViewHolder holder) {
inDragAndDrop = false;
listener.onDragEnded(holder);
}
@ -263,12 +313,17 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
OsmandApplication app = mapActivity.getMyApplication();
myLoc = app.getLocationProvider().getLastStaleKnownLocation();
showLocationItem = myLoc != null;
inRoundTrip = app.getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get();
if (showLocationItem) {
lookupLocationAddress(app);
items.add(myLoc);
}
items.addAll(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers());
calculateStartAndFinishPos();
showRoundTripItem = inRoundTrip && !inDragAndDrop && startPos != -1;
if (showRoundTripItem) {
items.add(finishPos, items.get(startPos));
}
}
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();
boolean startCalculated = false;
boolean finishCalculated = false;
@ -299,6 +354,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem) {
startPos = 0;
startCalculated = true;
if (inRoundTrip && !inDragAndDrop) {
finishPos = 1;
finishCalculated = true;
}
}
for (int i = 0; i < items.size(); i++) {
Object item = items.get(i);
@ -320,7 +379,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (item instanceof MapMarker) {
MapMarker m = (MapMarker) item;
if (m.selected) {
finishPos = i;
finishPos = i + (inRoundTrip && !inDragAndDrop ? 1 : 0);
finishCalculated = true;
break;
}
@ -339,6 +398,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
public interface MapMarkersListAdapterListener {
void onDisableRoundTripClick();
void onCheckBoxClick(View view);
void onItemClick(View view);
void onDragStarted(RecyclerView.ViewHolder holder);

View file

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

View file

@ -11,6 +11,9 @@ import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
public final static Log LOG = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
@ -21,6 +24,18 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
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
public EntityInfo getEntityInfo(long id) {
return null;
@ -41,6 +56,9 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
} else {
plugin.getDBPOI().addOpenstreetmap(p);
}
for (OnNodeCommittedListener listener : listeners) {
listener.onNoteCommitted();
}
return newNode;
}
@ -78,5 +96,9 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
@Override
public void closeChangeSet() {
}
public interface OnNodeCommittedListener {
void onNoteCommitted();
}
}

View file

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

View file

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

View file

@ -81,11 +81,17 @@ public class NavStartStopAction extends QuickAction {
public int getIconRes(Context context) {
if (context instanceof MapActivity) {
RoutingHelper helper = ((MapActivity) context).getRoutingHelper();
if (helper.isPauseNavigation() || helper.isFollowingMode()) {
return R.drawable.ic_action_target;
if (!helper.isRoutePlanningMode() && !helper.isFollowingMode()) {
return ((MapActivity) context).getMapActions().getRouteMode(null).getSmallIconDark();
}
return R.drawable.ic_action_start_navigation;
return helper.getAppMode().getSmallIconDark();
}
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 List<PoiUIFilter> list = new ArrayList<>();
list.add(poiFilters.getCustomPOIFilter());
for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) {
addFilterToList(adapter, list, f);

View file

@ -11,6 +11,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.resources.ResourceManager.ResourceListener;
import net.osmand.search.SearchUICore;
import net.osmand.search.SearchUICore.SearchResultCollection;
@ -86,7 +87,10 @@ public class QuickSearchHelper implements ResourceListener {
for(CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters()) {
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);
}

View file

@ -66,7 +66,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private Paint bitmapPaintDestYellow;
private Paint bitmapPaintDestTeal;
private Paint bitmapPaintDestPurple;
private Bitmap arrowLight;
private Bitmap arrowToDestination;
private Bitmap arrowShadow;
private float[] calculations = new float[2];
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);
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);
bitmapPaintDestGreen = createPaintDest(R.color.marker_green);
bitmapPaintDestOrange = createPaintDest(R.color.marker_orange);
@ -125,10 +129,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
bitmapPaintDestTeal = createPaintDest(R.color.marker_teal);
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);
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) {
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);
textAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.paint.setStyle(Paint.Style.FILL);
@ -315,7 +319,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
final QuadPoint cp = tileBox.getCenterPixelPoint();
canvas.rotate(bearing, cp.x, cp.y);
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(arrowLight, cp.x, cp.y, bitmapPaint);
canvas.restore();
}
i++;
@ -461,10 +467,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override
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

View file

@ -321,7 +321,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
app.getSettings().isLightContent() ?
R.style.OsmandLightTheme :
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);
ll.setOrientation(LinearLayout.VERTICAL);
@ -519,9 +519,17 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
@Override
public PointDescription getObjectName(Object o) {
if (o instanceof Amenity) {
return new PointDescription(PointDescription.POINT_TYPE_POI, ((Amenity) o).getName(
view.getSettings().MAP_PREFERRED_LOCALE.get(),
view.getSettings().MAP_TRANSLITERATE_NAMES.get()));
Amenity a = (Amenity) o;
String preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.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;
}

View file

@ -38,7 +38,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
private Bitmap mStartPoint;
private Bitmap mTargetPoint;
private Bitmap mIntermediatePoint;
private Bitmap mArrowToDestination;
private Paint mTextPaint;
@ -68,7 +67,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
mStartPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_start_point);
mTargetPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_target_point);
mIntermediatePoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_intermediate_point);
mArrowToDestination = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_arrow_to_destination);
}
@Override
@ -126,27 +124,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
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) {

View file

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

View file

@ -311,8 +311,7 @@ public class MapWidgetRegistry {
}
private void resetDefaultAppearance(ApplicationMode appMode) {
// settings.SHOW_RULER.resetToDefault();
settings.SHOW_DESTINATION_ARROW.resetToDefault();
// settings.SHOW_RULER.resetToDefault();
settings.TRANSPARENT_MAP_THEME.resetToDefault();
settings.SHOW_STREET_NAME.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) {
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.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP);
if (mode != ApplicationMode.DEFAULT) {