diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index 5bf1eee503..e2f96678fe 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -284,6 +284,12 @@ task copyStyleIcons(type: Copy) { include "**/*.png" } +task copyWidgetIcons(type: Exec) { + if (!Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine 'sh', file("./copy_widget_icons.sh").getAbsolutePath() + } +} + task collectExternalResources { dependsOn collectVoiceAssets, collectFonts, @@ -291,7 +297,8 @@ task collectExternalResources { collectHelpContentsStyle, copyStyleIcons, updateNoTranslate, - validateTranslate + validateTranslate, + copyWidgetIcons } // Legacy core build diff --git a/OsmAnd/res/drawable-large-hdpi/map_action_arrow.png b/OsmAnd/res/drawable-large-hdpi/map_action_arrow.png index 986b3ad186..1371b10c80 100644 Binary files a/OsmAnd/res/drawable-large-hdpi/map_action_arrow.png and b/OsmAnd/res/drawable-large-hdpi/map_action_arrow.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_action_fav_dark.png b/OsmAnd/res/drawable-large-hdpi/map_action_fav_dark.png index 9613a43ad6..2a37a2dc82 100644 Binary files a/OsmAnd/res/drawable-large-hdpi/map_action_fav_dark.png and b/OsmAnd/res/drawable-large-hdpi/map_action_fav_dark.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_action_flag_dark.png b/OsmAnd/res/drawable-large-hdpi/map_action_flag_dark.png index e61d74d4e9..43cb50c36f 100644 Binary files a/OsmAnd/res/drawable-large-hdpi/map_action_flag_dark.png and b/OsmAnd/res/drawable-large-hdpi/map_action_flag_dark.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_action_gshare_dark.png b/OsmAnd/res/drawable-large-hdpi/map_action_gshare_dark.png index c49eca17c4..518b936039 100644 Binary files a/OsmAnd/res/drawable-large-hdpi/map_action_gshare_dark.png and b/OsmAnd/res/drawable-large-hdpi/map_action_gshare_dark.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_marker_point_14dp.png b/OsmAnd/res/drawable-large-hdpi/map_marker_point_14dp.png new file mode 100644 index 0000000000..e72ed6198a Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_marker_point_14dp.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_overflow_menu_white.png b/OsmAnd/res/drawable-large-hdpi/map_overflow_menu_white.png index 67673adab6..e716e1f098 100644 Binary files a/OsmAnd/res/drawable-large-hdpi/map_overflow_menu_white.png and b/OsmAnd/res/drawable-large-hdpi/map_overflow_menu_white.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_day.png b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_day.png new file mode 100644 index 0000000000..3c1d19287d Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_day.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_night.png b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_night.png new file mode 100644 index 0000000000..b377614e41 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_night.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_small_day.png b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_small_day.png new file mode 100644 index 0000000000..250b095e7d Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_small_day.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_small_night.png b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_small_night.png new file mode 100644 index 0000000000..0d9a10f5b7 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_user_location_small_night.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_user_stale_location_day.png b/OsmAnd/res/drawable-large-hdpi/map_pin_user_stale_location_day.png new file mode 100644 index 0000000000..c11db9f38c Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_user_stale_location_day.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_user_stale_location_night.png b/OsmAnd/res/drawable-large-hdpi/map_pin_user_stale_location_night.png new file mode 100644 index 0000000000..56f248faae Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_user_stale_location_night.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_color.png b/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_color.png new file mode 100644 index 0000000000..c16e77acfa Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_color.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_shadow.png b/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_shadow.png new file mode 100644 index 0000000000..03c2ac4cb8 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_shadow.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_stroke.png b/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_stroke.png new file mode 100644 index 0000000000..a580882ce0 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_stroke.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_transport_stop_bg.png b/OsmAnd/res/drawable-large-hdpi/map_transport_stop_bg.png new file mode 100644 index 0000000000..33a9b2349f Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_transport_stop_bg.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_intermediate_time_day.png b/OsmAnd/res/drawable-large-hdpi/widget_intermediate_time_day.png new file mode 100644 index 0000000000..f1b34258e5 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_intermediate_time_day.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_intermediate_time_night.png b/OsmAnd/res/drawable-large-hdpi/widget_intermediate_time_night.png new file mode 100644 index 0000000000..5226f4bf94 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_intermediate_time_night.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_action_arrow.png b/OsmAnd/res/drawable-large-xhdpi/map_action_arrow.png index 34193b6443..6e73dc00d8 100644 Binary files a/OsmAnd/res/drawable-large-xhdpi/map_action_arrow.png and b/OsmAnd/res/drawable-large-xhdpi/map_action_arrow.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_action_fav_dark.png b/OsmAnd/res/drawable-large-xhdpi/map_action_fav_dark.png index d2407408a1..2b505969b5 100644 Binary files a/OsmAnd/res/drawable-large-xhdpi/map_action_fav_dark.png and b/OsmAnd/res/drawable-large-xhdpi/map_action_fav_dark.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_action_flag_dark.png b/OsmAnd/res/drawable-large-xhdpi/map_action_flag_dark.png index 7b41a25dfb..7096acce62 100644 Binary files a/OsmAnd/res/drawable-large-xhdpi/map_action_flag_dark.png and b/OsmAnd/res/drawable-large-xhdpi/map_action_flag_dark.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_action_gshare_dark.png b/OsmAnd/res/drawable-large-xhdpi/map_action_gshare_dark.png index f862a3f3f5..7e2c60df6b 100644 Binary files a/OsmAnd/res/drawable-large-xhdpi/map_action_gshare_dark.png and b/OsmAnd/res/drawable-large-xhdpi/map_action_gshare_dark.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_marker_point_14dp.png b/OsmAnd/res/drawable-large-xhdpi/map_marker_point_14dp.png new file mode 100644 index 0000000000..73899ce1b3 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_marker_point_14dp.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_overflow_menu_white.png b/OsmAnd/res/drawable-large-xhdpi/map_overflow_menu_white.png index 2dedaef71f..7d02de5140 100644 Binary files a/OsmAnd/res/drawable-large-xhdpi/map_overflow_menu_white.png and b/OsmAnd/res/drawable-large-xhdpi/map_overflow_menu_white.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_day.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_day.png new file mode 100644 index 0000000000..148c3f1eaf Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_day.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_night.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_night.png new file mode 100644 index 0000000000..7c7dfa0c91 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_night.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_small_day.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_small_day.png new file mode 100644 index 0000000000..a4df2aec38 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_small_day.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_small_night.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_small_night.png new file mode 100644 index 0000000000..a06d8dc5f4 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_small_night.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_user_stale_location_day.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_stale_location_day.png new file mode 100644 index 0000000000..a5971c9b8d Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_stale_location_day.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_user_stale_location_night.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_stale_location_night.png new file mode 100644 index 0000000000..4f3bc9fd25 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_user_stale_location_night.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_color.png b/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_color.png new file mode 100644 index 0000000000..fd1834ef5d Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_color.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_shadow.png b/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_shadow.png new file mode 100644 index 0000000000..63fe9aca4a Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_shadow.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_stroke.png b/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_stroke.png new file mode 100644 index 0000000000..aa7810c72c Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_shield_marker_point_stroke.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_transport_stop_bg.png b/OsmAnd/res/drawable-large-xhdpi/map_transport_stop_bg.png new file mode 100644 index 0000000000..7136521aca Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_transport_stop_bg.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_intermediate_time_day.png b/OsmAnd/res/drawable-large-xhdpi/widget_intermediate_time_day.png new file mode 100644 index 0000000000..c4d15166b5 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_intermediate_time_day.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_intermediate_time_night.png b/OsmAnd/res/drawable-large-xhdpi/widget_intermediate_time_night.png new file mode 100644 index 0000000000..c6de96431b Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_intermediate_time_night.png differ diff --git a/OsmAnd/res/drawable-large/map_action_arrow.png b/OsmAnd/res/drawable-large/map_action_arrow.png index 472732aa96..3a0d7de107 100644 Binary files a/OsmAnd/res/drawable-large/map_action_arrow.png and b/OsmAnd/res/drawable-large/map_action_arrow.png differ diff --git a/OsmAnd/res/drawable-large/map_action_fav_dark.png b/OsmAnd/res/drawable-large/map_action_fav_dark.png index dfe6808cad..bcff65516a 100644 Binary files a/OsmAnd/res/drawable-large/map_action_fav_dark.png and b/OsmAnd/res/drawable-large/map_action_fav_dark.png differ diff --git a/OsmAnd/res/drawable-large/map_action_flag_dark.png b/OsmAnd/res/drawable-large/map_action_flag_dark.png index 5bc3ca2e17..3909f3c18f 100644 Binary files a/OsmAnd/res/drawable-large/map_action_flag_dark.png and b/OsmAnd/res/drawable-large/map_action_flag_dark.png differ diff --git a/OsmAnd/res/drawable-large/map_action_gshare_dark.png b/OsmAnd/res/drawable-large/map_action_gshare_dark.png index f4df454272..7ea5f3bbed 100644 Binary files a/OsmAnd/res/drawable-large/map_action_gshare_dark.png and b/OsmAnd/res/drawable-large/map_action_gshare_dark.png differ diff --git a/OsmAnd/res/drawable-large/map_marker_point_14dp.png b/OsmAnd/res/drawable-large/map_marker_point_14dp.png new file mode 100644 index 0000000000..7f4e9e7012 Binary files /dev/null and b/OsmAnd/res/drawable-large/map_marker_point_14dp.png differ diff --git a/OsmAnd/res/drawable-large/map_overflow_menu_white.png b/OsmAnd/res/drawable-large/map_overflow_menu_white.png index a0001ebe32..275193e115 100644 Binary files a/OsmAnd/res/drawable-large/map_overflow_menu_white.png and b/OsmAnd/res/drawable-large/map_overflow_menu_white.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_user_location_day.png b/OsmAnd/res/drawable-large/map_pin_user_location_day.png new file mode 100644 index 0000000000..29940081b8 Binary files /dev/null and b/OsmAnd/res/drawable-large/map_pin_user_location_day.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_user_location_night.png b/OsmAnd/res/drawable-large/map_pin_user_location_night.png new file mode 100644 index 0000000000..803ec98639 Binary files /dev/null and b/OsmAnd/res/drawable-large/map_pin_user_location_night.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_user_location_small_day.png b/OsmAnd/res/drawable-large/map_pin_user_location_small_day.png new file mode 100644 index 0000000000..ad9d3e068f Binary files /dev/null and b/OsmAnd/res/drawable-large/map_pin_user_location_small_day.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_user_location_small_night.png b/OsmAnd/res/drawable-large/map_pin_user_location_small_night.png new file mode 100644 index 0000000000..c5da47c4ce Binary files /dev/null and b/OsmAnd/res/drawable-large/map_pin_user_location_small_night.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_user_stale_location_day.png b/OsmAnd/res/drawable-large/map_pin_user_stale_location_day.png new file mode 100644 index 0000000000..8f75c4498d Binary files /dev/null and b/OsmAnd/res/drawable-large/map_pin_user_stale_location_day.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_user_stale_location_night.png b/OsmAnd/res/drawable-large/map_pin_user_stale_location_night.png new file mode 100644 index 0000000000..20c38a1592 Binary files /dev/null and b/OsmAnd/res/drawable-large/map_pin_user_stale_location_night.png differ diff --git a/OsmAnd/res/drawable-large/map_shield_marker_point_color.png b/OsmAnd/res/drawable-large/map_shield_marker_point_color.png new file mode 100644 index 0000000000..d450f26b27 Binary files /dev/null and b/OsmAnd/res/drawable-large/map_shield_marker_point_color.png differ diff --git a/OsmAnd/res/drawable-large/map_shield_marker_point_shadow.png b/OsmAnd/res/drawable-large/map_shield_marker_point_shadow.png new file mode 100644 index 0000000000..5a532cf41c Binary files /dev/null and b/OsmAnd/res/drawable-large/map_shield_marker_point_shadow.png differ diff --git a/OsmAnd/res/drawable-large/map_shield_marker_point_stroke.png b/OsmAnd/res/drawable-large/map_shield_marker_point_stroke.png new file mode 100644 index 0000000000..5398836fea Binary files /dev/null and b/OsmAnd/res/drawable-large/map_shield_marker_point_stroke.png differ diff --git a/OsmAnd/res/drawable-large/map_transport_stop_bg.png b/OsmAnd/res/drawable-large/map_transport_stop_bg.png new file mode 100644 index 0000000000..169363e837 Binary files /dev/null and b/OsmAnd/res/drawable-large/map_transport_stop_bg.png differ diff --git a/OsmAnd/res/drawable-large/widget_intermediate_time_day.png b/OsmAnd/res/drawable-large/widget_intermediate_time_day.png new file mode 100644 index 0000000000..4cbae4cd16 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_intermediate_time_day.png differ diff --git a/OsmAnd/res/drawable-large/widget_intermediate_time_night.png b/OsmAnd/res/drawable-large/widget_intermediate_time_night.png new file mode 100644 index 0000000000..39532f25f9 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_intermediate_time_night.png differ diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 90dbbcb1fd..607083d8a7 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -950,6 +950,7 @@ Pink Translucent pink Brown + Black Translucent purple Restart the app manually to apply all changes. Light diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index cff3269310..e488dbd9fd 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -653,6 +653,7 @@ public class AppInitializer implements IProgress { notifyEvent(InitEvents.RESTORE_BACKUPS); app.mapMarkersHelper.syncAllGroupsAsync(); app.searchUICore.initSearchUICore(); + app.avoidSpecificRoads.initRouteObjects(); checkLiveUpdatesAlerts(); diff --git a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java index bd08eb16d7..89660db9a4 100644 --- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java @@ -36,6 +36,7 @@ public class GpxSelectionHelper { private static final String CURRENT_TRACK = "currentTrack"; private static final String FILE = "file"; private static final String COLOR = "color"; + private static final String SELECTED_BY_USER = "selected_by_user"; private OsmandApplication app; @NonNull private List selectedGPXFiles = new java.util.ArrayList<>(); @@ -410,7 +411,7 @@ public class GpxSelectionHelper { public void setGpxFileToDisplay(GPXFile... gpxs) { // special case for gpx current route for (GPXFile gpx : gpxs) { - selectGpxFileImpl(gpx, true, false, true); + selectGpxFileImpl(gpx, true, false, true, true); } saveCurrentSelections(); } @@ -423,6 +424,7 @@ public class GpxSelectionHelper { boolean save = false; for (int i = 0; i < ar.length(); i++) { JSONObject obj = ar.getJSONObject(i); + boolean selectedByUser = obj.optBoolean(SELECTED_BY_USER, true); if (obj.has(FILE)) { File fl = new File(obj.getString(FILE)); if (p != null) { @@ -436,10 +438,12 @@ public class GpxSelectionHelper { if (gpx.warning != null) { save = true; } else { - selectGpxFile(gpx, true, false); + selectGpxFile(gpx, true, false, true, selectedByUser); } } else if (obj.has(CURRENT_TRACK)) { - selectedGPXFiles.add(savingTrackHelper.getCurrentTrack()); + SelectedGpxFile file = savingTrackHelper.getCurrentTrack(); + file.selectedByUser = selectedByUser; + selectedGPXFiles.add(file); } } processSplit(); @@ -467,6 +471,7 @@ public class GpxSelectionHelper { obj.put(COLOR, Algorithms.colorToString(s.gpxFile.getColor(0))); } } + obj.put(SELECTED_BY_USER, s.selectedByUser); } catch (JSONException e) { e.printStackTrace(); } @@ -476,13 +481,16 @@ public class GpxSelectionHelper { app.getSettings().SELECTED_GPX.set(ar.toString()); } - private SelectedGpxFile selectGpxFileImpl(GPXFile gpx, boolean show, boolean notShowNavigationDialog, boolean syncGroup) { + private SelectedGpxFile selectGpxFileImpl(GPXFile gpx, boolean show, boolean notShowNavigationDialog, boolean syncGroup, boolean selectedByUser) { boolean displayed; SelectedGpxFile sf; if (gpx != null && gpx.showCurrentTrack) { sf = savingTrackHelper.getCurrentTrack(); sf.notShowNavigationDialog = notShowNavigationDialog; displayed = selectedGPXFiles.contains(sf); + if (!displayed && show) { + sf.selectedByUser = selectedByUser; + } } else { assert gpx != null; sf = getSelectedFileByPath(gpx.path); @@ -491,6 +499,7 @@ public class GpxSelectionHelper { sf = new SelectedGpxFile(); sf.setGpxFile(gpx); sf.notShowNavigationDialog = notShowNavigationDialog; + sf.selectedByUser = selectedByUser; } } if (displayed != show) { @@ -507,11 +516,11 @@ public class GpxSelectionHelper { } public SelectedGpxFile selectGpxFile(GPXFile gpx, boolean show, boolean notShowNavigationDialog) { - return selectGpxFile(gpx, show, notShowNavigationDialog, true); + return selectGpxFile(gpx, show, notShowNavigationDialog, true, true); } - public SelectedGpxFile selectGpxFile(GPXFile gpx, boolean show, boolean notShowNavigationDialog, boolean syncGroup) { - SelectedGpxFile sf = selectGpxFileImpl(gpx, show, notShowNavigationDialog, syncGroup); + public SelectedGpxFile selectGpxFile(GPXFile gpx, boolean show, boolean notShowNavigationDialog, boolean syncGroup, boolean selectedByUser) { + SelectedGpxFile sf = selectGpxFileImpl(gpx, show, notShowNavigationDialog, syncGroup, selectedByUser); saveCurrentSelections(); return sf; } @@ -549,6 +558,7 @@ public class GpxSelectionHelper { public static class SelectedGpxFile { public boolean notShowNavigationDialog = false; + public boolean selectedByUser = true; private boolean showCurrentTrack; private GPXFile gpxFile; diff --git a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java index 84fcbb11d7..e7e5fdaeb4 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java @@ -1,6 +1,7 @@ package net.osmand.plus; import android.content.Context; +import android.text.format.DateUtils; import net.osmand.data.Amenity; import net.osmand.data.City.CityType; @@ -52,6 +53,10 @@ public class OsmAndFormatter { return hours + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (sec < 10 ? "0" + sec : sec); } + public static String getFormattedDate(Context context, long milliseconds) { + return DateUtils.formatDateTime(context, milliseconds, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); + } + public static double calculateRoundedDist(double distInMeters, OsmandApplication ctx) { OsmandSettings settings = ctx.getSettings(); MetricsConstants mc = settings.METRIC_SYSTEM.get(); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 72c899cdb9..1a8401a167 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1481,6 +1481,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven LOG.error("error", e); } } + setIntent(null); } } } diff --git a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java index adc4b49333..ce439474e8 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java +++ b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java @@ -21,7 +21,6 @@ import net.osmand.ResultMatcher; import net.osmand.binary.RouteDataObject; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; -import net.osmand.plus.AppInitializer; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; @@ -47,34 +46,13 @@ public class AvoidSpecificRoads { for (LatLon latLon : app.getSettings().getImpassableRoadPoints()) { impassableRoads.put(latLon, null); } - if (app.isApplicationInitializing()) { - app.runInUIThread(new Runnable() { - @Override - public void run() { - app.getAppInitializer().addListener(new AppInitializer.AppInitializeListener() { - @Override - public void onProgress(AppInitializer init, AppInitializer.InitEvents event) { - - } - - @Override - public void onFinish(AppInitializer init) { - initRouteObjects(); - init.removeListener(this); - } - }); - } - }); - } else { - initRouteObjects(); - } } public Map getImpassableRoads() { return impassableRoads; } - private void initRouteObjects() { + public void initRouteObjects() { for (LatLon latLon : impassableRoads.keySet()) { addImpassableRoad(null, latLon, false, true); } diff --git a/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java b/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java index c3da6d983e..79dc38e3d4 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java @@ -38,7 +38,8 @@ public class ColorDialogs { R.string.rendering_value_blue_name, R.string.rendering_value_purple_name, R.string.rendering_value_pink_name, - R.string.rendering_value_brown_name + R.string.rendering_value_brown_name, + R.string.rendering_value_black_name }; public static int[] pallette = new int[] { @@ -52,7 +53,8 @@ public class ColorDialogs { 0xb41010a0, 0xb4a71de1, 0xb4e044bb, - 0xb48e2512 + 0xb48e2512, + 0xff000001 }; public static String[] paletteColorTags = new String[] { @@ -66,7 +68,8 @@ public class ColorDialogs { "blue", "purple", "pink", - "brown" + "brown", + "black" }; private static double getDistanceBetweenColors(int color1, int color2) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java index ba03ff372d..7fee517a1c 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java @@ -16,9 +16,6 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.views.DirectionDrawable; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; public class MapMarkerDialogHelper { @@ -101,14 +98,7 @@ public class MapMarkerDialogHelper { descText.setVisibility(View.GONE); - 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 desc = OsmAndFormatter.getFormattedDate(app, marker.creationDate); String markerGroupName = marker.groupName; if (markerGroupName != null) { if (markerGroupName.equals("")) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java index 845ce4c045..106db868e6 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java @@ -16,8 +16,6 @@ import net.osmand.plus.GPXUtilities; import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GPXUtilities.GPXTrackAnalysis; import net.osmand.plus.GpxSelectionHelper; -import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.mapmarkers.adapters.GroupsAdapter; @@ -68,15 +66,21 @@ public class AddTracksGroupBottomSheetDialogFragment extends AddGroupBottomSheet fragment.setArguments(args); fragment.setUsedOnMap(false); fragment.show(getParentFragment().getChildFragmentManager(), SelectWptCategoriesBottomSheetDialogFragment.TAG); - dismiss(); - } else if(dataItem.getFile() != null) { - getMyApplication().getMapMarkersHelper().addOrEnableGpxGroup(dataItem.getFile()); - dismiss(); + } else { + OsmandApplication app = getMyApplication(); + if (app != null) { + GpxSelectionHelper selectionHelper = app.getSelectedGpxHelper(); + File gpx = dataItem.getFile(); + if (selectionHelper.getSelectedFileByPath(gpx.getAbsolutePath()) == null) { + GPXFile res = GPXUtilities.loadGPXFile(app, gpx); + selectionHelper.selectGpxFile(res, true, false, false, false); + } + app.getMapMarkersHelper().addOrEnableGpxGroup(gpx); + } } + dismiss(); } - - @SuppressLint("StaticFieldLeak") public class ProcessGpxTask extends AsyncTask { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java index 9800cc4d94..5b23af3470 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java @@ -136,7 +136,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedFileByPath(gpxFile.path); if (selectedGpxFile == null) { - gpxSelectionHelper.selectGpxFile(gpxFile, true, false); + gpxSelectionHelper.selectGpxFile(gpxFile, true, false, false, false); } MapMarkersGroup group = mapMarkersHelper.getMarkersGroup(gpxFile); if (group == null) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java index 7c554c4c4e..99f626b93c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java @@ -11,6 +11,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import net.osmand.AndroidUtils; import net.osmand.data.LatLon; +import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.UiUtilities; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; @@ -18,14 +19,10 @@ import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.R; import net.osmand.plus.UiUtilities.UpdateLocationViewCache; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.util.Algorithms; -import java.text.SimpleDateFormat; import java.util.Collections; -import java.util.Date; import java.util.List; -import java.util.Locale; public class MapMarkersActiveAdapter extends RecyclerView.Adapter implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter { @@ -136,14 +133,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter 1) { - month = Character.toUpperCase(month.charAt(0)) + month.substring(1); - } - month = month.replaceAll("\\.", ""); - String day = new SimpleDateFormat("d", Locale.getDefault()).format(date); - descr = month + " " + day; + descr = OsmAndFormatter.getFormattedDate(mapActivity, marker.creationDate); } if (marker.wptPt != null && !Algorithms.isEmpty(marker.wptPt.category)) { descr = marker.wptPt.category + ", " + descr; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java index d8aa980092..b5a707d9f3 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java @@ -2,6 +2,7 @@ package net.osmand.plus.mapmarkers.adapters; import android.os.Bundle; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.design.widget.Snackbar; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; @@ -17,6 +18,7 @@ import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.GPXUtilities; +import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.UiUtilities; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.GroupHeader; @@ -27,7 +29,6 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities.UpdateLocationViewCache; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.plus.mapmarkers.SelectWptCategoriesBottomSheetDialogFragment; import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment; import net.osmand.plus.wikivoyage.data.TravelArticle; @@ -38,7 +39,6 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -318,19 +318,13 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter 1) { - month = Character.toUpperCase(month.charAt(0)) + month.substring(1); - } - month = month.replaceAll("\\.", ""); - String day = new SimpleDateFormat("d", Locale.getDefault()).format(date); - itemViewHolder.description.setText(app.getString(R.string.passed, month + " " + day)); + itemViewHolder.description.setText(app.getString(R.string.passed, OsmAndFormatter.getFormattedDate(app, date))); } else { itemViewHolder.point.setVisibility(View.GONE); itemViewHolder.description.setVisibility(View.GONE); @@ -471,13 +465,13 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter 1) { - month = Character.toUpperCase(month.charAt(0)) + month.substring(1); - } - month = month.replaceAll("\\.", ""); - String day = new SimpleDateFormat("d", Locale.getDefault()).format(date); - String desc = app.getString(R.string.passed, month + " " + day); + String desc = app.getString(R.string.passed, OsmAndFormatter.getFormattedDate(app, marker.visitedDate)); String markerGroupName = marker.groupName; if (markerGroupName != null) { if (markerGroupName.equals("")) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index 7e8f730cac..c2a0f75879 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -24,12 +24,9 @@ import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.util.MapUtils; -import java.text.SimpleDateFormat; import java.util.Collections; -import java.util.Date; import java.util.LinkedList; import java.util.List; -import java.util.Locale; import java.util.Map; public class MapMarkersListAdapter extends RecyclerView.Adapter @@ -203,13 +200,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter 1) { - month = Character.toUpperCase(month.charAt(0)) + month.substring(1); - } - String day = new SimpleDateFormat("d", Locale.getDefault()).format(date); - descr = month + " " + day; + descr = OsmAndFormatter.getFormattedDate(app, marker.creationDate); } holder.description.setText(descr); } diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index a73298f615..519caa12c9 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -45,10 +45,6 @@ import net.osmand.util.MapUtils; import org.json.JSONException; import org.json.JSONObject; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; import org.xml.sax.SAXException; import java.io.BufferedReader; @@ -65,8 +61,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; @@ -79,14 +73,15 @@ public class RouteProvider { private static final int MIN_DISTANCE_FOR_INSERTING_ROUTE_SEGMENT = 60; public enum RouteService { - OSMAND("OsmAnd (offline)"), YOURS("YOURS"), -// ORS("OpenRouteService"), // disable ors due to no public rest service (testing2015 doesn't seem stable) - OSRM("OSRM (only car)"), - BROUTER("BRouter (offline)"), STRAIGHT("Straight line"); + OSMAND("OsmAnd (offline)"), + //ORS("OpenRouteService"), // disable ors due to no public rest service (testing2015 doesn't seem stable) + OSRM("OSRM (only car)"), + BROUTER("BRouter (offline)"), + STRAIGHT("Straight line"); private final String name; - private RouteService(String name) { + RouteService(String name) { this.name = name; } @@ -106,8 +101,8 @@ public class RouteProvider { } public static RouteService[] getAvailableRouters(OsmandApplication ctx) { - List list = new ArrayList(); - for(RouteService r : values()) { + List list = new ArrayList<>(); + for (RouteService r : values()) { if (r.isAvailable(ctx)) { list.add(r); } @@ -311,8 +306,6 @@ public class RouteProvider { res = findVectorMapsRoute(params, calcGPXRoute); } else if (params.type == RouteService.BROUTER) { res = findBROUTERRoute(params); - } else if (params.type == RouteService.YOURS) { - res = findYOURSRoute(params); // } else if (params.type == RouteService.ORS) { // res = findORSRoute(params); } else if (params.type == RouteService.OSRM) { @@ -596,66 +589,6 @@ public class RouteProvider { return ctx.getString(resId); } - protected RouteCalculationResult findYOURSRoute(RouteCalculationParams params) throws MalformedURLException, IOException, - ParserConfigurationException, FactoryConfigurationError, SAXException { - List res = new ArrayList(); - StringBuilder uri = new StringBuilder(); - uri.append("http://www.yournavigation.org/api/1.0/gosmore.php?format=kml"); //$NON-NLS-1$ - uri.append("&flat=").append(params.start.getLatitude()); //$NON-NLS-1$ - uri.append("&flon=").append(params.start.getLongitude()); //$NON-NLS-1$ - uri.append("&tlat=").append(params.end.getLatitude()); //$NON-NLS-1$ - uri.append("&tlon=").append(params.end.getLongitude()); //$NON-NLS-1$ - if (params.mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) { - uri.append("&v=bicycle") ; //$NON-NLS-1$ - } else if (params.mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) { - uri.append("&v=foot") ; //$NON-NLS-1$ - } else if(params.mode.isDerivedRoutingFrom(ApplicationMode.CAR)){ - uri.append("&v=motorcar"); //$NON-NLS-1$ - } else { - return applicationModeNotSupported(params); - } - uri.append("&fast=").append(params.fast ? "1" : "0").append("&layer=mapnik"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - log.info("URL route " + uri); - URLConnection connection = NetworkUtils.getHttpURLConnection(uri.toString()); - connection.setRequestProperty("User-Agent", Version.getFullVersion(params.ctx)); - DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document doc = dom.parse(new InputSource(new InputStreamReader(connection.getInputStream()))); - NodeList list = doc.getElementsByTagName("coordinates"); //$NON-NLS-1$ - for(int i=0; i items = downloadThread.getIndexes().getWikivoyageItems(); showOtherMaps = items != null && items.size() > 1; } @@ -341,9 +342,10 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv @NonNull private String getWikivoyageFileName() { - OsmandApplication app = getMyApplication(); - File selectedTravelBook = app != null ? app.getTravelDbHelper().getSelectedTravelBook() : null; - return selectedTravelBook == null ? WORLD_WIKIVOYAGE_FILE_NAME : selectedTravelBook.getName(); +// OsmandApplication app = getMyApplication(); +// File selectedTravelBook = app != null ? app.getTravelDbHelper().getSelectedTravelBook() : null; +// return selectedTravelBook == null ? WORLD_WIKIVOYAGE_FILE_NAME : selectedTravelBook.getName(); + return WORLD_WIKIVOYAGE_FILE_NAME; } private void removeDownloadUpdateCard() {