Merge branch 'master' of https://github.com/osmandapp/Osmand
|
@ -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
|
||||
|
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
OsmAnd/res/drawable-large-hdpi/map_marker_point_14dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-large-hdpi/map_pin_user_location_day.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
OsmAnd/res/drawable-large-hdpi/map_pin_user_location_night.png
Normal file
After Width: | Height: | Size: 7 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 6.9 KiB |
BIN
OsmAnd/res/drawable-large-hdpi/map_shield_marker_point_color.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2 KiB |
After Width: | Height: | Size: 1.8 KiB |
BIN
OsmAnd/res/drawable-large-hdpi/map_transport_stop_bg.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
OsmAnd/res/drawable-large-hdpi/widget_intermediate_time_day.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
OsmAnd/res/drawable-large-xhdpi/map_marker_point_14dp.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_day.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
OsmAnd/res/drawable-large-xhdpi/map_pin_user_location_night.png
Normal file
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
BIN
OsmAnd/res/drawable-large-xhdpi/map_transport_stop_bg.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
OsmAnd/res/drawable-large-xhdpi/widget_intermediate_time_day.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
OsmAnd/res/drawable-large/map_marker_point_14dp.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
OsmAnd/res/drawable-large/map_pin_user_location_day.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
OsmAnd/res/drawable-large/map_pin_user_location_night.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
OsmAnd/res/drawable-large/map_pin_user_location_small_day.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
OsmAnd/res/drawable-large/map_pin_user_location_small_night.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
OsmAnd/res/drawable-large/map_pin_user_stale_location_day.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
OsmAnd/res/drawable-large/map_pin_user_stale_location_night.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
OsmAnd/res/drawable-large/map_shield_marker_point_color.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
OsmAnd/res/drawable-large/map_shield_marker_point_shadow.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
OsmAnd/res/drawable-large/map_shield_marker_point_stroke.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
OsmAnd/res/drawable-large/map_transport_stop_bg.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
OsmAnd/res/drawable-large/widget_intermediate_time_day.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
OsmAnd/res/drawable-large/widget_intermediate_time_night.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
|
@ -950,6 +950,7 @@
|
|||
<string name="rendering_value_pink_name">Pink</string>
|
||||
<string name="rendering_value_translucent_pink_name">Translucent pink</string>
|
||||
<string name="rendering_value_brown_name">Brown</string>
|
||||
<string name="rendering_value_black_name">Black</string>
|
||||
<string name="rendering_value_translucent_purple_name">Translucent purple</string>
|
||||
<string name="restart_is_required">Restart the app manually to apply all changes.</string>
|
||||
<string name="light_theme">Light</string>
|
||||
|
|
|
@ -653,6 +653,7 @@ public class AppInitializer implements IProgress {
|
|||
notifyEvent(InitEvents.RESTORE_BACKUPS);
|
||||
app.mapMarkersHelper.syncAllGroupsAsync();
|
||||
app.searchUICore.initSearchUICore();
|
||||
app.avoidSpecificRoads.initRouteObjects();
|
||||
|
||||
checkLiveUpdatesAlerts();
|
||||
|
||||
|
|
|
@ -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<SelectedGpxFile> 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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1481,6 +1481,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
LOG.error("error", e);
|
||||
}
|
||||
}
|
||||
setIntent(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<LatLon, RouteDataObject> getImpassableRoads() {
|
||||
return impassableRoads;
|
||||
}
|
||||
|
||||
private void initRouteObjects() {
|
||||
public void initRouteObjects() {
|
||||
for (LatLon latLon : impassableRoads.keySet()) {
|
||||
addImpassableRoad(null, latLon, false, true);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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("")) {
|
||||
|
|
|
@ -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,14 +66,20 @@ 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<Void, GpxDataItem, Void> {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<MapMarkerItemViewHolder>
|
||||
implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter {
|
||||
|
@ -136,14 +133,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
descr = mapActivity.getString(R.string.shared_string_favorites);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
descr = month + " " + day;
|
||||
descr = OsmAndFormatter.getFormattedDate(mapActivity, marker.creationDate);
|
||||
}
|
||||
if (marker.wptPt != null && !Algorithms.isEmpty(marker.wptPt.category)) {
|
||||
descr = marker.wptPt.category + ", " + descr;
|
||||
|
|
|
@ -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<RecyclerView.V
|
|||
if (markerInHistory || createdEarly) {
|
||||
itemViewHolder.point.setVisibility(View.VISIBLE);
|
||||
itemViewHolder.description.setVisibility(View.VISIBLE);
|
||||
Date date;
|
||||
long date;
|
||||
if (markerInHistory) {
|
||||
date = new Date(marker.visitedDate);
|
||||
date = marker.visitedDate;
|
||||
} else {
|
||||
date = new Date(marker.creationDate);
|
||||
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);
|
||||
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<RecyclerView.V
|
|||
if (disabled) {
|
||||
if (selectedGpxFile != null) {
|
||||
gpxFile[0] = selectedGpxFile.getGpxFile();
|
||||
switchGpxVisibility(gpxFile[0], false);
|
||||
switchGpxVisibility(gpxFile[0], selectedGpxFile, false);
|
||||
}
|
||||
} else {
|
||||
if (selectedGpxFile == null) {
|
||||
// TODO IO load in another thread ?
|
||||
gpxFile[0] = GPXUtilities.loadGPXFile(app, new File(gpxPath));
|
||||
switchGpxVisibility(gpxFile[0], true);
|
||||
switchGpxVisibility(gpxFile[0], null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -494,7 +488,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
if (group.getType() == MapMarkersGroup.GPX_TYPE && gpxFile[0] != null) {
|
||||
switchGpxVisibility(gpxFile[0], true);
|
||||
switchGpxVisibility(gpxFile[0], null, true);
|
||||
}
|
||||
mapMarkersHelper.enableGroup(group);
|
||||
}
|
||||
|
@ -564,9 +558,12 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
}
|
||||
}
|
||||
|
||||
private void switchGpxVisibility(@NonNull GPXFile gpxFile, boolean visible) {
|
||||
private void switchGpxVisibility(@NonNull GPXFile gpxFile, @Nullable SelectedGpxFile selectedGpxFile, boolean visible) {
|
||||
GpxSelectionHelper gpxHelper = app.getSelectedGpxHelper();
|
||||
gpxHelper.selectGpxFile(gpxFile, visible, false, false);
|
||||
if (!visible && selectedGpxFile != null && selectedGpxFile.selectedByUser) {
|
||||
return;
|
||||
}
|
||||
gpxHelper.selectGpxFile(gpxFile, visible, false, false, false);
|
||||
}
|
||||
|
||||
public void hideSnackbar() {
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -122,14 +123,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
|
||||
itemViewHolder.title.setText(marker.getName(app));
|
||||
|
||||
Date date = new Date(marker.visitedDate);
|
||||
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 = 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("")) {
|
||||
|
|
|
@ -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<MapMarkerItemViewHolder>
|
||||
|
@ -203,13 +200,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
|
|||
descr = mapActivity.getString(R.string.shared_string_favorites);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
|
||||
descr = month + " " + day;
|
||||
descr = OsmAndFormatter.getFormattedDate(app, marker.creationDate);
|
||||
}
|
||||
holder.description.setText(descr);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
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");
|
||||
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<RouteService> list = new ArrayList<RouteProvider.RouteService>();
|
||||
for(RouteService r : values()) {
|
||||
List<RouteService> 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<Location> res = new ArrayList<Location>();
|
||||
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<list.getLength(); i++){
|
||||
Node item = list.item(i);
|
||||
String str = item.getFirstChild().getNodeValue();
|
||||
if(str == null){
|
||||
continue;
|
||||
}
|
||||
int st = 0;
|
||||
int next = 0;
|
||||
while((next = str.indexOf('\n', st)) != -1){
|
||||
String coordinate = str.substring(st, next + 1);
|
||||
int s = coordinate.indexOf(',');
|
||||
if (s != -1) {
|
||||
try {
|
||||
double lon = Double.parseDouble(coordinate.substring(0, s));
|
||||
double lat = Double.parseDouble(coordinate.substring(s + 1));
|
||||
Location l = new Location("router"); //$NON-NLS-1$
|
||||
l.setLatitude(lat);
|
||||
l.setLongitude(lon);
|
||||
res.add(l);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
st = next + 1;
|
||||
}
|
||||
}
|
||||
if(list.getLength() == 0){
|
||||
if(doc.getChildNodes().getLength() == 1){
|
||||
Node item = doc.getChildNodes().item(0);
|
||||
return new RouteCalculationResult(item.getNodeValue());
|
||||
}
|
||||
}
|
||||
params.intermediates = null;
|
||||
return new RouteCalculationResult(res, null, params, null, true);
|
||||
}
|
||||
|
||||
protected RouteCalculationResult findVectorMapsRoute(final RouteCalculationParams params, boolean calcGPXRoute) throws IOException {
|
||||
BinaryMapIndexReader[] files = params.ctx.getResourceManager().getRoutingMapFiles();
|
||||
RoutePlannerFrontEnd router = new RoutePlannerFrontEnd();
|
||||
|
|
|
@ -233,11 +233,12 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
final DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||
|
||||
boolean outdated = mainIndexItem != null && mainIndexItem.isOutdated();
|
||||
boolean needsDownloading = mainIndexItem != null && !mainIndexItem.isDownloaded();
|
||||
File selectedTravelBook = app.getTravelDbHelper().getSelectedTravelBook();
|
||||
|
||||
if (selectedTravelBook == null || (outdated && app.getSettings().SHOW_TRAVEL_UPDATE_CARD.get())) {
|
||||
if (selectedTravelBook == null || needsDownloading || (outdated && app.getSettings().SHOW_TRAVEL_UPDATE_CARD.get())) {
|
||||
boolean showOtherMaps = false;
|
||||
if (selectedTravelBook == null) {
|
||||
if (needsDownloading) {
|
||||
List<IndexItem> 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() {
|
||||
|
|