diff --git a/OsmAnd/res/drawable/ic_action_sort_by_name_ascending.xml b/OsmAnd/res/drawable/ic_action_sort_by_name_ascending.xml
new file mode 100644
index 0000000000..07406ae2c7
--- /dev/null
+++ b/OsmAnd/res/drawable/ic_action_sort_by_name_ascending.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/drawable/ic_action_sort_by_name_descending.xml b/OsmAnd/res/drawable/ic_action_sort_by_name_descending.xml
new file mode 100644
index 0000000000..04cd095335
--- /dev/null
+++ b/OsmAnd/res/drawable/ic_action_sort_by_name_descending.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml
index 53f9e13926..14173b1d76 100644
--- a/OsmAnd/res/values-de/phrases.xml
+++ b/OsmAnd/res/values-de/phrases.xml
@@ -3844,4 +3844,5 @@
Abbiegepfeil: nein
Anzeige der Abreisezeiten
Nachfüllen von Trinkwasser
+ Bienenstock
\ No newline at end of file
diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml
index e1839d42f2..4019b950b2 100644
--- a/OsmAnd/res/values-es-rAR/phrases.xml
+++ b/OsmAnd/res/values-es-rAR/phrases.xml
@@ -3850,4 +3850,5 @@
Recarga de agua potable
Pequeños electrodomésticos
Panal de abejas
+ Frutos secos
\ No newline at end of file
diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml
index 2c829dcfd0..fea216bce3 100644
--- a/OsmAnd/res/values-et/strings.xml
+++ b/OsmAnd/res/values-et/strings.xml
@@ -3181,7 +3181,7 @@
Nupp alloleva loendi sirvimiseks.
OsmAnd (OSM automatiseeritud navigeerimisjuhised) on kaardi- ja navigatsioonirakendus, millel on juurdepääs tasuta, ülemaailmsetele ja kvaliteetsetele OpenStreetMap (OSM) andmetele.
\n
-\n Naudi hääl- ja optilist navigaatorit, HP-de (huvipunktide) vaatamist, GPX radade loomist ja haldamist, kõrgusjoonte visuaalse kuvamise ja kõrguse teabe kasutamist (lisa kaudu), valikut sõidu, jalgrattasõidu, jalakäijate režiimide, OSM redigeerimise ja palju muu vahel.
+\n Naudi hääl- ja optilist navigaatorit, HP-de (huvipunktide) vaatamist, GPX radade loomist ja haldamist, kõrgusjoonte visuaalse kuvamise ja kõrguse teabe kasutamist (lisa kaudu), valikut sõidu, jalgrattasõidu, jalakäijate režiimide, OSM\'i andmete muutmise ja palju muu vahel.
Kaart
\n • Kuvab HP-d (huvipunktid) sinu ümber
\n • Kohandab kaarti sinu liikumissuunaga (või kompassiga)
@@ -3557,7 +3557,7 @@
Helitugevuse nupud toimivad suumina
Palun sisestage punkti nimi
Lae alla Vikipeedia kaardid
- Hangi huviväärsuste kohta teavet Vikipeediast. See on sinu võrguühenduseta reisiraamat - luba lihtsalt Vikipeedia lisaprogramm ja loe artikleid enda ümber asuvate objektide kohta.
+ Hangi huviväärsuste kohta teavet Vikipeediast. See on sinu võrguühenduseta reisiraamat - lihtsalt võta kasutusele Vikipeedia lisaprogramm ja loe artikleid enda ümber asuvate objektide kohta.
Kuna valitud grupp on peidetud, siis lisatud punkt ei ole kaardil nähtav. Vajadusel leiad ta „%s“ alt.
Kartauto
Parkimiskohad
@@ -3728,7 +3728,7 @@
Kärbi enne
Kinnita teede külge
Selle valiku kasutamiseks mõne oma navigeerimisprofiili kasutamisel kinnita oma rada lähimale lubatud teele.
- Valitud profiili alusel arvutatakse uus teekond vaid järgmise segmendi osas.
+ Selle valitud profiili alusel arvutatakse uus teekond vaid järgmise segmendi osas.
Põhitegevused
Ostu kinnitusel võetakse sinu Google Play kontolt tasu.
\n
@@ -3737,7 +3737,7 @@
\nTellimuste haldamiseks ja tühistamiseks ava Google Play seadistused.
Kiirtegevusi saad eksportida või importida koos rakenduse profiilidega.
Kas sa oled kindel, et soovid pöördumatult kustutada %d kiirtegevust\?
- Vali kas soovid ühendada punkte sirge joonega või arvutada nendevahelist teekonda vastavalt oma valitud profiilile.
+ Vali kas soovid ühendada punkte sirge joonega või arvutada nendevahelist teekonda selle alusel kuidas järgnevalt on määratud.
• Uuendatud teekonnaplaneerija: võimaldab kasutada igal segmendil erinevat liikumisviisi ning radade kaasamist
\n
\n • Uus radade kujunduse seadistamise menüü: valida saad värve, joone paksust, suunanoolte kuvamist ning alguse ja lõpu ikoone
diff --git a/OsmAnd/res/values-fr/phrases.xml b/OsmAnd/res/values-fr/phrases.xml
index b90c5e8bde..638995c1f2 100644
--- a/OsmAnd/res/values-fr/phrases.xml
+++ b/OsmAnd/res/values-fr/phrases.xml
@@ -3814,7 +3814,7 @@
Niveau d\'eau : au-dessus du niveau d\'eau moyen
Niveau d\'eau : en-dessous du niveau d\'eau moyen
Obstacle
- Remplissage d\'eau potable : oui
+ Oui
Remplissage d\'eau potable : non
Réseau de remplissage d\'eau potable
Uniquement si la marche est autorisée
diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index 55ff01a9a1..211819502e 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -1386,7 +1386,7 @@
Задать пункт назначения
Предпочтения маршрута
Информация про маршрут
- Добавить следующим пунктом назначения
+ Добавить как новый пункт назначения
Использовать показанный путь для навигации?
Рассчитать сегмент маршрута OsmAnd без интернета
Рассчитать маршрут OsmAnd для первого и последнего сегмента маршрута
diff --git a/OsmAnd/res/values-zh-rTW/phrases.xml b/OsmAnd/res/values-zh-rTW/phrases.xml
index 352282d071..25766f928e 100644
--- a/OsmAnd/res/values-zh-rTW/phrases.xml
+++ b/OsmAnd/res/values-zh-rTW/phrases.xml
@@ -3842,4 +3842,5 @@
飲用水補充
小電器
蜂箱
+ 堅果店
\ No newline at end of file
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 3f8159283b..c497ffda36 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -3251,7 +3251,7 @@
The selected language is not supported by the Android TTS (text-to-speech) engine installed, its preset TTS language will be used instead. Look for another TTS engine in the market?
Missing data
Go to the market to download selected language?
- Reverse GPX direction
+ Reverse track direction
Use current destination
Pass along entire track
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index ea597558e1..5414b9c0f7 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -738,9 +738,9 @@ public class MapActivityActions implements DialogProvider {
Map profilesObjects = getRoutingProfiles(app);
for (final ApplicationMode appMode : activeModes) {
if (appMode.isCustomProfile()) {
- modeDescription = getCustomProfileDescription(app, appMode, profilesObjects);
+ modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_custom_string));
} else {
- modeDescription = getString(R.string.profile_type_base_string);
+ modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_base_string));
}
int tag = currentMode.equals(appMode) ? PROFILES_CHOSEN_PROFILE_TAG : PROFILES_NORMAL_PROFILE_TAG;
@@ -1047,12 +1047,13 @@ public class MapActivityActions implements DialogProvider {
//switch profile button
ApplicationMode currentMode = app.getSettings().APPLICATION_MODE.get();
String modeDescription;
+ Map profilesObjects = getRoutingProfiles(app);
if (currentMode.isCustomProfile()) {
- Map profilesObjects = getRoutingProfiles(app);
- modeDescription = getCustomProfileDescription(app, currentMode, profilesObjects);
+ modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_custom_string));
} else {
- modeDescription = getString(R.string.profile_type_base_string);
+ modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_base_string));
}
+
int icArrowResId = listExpanded ? R.drawable.ic_action_arrow_drop_up : R.drawable.ic_action_arrow_drop_down;
final int nextMode = listExpanded ? DRAWER_MODE_NORMAL : DRAWER_MODE_SWITCH_PROFILE;
optionsMenuHelper.addItem(new ItemBuilder().setLayout(R.layout.main_menu_drawer_btn_switch_profile)
@@ -1084,9 +1085,9 @@ public class MapActivityActions implements DialogProvider {
.createItem());
}
- private String getCustomProfileDescription(OsmandApplication app, ApplicationMode mode,
- Map profilesObjects){
- String description = getString(R.string.profile_type_custom_string);
+ private String getProfileDescription(OsmandApplication app, ApplicationMode mode,
+ Map profilesObjects, String defaultDescription){
+ String description = defaultDescription;
String routingProfileKey = mode.getRoutingProfile();
if (!Algorithms.isEmpty(routingProfileKey)) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
index 9bfe58324a..3e4093d253 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
@@ -307,7 +307,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
FavoritePointEditor editor = getFavoritePointEditor();
if (editor != null && helper != null) {
if (editor.isNew()) {
- doAddFavorite(name, category, description, color, backgroundType, iconId);
+ doAddFavorite(name, category, description, address, color, backgroundType, iconId);
} else {
doEditFavorite(favorite, name, category, description, address, color, backgroundType, iconId, helper);
}
@@ -341,7 +341,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
}
}
- private void doAddFavorite(String name, String category, String description, @ColorInt int color,
+ private void doAddFavorite(String name, String category, String description, String address, @ColorInt int color,
BackgroundType backgroundType, @DrawableRes int iconId) {
OsmandApplication app = getMyApplication();
FavouritesDbHelper helper = getHelper();
@@ -350,6 +350,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
favorite.setName(name);
favorite.setCategory(category);
favorite.setDescription(description);
+ favorite.setAddress(address);
favorite.setColor(color);
favorite.setBackgroundType(backgroundType);
favorite.setIconId(iconId);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
index 3214817780..7500a17d77 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
@@ -817,11 +817,15 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
hideKeyboard();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
+ MapContextMenu mapContextMenu = mapActivity.getContextMenu();
if (includingMenu) {
mapActivity.getSupportFragmentManager().popBackStack();
- mapActivity.getContextMenu().close();
+ mapContextMenu.close();
} else {
mapActivity.getSupportFragmentManager().popBackStack();
+ if (!mapContextMenu.isVisible() && mapContextMenu.isActive()) {
+ mapContextMenu.show();
+ }
}
}
}
@@ -932,17 +936,6 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private void exitEditing() {
cancelled = true;
dismiss();
- showContextMenu();
- }
-
- private void showContextMenu() {
- MapActivity mapActivity = getMapActivity();
- if (mapActivity != null) {
- MapContextMenu mapContextMenu = mapActivity.getContextMenu();
- if (!mapContextMenu.isVisible() && mapContextMenu.isActive()) {
- mapContextMenu.show();
- }
- }
}
private AlertDialog.Builder createWarningDialog(Activity activity, int title, int message, int negButton) {
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
index d80eddb6b7..e2e4d79531 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
@@ -1037,7 +1037,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
OsmandApplication app = getMyApplication();
if (app != null) {
File dir = getMyApplication().getAppPath(GPX_INDEX_DIR);
- if (folderName != null) {
+ if (folderName != null && !dir.getName().equals(folderName)) {
dir = new File(dir, folderName);
}
fileName += GPX_FILE_EXT;
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
index fb1badf2aa..40877bf8dc 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
@@ -76,6 +76,8 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
sourceFileName = savedInstanceState.getString(SOURCE_FILE_NAME_KEY);
sourceFolderName = savedInstanceState.getString(SOURCE_FOLDER_NAME_KEY);
showSimplifiedButton = savedInstanceState.getBoolean(SHOW_SIMPLIFIED_BUTTON_KEY);
+ } else {
+ folderName = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getName();
}
items.add(new TitleItem(getString(R.string.save_as_new_track)));
@@ -290,7 +292,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
private File getFile(OsmandApplication app, String folderName, String fileName) {
File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
File source = dir;
- if (folderName != null) {
+ if (folderName != null && !dir.getName().equals(folderName)) {
source = new File(dir, folderName);
}
source = new File(source, fileName + IndexConstants.GPX_FILE_EXT);
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java
index b207d7aac5..b383a4bef6 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java
@@ -48,7 +48,8 @@ public class FolderListAdapter extends RecyclerView.Adapter getFolders() {
List dirs = new ArrayList<>();
- final File gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
+ File gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
+ dirs.add(gpxDir);
Algorithms.collectDirs(gpxDir, dirs);
List dirItems = new ArrayList<>();
for (File dir : dirs) {
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java
index 6e862b5d4b..8432080bc8 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java
@@ -37,6 +37,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
@@ -102,7 +103,11 @@ import java.util.regex.Pattern;
import static net.osmand.plus.GpxSelectionHelper.CURRENT_TRACK;
import static net.osmand.plus.myplaces.FavoritesActivity.GPX_TAB;
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
-import static net.osmand.util.Algorithms.*;
+import static net.osmand.util.Algorithms.capitalizeFirstLetter;
+import static net.osmand.util.Algorithms.collectDirs;
+import static net.osmand.util.Algorithms.formatDuration;
+import static net.osmand.util.Algorithms.objectEquals;
+import static net.osmand.util.Algorithms.removeAllFiles;
public class AvailableGPXFragment extends OsmandExpandableListFragment implements
FavoritesFragmentStateHolder {
@@ -129,6 +134,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
private boolean importing = false;
private View emptyView;
private GpxSelectionHelper.SelectGpxTaskListener gpxTaskListener;
+ private boolean sortByName;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -157,6 +163,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
public void onAttach(Context activity) {
super.onAttach(activity);
this.app = (OsmandApplication) getActivity().getApplication();
+ sortByName = app.getSettings().SORT_TRACKS_BY_NAME.get();
final Collator collator = Collator.getInstance();
collator.setStrength(Collator.SECONDARY);
currentRecording = new GpxInfo(getMyApplication().getSavingTrackHelper().getCurrentGpx(), getString(R.string.shared_string_currently_recording_track));
@@ -495,6 +502,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
addTrack();
}else if (itemId == R.string.coordinate_input) {
openCoordinatesInput();
+ } else if (itemId == R.string.shared_string_sort) {
+ updateTracksSort();
}
return true;
}
@@ -512,6 +521,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
.setIcon(R.drawable.ic_action_delete_dark).setListener(listener).createItem());
optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_refresh, getActivity())
.setIcon(R.drawable.ic_action_refresh_dark).setListener(listener).createItem());
+ optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_sort, getActivity())
+ .setIcon(getSortIconId(!sortByName)).setListener(listener).createItem());
OsmandPlugin.onOptionsMenuActivity(getActivity(), this, optionsMenuAdapter);
for (int j = 0; j < optionsMenuAdapter.length(); j++) {
final MenuItem item;
@@ -536,6 +547,11 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
}
}
+ @DrawableRes
+ private int getSortIconId(boolean sortByName) {
+ return sortByName ? R.drawable.ic_action_sort_by_name : R.drawable.ic_action_list_sort;
+ }
+
public void doAction(int actionResId) {
if (actionResId == R.string.shared_string_delete) {
operationTask = new DeleteGpxTask();
@@ -555,6 +571,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(i);
if (itemId == contextMenuItem.getTitleId()) {
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false, null);
+ if (itemId == R.string.shared_string_sort) {
+ item.setIcon(getSortIconId(!sortByName));
+ }
return true;
}
}
@@ -565,6 +584,12 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
((FavoritesActivity) getActivity()).addTrack();
}
+ private void updateTracksSort() {
+ sortByName = !sortByName;
+ app.getSettings().SORT_TRACKS_BY_NAME.set(sortByName);
+ reloadTracks();
+ }
+
private void openCoordinatesInput() {
CoordinateInputDialogFragment fragment = new CoordinateInputDialogFragment();
fragment.setRetainInstance(true);
@@ -948,11 +973,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
Arrays.sort(listFiles, new Comparator() {
@Override
public int compare(File f1, File f2) {
- // here we could guess date from file name '2017-08-30 ...' - first part date
- if (f1.lastModified() == f2.lastModified()) {
+ if (sortByName) {
return -f1.getName().compareTo(f2.getName());
+ } else {
+ // here we could guess date from file name '2017-08-30 ...' - first part date
+ if (f1.lastModified() == f2.lastModified()) {
+ return -f1.getName().compareTo(f2.getName());
+ }
+ return -Long.compare(f1.lastModified(), f2.lastModified());
}
- return -Long.compare(f1.lastModified(), f2.lastModified());
}
});
return listFiles;
@@ -969,8 +998,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
}
private void loadGPXFolder(File mapPath, List result, LoadGpxTask loadTask, List progress,
- String gpxSubfolder) {
- for (File gpxFile : listFilesSorted(mapPath)) {
+ String gpxSubfolder) {
+ File[] listFiles = listFilesSorted(mapPath);
+ for (File gpxFile : listFiles) {
if (gpxFile.isDirectory()) {
String sub = gpxSubfolder.length() == 0 ? gpxFile.getName() : gpxSubfolder + "/"
+ gpxFile.getName();
@@ -985,7 +1015,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
loadTask.loadFile(progress.toArray(new GpxInfo[progress.size()]));
progress.clear();
}
-
}
}
}
@@ -993,7 +1022,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
public List getResult() {
return result;
}
-
}
protected class GpxIndexesAdapter extends OsmandBaseExpandableListAdapter implements Filterable {
@@ -1050,7 +1078,16 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
Collections.sort(selected, new Comparator() {
@Override
public int compare(GpxInfo i1, GpxInfo i2) {
- return i1.getName().toLowerCase().compareTo(i2.getName().toLowerCase());
+ if (sortByName) {
+ return i1.getName().toLowerCase().compareTo(i2.getName().toLowerCase());
+ } else {
+ long time1 = i1.file.lastModified();
+ long time2 = i2.file.lastModified();
+ if (time1 == time2) {
+ return i1.getName().toLowerCase().compareTo(i2.getName().toLowerCase());
+ }
+ return -Long.compare(time1, time2);
+ }
}
});
}
@@ -1112,7 +1149,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
data.get(category.get(found)).add(info);
}
- // disable sort
public void sort() {
Collections.sort(category, new Comparator() {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java
index e40a911027..da7a7882d3 100644
--- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java
@@ -149,10 +149,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
underlayLayer.setMap(null);
}
if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDERLAY &&
- underlayLayer.getMap() != null) {
+ underlayLayer.getMap() != null || underlayLayer.getMapTileAdapter() != null) {
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_TRANSPARENCY, true);
} else if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.OVERLAY &&
- overlayLayer.getMap() != null) {
+ overlayLayer.getMap() != null || overlayLayer.getMapTileAdapter() != null) {
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
} else {
layers.getMapControlsLayer().hideTransparencyBar();
diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
index b7b87f01b2..004f5c4d2b 100644
--- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
@@ -894,7 +894,10 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
public void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack) {
OsmandApplication app = getMyApplication();
if (app != null) {
- File fileDir = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), folderName == null ? "" : folderName);
+ File fileDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
+ if (folderName != null && !fileDir.getName().equals(folderName)) {
+ fileDir = new File(fileDir, folderName);
+ }
File toSave = new File(fileDir, fileName + GPX_FILE_EXT);
new SaveDirectionsAsyncTask(app, showOnMap).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
}
diff --git a/OsmAnd/src/net/osmand/plus/routing/GpxApproximator.java b/OsmAnd/src/net/osmand/plus/routing/GpxApproximator.java
index 61d8408fe6..4650d527ae 100644
--- a/OsmAnd/src/net/osmand/plus/routing/GpxApproximator.java
+++ b/OsmAnd/src/net/osmand/plus/routing/GpxApproximator.java
@@ -91,8 +91,8 @@ public class GpxApproximator {
this.env = routingHelper.getRoutingEnvironment(ctx, mode, start, end);
}
- private GpxRouteApproximation getNewGpxApproximationContext(@Nullable GpxRouteApproximation gctx) {
- GpxRouteApproximation newContext = gctx != null ? new GpxRouteApproximation(gctx) : new GpxRouteApproximation(env.getCtx());
+ private GpxRouteApproximation getNewGpxApproximationContext() {
+ GpxRouteApproximation newContext = new GpxRouteApproximation(env.getCtx());
newContext.ctx.calculationProgress = new RouteCalculationProgress();
newContext.MINIMUM_POINT_APPROXIMATION = pointApproximation;
return newContext;
@@ -100,7 +100,7 @@ public class GpxApproximator {
private List getPoints() {
if (points == null) {
- points = routingHelper.generateGpxPoints(env, getNewGpxApproximationContext(null), locationsHolder);
+ points = routingHelper.generateGpxPoints(env, getNewGpxApproximationContext(), locationsHolder);
}
List points = new ArrayList<>(this.points.size());
for (GpxPoint p : this.points) {
@@ -150,7 +150,7 @@ public class GpxApproximator {
if (gctx != null) {
gctx.ctx.calculationProgress.isCancelled = true;
}
- final GpxRouteApproximation gctx = getNewGpxApproximationContext(this.gctx);
+ final GpxRouteApproximation gctx = getNewGpxApproximationContext();
this.gctx = gctx;
startProgress();
updateProgress(gctx);
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java
index 4baca18a19..a860d4c65c 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java
@@ -3936,6 +3936,9 @@ public class OsmandSettings {
public final CommonPreference FAVORITES_TAB =
new IntPreference("FAVORITES_TAB", 0).makeGlobal().cache();
+ public final CommonPreference SORT_TRACKS_BY_NAME
+ = new BooleanPreference("sort_tracks_by_name", true).makeGlobal().cache();
+
public final CommonPreference OSMAND_THEME =
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME) {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/views/YandexTrafficAdapter.java b/OsmAnd/src/net/osmand/plus/views/YandexTrafficAdapter.java
index a58713c4cc..1118cfd514 100644
--- a/OsmAnd/src/net/osmand/plus/views/YandexTrafficAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/views/YandexTrafficAdapter.java
@@ -25,6 +25,7 @@ public class YandexTrafficAdapter extends MapTileAdapter {
private final static Log log = PlatformUtil.getLog(MapTileLayer.class);
private final static String YANDEX_PREFFIX = ".YandexTraffic_";
+ private final static String YANDEX_BASE_URL = "https://core-jams-rdr.maps.yandex.net";
private static final long DELTA = 10 * 60 * 1000;
private long lastTimestampUpdated;
@@ -59,11 +60,6 @@ public class YandexTrafficAdapter extends MapTileAdapter {
}
protected void updateTimeStampImpl() {
- String YANDEX_BASE_URL;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
- YANDEX_BASE_URL = "https://core-jams-rdr.maps.yandex.net";
- else
- YANDEX_BASE_URL = "http://core-jams-rdr.maps.yandex.net";
if (mTimestamp == null || (System.currentTimeMillis() - lastTimestampUpdated) > DELTA) {
log.info("Updating timestamp"); //$NON-NLS-1$
try {
diff --git a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java
index 4567770e9c..7a8690fe2d 100644
--- a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java
@@ -323,7 +323,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
return false;
}
- showContextMenu(point, tileBox, true);
+ LatLon pointLatLon = tileBox.getLatLonFromPixel(point.x, point.y);
+ menu.show(pointLatLon, null, null);
+
view.refreshMap();
return true;
}