Merge pull request #9840 from osmandapp/master

update test branch
This commit is contained in:
Hardy 2020-09-18 00:12:39 +02:00 committed by GitHub
commit 185ff8a1f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 158 additions and 55 deletions

View file

@ -0,0 +1,31 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M20,16L17,20L14,16H16V4H18V16H20Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M5,13H12V15L7.5,20H12V22H5V20L9.5,15H5V13Z"
android:strokeAlpha="0.5"
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:fillAlpha="0.5"/>
<path
android:pathData="M9.5,2H7.5L4,11H6L6.7692,9H10.2308L11,11H13L9.5,2ZM9.4615,7L8.5,4.5L7.5385,7H9.4615Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
<path
android:pathData="M20,16L17,20L14,16H16V4H18V16H20Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M5,13H12V15L7.5,20H12V22H5V20L9.5,15H5V13Z"
android:strokeAlpha="0.5"
android:fillColor="#ffffff"
android:fillAlpha="0.5"/>
<path
android:pathData="M9.5,2H7.5L4,11H6L6.7692,9H10.2308L11,11H13L9.5,2ZM9.4615,7L8.5,4.5L7.5385,7H9.4615Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>

View file

@ -0,0 +1,31 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M20,16L17,20L14,16H16V4H18V16H20Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M5,2H12V4L7.5,9H12V11H5V9L9.5,4H5V2Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
<path
android:pathData="M9.5,13H7.5L4,22H6L6.7692,20H10.2308L11,22H13L9.5,13ZM9.4615,18L8.5,15.5L7.5385,18H9.4615Z"
android:strokeAlpha="0.5"
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:fillAlpha="0.5"/>
<path
android:pathData="M20,16L17,20L14,16H16V4H18V16H20Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M5,2H12V4L7.5,9H12V11H5V9L9.5,4H5V2Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M9.5,13H7.5L4,22H6L6.7692,20H10.2308L11,22H13L9.5,13ZM9.4615,18L8.5,15.5L7.5385,18H9.4615Z"
android:strokeAlpha="0.5"
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:fillAlpha="0.5"/>
</vector>

View file

@ -3844,4 +3844,5 @@
<string name="poi_traffic_signals_arrow_no">Abbiegepfeil: nein</string> <string name="poi_traffic_signals_arrow_no">Abbiegepfeil: nein</string>
<string name="poi_departures_board">Anzeige der Abreisezeiten</string> <string name="poi_departures_board">Anzeige der Abreisezeiten</string>
<string name="poi_drinking_water_refill">Nachfüllen von Trinkwasser</string> <string name="poi_drinking_water_refill">Nachfüllen von Trinkwasser</string>
<string name="poi_beehive">Bienenstock</string>
</resources> </resources>

View file

@ -3850,4 +3850,5 @@
<string name="poi_drinking_water_refill">Recarga de agua potable</string> <string name="poi_drinking_water_refill">Recarga de agua potable</string>
<string name="poi_recycling_small_electrical_appliances">Pequeños electrodomésticos</string> <string name="poi_recycling_small_electrical_appliances">Pequeños electrodomésticos</string>
<string name="poi_beehive">Panal de abejas</string> <string name="poi_beehive">Panal de abejas</string>
<string name="poi_nuts">Frutos secos</string>
</resources> </resources>

View file

@ -3181,7 +3181,7 @@
<string name="quick_action_page_list_descr">Nupp alloleva loendi sirvimiseks.</string> <string name="quick_action_page_list_descr">Nupp alloleva loendi sirvimiseks.</string>
<string name="osmand_extended_description_part1">OsmAnd (OSM automatiseeritud navigeerimisjuhised) on kaardi- ja navigatsioonirakendus, millel on juurdepääs tasuta, ülemaailmsetele ja kvaliteetsetele OpenStreetMap (OSM) andmetele. <string name="osmand_extended_description_part1">OsmAnd (OSM automatiseeritud navigeerimisjuhised) on kaardi- ja navigatsioonirakendus, millel on juurdepääs tasuta, ülemaailmsetele ja kvaliteetsetele OpenStreetMap (OSM) andmetele.
\n \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.</string> \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.</string>
<string name="osmand_extended_description_part3">Kaart <string name="osmand_extended_description_part3">Kaart
\n • Kuvab HP-d (huvipunktid) sinu ümber \n • Kuvab HP-d (huvipunktid) sinu ümber
\n • Kohandab kaarti sinu liikumissuunaga (või kompassiga) \n • Kohandab kaarti sinu liikumissuunaga (või kompassiga)
@ -3557,7 +3557,7 @@
<string name="use_volume_buttons_as_zoom">Helitugevuse nupud toimivad suumina</string> <string name="use_volume_buttons_as_zoom">Helitugevuse nupud toimivad suumina</string>
<string name="please_provide_point_name_error">Palun sisestage punkti nimi</string> <string name="please_provide_point_name_error">Palun sisestage punkti nimi</string>
<string name="search_download_wikipedia_maps">Lae alla Vikipeedia kaardid</string> <string name="search_download_wikipedia_maps">Lae alla Vikipeedia kaardid</string>
<string name="plugin_wikipedia_description">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.</string> <string name="plugin_wikipedia_description">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.</string>
<string name="add_hidden_group_info">Kuna valitud grupp on peidetud, siis lisatud punkt ei ole kaardil nähtav. Vajadusel leiad ta „%s“ alt.</string> <string name="add_hidden_group_info">Kuna valitud grupp on peidetud, siis lisatud punkt ei ole kaardil nähtav. Vajadusel leiad ta „%s“ alt.</string>
<string name="app_mode_go_cart">Kartauto</string> <string name="app_mode_go_cart">Kartauto</string>
<string name="parking_positions">Parkimiskohad</string> <string name="parking_positions">Parkimiskohad</string>
@ -3728,7 +3728,7 @@
<string name="plan_route_trim_before">Kärbi enne</string> <string name="plan_route_trim_before">Kärbi enne</string>
<string name="attach_to_the_roads">Kinnita teede külge</string> <string name="attach_to_the_roads">Kinnita teede külge</string>
<string name="route_between_points_warning_desc">Selle valiku kasutamiseks mõne oma navigeerimisprofiili kasutamisel kinnita oma rada lähimale lubatud teele.</string> <string name="route_between_points_warning_desc">Selle valiku kasutamiseks mõne oma navigeerimisprofiili kasutamisel kinnita oma rada lähimale lubatud teele.</string>
<string name="route_between_points_next_segment_button_desc">Valitud profiili alusel arvutatakse uus teekond vaid järgmise segmendi osas.</string> <string name="route_between_points_next_segment_button_desc">Selle valitud profiili alusel arvutatakse uus teekond vaid järgmise segmendi osas.</string>
<string name="main_actions">Põhitegevused</string> <string name="main_actions">Põhitegevused</string>
<string name="osm_live_payment_subscription_management">Ostu kinnitusel võetakse sinu Google Play kontolt tasu. <string name="osm_live_payment_subscription_management">Ostu kinnitusel võetakse sinu Google Play kontolt tasu.
\n \n
@ -3737,7 +3737,7 @@
\nTellimuste haldamiseks ja tühistamiseks ava Google Play seadistused.</string> \nTellimuste haldamiseks ja tühistamiseks ava Google Play seadistused.</string>
<string name="export_import_quick_actions_with_profiles_promo">Kiirtegevusi saad eksportida või importida koos rakenduse profiilidega.</string> <string name="export_import_quick_actions_with_profiles_promo">Kiirtegevusi saad eksportida või importida koos rakenduse profiilidega.</string>
<string name="delete_all_actions_message_q">Kas sa oled kindel, et soovid pöördumatult kustutada %d kiirtegevust\?</string> <string name="delete_all_actions_message_q">Kas sa oled kindel, et soovid pöördumatult kustutada %d kiirtegevust\?</string>
<string name="route_between_points_desc">Vali kas soovid ühendada punkte sirge joonega või arvutada nendevahelist teekonda vastavalt oma valitud profiilile.</string> <string name="route_between_points_desc">Vali kas soovid ühendada punkte sirge joonega või arvutada nendevahelist teekonda selle alusel kuidas järgnevalt on määratud.</string>
<string name="release_3_8">• Uuendatud teekonnaplaneerija: võimaldab kasutada igal segmendil erinevat liikumisviisi ning radade kaasamist <string name="release_3_8">• Uuendatud teekonnaplaneerija: võimaldab kasutada igal segmendil erinevat liikumisviisi ning radade kaasamist
\n \n
\n • Uus radade kujunduse seadistamise menüü: valida saad värve, joone paksust, suunanoolte kuvamist ning alguse ja lõpu ikoone \n • Uus radade kujunduse seadistamise menüü: valida saad värve, joone paksust, suunanoolte kuvamist ning alguse ja lõpu ikoone

View file

@ -3814,7 +3814,7 @@
<string name="poi_seamark_water_level_above_mwl">Niveau d\'eau : au-dessus du niveau d\'eau moyen</string> <string name="poi_seamark_water_level_above_mwl">Niveau d\'eau : au-dessus du niveau d\'eau moyen</string>
<string name="poi_seamark_water_level_below_mwl">Niveau d\'eau : en-dessous du niveau d\'eau moyen</string> <string name="poi_seamark_water_level_below_mwl">Niveau d\'eau : en-dessous du niveau d\'eau moyen</string>
<string name="poi_seamark_obstruction">Obstacle</string> <string name="poi_seamark_obstruction">Obstacle</string>
<string name="poi_drinking_water_refill_yes">Remplissage d\'eau potable : oui</string> <string name="poi_drinking_water_refill_yes">Oui</string>
<string name="poi_drinking_water_refill_no">Remplissage d\'eau potable : non</string> <string name="poi_drinking_water_refill_no">Remplissage d\'eau potable : non</string>
<string name="poi_drinking_water_refill_network">Réseau de remplissage d\'eau potable</string> <string name="poi_drinking_water_refill_network">Réseau de remplissage d\'eau potable</string>
<string name="poi_traffic_signals_sound_locate">Uniquement si la marche est autorisée</string> <string name="poi_traffic_signals_sound_locate">Uniquement si la marche est autorisée</string>

View file

@ -1386,7 +1386,7 @@
<string name="route_descr_select_destination">Задать пункт назначения</string> <string name="route_descr_select_destination">Задать пункт назначения</string>
<string name="route_preferences">Предпочтения маршрута</string> <string name="route_preferences">Предпочтения маршрута</string>
<string name="route_info">Информация про маршрут</string> <string name="route_info">Информация про маршрут</string>
<string name="keep_and_add_destination_point">Добавить следующим пунктом назначения</string> <string name="keep_and_add_destination_point">Добавить как новый пункт назначения</string>
<string name="use_displayed_track_for_navigation">Использовать показанный путь для навигации?</string> <string name="use_displayed_track_for_navigation">Использовать показанный путь для навигации?</string>
<string name="calculate_osmand_route_without_internet">Рассчитать сегмент маршрута OsmAnd без интернета</string> <string name="calculate_osmand_route_without_internet">Рассчитать сегмент маршрута OsmAnd без интернета</string>
<string name="gpx_option_calculate_first_last_segment">Рассчитать маршрут OsmAnd для первого и последнего сегмента маршрута</string> <string name="gpx_option_calculate_first_last_segment">Рассчитать маршрут OsmAnd для первого и последнего сегмента маршрута</string>

View file

@ -3842,4 +3842,5 @@
<string name="poi_drinking_water_refill">飲用水補充</string> <string name="poi_drinking_water_refill">飲用水補充</string>
<string name="poi_recycling_small_electrical_appliances">小電器</string> <string name="poi_recycling_small_electrical_appliances">小電器</string>
<string name="poi_beehive">蜂箱</string> <string name="poi_beehive">蜂箱</string>
<string name="poi_nuts">堅果店</string>
</resources> </resources>

View file

@ -3251,7 +3251,7 @@
<string name="tts_language_not_supported">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?</string> <string name="tts_language_not_supported">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?</string>
<string name="tts_missing_language_data_title">Missing data</string> <string name="tts_missing_language_data_title">Missing data</string>
<string name="tts_missing_language_data">Go to the market to download selected language?</string> <string name="tts_missing_language_data">Go to the market to download selected language?</string>
<string name="gpx_option_reverse_route">Reverse GPX direction</string> <string name="gpx_option_reverse_route">Reverse track direction</string>
<string name="gpx_option_destination_point">Use current destination</string> <string name="gpx_option_destination_point">Use current destination</string>
<string name="gpx_option_from_start_point">Pass along entire track</string> <string name="gpx_option_from_start_point">Pass along entire track</string>
<!-- Use ← for RTL languages --> <!-- Use ← for RTL languages -->

View file

@ -738,9 +738,9 @@ public class MapActivityActions implements DialogProvider {
Map<String, RoutingProfileDataObject> profilesObjects = getRoutingProfiles(app); Map<String, RoutingProfileDataObject> profilesObjects = getRoutingProfiles(app);
for (final ApplicationMode appMode : activeModes) { for (final ApplicationMode appMode : activeModes) {
if (appMode.isCustomProfile()) { if (appMode.isCustomProfile()) {
modeDescription = getCustomProfileDescription(app, appMode, profilesObjects); modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_custom_string));
} else { } 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; 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 //switch profile button
ApplicationMode currentMode = app.getSettings().APPLICATION_MODE.get(); ApplicationMode currentMode = app.getSettings().APPLICATION_MODE.get();
String modeDescription; String modeDescription;
Map<String, RoutingProfileDataObject> profilesObjects = getRoutingProfiles(app);
if (currentMode.isCustomProfile()) { if (currentMode.isCustomProfile()) {
Map<String, RoutingProfileDataObject> profilesObjects = getRoutingProfiles(app); modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_custom_string));
modeDescription = getCustomProfileDescription(app, currentMode, profilesObjects);
} else { } 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; 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; final int nextMode = listExpanded ? DRAWER_MODE_NORMAL : DRAWER_MODE_SWITCH_PROFILE;
optionsMenuHelper.addItem(new ItemBuilder().setLayout(R.layout.main_menu_drawer_btn_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()); .createItem());
} }
private String getCustomProfileDescription(OsmandApplication app, ApplicationMode mode, private String getProfileDescription(OsmandApplication app, ApplicationMode mode,
Map<String, RoutingProfileDataObject> profilesObjects){ Map<String, RoutingProfileDataObject> profilesObjects, String defaultDescription){
String description = getString(R.string.profile_type_custom_string); String description = defaultDescription;
String routingProfileKey = mode.getRoutingProfile(); String routingProfileKey = mode.getRoutingProfile();
if (!Algorithms.isEmpty(routingProfileKey)) { if (!Algorithms.isEmpty(routingProfileKey)) {

View file

@ -307,7 +307,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
FavoritePointEditor editor = getFavoritePointEditor(); FavoritePointEditor editor = getFavoritePointEditor();
if (editor != null && helper != null) { if (editor != null && helper != null) {
if (editor.isNew()) { if (editor.isNew()) {
doAddFavorite(name, category, description, color, backgroundType, iconId); doAddFavorite(name, category, description, address, color, backgroundType, iconId);
} else { } else {
doEditFavorite(favorite, name, category, description, address, color, backgroundType, iconId, helper); 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) { BackgroundType backgroundType, @DrawableRes int iconId) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
FavouritesDbHelper helper = getHelper(); FavouritesDbHelper helper = getHelper();
@ -350,6 +350,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
favorite.setName(name); favorite.setName(name);
favorite.setCategory(category); favorite.setCategory(category);
favorite.setDescription(description); favorite.setDescription(description);
favorite.setAddress(address);
favorite.setColor(color); favorite.setColor(color);
favorite.setBackgroundType(backgroundType); favorite.setBackgroundType(backgroundType);
favorite.setIconId(iconId); favorite.setIconId(iconId);

View file

@ -817,11 +817,15 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
hideKeyboard(); hideKeyboard();
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
MapContextMenu mapContextMenu = mapActivity.getContextMenu();
if (includingMenu) { if (includingMenu) {
mapActivity.getSupportFragmentManager().popBackStack(); mapActivity.getSupportFragmentManager().popBackStack();
mapActivity.getContextMenu().close(); mapContextMenu.close();
} else { } else {
mapActivity.getSupportFragmentManager().popBackStack(); mapActivity.getSupportFragmentManager().popBackStack();
if (!mapContextMenu.isVisible() && mapContextMenu.isActive()) {
mapContextMenu.show();
}
} }
} }
} }
@ -932,17 +936,6 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private void exitEditing() { private void exitEditing() {
cancelled = true; cancelled = true;
dismiss(); 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) { private AlertDialog.Builder createWarningDialog(Activity activity, int title, int message, int negButton) {

View file

@ -1037,7 +1037,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null) { if (app != null) {
File dir = getMyApplication().getAppPath(GPX_INDEX_DIR); File dir = getMyApplication().getAppPath(GPX_INDEX_DIR);
if (folderName != null) { if (folderName != null && !dir.getName().equals(folderName)) {
dir = new File(dir, folderName); dir = new File(dir, folderName);
} }
fileName += GPX_FILE_EXT; fileName += GPX_FILE_EXT;

View file

@ -76,6 +76,8 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
sourceFileName = savedInstanceState.getString(SOURCE_FILE_NAME_KEY); sourceFileName = savedInstanceState.getString(SOURCE_FILE_NAME_KEY);
sourceFolderName = savedInstanceState.getString(SOURCE_FOLDER_NAME_KEY); sourceFolderName = savedInstanceState.getString(SOURCE_FOLDER_NAME_KEY);
showSimplifiedButton = savedInstanceState.getBoolean(SHOW_SIMPLIFIED_BUTTON_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))); 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) { private File getFile(OsmandApplication app, String folderName, String fileName) {
File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
File source = dir; File source = dir;
if (folderName != null) { if (folderName != null && !dir.getName().equals(folderName)) {
source = new File(dir, folderName); source = new File(dir, folderName);
} }
source = new File(source, fileName + IndexConstants.GPX_FILE_EXT); source = new File(source, fileName + IndexConstants.GPX_FILE_EXT);

View file

@ -48,7 +48,8 @@ public class FolderListAdapter extends RecyclerView.Adapter<FolderListAdapter.Gr
private Collection<? extends String> getFolders() { private Collection<? extends String> getFolders() {
List<File> dirs = new ArrayList<>(); List<File> 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); Algorithms.collectDirs(gpxDir, dirs);
List<String> dirItems = new ArrayList<>(); List<String> dirItems = new ArrayList<>();
for (File dir : dirs) { for (File dir : dirs) {

View file

@ -37,6 +37,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; 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.GpxSelectionHelper.CURRENT_TRACK;
import static net.osmand.plus.myplaces.FavoritesActivity.GPX_TAB; import static net.osmand.plus.myplaces.FavoritesActivity.GPX_TAB;
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID; 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 public class AvailableGPXFragment extends OsmandExpandableListFragment implements
FavoritesFragmentStateHolder { FavoritesFragmentStateHolder {
@ -129,6 +134,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
private boolean importing = false; private boolean importing = false;
private View emptyView; private View emptyView;
private GpxSelectionHelper.SelectGpxTaskListener gpxTaskListener; private GpxSelectionHelper.SelectGpxTaskListener gpxTaskListener;
private boolean sortByName;
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
@ -157,6 +163,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
public void onAttach(Context activity) { public void onAttach(Context activity) {
super.onAttach(activity); super.onAttach(activity);
this.app = (OsmandApplication) getActivity().getApplication(); this.app = (OsmandApplication) getActivity().getApplication();
sortByName = app.getSettings().SORT_TRACKS_BY_NAME.get();
final Collator collator = Collator.getInstance(); final Collator collator = Collator.getInstance();
collator.setStrength(Collator.SECONDARY); collator.setStrength(Collator.SECONDARY);
currentRecording = new GpxInfo(getMyApplication().getSavingTrackHelper().getCurrentGpx(), getString(R.string.shared_string_currently_recording_track)); 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(); addTrack();
}else if (itemId == R.string.coordinate_input) { }else if (itemId == R.string.coordinate_input) {
openCoordinatesInput(); openCoordinatesInput();
} else if (itemId == R.string.shared_string_sort) {
updateTracksSort();
} }
return true; return true;
} }
@ -512,6 +521,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
.setIcon(R.drawable.ic_action_delete_dark).setListener(listener).createItem()); .setIcon(R.drawable.ic_action_delete_dark).setListener(listener).createItem());
optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_refresh, getActivity()) optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_refresh, getActivity())
.setIcon(R.drawable.ic_action_refresh_dark).setListener(listener).createItem()); .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); OsmandPlugin.onOptionsMenuActivity(getActivity(), this, optionsMenuAdapter);
for (int j = 0; j < optionsMenuAdapter.length(); j++) { for (int j = 0; j < optionsMenuAdapter.length(); j++) {
final MenuItem item; 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) { public void doAction(int actionResId) {
if (actionResId == R.string.shared_string_delete) { if (actionResId == R.string.shared_string_delete) {
operationTask = new DeleteGpxTask(); operationTask = new DeleteGpxTask();
@ -555,6 +571,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(i); ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(i);
if (itemId == contextMenuItem.getTitleId()) { if (itemId == contextMenuItem.getTitleId()) {
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false, null); contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false, null);
if (itemId == R.string.shared_string_sort) {
item.setIcon(getSortIconId(!sortByName));
}
return true; return true;
} }
} }
@ -565,6 +584,12 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
((FavoritesActivity) getActivity()).addTrack(); ((FavoritesActivity) getActivity()).addTrack();
} }
private void updateTracksSort() {
sortByName = !sortByName;
app.getSettings().SORT_TRACKS_BY_NAME.set(sortByName);
reloadTracks();
}
private void openCoordinatesInput() { private void openCoordinatesInput() {
CoordinateInputDialogFragment fragment = new CoordinateInputDialogFragment(); CoordinateInputDialogFragment fragment = new CoordinateInputDialogFragment();
fragment.setRetainInstance(true); fragment.setRetainInstance(true);
@ -948,11 +973,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
Arrays.sort(listFiles, new Comparator<File>() { Arrays.sort(listFiles, new Comparator<File>() {
@Override @Override
public int compare(File f1, File f2) { public int compare(File f1, File f2) {
// here we could guess date from file name '2017-08-30 ...' - first part date if (sortByName) {
if (f1.lastModified() == f2.lastModified()) {
return -f1.getName().compareTo(f2.getName()); 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; return listFiles;
@ -969,8 +998,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
} }
private void loadGPXFolder(File mapPath, List<GpxInfo> result, LoadGpxTask loadTask, List<GpxInfo> progress, private void loadGPXFolder(File mapPath, List<GpxInfo> result, LoadGpxTask loadTask, List<GpxInfo> progress,
String gpxSubfolder) { String gpxSubfolder) {
for (File gpxFile : listFilesSorted(mapPath)) { File[] listFiles = listFilesSorted(mapPath);
for (File gpxFile : listFiles) {
if (gpxFile.isDirectory()) { if (gpxFile.isDirectory()) {
String sub = gpxSubfolder.length() == 0 ? gpxFile.getName() : gpxSubfolder + "/" String sub = gpxSubfolder.length() == 0 ? gpxFile.getName() : gpxSubfolder + "/"
+ gpxFile.getName(); + gpxFile.getName();
@ -985,7 +1015,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
loadTask.loadFile(progress.toArray(new GpxInfo[progress.size()])); loadTask.loadFile(progress.toArray(new GpxInfo[progress.size()]));
progress.clear(); progress.clear();
} }
} }
} }
} }
@ -993,7 +1022,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
public List<GpxInfo> getResult() { public List<GpxInfo> getResult() {
return result; return result;
} }
} }
protected class GpxIndexesAdapter extends OsmandBaseExpandableListAdapter implements Filterable { protected class GpxIndexesAdapter extends OsmandBaseExpandableListAdapter implements Filterable {
@ -1050,7 +1078,16 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
Collections.sort(selected, new Comparator<GpxInfo>() { Collections.sort(selected, new Comparator<GpxInfo>() {
@Override @Override
public int compare(GpxInfo i1, GpxInfo i2) { 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); data.get(category.get(found)).add(info);
} }
// disable sort
public void sort() { public void sort() {
Collections.sort(category, new Comparator<String>() { Collections.sort(category, new Comparator<String>() {
@Override @Override

View file

@ -149,10 +149,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
underlayLayer.setMap(null); underlayLayer.setMap(null);
} }
if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDERLAY && 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); layers.getMapControlsLayer().showTransparencyBar(settings.MAP_TRANSPARENCY, true);
} else if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.OVERLAY && } 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); layers.getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
} else { } else {
layers.getMapControlsLayer().hideTransparencyBar(); layers.getMapControlsLayer().hideTransparencyBar();

View file

@ -894,7 +894,10 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
public void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack) { public void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null) { 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); File toSave = new File(fileDir, fileName + GPX_FILE_EXT);
new SaveDirectionsAsyncTask(app, showOnMap).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave); new SaveDirectionsAsyncTask(app, showOnMap).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
} }

View file

@ -91,8 +91,8 @@ public class GpxApproximator {
this.env = routingHelper.getRoutingEnvironment(ctx, mode, start, end); this.env = routingHelper.getRoutingEnvironment(ctx, mode, start, end);
} }
private GpxRouteApproximation getNewGpxApproximationContext(@Nullable GpxRouteApproximation gctx) { private GpxRouteApproximation getNewGpxApproximationContext() {
GpxRouteApproximation newContext = gctx != null ? new GpxRouteApproximation(gctx) : new GpxRouteApproximation(env.getCtx()); GpxRouteApproximation newContext = new GpxRouteApproximation(env.getCtx());
newContext.ctx.calculationProgress = new RouteCalculationProgress(); newContext.ctx.calculationProgress = new RouteCalculationProgress();
newContext.MINIMUM_POINT_APPROXIMATION = pointApproximation; newContext.MINIMUM_POINT_APPROXIMATION = pointApproximation;
return newContext; return newContext;
@ -100,7 +100,7 @@ public class GpxApproximator {
private List<GpxPoint> getPoints() { private List<GpxPoint> getPoints() {
if (points == null) { if (points == null) {
points = routingHelper.generateGpxPoints(env, getNewGpxApproximationContext(null), locationsHolder); points = routingHelper.generateGpxPoints(env, getNewGpxApproximationContext(), locationsHolder);
} }
List<GpxPoint> points = new ArrayList<>(this.points.size()); List<GpxPoint> points = new ArrayList<>(this.points.size());
for (GpxPoint p : this.points) { for (GpxPoint p : this.points) {
@ -150,7 +150,7 @@ public class GpxApproximator {
if (gctx != null) { if (gctx != null) {
gctx.ctx.calculationProgress.isCancelled = true; gctx.ctx.calculationProgress.isCancelled = true;
} }
final GpxRouteApproximation gctx = getNewGpxApproximationContext(this.gctx); final GpxRouteApproximation gctx = getNewGpxApproximationContext();
this.gctx = gctx; this.gctx = gctx;
startProgress(); startProgress();
updateProgress(gctx); updateProgress(gctx);

View file

@ -3936,6 +3936,9 @@ public class OsmandSettings {
public final CommonPreference<Integer> FAVORITES_TAB = public final CommonPreference<Integer> FAVORITES_TAB =
new IntPreference("FAVORITES_TAB", 0).makeGlobal().cache(); new IntPreference("FAVORITES_TAB", 0).makeGlobal().cache();
public final CommonPreference<Boolean> SORT_TRACKS_BY_NAME
= new BooleanPreference("sort_tracks_by_name", true).makeGlobal().cache();
public final CommonPreference<Integer> OSMAND_THEME = public final CommonPreference<Integer> OSMAND_THEME =
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME) { new IntPreference("osmand_theme", OSMAND_LIGHT_THEME) {
@Override @Override

View file

@ -25,6 +25,7 @@ public class YandexTrafficAdapter extends MapTileAdapter {
private final static Log log = PlatformUtil.getLog(MapTileLayer.class); private final static Log log = PlatformUtil.getLog(MapTileLayer.class);
private final static String YANDEX_PREFFIX = ".YandexTraffic_"; 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 static final long DELTA = 10 * 60 * 1000;
private long lastTimestampUpdated; private long lastTimestampUpdated;
@ -59,11 +60,6 @@ public class YandexTrafficAdapter extends MapTileAdapter {
} }
protected void updateTimeStampImpl() { 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) { if (mTimestamp == null || (System.currentTimeMillis() - lastTimestampUpdated) > DELTA) {
log.info("Updating timestamp"); //$NON-NLS-1$ log.info("Updating timestamp"); //$NON-NLS-1$
try { try {

View file

@ -323,7 +323,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
return false; return false;
} }
showContextMenu(point, tileBox, true); LatLon pointLatLon = tileBox.getLatLonFromPixel(point.x, point.y);
menu.show(pointLatLon, null, null);
view.refreshMap(); view.refreshMap();
return true; return true;
} }