From e069d66b66e521a4974f4ff9e514fc257a0996bf Mon Sep 17 00:00:00 2001 From: PaulStets Date: Fri, 26 Jan 2018 16:49:52 +0200 Subject: [PATCH 01/11] Fixed #4873 --- .../MeasurementToolFragment.java | 3 +-- .../adapter/MeasurementToolAdapter.java | 18 +++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 0245c0ce75..5e3dd47ac4 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -705,9 +705,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { } @Override - public void onItemClick(View view) { + public void onItemClick(int position) { if (mapActivity != null && measurementLayer != null) { - int position = pointsRv.indexOfChild(view); if (pointsListOpened) { hidePointsList(); } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java index effb5e6442..caa20b9106 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java @@ -8,8 +8,10 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.RelativeLayout; import android.widget.TextView; import net.osmand.plus.GPXUtilities.WptPt; @@ -52,12 +54,6 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter Date: Fri, 26 Jan 2018 16:51:56 +0200 Subject: [PATCH 02/11] Removed unused import --- .../plus/measurementtool/adapter/MeasurementToolAdapter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java index caa20b9106..293fd57816 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java @@ -11,7 +11,6 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; -import android.widget.RelativeLayout; import android.widget.TextView; import net.osmand.plus.GPXUtilities.WptPt; From bffea36c300c3813ba28c6d110556e11e33f2a96 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Fri, 26 Jan 2018 17:03:02 +0200 Subject: [PATCH 03/11] Use itemView --- .../plus/measurementtool/adapter/MeasurementToolAdapter.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java index 293fd57816..c123cf5c15 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/MeasurementToolAdapter.java @@ -8,7 +8,6 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -124,7 +123,7 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter Date: Fri, 26 Jan 2018 18:33:56 +0200 Subject: [PATCH 04/11] Fix format for latitude and longitude --- OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index 9eca8830e8..97b463d1c0 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -93,6 +93,7 @@ import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.Undoable import net.osmand.plus.views.mapwidgets.MapWidgetRegistry; import java.lang.ref.WeakReference; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -1515,7 +1516,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis start.start = false; start.intermediate = startInd != allTargets.size() - 1; if (targetPointsHelper.getPointToStart() == null) { - start.getOriginalPointDescription().setName(start.getLatitude() + ", " + start.getLongitude()); + DecimalFormat format = new DecimalFormat("#.#####"); + start.getOriginalPointDescription().setName(format.format(start.getLatitude()) + + ", " + format.format(start.getLongitude())); } first.start = true; first.intermediate = false; From 6f96fa61ac7097ca53d9f01bb0dc5af3868fa823 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 26 Jan 2018 18:58:45 +0200 Subject: [PATCH 05/11] Use PointDescription#getLocationNamePlain instead of DecimalFormat --- OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index 97b463d1c0..ce7f5efdef 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -46,6 +46,7 @@ import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.ValueHolder; import net.osmand.data.LatLon; +import net.osmand.data.PointDescription; import net.osmand.plus.ApplicationMode; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter.OnRowItemClick; @@ -93,7 +94,6 @@ import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.Undoable import net.osmand.plus.views.mapwidgets.MapWidgetRegistry; import java.lang.ref.WeakReference; -import java.text.DecimalFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -1516,9 +1516,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis start.start = false; start.intermediate = startInd != allTargets.size() - 1; if (targetPointsHelper.getPointToStart() == null) { - DecimalFormat format = new DecimalFormat("#.#####"); - start.getOriginalPointDescription().setName(format.format(start.getLatitude()) - + ", " + format.format(start.getLongitude())); + start.getOriginalPointDescription().setName(PointDescription + .getLocationNamePlain(getMyApplication(), start.getLatitude(), start.getLongitude())); } first.start = true; first.intermediate = false; From 76a077859990ad42fb17474044e9ca09107e040b Mon Sep 17 00:00:00 2001 From: sonora Date: Sat, 27 Jan 2018 09:56:01 +0100 Subject: [PATCH 06/11] Update 2.9 release notes with stuff I worked on last fall --- OsmAnd/res/values/strings.xml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 43a84e03c8..5a1d80d14f 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -28,9 +28,7 @@ GPX file with coordinates and data of the selected notes. GPX file with coordinates and data of all notes. - \u2022 Detection of stop signs now considers driving direction\n\n - \u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n - \u2022 Terrain (ascent) aware hiking time (Naismith\'s rule)\n\n + \u2022 \n\n Modify the search query. Actions @@ -340,13 +338,16 @@ \u2022 OsmAnd Live: bug fixes, fresh data on the server every 30 minutes, updates implemented into the navigation\n\n + \u2022 Detection of stop signs now considers driving direction\n\n + \u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n + \u2022 Terrain (ascent) aware hiking time (Naismith\'s rule)\n\n \u2022 Updated the context menu: show when the POI opens / closes\n\n \u2022 Transport menu: all available routes are now at the top\n\n \u2022 Wikipedia: added the button to open the original article, updated the appearance of articles\n\n - \u2022 Route: added possibility to swap start and end points in one tap\n\n - \u2022 Notes: added sorting by type and date\n\n - \u2022 OSM edits: show an icon and a name of the POI category, display completed actions\n\n - \u2022 New quick coordinate input screen for quick markers creation\n\n + \u2022 Route: added possibility to swap start and end points in one tap\n\n + \u2022 Notes: added sorting by type and date\n\n + \u2022 OSM edits: show an icon and a name of the POI category, display completed actions\n\n + \u2022 New quick coordinate input screen for quick markers creation\n\n Auto-split recordings after gap Start new segment after gap of 6 min, new track after gap of 2 h, or new file after a longer gap if the date has changed. From 556cb64fc8b78dee3bf337afcbeb59bd51de7f09 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Sat, 27 Jan 2018 12:34:37 +0200 Subject: [PATCH 07/11] Added negative speed tolerance --- .../osmand/plus/activities/SettingsNavigationActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index 7978fe9b15..55c6ed23dd 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -194,8 +194,8 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { registerListPreference(settings.ARRIVAL_DISTANCE_FACTOR, screen, arrivalNames, arrivalValues); //array size should be equal! - Float[] speedLimitsKm = new Float[]{0f, 5f, 7f, 10f, 15f, 20f}; - Float[] speedLimitsMiles = new Float[]{0f, 3f, 5f, 7f, 10f, 15f}; + Float[] speedLimitsKm = new Float[]{-10f, -7f,-5f, 0f, 5f, 7f, 10f, 15f, 20f}; + Float[] speedLimitsMiles = new Float[]{-7f, -5f, -3f, 0f, 3f, 5f, 7f, 10f, 15f}; if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) { String[] speedNames = new String[speedLimitsKm.length]; for (int i =0; i Date: Sat, 27 Jan 2018 13:35:37 +0200 Subject: [PATCH 08/11] Added ability to share point name (#4777) --- OsmAnd/res/values/strings.xml | 2 ++ .../osmand/plus/activities/actions/ShareDialog.java | 2 ++ .../osmand/plus/mapcontextmenu/other/ShareMenu.java | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 43a84e03c8..e689e51476 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2856,4 +2856,6 @@ Winter and ski Touring view (contrast and details) Nautical + Copy Point/POI name + Location has no name diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java index 300f9641d5..ad2cac6079 100644 --- a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java @@ -216,5 +216,7 @@ public class ShareDialog { public static void sendToClipboard(Activity activity, String text) { ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Activity.CLIPBOARD_SERVICE); clipboard.setText(text); + Toast.makeText(activity, "Copied to clipboard", Toast.LENGTH_LONG) + .show(); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java index ae7a4456e1..2de223bee1 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java @@ -5,6 +5,7 @@ import android.net.Uri; import android.os.Bundle; import android.support.v4.text.TextUtilsCompat; import android.support.v4.view.ViewCompat; +import android.widget.Toast; import net.osmand.data.LatLon; import net.osmand.plus.R; @@ -30,6 +31,7 @@ public class ShareMenu extends BaseMenuController { public enum ShareItem { MESSAGE(R.drawable.ic_action_message, R.string.shared_string_send), CLIPBOARD(R.drawable.ic_action_copy, R.string.shared_string_copy), + NAME(R.drawable.ic_action_copy, R.string.copy_location_name), GEO(R.drawable.ic_world_globe_dark, R.string.share_geo), QR_CODE(R.drawable.ic_action_qrcode, R.string.shared_string_qr_code); @@ -58,6 +60,7 @@ public class ShareMenu extends BaseMenuController { List list = new LinkedList<>(); list.add(ShareItem.MESSAGE); list.add(ShareItem.CLIPBOARD); + list.add(ShareItem.NAME); list.add(ShareItem.GEO); list.add(ShareItem.QR_CODE); return list; @@ -107,6 +110,15 @@ public class ShareMenu extends BaseMenuController { case CLIPBOARD: ShareDialog.sendToClipboard(getMapActivity(), sms); break; + case NAME: + if (!Algorithms.isEmpty(title)) { + ShareDialog.sendToClipboard(getMapActivity(), title); + } else { + Toast.makeText(getMapActivity(), + R.string.toast_empty_name_error, + Toast.LENGTH_LONG).show(); + } + break; case GEO: Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl)); getMapActivity().startActivity(mapIntent); From 3f2dfee22dc933cf8bd6331f7920e8a4f51f888e Mon Sep 17 00:00:00 2001 From: PaulStets Date: Sat, 27 Jan 2018 13:46:23 +0200 Subject: [PATCH 09/11] Extracted string resource for clipboard toast --- OsmAnd/res/values/strings.xml | 1 + OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index e689e51476..2e9583eac0 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2858,4 +2858,5 @@ Nautical Copy Point/POI name Location has no name + Copied to clipboard diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java index ad2cac6079..67d54ebe15 100644 --- a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java @@ -216,7 +216,7 @@ public class ShareDialog { public static void sendToClipboard(Activity activity, String text) { ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Activity.CLIPBOARD_SERVICE); clipboard.setText(text); - Toast.makeText(activity, "Copied to clipboard", Toast.LENGTH_LONG) + Toast.makeText(activity, R.string.clipboard_message, Toast.LENGTH_LONG) .show(); } } From 937ee090fc06a66cec5a7d6893595de979ff6bcf Mon Sep 17 00:00:00 2001 From: PaulStets Date: Sat, 27 Jan 2018 13:48:53 +0200 Subject: [PATCH 10/11] Fixed string resource for clipboard toast --- OsmAnd/res/values/strings.xml | 1 - OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2e9583eac0..e689e51476 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2858,5 +2858,4 @@ Nautical Copy Point/POI name Location has no name - Copied to clipboard diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java index 67d54ebe15..45371aef6e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java @@ -216,7 +216,7 @@ public class ShareDialog { public static void sendToClipboard(Activity activity, String text) { ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Activity.CLIPBOARD_SERVICE); clipboard.setText(text); - Toast.makeText(activity, R.string.clipboard_message, Toast.LENGTH_LONG) + Toast.makeText(activity, R.string.copied_to_clipboard, Toast.LENGTH_LONG) .show(); } } From 4a04cf2ecf5b25fc23c99e16c70c5a869dad8777 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sat, 27 Jan 2018 19:46:31 +0300 Subject: [PATCH 11/11] Tiny fix of opening hours parser --- OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java index 1edc076c61..870ab9b01f 100644 --- a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java +++ b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java @@ -643,7 +643,7 @@ public class OpeningHoursParser { private boolean off = false; /** - * Aadditional information or limitation. + * Additional information or limitation. * https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:comment */ private String comment; @@ -1106,7 +1106,7 @@ public class OpeningHoursParser { } else if (time > endTime && days[ad] && checkAnotherDay) { diff = 24 * 60 - endTime + time; } - if (limit == WITHOUT_TIME_LIMIT || (diff != -1 && diff <= limit || limit == CURRENT_DAY_TIME_LIMIT)) { + if (limit == WITHOUT_TIME_LIMIT || ((diff != -1 && diff <= limit) || limit == CURRENT_DAY_TIME_LIMIT)) { formatTime(startTime, sb); break; }