From b85725d6c1ed1d20150c09257c6d5a296cc4e5a4 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 17 Aug 2013 00:12:30 +0200 Subject: [PATCH 01/38] Fix apostrophe --- OsmAnd/res/values-da/strings.xml | 2 +- OsmAnd/res/values-el/strings.xml | 16 ++++++++-------- OsmAnd/res/values-es/strings.xml | 2 +- OsmAnd/res/values-fa/strings.xml | 16 ++++++++-------- OsmAnd/res/values-fr/strings.xml | 4 ++-- OsmAnd/res/values-sl/strings.xml | 16 ++++++++-------- OsmAnd/res/values-sv/strings.xml | 8 ++++---- OsmAnd/res/values-zh-rTW/strings.xml | 2 +- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index 04b50a1bdd..20fd4e091e 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -1,4 +1,4 @@ - + Overvej at købe Højdekurve udvidelsen (\'Contour lines\') på Google Play for at støtte den videre udvikling. Optag video Optag audio diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml index cea1c288ae..1aa1f8f5f0 100644 --- a/OsmAnd/res/values-el/strings.xml +++ b/OsmAnd/res/values-el/strings.xml @@ -1,4 +1,4 @@ - + Προσθήκη Ετικέτας Λειτουργία για προχωρημένους… Στάθμευση @@ -384,9 +384,9 @@ Προσανατολισμός Χάρτη Μπορείτε να αλλάξετε το πότε και το πως ο χάρτης θα περιστρέφεται με επαναλαμβανόμενα κλικ στο εικονίδιο της πυξίδας στην οθόνη χάρτη. \n\nΟι επιλογές είναι: - \n\t* 'Χωρίς περιστροφή (ο βορράς επάνω)\': Ο χάρτης δεν θα περιστρέφεται. Ο βορράς θα είναι πάντα επάνω - \n\t* 'Προς την κατεύθυνση κίνησης\': Ο χάρτης συνεχώς θα συγχρονίζεται με την κατεύθυνσή σας - \n\t* 'Πυξίδα\': Ο χάρτης συνεχώς θα συγχρονίζεται με την κατεύθυνση της πυξίδας + \n\t* \'Χωρίς περιστροφή (ο βορράς επάνω)\': Ο χάρτης δεν θα περιστρέφεται. Ο βορράς θα είναι πάντα επάνω + \n\t* \'Προς την κατεύθυνση κίνησης\': Ο χάρτης συνεχώς θα συγχρονίζεται με την κατεύθυνσή σας + \n\t* \'Πυξίδα\': Ο χάρτης συνεχώς θα συγχρονίζεται με την κατεύθυνση της πυξίδας Η λήψη ήταν επιτυχής. \n\t\n\tΓια χρήση ενεργοποιήστε \'Μενού\' -> \'Επίπεδα χάρτη\' -> \'Πηγή χάρτη…\' -> \'Offline διανυσματικοί χάρτες\'. @@ -395,10 +395,10 @@ Η εμφάνιση μπορεί στους διανυσματικούς χάρτες να αλλάξει μεταξύ ημέρας (πιο φωτεινό) και νύχτας (πιο σκοτεινό). Τα νυχτερινά χρώματα είναι πιο βολικά για νυχτερινή οδήγηση. \n\nΜπορείτε να ορίσετε μια πολιτική για την εναλλαγή ημέρα/νύχτα στο \'Μενού\' → \'Ρύθμιση οθόνης …\' →\'Χάρτης ημέρας/νύχτας\'. \n\nΟι επιλογές είναι: - \n\t* 'Ανατολή/Δύση\': αυτόματος τρόπος, ελεγχόμενο από τη θέση του ήλιου (προκαθορισμένο) - \n\t* 'Ημέρα\': πάντα χρήση της λειτουργίας ημέρας - \n\t* 'Νύχτα\': πάντα χρήση της λειτουργίας νύχτας - \n\t* 'Αισθητήρας φωτός\': η εμφάνιση του χάρτη ελέγχεται από τον αισθητήρα φωτός της συσκευής σας (μόνο αν υπάρχει) + \n\t* \'Ανατολή/Δύση\': αυτόματος τρόπος, ελεγχόμενο από τη θέση του ήλιου (προκαθορισμένο) + \n\t* \'Ημέρα\': πάντα χρήση της λειτουργίας ημέρας + \n\t* \'Νύχτα\': πάντα χρήση της λειτουργίας νύχτας + \n\t* \'Αισθητήρας φωτός\': η εμφάνιση του χάρτη ελέγχεται από τον αισθητήρα φωτός της συσκευής σας (μόνο αν υπάρχει) Βελτίωση Δεδομένων OSM \tΟ OsmAnd χρησιμοποιεί χάρτες βασισμένους στα δεδομένα του Openstreetmap.org (OSM) και -εκτός από προβολή χάρτη και δρομολόγηση- μπορεί να χρησιμοποιηθεί για τη βελτίωση της ποιότητας των δεδομένων OSM. Μπορείτε εύκολα να δημιουργήσετε και να αποστείλετε νέα Σημ. Ενδ. ή αναφορές σφαλμάτων με λίγα μόνο κλικ! diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml index 13e3cb411f..532c250930 100644 --- a/OsmAnd/res/values-es/strings.xml +++ b/OsmAnd/res/values-es/strings.xml @@ -1,4 +1,4 @@ - + Iniciar\n seguimiento en directo Parar\n seguimiento en directo Configura pantalla diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml index 49f2c03938..9da9a5a2d5 100644 --- a/OsmAnd/res/values-fa/strings.xml +++ b/OsmAnd/res/values-fa/strings.xml @@ -1,4 +1,4 @@ - + پشتیبان گیری از تغییرات OSM ناموفق بود زمان دقت @@ -343,7 +343,7 @@ دنبال کردن لطفا ابتدا مقصد را انتخاب کنید مسیرها - نشان دادن /'وضعیت GPS/' + نشان دادن /\'وضعیت GPS/\' ساعات باز بودن تاریخچه چیزی پیدا نشد @@ -1370,17 +1370,17 @@ OsmAnd منبع باز است و فعالانه در حال توسعه است. ویکی پدیای POIهای سراسر جهان میتوانید چگونگی نمایش و چرخش نقشه را با کلیک کردن بر روی آیکون قطب نمای صفحه نمایش نقشه عوض کنید. \n\nانتخابها عبارتند از: - \n\t\*'عدم چرخش (شمال به طرف بالا)\'- نقشه نمیچرخد. شمال همیشه به طرف بالا خواهد بود - \n\t\*'به طرف جهت حرکت\'- نقشه به طور مداوم هم جهت با مسیر حرکت خواهد بود + \n\t\*\'عدم چرخش (شمال به طرف بالا)\'- نقشه نمیچرخد. شمال همیشه به طرف بالا خواهد بود + \n\t\*\'به طرف جهت حرکت\'- نقشه به طور مداوم هم جهت با مسیر حرکت خواهد بود \n\t\'به طرف قطب نما\'- نقشه به طور مداوم هم جهت با قطب نمای دستگاه خواهد بود ظاهر نقشه برای نقشه های بُرداری بین حالت روز(روشن) و شب(تیره) قابل تغییر میباشد. رنگهای شب برای رانندگی در شب امن تر و راحت تر هستند. \n\nمیتوانیداز طریق \'منو\'->\'پیکربندی صفحه نمایش\'->\'نقشه روز/شب\' زمان تفییر روز/شب را تنظیم کنید. \n\nانتخابها عبارتند از: - \n\t* 'طلوع/غروب\'- حالت اتوماتیک، که با موقعیت خورشید کنترل میشود(پیش فرض) - \n\t* 'روز\'- همواره حالت روز استفاده میشود - \n\t* 'شب\'- همواره حالت شب استفاده میشود - \n\t* 'حسگر نور\'- ظاهر نقشه توسط حسگر نور دستگاه کنترل میشود(درصورتیکه وجود داشته باشد) + \n\t* \'طلوع/غروب\'- حالت اتوماتیک، که با موقعیت خورشید کنترل میشود(پیش فرض) + \n\t* \'روز\'- همواره حالت روز استفاده میشود + \n\t* \'شب\'- همواره حالت شب استفاده میشود + \n\t* \'حسگر نور\'- ظاهر نقشه توسط حسگر نور دستگاه کنترل میشود(درصورتیکه وجود داشته باشد) OsmAnd از اطلاعات نقشه های (Openstreetmap.org (OSM استفاده میکند و علاوه بر مشاهده نقشه و مسیریابی میتواند برای بهبود کیفیت داده ها OSM مورد استفاده قرار گیرد. شما مستقیماً میتوانید POIهای جدید ایجاد و آپلود کنید و یا تنها با چند کلیک ساده اشکالات OSM را گزارش کنید. \n\nبرای اینکار ابتدا باید این قسمت را از \'تنظیمات\'->\'افزونه ها\' فعال کنید و سپس اطلاعات ورود به OSM خود را در \'تنظیمات\'->\'ویرایش OSM\' وارد کنید. diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 8adced79c2..f647c4cbee 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -1,4 +1,4 @@ - + Modifications hors ligne Toujours utiliser l\'édition hors ligne "Changements en 0.7.1 : @@ -1333,7 +1333,7 @@ Annonce… Annoncer les radars Annonce les alertes de trafic - Merci de spécifier votre nom d'utilisateur et mot de passe OSM dans les paramètres + Merci de spécifier votre nom d\'utilisateur et mot de passe OSM dans les paramètres Effacer les points intermédiaires Garder les points intermédiaires diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml index f85e2a6941..e64f811515 100644 --- a/OsmAnd/res/values-sl/strings.xml +++ b/OsmAnd/res/values-sl/strings.xml @@ -1,4 +1,4 @@ - + Išči Išči Nastavitve @@ -580,9 +580,9 @@ Usmerjenost zemljevida Z večkratnim klikom na sliki kompasa lahko določite, kako se obrača zemljevid na zaslonu. \n\nMožnosti so: - \n\t\* 'Brez obračanja (sever je gor)\': Zemljevid ne bo obračan. Sever bo vedno proti sthu zaslona. - \n\t\* 'V smeri gibanja\': Zemljevid bo stalno usmerjen z smerjo premikanja. - \n\t\* 'Po kompasu\': Zemljevid bo stalno usmerjen po kompasu naprave torej poravnan z okolico. + \n\t\* \'Brez obračanja (sever je gor)\': Zemljevid ne bo obračan. Sever bo vedno proti sthu zaslona. + \n\t\* \'V smeri gibanja\': Zemljevid bo stalno usmerjen z smerjo premikanja. + \n\t\* \'Po kompasu\': Zemljevid bo stalno usmerjen po kompasu naprave torej poravnan z okolico. Posodabljanje zemljevidov je pomembno za uporabljanje map, interesnih točk, iskanje naslovov in navigacijo brez povezave. OsmAnd nudi upravitelja prenosov s katerim lahko prenesete take zemljevide (in druge podatkovne datoteke) in preverite razpoložljive podatke. \n\nZa prenos podatkov pojdite na \'Nastavitve\' → \'Upravljnje podatkov\' → \'Podatki za delo brez povezave\'. @@ -722,10 +722,10 @@ Izgled zemljevida se lahko za vektorske karte menja med dnevnim (svetlejšim) in nočnim (temnejšim) videzom. Nočne barve so varnejše za nočno vožnjo. \n\nPreklop med dnevnim in nočnim načinom lahko nastavljate v \'Meni\' → \'Nastavitev zaslona …\' → \'zemljevid dan/noč\'. \n\nMožnosti so: - \n\t\* 'Sončni vzhod/zahod\': avtomatski način glede na položaj sonca (privzeto) - \n\t\* 'Dnevni\': vedno se uporablja dnevni način - \n\t\* 'Nočni\': vedno se uporablja nočni način - \n\t\* 'Svetlobni senzor\': izgled zemljevida nadzoruje svetlobno tipalo naprave (če je na voljo) + \n\t\* \'Sončni vzhod/zahod\': avtomatski način glede na položaj sonca (privzeto) + \n\t\* \'Dnevni\': vedno se uporablja dnevni način + \n\t\* \'Nočni\': vedno se uporablja nočni način + \n\t\* \'Svetlobni senzor\': izgled zemljevida nadzoruje svetlobno tipalo naprave (če je na voljo) Ni dovolj razpoložljivega prostora za prejem %1$s MB(prosto: %2$s). Razpoložljiv prostor je sedaj {2}MB! Ali želite prejeti {0} datotek(o) ({1}MB)? diff --git a/OsmAnd/res/values-sv/strings.xml b/OsmAnd/res/values-sv/strings.xml index 73201ae3ad..6773b7bea7 100644 --- a/OsmAnd/res/values-sv/strings.xml +++ b/OsmAnd/res/values-sv/strings.xml @@ -1,4 +1,4 @@ - + För att låsa upp skärmen tryck på låsikonen Välj land Välj stad @@ -374,9 +374,9 @@ Aktuella data på enheten (%1$s ledigt): Kartorientering Du kan växla mellan om och hur kartbilden roteras genom att upprepade gånger klicka på kartskärmens kompassikon. \n\nAlternativen är: - \n\t*\ 'Norr uppåt (vrid inte kartan)\'- Kartan roteras inte. Norr är alltid uppåt. - \n\t*\ 'I rörelseriktningen\' - Kartan kommer att anpassas kontinuerligt efter din kurs. - \n\t*\ 'Efter kompassen\' - Kartan kommer att anpassas kontinuerligt till enhetens kompass. + \n\t*\ \'Norr uppåt (vrid inte kartan)\'- Kartan roteras inte. Norr är alltid uppåt. + \n\t*\ \'I rörelseriktningen\' - Kartan kommer att anpassas kontinuerligt efter din kurs. + \n\t*\ \'Efter kompassen\' - Kartan kommer att anpassas kontinuerligt till enhetens kompass. Hämtades utan problem. \n\t\n\tFör användning aktivera \'Meny\' -> \'Definiera vy\' -> \'Kartkälla …\' -> \'Offline vektorkartor\'. diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 329d6c7c29..43b5f23dd5 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -1,4 +1,4 @@ - + 選擇道路的色彩調配: 道路的色彩調配 顯示目的地方向 From 8fb4fdcb7a050bcef4ed0abfaed3c928870c6ac0 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 17 Aug 2013 01:24:08 +0200 Subject: [PATCH 02/38] Use android time utils --- .../src/net/osmand/util/Algorithms.java | 24 ------------------- OsmAnd/src/net/osmand/AndroidUtils.java | 11 +++++++++ .../ContributionVersionActivity.java | 8 ++++--- .../activities/DownloadIndexActivity.java | 17 ++++++------- .../audionotes/AudioVideoNotesPlugin.java | 9 +++---- .../plus/download/DownloadIndexesThread.java | 6 ++--- .../download/DownloadOsmandIndexesHelper.java | 18 +++++++------- .../net/osmand/plus/download/IndexItem.java | 6 ++++- .../plus/resources/ResourceManager.java | 7 +++--- 9 files changed, 51 insertions(+), 55 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/util/Algorithms.java b/OsmAnd-java/src/net/osmand/util/Algorithms.java index faae29c8fb..8aa83b16d5 100644 --- a/OsmAnd-java/src/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/net/osmand/util/Algorithms.java @@ -296,28 +296,4 @@ public class Algorithms { return defaultValue; } - private static java.text.DateFormat dateFormat; - private static java.text.DateFormat dateTimeFormat; - public static String formatDate(long t) { - return getDateFormat().format(new Date(t)); - } - - public static DateFormat getDateFormat() { - if(dateFormat == null) { - dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()); - } - return dateFormat; - } - - public static DateFormat getDateTimeFormat() { - if (dateTimeFormat == null) { - dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()); - } - return dateTimeFormat; - } - - public static String formatDateTime(long t) { - return getDateTimeFormat().format(new Date(t)); - } - } diff --git a/OsmAnd/src/net/osmand/AndroidUtils.java b/OsmAnd/src/net/osmand/AndroidUtils.java index 5c60a11966..5ab04e5637 100644 --- a/OsmAnd/src/net/osmand/AndroidUtils.java +++ b/OsmAnd/src/net/osmand/AndroidUtils.java @@ -1,7 +1,11 @@ package net.osmand; + +import java.util.Date; + import android.content.Context; import android.content.res.Configuration; +import android.text.format.DateFormat; import android.view.View; import android.view.inputmethod.InputMethodManager; @@ -32,4 +36,11 @@ public class AndroidUtils { }); } + public static String formatDate(Context ctx, long time) { + return DateFormat.getDateFormat(ctx).format(new Date(time)); + } + + public static String formatTime(Context ctx, long time) { + return DateFormat.getTimeFormat(ctx).format(new Date(time)); + } } diff --git a/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java b/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java index b6dbfff1f5..d40ee71739 100644 --- a/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import net.osmand.AndroidUtils; import net.osmand.access.AccessibleToast; import net.osmand.plus.R; import net.osmand.util.Algorithms; @@ -26,6 +27,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -131,7 +133,7 @@ public class ContributionVersionActivity extends OsmandListActivity { AccessibleToast.makeText( this, MessageFormat.format(getString(R.string.build_installed), currentSelectedBuild.tag, - Algorithms.formatDate(currentSelectedBuild.date.getTime())), Toast.LENGTH_LONG).show(); + AndroidUtils.formatDate(getMyApplication(), currentSelectedBuild.date.getTime())), Toast.LENGTH_LONG).show(); } getMyApplication().getSettings().CONTRIBUTION_INSTALL_APP_DATE.set(dateFormat.format(d)); } @@ -195,7 +197,7 @@ public class ContributionVersionActivity extends OsmandListActivity { final OsmAndBuild item = (OsmAndBuild) getListAdapter().getItem(position); Builder builder = new AlertDialog.Builder(this); builder.setMessage(MessageFormat.format(getString(R.string.install_selected_build), item.tag, - Algorithms.formatDate(item.date.getTime()), item.size)); + AndroidUtils.formatDate(getMyApplication(), item.date.getTime()), item.size)); builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() { @Override @@ -248,7 +250,7 @@ public class ContributionVersionActivity extends OsmandListActivity { TextView description = (TextView) row.findViewById(R.id.download_descr); StringBuilder format = new StringBuilder(); - format.append(Algorithms.formatDate(build.date.getTime()))/*.append(" : ").append(build.size).append(" MB")*/; + format.append(AndroidUtils.formatDate(getMyApplication(), build.date.getTime()))/*.append(" : ").append(build.size).append(" MB")*/; description.setText(format.toString()); int color = getResources().getColor(R.color.color_unknown); diff --git a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java index 030b3c7c12..618b47850e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import net.osmand.AndroidUtils; import net.osmand.IndexConstants; import net.osmand.access.AccessibleToast; import net.osmand.plus.ClientContext; @@ -28,10 +29,10 @@ import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItemCategory; import net.osmand.plus.srtmplugin.SRTMPlugin; -import net.osmand.util.Algorithms; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.ActivityNotFoundException; +import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; @@ -456,24 +457,24 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity { private Map listAlreadyDownloadedWithAlternatives() { Map files = new TreeMap(); - listWithAlternatives(getMyApplication().getAppPath(IndexConstants.BACKUP_INDEX_DIR),IndexConstants.BINARY_MAP_INDEX_EXT, files); - listWithAlternatives(getMyApplication().getAppPath(IndexConstants.MAPS_PATH),IndexConstants.BINARY_MAP_INDEX_EXT, files); - listWithAlternatives(getMyApplication().getAppPath(IndexConstants.MAPS_PATH),IndexConstants.EXTRA_EXT, files); + listWithAlternatives(getMyApplication(), getMyApplication().getAppPath(IndexConstants.BACKUP_INDEX_DIR),IndexConstants.BINARY_MAP_INDEX_EXT, files); + listWithAlternatives(getMyApplication(), getMyApplication().getAppPath(IndexConstants.MAPS_PATH),IndexConstants.BINARY_MAP_INDEX_EXT, files); + listWithAlternatives(getMyApplication(), getMyApplication().getAppPath(IndexConstants.MAPS_PATH),IndexConstants.EXTRA_EXT, files); if(OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null) { - listWithAlternatives(getMyApplication().getAppPath(IndexConstants.SRTM_INDEX_DIR),IndexConstants.BINARY_MAP_INDEX_EXT, files); + listWithAlternatives(getMyApplication(), getMyApplication().getAppPath(IndexConstants.SRTM_INDEX_DIR),IndexConstants.BINARY_MAP_INDEX_EXT, files); } - listWithAlternatives(getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR),"", files); + listWithAlternatives(getMyApplication(), getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR),"", files); return files; } - public static Map listWithAlternatives(File file, final String ext, + public static Map listWithAlternatives(final Context ctx, File file, final String ext, final Map files) { if (file.isDirectory()) { file.list(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { if (filename.endsWith(ext)) { - String date = Algorithms.formatDate(new File(dir, filename).lastModified()); + String date = AndroidUtils.formatDate(ctx, new File(dir, filename).lastModified()); files.put(filename, date); return true; } else { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index cf97594c0e..54b6db830d 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -15,6 +15,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import net.osmand.AndroidUtils; import net.osmand.IProgress; import net.osmand.IndexConstants; import net.osmand.Location; @@ -275,19 +276,19 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { public String getDescription(Context ctx) { String nm = name == null ? "" : name; if (isPhoto()) { - return ctx.getString(R.string.recording_photo_description, nm, Algorithms.formatDateTime(file.lastModified())).trim(); + return ctx.getString(R.string.recording_photo_description, nm, AndroidUtils.formatTime(ctx, file.lastModified())).trim(); } updateInternalDescription(); - return ctx.getString(R.string.recording_description, nm, getDuration(ctx), Algorithms.formatDateTime(file.lastModified())) + return ctx.getString(R.string.recording_description, nm, getDuration(ctx), AndroidUtils.formatTime(ctx, file.lastModified())) .trim(); } public String getSmallDescription(Context ctx) { String nm = name == null ? "" : name; if (isPhoto()) { - return ctx.getString(R.string.recording_photo_description, nm, Algorithms.formatDateTime(file.lastModified())).trim(); + return ctx.getString(R.string.recording_photo_description, nm, AndroidUtils.formatTime(ctx,file.lastModified())).trim(); } - return ctx.getString(R.string.recording_description, nm, "", Algorithms.formatDateTime(file.lastModified())).trim(); + return ctx.getString(R.string.recording_description, nm, "", AndroidUtils.formatTime(ctx, file.lastModified())).trim(); } private String getDuration(Context ctx) { diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 072fd1adb6..318468ae8c 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -89,12 +89,12 @@ public class DownloadIndexesThread { public void updateLoadedFiles() { Map indexActivatedFileNames = app.getResourceManager().getIndexFileNames(); - DownloadIndexActivity.listWithAlternatives(app.getAppPath(""), + DownloadIndexActivity.listWithAlternatives(app, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexActivatedFileNames); Map indexFileNames = app.getResourceManager().getIndexFileNames(); - DownloadIndexActivity.listWithAlternatives(app.getAppPath(""), + DownloadIndexActivity.listWithAlternatives(app, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexFileNames); - DownloadIndexActivity.listWithAlternatives(app.getAppPath(IndexConstants.TILES_INDEX_DIR), + DownloadIndexActivity.listWithAlternatives(app,app.getAppPath(IndexConstants.TILES_INDEX_DIR), IndexConstants.SQLITE_EXT, indexFileNames); app.getResourceManager().getBackupIndexes(indexFileNames); this.indexFileNames = indexFileNames; diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java index 037d820911..0d1a07031a 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java @@ -6,19 +6,18 @@ import java.io.InputStream; import java.net.URL; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import net.osmand.AndroidUtils; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.Version; -import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; import org.xmlpull.v1.XmlPullParser; @@ -30,6 +29,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.AssetManager; +import android.text.format.DateFormat; public class DownloadOsmandIndexesHelper { private final static Log log = PlatformUtil.getLog(DownloadOsmandIndexesHelper.class); @@ -40,7 +40,7 @@ public class DownloadOsmandIndexesHelper { PackageManager pm =ctx.getPackageManager(); AssetManager amanager = ctx.getAssets(); String versionUrlParam = Version.getVersionAsURLParam(((OsmandApplication) ctx.getApplicationContext())); - IndexFileList result = downloadIndexesListFromInternet(versionUrlParam); + IndexFileList result = downloadIndexesListFromInternet(ctx, versionUrlParam); if (result == null) { result = new IndexFileList(); } else { @@ -81,7 +81,7 @@ public class DownloadOsmandIndexesHelper { try { ApplicationInfo appInfo = pm.getApplicationInfo(OsmandApplication.class.getPackage().getName(), 0); dateModified = new File(appInfo.sourceDir).lastModified(); - date = Algorithms.formatDate(dateModified); + date = AndroidUtils.formatDate((Context) settings.getContext(), dateModified); } catch (NameNotFoundException e) { //do nothing... } @@ -98,7 +98,7 @@ public class DownloadOsmandIndexesHelper { if (item != null) { File destFile = new File(voicePath, voice + File.separatorChar + "_config.p"); try { - Date d = Algorithms.getDateFormat().parse(item.getDate()); + Date d = DateFormat.getDateFormat((Context) settings.getContext()).parse(item.getDate()); if (d.getTime() > dateModified) { continue; } @@ -130,7 +130,7 @@ public class DownloadOsmandIndexesHelper { return null; } - private static IndexFileList downloadIndexesListFromInternet(String versionAsUrl){ + private static IndexFileList downloadIndexesListFromInternet(Context ctx, String versionAsUrl){ try { IndexFileList result = new IndexFileList(); log.debug("Start loading list of index files"); //$NON-NLS-1$ @@ -150,7 +150,7 @@ public class DownloadOsmandIndexesHelper { String date = parser.getAttributeValue(null, "date"); //$NON-NLS-1$ String description = parser.getAttributeValue(null, "description"); //$NON-NLS-1$ String parts = parser.getAttributeValue(null, "parts"); //$NON-NLS-1$ - date = reparseDate(date); + date = reparseDate(ctx, date); IndexItem it = new IndexItem(name, description, date, size, parts); it.setType(tp); result.add(it); @@ -180,10 +180,10 @@ public class DownloadOsmandIndexesHelper { } } - private static String reparseDate(String date) { + private static String reparseDate(Context ctx, String date) { try { Date d = simpleDateFormat.parse(date); - return Algorithms.formatDate(d.getTime()); + return AndroidUtils.formatDate(ctx, d.getTime()); } catch (ParseException e) { return date; } diff --git a/OsmAnd/src/net/osmand/plus/download/IndexItem.java b/OsmAnd/src/net/osmand/plus/download/IndexItem.java index 4c168ab6be..93513329a9 100644 --- a/OsmAnd/src/net/osmand/plus/download/IndexItem.java +++ b/OsmAnd/src/net/osmand/plus/download/IndexItem.java @@ -10,6 +10,7 @@ import java.util.Date; import java.util.List; import java.util.Map; +import net.osmand.AndroidUtils; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.plus.ClientContext; @@ -19,6 +20,9 @@ import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; +import android.content.Context; +import android.text.format.DateFormat; + public class IndexItem implements Comparable { private static final Log log = PlatformUtil.getLog(IndexItem.class); @@ -193,7 +197,7 @@ public class IndexItem implements Comparable { entry.zipStream = zipStream; entry.unzipFolder = unzipDir; try { - Date d = Algorithms.getDateFormat().parse(date); + Date d = DateFormat.getDateFormat((Context) ctx).parse(date); entry.dateModified = d.getTime(); } catch (ParseException e1) { log.error("ParseException", e1); diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index 50e484d1f8..e0a182aa08 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -18,6 +18,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; +import net.osmand.AndroidUtils; import net.osmand.GeoidAltitudeCorrection; import net.osmand.IProgress; import net.osmand.IndexConstants; @@ -427,7 +428,7 @@ public class ResourceManager { conf = new File(f, "_ttsconfig.p"); } if (conf.exists()) { - indexFileNames.put(f.getName(), Algorithms.formatDate(conf.lastModified())); //$NON-NLS-1$ + indexFileNames.put(f.getName(), AndroidUtils.formatDate(context, conf.lastModified())); //$NON-NLS-1$ } } } @@ -619,7 +620,7 @@ public class ResourceManager { if (dateCreated == 0) { dateCreated = f.lastModified(); } - indexFileNames.put(f.getName(), Algorithms.formatDate(dateCreated)); //$NON-NLS-1$ + indexFileNames.put(f.getName(), AndroidUtils.formatDate(context, dateCreated)); //$NON-NLS-1$ for (String rName : index.getRegionNames()) { // skip duplicate names (don't make collision between getName() and name in the map) // it can be dangerous to use one file to different indexes if it is multithreaded @@ -907,7 +908,7 @@ public class ResourceManager { if (lf != null) { for (File f : lf) { if (f != null && f.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) { - map.put(f.getName(), Algorithms.formatDate(f.lastModified())); //$NON-NLS-1$ + map.put(f.getName(), AndroidUtils.formatDate(context, f.lastModified())); //$NON-NLS-1$ } } } From 64cab3f72da70f2ac559eb60cf86aece1389de1b Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 17 Aug 2013 01:42:37 +0200 Subject: [PATCH 03/38] Implement quick address search --- .../search/SearchBuildingByNameActivity.java | 4 +-- .../search/SearchByNameAbstractActivity.java | 35 +++++++++++++++++++ .../search/SearchCityByNameActivity.java | 8 ++++- .../search/SearchRegionByNameActivity.java | 8 ++++- .../search/SearchStreet2ByNameActivity.java | 2 +- .../search/SearchStreetByNameActivity.java | 2 +- 6 files changed, 53 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java index 3b18c23005..47b27e0786 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java @@ -112,10 +112,10 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity extends OsmandListActivity setContentView(R.layout.search_by_name); getSupportActionBar().setTitle(R.string.search_activity); getSupportActionBar().setIcon(R.drawable.tab_search_address_icon); + initializeTask = getInitializeTask(); uiHandler = new UIUpdateHandler(); @@ -440,4 +445,34 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity return row; } } + + protected void quitActivity() { + finish(); + if(getNextActivity() != null) { + Intent intent = new Intent(this, getNextActivity()); + startActivity(intent); + } + } + + + protected Class getNextActivity() { + return null; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == 1) { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + createMenuItem(menu, 1, R.string.default_buttons_ok, + R.drawable.ic_action_ok_light, R.drawable.ic_action_ok_dark , + MenuItem.SHOW_AS_ACTION_IF_ROOM); + return super.onCreateOptionsMenu(menu); + } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java index 478d6315b7..4fb8cbf975 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java @@ -16,6 +16,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.resources.RegionAddressRepository; import net.osmand.util.MapUtils; +import android.app.Activity; import android.os.AsyncTask; import android.os.Message; import android.view.Gravity; @@ -169,7 +170,7 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity if (region.getCityById(obj.getId(), obj.getName(region.useEnglishNames())) == null) { region.addCityToPreloadedList((City) obj); } - finish(); + quitActivity(); } private final class CityComparator implements Comparator { @@ -218,5 +219,10 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity return c1? 1 : -1; } } + + @Override + protected Class getNextActivity() { + return SearchStreetByNameActivity.class; + } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java index 8931d12d25..3ecea32730 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java @@ -9,6 +9,7 @@ import net.osmand.data.LatLon; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.resources.RegionAddressRepository; +import android.app.Activity; import android.os.Bundle; import android.widget.Toast; @@ -52,7 +53,12 @@ public class SearchRegionByNameActivity extends SearchByNameAbstractActivity getNextActivity() { + return SearchCityByNameActivity.class; } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java index b4d2a5cb5c..280e638726 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java @@ -64,6 +64,6 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity Date: Sat, 17 Aug 2013 01:50:03 +0200 Subject: [PATCH 04/38] Implement quick address search --- .../plus/activities/OsmandListActivity.java | 4 ++++ .../search/SearchBuildingByNameActivity.java | 2 +- .../search/SearchByNameAbstractActivity.java | 24 +++++++++++-------- .../search/SearchCityByNameActivity.java | 6 +---- .../search/SearchRegionByNameActivity.java | 6 +---- .../search/SearchStreet2ByNameActivity.java | 2 +- .../search/SearchStreetByNameActivity.java | 6 ++++- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/OsmandListActivity.java b/OsmAnd/src/net/osmand/plus/activities/OsmandListActivity.java index a80476a42f..b7a19802c6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/OsmandListActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/OsmandListActivity.java @@ -15,6 +15,10 @@ public abstract class OsmandListActivity extends SherlockListActivity { protected void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); super.onCreate(savedInstanceState); + setActionBarSettings(); + } + + protected void setActionBarSettings() { getSherlock().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java index 47b27e0786..af087e9ed8 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java @@ -112,7 +112,7 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity extends OsmandListActivity private StyleSpan previousSpan; private static final Log log = PlatformUtil.getLog(SearchByNameAbstractActivity.class); + protected void setActionBarSettings() { +// getSherlock().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); + getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setTitle(R.string.search_activity); + getSupportActionBar().setIcon(R.drawable.tab_search_address_icon); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); settings = ((OsmandApplication) getApplication()).getSettings(); setContentView(R.layout.search_by_name); - getSupportActionBar().setTitle(R.string.search_activity); - getSupportActionBar().setIcon(R.drawable.tab_search_address_icon); initializeTask = getInitializeTask(); @@ -446,19 +454,15 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity } } - protected void quitActivity() { + protected void quitActivity(Class next) { finish(); - if(getNextActivity() != null) { - Intent intent = new Intent(this, getNextActivity()); + if(next != null) { + Intent intent = new Intent(this, next); startActivity(intent); } } - protected Class getNextActivity() { - return null; - } - @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == 1) { @@ -472,7 +476,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity public boolean onCreateOptionsMenu(Menu menu) { createMenuItem(menu, 1, R.string.default_buttons_ok, R.drawable.ic_action_ok_light, R.drawable.ic_action_ok_dark , - MenuItem.SHOW_AS_ACTION_IF_ROOM); + MenuItem.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java index 4fb8cbf975..4f430769b6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java @@ -170,7 +170,7 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity if (region.getCityById(obj.getId(), obj.getName(region.useEnglishNames())) == null) { region.addCityToPreloadedList((City) obj); } - quitActivity(); + quitActivity(SearchStreetByNameActivity.class); } private final class CityComparator implements Comparator { @@ -220,9 +220,5 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity } } - @Override - protected Class getNextActivity() { - return SearchStreetByNameActivity.class; - } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java index 3ecea32730..f11898fd7e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchRegionByNameActivity.java @@ -53,12 +53,8 @@ public class SearchRegionByNameActivity extends SearchByNameAbstractActivity getNextActivity() { - return SearchCityByNameActivity.class; - } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java index 280e638726..87c4565fae 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java @@ -64,6 +64,6 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity Date: Sat, 17 Aug 2013 09:59:48 +0200 Subject: [PATCH 05/38] sync Credits to About --- CREDITS.md | 4 ++-- OsmAnd/res/values/no_translate.xml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index a7f8217e0c..5667c609ca 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,7 +1,7 @@ ### Credits to all major contributors/developers : * Victor Shcherb - all parts of the project, originator - * Pavol Zibrita - first contributor & developer of some utilities - * Dusan Kazik - one of the first contributor + * Pavol Zibrita - first contributor and developer of some utilities + * Dusan Kazik - one of the first contributors * Andre Van Atten - project supporter, active forum participant, one of the first users. * Dr. Hardy Mueller - map appearance concept and base renderers, international consistency and testing, usability, app scoping, concepts, documentation, wiki, market research. * Yvecai - main contributor to Contour Lines and Hillshade maps diff --git a/OsmAnd/res/values/no_translate.xml b/OsmAnd/res/values/no_translate.xml index 81250cbd39..823417da8a 100644 --- a/OsmAnd/res/values/no_translate.xml +++ b/OsmAnd/res/values/no_translate.xml @@ -18,6 +18,8 @@ \n\nCredits to all major Contributors/Developers : \n\tVictor Shcherb - project lead + \n\tPavol Zibrita - first contributor and developer of some utilities + \n\tDusan Kazik - one of the first contributors \n\tAndre Van Atten - project supporter, active forum participant, one of the first users. \n\tDr. Hardy Mueller - map appearance concept and base renderers, international consistency and testing, usability, app scoping, concepts, documentation, wiki, market research. \n\tYvecai - main contributor to Contour Lines and Hillshade maps From e75a1b1dae1e72af31028bf0f244813965ce0be8 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 17 Aug 2013 11:22:06 +0200 Subject: [PATCH 06/38] Fix miles in search --- OsmAnd/old-ndk-build.sh | 2 +- OsmAnd/src/net/osmand/plus/PoiFilter.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/old-ndk-build.sh b/OsmAnd/old-ndk-build.sh index 52ef0b18eb..878a3ab6b9 100755 --- a/OsmAnd/old-ndk-build.sh +++ b/OsmAnd/old-ndk-build.sh @@ -22,4 +22,4 @@ if [ -z "$OSMAND_X86_ONLY" ] && [ -z "$OSMAND_ARM_ONLY" ] && [ -z "$OSMAND_ARMv5 fi export BUILD_ONLY_OLD_LIB=1 "$SCRIPT_LOC/../../core/externals/configure.sh" -(cd "$SCRIPT_LOC" && "$ANDROID_NDK/ndk-build" -j`nproc`) +(cd "$SCRIPT_LOC" && "$ANDROID_NDK/ndk-build" -j1) diff --git a/OsmAnd/src/net/osmand/plus/PoiFilter.java b/OsmAnd/src/net/osmand/plus/PoiFilter.java index e6bb8894bb..e5f110868b 100644 --- a/OsmAnd/src/net/osmand/plus/PoiFilter.java +++ b/OsmAnd/src/net/osmand/plus/PoiFilter.java @@ -109,9 +109,9 @@ public class PoiFilter { public String getSearchArea(){ double val = distanceToSearchValues[distanceInd]; if(val >= 1){ - return " < " + ((int) val)+ " " + application.getString(R.string.km); //$NON-NLS-1$//$NON-NLS-2$ + return " < " + OsmAndFormatter.getFormattedDistance(((int)val * 1000), application); //$NON-NLS-1$//$NON-NLS-2$ } else { - return " < 500 " + application.getString(R.string.m); //$NON-NLS-1$ + return " < " + OsmAndFormatter.getFormattedDistance(500, application); //$NON-NLS-1$ } } From ca04fe9415667384aadebd4e4ad802fcfb558335 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 17 Aug 2013 11:25:57 +0200 Subject: [PATCH 07/38] Do not show navigation when the route is already being calculated --- OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 7e74b2d08d..b8dbe7f90a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -1142,7 +1142,8 @@ public class MapActivityActions implements DialogProvider { } }).reg(); } - optionsMenuHelper.item(routingHelper.isRouteCalculated() ? R.string.show_route: R.string.get_directions) + if(!routingHelper.isRouteBeingCalculated() || routingHelper.isRouteCalculated()) { + optionsMenuHelper.item(routingHelper.isRouteCalculated() ? R.string.show_route: R.string.get_directions) .icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light) .listen(new OnContextMenuClick() { @Override @@ -1157,6 +1158,7 @@ public class MapActivityActions implements DialogProvider { } } }).reg(); + } if (getTargets().getPointToNavigate() != null) { optionsMenuHelper.item(R.string.target_points).icons(R.drawable.ic_action_flage_dark, R.drawable.ic_action_flage_light) .listen(new OnContextMenuClick() { From dc9d7d2501991b992d8a9d3d8c68707096cad78e Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 17 Aug 2013 12:23:06 +0200 Subject: [PATCH 08/38] Fix java rendering style --- .../net/osmand/plus/render/OsmandRenderer.java | 10 ++-------- .../net/osmand/plus/render/TextRenderer.java | 17 +++++------------ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java index c9d7cc9485..58ce233b67 100644 --- a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java @@ -315,14 +315,8 @@ public class OsmandRenderer { // check bit b if it is set if (((ind >> b) & 1) == 0) { alreadyDrawnIcons[i] = ind | (1 << b); - if(rc.getDensityValue(1) != 1) { - float left = icon.x - rc.getDensityValue(ico.getWidth() / 2); - float top = icon.y - rc.getDensityValue(ico.getHeight() / 2); - cv.drawBitmap(ico, null, new RectF(left, top, left + rc.getDensityValue(ico.getWidth()), top - + rc.getDensityValue(ico.getHeight())), paintIcon); - } else { - cv.drawBitmap(ico, icon.x - ico.getWidth() / 2, icon.y - ico.getHeight() / 2, paintIcon); - } + cv.drawBitmap(ico, icon.x - ico.getWidth() / 2, + icon.y - ico.getHeight() / 2, paintIcon); } } } diff --git a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java index 884e3f70e4..52d2594ac7 100644 --- a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java @@ -242,18 +242,11 @@ public class TextRenderer { if (text.shieldRes != null) { Bitmap ico = RenderingIcons.getIcon(context, text.shieldRes); if (ico != null) { - if (rc.getDensityValue(1) != 1) { - float left = text.centerX - rc.getDensityValue(ico.getWidth() / 2) - 0.5f; - float top = text.centerY - rc.getDensityValue(ico.getHeight() / 2) - rc.getDensityValue(4.5f); - Rect rec = new Rect(0, 0, ico.getWidth(), ico.getHeight()); - cv.drawBitmap(ico, rec, - new RectF(left, top, left + rc.getDensityValue(ico.getWidth()), top - + rc.getDensityValue(ico.getHeight())), paintIcon); - } else { - float left = text.centerX - ico.getWidth() / 2 - 0.5f; - float top = text.centerY - ico.getHeight() / 2 - rc.getDensityValue(4.5f); - cv.drawBitmap(ico, left, top, paintIcon); - } + float left = text.centerX - ico.getWidth() / 2 + - 0.5f; + float top = text.centerY - ico.getHeight() / 2 + - rc.getDensityValue(4.5f); + cv.drawBitmap(ico, left, top, paintIcon); } } From 61433f961a20757907ade6bfa81919ad1bab355e Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 17 Aug 2013 23:33:19 +0200 Subject: [PATCH 09/38] Update native interface --- OsmAnd-java/src/net/osmand/NativeLibrary.java | 29 +++++++++++------ .../osmand/binary/BinaryInspectorNative.java | 7 ----- .../activities/SettingsGeneralActivity.java | 2 -- .../plus/render/NativeOsmandLibrary.java | 31 +++++++++++-------- 4 files changed, 37 insertions(+), 32 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/NativeLibrary.java b/OsmAnd-java/src/net/osmand/NativeLibrary.java index e9e2531083..c9629fa970 100644 --- a/OsmAnd-java/src/net/osmand/NativeLibrary.java +++ b/OsmAnd-java/src/net/osmand/NativeLibrary.java @@ -28,7 +28,13 @@ import net.osmand.router.RoutingConfiguration; public class NativeLibrary { - public static class RenderingGenerationResult { + protected final boolean newLibrary; + + public NativeLibrary(boolean newLibrary) { + this.newLibrary = newLibrary; + } + + public static class RenderingGenerationResult { public RenderingGenerationResult(ByteBuffer bitmap) { bitmapBuffer = bitmap; } @@ -84,7 +90,7 @@ public class NativeLibrary { } /** - * @param searchResultHandle + * @param * - must be null if there is no need to append to previous results returns native handle to results */ public NativeSearchResult searchObjectsForRendering(int sleft, int sright, int stop, int sbottom, int zoom, @@ -106,7 +112,12 @@ public class NativeLibrary { } public boolean initMapFile(String filePath) { - return initBinaryMapFile(filePath); + if(newLibrary) { + // TODO + return initBinaryMapFile(filePath); + } else { + return initBinaryMapFile(filePath); + } } public boolean initCacheMapFile(String filePath) { @@ -221,13 +232,10 @@ public class NativeLibrary { */ private static final Log log = PlatformUtil.getLog(NativeLibrary.class); - public static boolean loadAllLibs(String path) { - boolean b = true; - b &= load("Qt5Core", path); - b &= load("OsmAndCore", path); - b &= load("OsmAndCoreUtils", path); - b &= load("OsmAndJNI", path); - return b; + + + public static boolean loadNewLib(String path) { + return load("OsmAndJNI", path); } public static boolean loadOldLib(String path) { @@ -289,4 +297,5 @@ public class NativeLibrary { } // fall through return false; } + } diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryInspectorNative.java b/OsmAnd-java/src/net/osmand/binary/BinaryInspectorNative.java index 5fdd613fcc..cc9710b53c 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryInspectorNative.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryInspectorNative.java @@ -2,9 +2,6 @@ package net.osmand.binary; import java.io.IOException; -import java.util.Collections; - -import net.osmand.NativeLibrary; public class BinaryInspectorNative { @@ -18,10 +15,6 @@ public class BinaryInspectorNative { } args = new String[]{"-vmap", "-bbox=11.3,47.1,11.6,47", "/home/victor/projects/OsmAnd/data/osm-gen/Austria_2.obf"}; // test cases show info - NativeLibrary.loadAllLibs(null); -// StringVector vector = new StringVector(); -// Collections.addAll(vector, args); -// ObfInspector.inspector(vector); } public static void printUsage(String warning) { diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index f94311cfea..0c402bd3ea 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -44,7 +44,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity { private Preference applicationDir; private ListPreference applicationModePreference; private ListPreference drivingRegionPreference; - private ListPreference metricsAndConstantsPreference; @Override @@ -211,7 +210,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity { applicationModePreference = (ListPreference) screen.findPreference(settings.APPLICATION_MODE.getId()); applicationModePreference.setOnPreferenceChangeListener(this); drivingRegionPreference = (ListPreference) screen.findPreference(settings.DRIVING_REGION.getId()); - metricsAndConstantsPreference = (ListPreference) screen.findPreference(settings.METRIC_SYSTEM.getId()); } diff --git a/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java b/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java index d0116a41d1..ab7ad31577 100644 --- a/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java +++ b/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java @@ -17,14 +17,19 @@ public class NativeOsmandLibrary extends NativeLibrary { private static NativeOsmandLibrary library; private static Boolean isNativeSupported = null; - - public static NativeOsmandLibrary getLoadedLibrary(){ + + public NativeOsmandLibrary(boolean newLibrary) { + super(newLibrary); + } + + public static NativeOsmandLibrary getLoadedLibrary(){ synchronized (NativeOsmandLibrary.class) { return library; } } - public static NativeOsmandLibrary getLibrary(RenderingRulesStorage storage, ClientContext ctx) { + + public static NativeOsmandLibrary getLibrary(RenderingRulesStorage storage, ClientContext ctx) { if (!isLoaded()) { synchronized (NativeOsmandLibrary.class) { if (!isLoaded()) { @@ -43,7 +48,7 @@ public class NativeOsmandLibrary extends NativeLibrary { try { loadNewCore(libCpuSuffix); log.debug("Creating NativeOsmandLibrary instance..."); //$NON-NLS-1$ - library = new NativeOsmandLibrary(); + library = new NativeOsmandLibrary(true); isNativeSupported = true; } catch(Throwable e) { log.error("Failed to load new native library", e); //$NON-NLS-1$ @@ -51,7 +56,7 @@ public class NativeOsmandLibrary extends NativeLibrary { if(!isNativeSupported) { loadOldCore(libCpuSuffix); log.debug("Creating NativeOsmandLibrary instance..."); //$NON-NLS-1$ - library = new NativeOsmandLibrary(); + library = new NativeOsmandLibrary(false); log.debug("Initializing rendering rules storage..."); //$NON-NLS-1$ NativeOsmandLibrary.initRenderingRulesStorage(storage); isNativeSupported = true; @@ -70,13 +75,13 @@ public class NativeOsmandLibrary extends NativeLibrary { } private static void loadNewCore(final String libCpuSuffix) { - System.loadLibrary("Qt5Core" + libCpuSuffix); - System.loadLibrary("Qt5Network" + libCpuSuffix); - System.loadLibrary("Qt5Concurrent" + libCpuSuffix); - System.loadLibrary("Qt5Sql" + libCpuSuffix); - System.loadLibrary("Qt5Xml" + libCpuSuffix); - System.loadLibrary("OsmAndCore" + libCpuSuffix); - System.loadLibrary("OsmAndCoreUtils" + libCpuSuffix); +// System.loadLibrary("Qt5Core" + libCpuSuffix); +// System.loadLibrary("Qt5Network" + libCpuSuffix); +// System.loadLibrary("Qt5Concurrent" + libCpuSuffix); +// System.loadLibrary("Qt5Sql" + libCpuSuffix); +// System.loadLibrary("Qt5Xml" + libCpuSuffix); +// System.loadLibrary("OsmAndCore" + libCpuSuffix); +// System.loadLibrary("OsmAndCoreUtils" + libCpuSuffix); System.loadLibrary("OsmAndJNI" + libCpuSuffix); } @@ -103,7 +108,7 @@ public class NativeOsmandLibrary extends NativeLibrary { public RenderingGenerationResult generateRendering(RenderingContext rc, NativeSearchResult searchResultHandler, Bitmap bitmap, boolean isTransparent, RenderingRuleSearchRequest render) { if (searchResultHandler == null) { - log.error("Error searchresult = null"); //$NON-NLS-1$ + log.error("Error search result = null"); //$NON-NLS-1$ return new RenderingGenerationResult(null); } From c76322941a9188f59a6e5894880b19bbf6b9f959 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sun, 18 Aug 2013 00:25:58 +0200 Subject: [PATCH 10/38] Add idea projects to ws --- .gitignore | 1 + OsmAnd-java/OsmAnd-java.iml | 108 ++++++++++++++++++ OsmAnd/OsmAnd.iml | 55 +++++++++ SherlockBar/SherlockBar.iml | 39 +++++++ .../OsmAnd-AddressPlugin.iml | 28 +++++ .../Osmand-ParkingPlugin.iml | 28 +++++ .../Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml | 28 +++++ 7 files changed, 287 insertions(+) create mode 100644 OsmAnd-java/OsmAnd-java.iml create mode 100644 OsmAnd/OsmAnd.iml create mode 100644 SherlockBar/SherlockBar.iml create mode 100644 plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml create mode 100644 plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml create mode 100644 plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml diff --git a/.gitignore b/.gitignore index 42a3c52c3d..21388f996e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ mm_*.png mx_*.png *.class .settings +.idea diff --git a/OsmAnd-java/OsmAnd-java.iml b/OsmAnd-java/OsmAnd-java.iml new file mode 100644 index 0000000000..d1b986860d --- /dev/null +++ b/OsmAnd-java/OsmAnd-java.iml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OsmAnd/OsmAnd.iml b/OsmAnd/OsmAnd.iml new file mode 100644 index 0000000000..4b2429a0e9 --- /dev/null +++ b/OsmAnd/OsmAnd.iml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SherlockBar/SherlockBar.iml b/SherlockBar/SherlockBar.iml new file mode 100644 index 0000000000..b8800f7b15 --- /dev/null +++ b/SherlockBar/SherlockBar.iml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml b/plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml new file mode 100644 index 0000000000..fcb91eb6fe --- /dev/null +++ b/plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml b/plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml new file mode 100644 index 0000000000..fcb91eb6fe --- /dev/null +++ b/plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml b/plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml new file mode 100644 index 0000000000..fcb91eb6fe --- /dev/null +++ b/plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d61e0ec7e01dfb31c1ed9f231a59c48b28a022f4 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 18 Aug 2013 10:22:47 +0200 Subject: [PATCH 11/38] edit About --- OsmAnd/res/values/no_translate.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values/no_translate.xml b/OsmAnd/res/values/no_translate.xml index 823417da8a..d20503441c 100644 --- a/OsmAnd/res/values/no_translate.xml +++ b/OsmAnd/res/values/no_translate.xml @@ -12,12 +12,12 @@ \n\nAll rights belong to OsmAnd app. \n\nCopyright (C) 2010-2013 OsmAnd Authors : - \n\tVictor Shcherb - all parts of the project, originator + \n\tV.S. - all parts of the project, originator \n\tAlexey Pelykh - rendering and core parts \n\tHardy Mueller - main parts of the project, mostly rendering, UI interaction design \n\nCredits to all major Contributors/Developers : - \n\tVictor Shcherb - project lead + \n\tV.S. - project lead \n\tPavol Zibrita - first contributor and developer of some utilities \n\tDusan Kazik - one of the first contributors \n\tAndre Van Atten - project supporter, active forum participant, one of the first users. From df6ec4036b4efe94ec9993f3f7af56d2912dae41 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Sun, 18 Aug 2013 21:55:32 +0300 Subject: [PATCH 12/38] keep up-to-date --- OsmAnd-java/CMakeLists.txt | 17 +++++++++++++++++ OsmAnd-java/collect_libs.sh | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 7369c2bca7..ca26407a6d 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -16,6 +16,20 @@ elseif(CMAKE_TARGET_OS STREQUAL "linux") ) endif() +if(CMAKE_HOST_WIN32 AND NOT CYGWIN) + add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + COMMENT "Generating sources...") +else() + add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + COMMENT "Generating sources...") +endif() +add_custom_target(OsmAndJNI_swig + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" +) +set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) + if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) add_library(OsmAndJNI SHARED "c-src/swig.cpp" @@ -29,6 +43,9 @@ if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) "$ENV{JAVA_HOME}/include" ${target_specific_private_includes} ) + add_dependencies(OsmAndJNI + OsmAndJNI_swig + ) if(CMAKE_STATIC_LIBS_ALLOWED_ON_TARGET) add_dependencies(OsmAndJNI diff --git a/OsmAnd-java/collect_libs.sh b/OsmAnd-java/collect_libs.sh index 210b8e1ae6..8caa2aac4f 100755 --- a/OsmAnd-java/collect_libs.sh +++ b/OsmAnd-java/collect_libs.sh @@ -28,7 +28,6 @@ function compile { "$ROOT_LOC/core/externals/configure.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]} "$ROOT_LOC/core/externals/build.sh" ${OSMAND_ANDROID_EXTERNAL_DEPENDENCIES[*]} "$ROOT_LOC/tools/map-viewer/externals/configure.sh" - "$ROOT_LOC/android/OsmAnd-java/generate-swig.sh" if [ ! -d "$ROOT_LOC/amd64-linux-gcc-release.makefile" ]; then "$ROOT_LOC/build/amd64-linux-gcc.sh" release fi From 2452472b131b9d28f1a470a6cc1d8a688b296bcf Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Sun, 18 Aug 2013 22:09:37 +0300 Subject: [PATCH 13/38] Fix --- OsmAnd-java/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index ca26407a6d..769367ea55 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -25,9 +25,7 @@ else() COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" COMMENT "Generating sources...") endif() -add_custom_target(OsmAndJNI_swig - DEPENDS "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" -) +add_custom_target(OsmAndJNI_swig) set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) From 5a3487ccd30afc14617e64d75e5ed244fe8bbe6b Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Sun, 18 Aug 2013 22:43:29 +0300 Subject: [PATCH 14/38] Dependencies --- OsmAnd-java/CMakeLists.txt | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 769367ea55..56ba950471 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -16,16 +16,37 @@ elseif(CMAKE_TARGET_OS STREQUAL "linux") ) endif() +file(GLOB_RECURSE core_includes "${OSMAND_ROOT}/core/include/*.h*") +file(GLOB_RECURSE core_headers "${OSMAND_ROOT}/core/src/*.h*") +file(GLOB_RECURSE core_sources "${OSMAND_ROOT}/core/src/*.c*") +file(GLOB_RECURSE core_headers_client "${OSMAND_ROOT}/core/client/*.h*") +file(GLOB_RECURSE core_sources_client "${OSMAND_ROOT}/core/client/*.c*") if(CMAKE_HOST_WIN32 AND NOT CYGWIN) add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + DEPENDS + ${core_includes} + ${core_headers} + ${core_sources} + ${core_headers_client} + ${core_sources_client} COMMENT "Generating sources...") else() add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + DEPENDS + ${core_includes} + ${core_headers} + ${core_sources} + ${core_headers_client} + ${core_sources_client} COMMENT "Generating sources...") endif() -add_custom_target(OsmAndJNI_swig) +add_custom_target(OsmAndJNI_generate_swig + ALL + DEPENDS + "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" +) set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) @@ -42,7 +63,7 @@ if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) ${target_specific_private_includes} ) add_dependencies(OsmAndJNI - OsmAndJNI_swig + OsmAndJNI_generate_swig ) if(CMAKE_STATIC_LIBS_ALLOWED_ON_TARGET) From d9f948220edefd4728c06277a96bf981a598a537 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Mon, 19 Aug 2013 07:51:24 +0300 Subject: [PATCH 15/38] Enhance build instructions --- OsmAnd-java/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 56ba950471..30b8fc0563 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -21,6 +21,7 @@ file(GLOB_RECURSE core_headers "${OSMAND_ROOT}/core/src/*.h*") file(GLOB_RECURSE core_sources "${OSMAND_ROOT}/core/src/*.c*") file(GLOB_RECURSE core_headers_client "${OSMAND_ROOT}/core/client/*.h*") file(GLOB_RECURSE core_sources_client "${OSMAND_ROOT}/core/client/*.c*") +file(GLOB_RECURSE core_swig "${OSMAND_ROOT}/swig/*") if(CMAKE_HOST_WIN32 AND NOT CYGWIN) add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" @@ -30,6 +31,8 @@ if(CMAKE_HOST_WIN32 AND NOT CYGWIN) ${core_sources} ${core_headers_client} ${core_sources_client} + "${OSMAND_ROOT}/core/core.swig" + ${core_swig} COMMENT "Generating sources...") else() add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" @@ -40,6 +43,8 @@ else() ${core_sources} ${core_headers_client} ${core_sources_client} + "${OSMAND_ROOT}/core/core.swig" + ${core_swig} COMMENT "Generating sources...") endif() add_custom_target(OsmAndJNI_generate_swig From aa4f280d63a989092a3a43fdfe8dd840f5e750ae Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Mon, 19 Aug 2013 08:13:57 +0300 Subject: [PATCH 16/38] Cmakelists --- OsmAnd-java/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 30b8fc0563..7b63afdd7c 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -21,7 +21,8 @@ file(GLOB_RECURSE core_headers "${OSMAND_ROOT}/core/src/*.h*") file(GLOB_RECURSE core_sources "${OSMAND_ROOT}/core/src/*.c*") file(GLOB_RECURSE core_headers_client "${OSMAND_ROOT}/core/client/*.h*") file(GLOB_RECURSE core_sources_client "${OSMAND_ROOT}/core/client/*.c*") -file(GLOB_RECURSE core_swig "${OSMAND_ROOT}/swig/*") +file(GLOB core_swig "${OSMAND_ROOT}/core.swig") +file(GLOB_RECURSE core_swig_subfiles "${OSMAND_ROOT}/swig/*") if(CMAKE_HOST_WIN32 AND NOT CYGWIN) add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" @@ -31,8 +32,8 @@ if(CMAKE_HOST_WIN32 AND NOT CYGWIN) ${core_sources} ${core_headers_client} ${core_sources_client} - "${OSMAND_ROOT}/core/core.swig" ${core_swig} + ${core_swig_subfiles} COMMENT "Generating sources...") else() add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" @@ -43,14 +44,14 @@ else() ${core_sources} ${core_headers_client} ${core_sources_client} - "${OSMAND_ROOT}/core/core.swig" ${core_swig} + ${core_swig_subfiles} COMMENT "Generating sources...") endif() add_custom_target(OsmAndJNI_generate_swig ALL - DEPENDS - "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" +# DEPENDS +# "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" ) set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) From a4510f51a6b366eaa410ad44e420e824d06de046 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Mon, 19 Aug 2013 10:41:54 +0300 Subject: [PATCH 17/38] Custom target --- OsmAnd-java/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 7b63afdd7c..3b480c9aec 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -24,8 +24,9 @@ file(GLOB_RECURSE core_sources_client "${OSMAND_ROOT}/core/client/*.c*") file(GLOB core_swig "${OSMAND_ROOT}/core.swig") file(GLOB_RECURSE core_swig_subfiles "${OSMAND_ROOT}/swig/*") if(CMAKE_HOST_WIN32 AND NOT CYGWIN) - add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" - COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + add_custom_target(OsmAndJNI_generate_swig + ALL + bash --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" DEPENDS ${core_includes} ${core_headers} @@ -36,8 +37,9 @@ if(CMAKE_HOST_WIN32 AND NOT CYGWIN) ${core_swig_subfiles} COMMENT "Generating sources...") else() - add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" - COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + add_custom_target(OsmAndJNI_generate_swig + ALL + "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" DEPENDS ${core_includes} ${core_headers} @@ -48,12 +50,10 @@ else() ${core_swig_subfiles} COMMENT "Generating sources...") endif() -add_custom_target(OsmAndJNI_generate_swig - ALL -# DEPENDS -# "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" +set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + PROPERTIES + GENERATED TRUE ) -set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) add_library(OsmAndJNI SHARED From 5ce508d9181fd68311aca46327faceffcd5874e4 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Mon, 19 Aug 2013 10:48:05 +0300 Subject: [PATCH 18/38] Revert "Custom target" This reverts commit a4510f51a6b366eaa410ad44e420e824d06de046. --- OsmAnd-java/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 3b480c9aec..7b63afdd7c 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -24,9 +24,8 @@ file(GLOB_RECURSE core_sources_client "${OSMAND_ROOT}/core/client/*.c*") file(GLOB core_swig "${OSMAND_ROOT}/core.swig") file(GLOB_RECURSE core_swig_subfiles "${OSMAND_ROOT}/swig/*") if(CMAKE_HOST_WIN32 AND NOT CYGWIN) - add_custom_target(OsmAndJNI_generate_swig - ALL - bash --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" DEPENDS ${core_includes} ${core_headers} @@ -37,9 +36,8 @@ if(CMAKE_HOST_WIN32 AND NOT CYGWIN) ${core_swig_subfiles} COMMENT "Generating sources...") else() - add_custom_target(OsmAndJNI_generate_swig - ALL - "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" + add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" DEPENDS ${core_includes} ${core_headers} @@ -50,10 +48,12 @@ else() ${core_swig_subfiles} COMMENT "Generating sources...") endif() -set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" - PROPERTIES - GENERATED TRUE +add_custom_target(OsmAndJNI_generate_swig + ALL +# DEPENDS +# "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" ) +set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) add_library(OsmAndJNI SHARED From 0ac2f471e654b519e983410866734dc39629ab45 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Mon, 19 Aug 2013 11:15:19 +0300 Subject: [PATCH 19/38] Fix --- OsmAnd-java/CMakeLists.txt | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/CMakeLists.txt b/OsmAnd-java/CMakeLists.txt index 7b63afdd7c..256784ad70 100644 --- a/OsmAnd-java/CMakeLists.txt +++ b/OsmAnd-java/CMakeLists.txt @@ -23,8 +23,12 @@ file(GLOB_RECURSE core_headers_client "${OSMAND_ROOT}/core/client/*.h*") file(GLOB_RECURSE core_sources_client "${OSMAND_ROOT}/core/client/*.c*") file(GLOB core_swig "${OSMAND_ROOT}/core.swig") file(GLOB_RECURSE core_swig_subfiles "${OSMAND_ROOT}/swig/*") + +set(OsmAndJNI_generated_cpp + "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" +) if(CMAKE_HOST_WIN32 AND NOT CYGWIN) - add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + add_custom_command(OUTPUT ${OsmAndJNI_generated_cpp} COMMAND bash ARGS --login "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" DEPENDS ${core_includes} @@ -34,9 +38,10 @@ if(CMAKE_HOST_WIN32 AND NOT CYGWIN) ${core_sources_client} ${core_swig} ${core_swig_subfiles} + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMENT "Generating sources...") else() - add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + add_custom_command(OUTPUT ${OsmAndJNI_generated_cpp} COMMAND "${CMAKE_CURRENT_LIST_DIR}/generate-swig.sh" DEPENDS ${core_includes} @@ -46,18 +51,24 @@ else() ${core_sources_client} ${core_swig} ${core_swig_subfiles} + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMENT "Generating sources...") endif() add_custom_target(OsmAndJNI_generate_swig ALL -# DEPENDS -# "${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" + DEPENDS + ${OsmAndJNI_generated_cpp} + SOURCES + ${OsmAndJNI_generated_cpp} +) +set_source_files_properties(${OsmAndJNI_generated_cpp} + PROPERTIES + GENERATED TRUE ) -set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/c-src/swig.cpp" PROPERTIES GENERATED TRUE) if(CMAKE_SHARED_LIBS_ALLOWED_ON_TARGET) add_library(OsmAndJNI SHARED - "c-src/swig.cpp" + ${OsmAndJNI_generated_cpp} ) target_compile_definitions(OsmAndJNI PRIVATE From cb38f79ad82a41c2aaf8d75cf7b118d8ea537682 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 03:15:34 +0200 Subject: [PATCH 20/38] register new topo name --- OsmAnd/src/net/osmand/plus/render/RendererRegistry.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java b/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java index a9b6ad51cf..b754230f4e 100644 --- a/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java +++ b/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java @@ -38,8 +38,7 @@ public class RendererRegistry { internalRenderers.put("Touring-view_(more-contrast-and-details)", "Touring-view_(more-contrast-and-details)" +".render.xml"); internalRenderers.put("High-contrast-roads", "High-contrast-roads" + ".render.xml"); internalRenderers.put("Winter-and-ski", "Winter-and-ski" + ".render.xml"); - // internalRenderers.put("High-detail-topo", "High-detail-topo" + ".render.xml"); - internalRenderers.put("High-detail-topo", "High-detail-topo-v2" + ".render.xml"); + internalRenderers.put("Topo-map-assimilation", "Topo-map-assimilation" + ".render.xml"); } public RenderingRulesStorage defaultRender() { From 50b125541ed218f4fd3a21d776a89b62172f4670 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 14:25:08 +0200 Subject: [PATCH 21/38] =?UTF-8?q?help=20non-German=20tts=20voices=20to=20p?= =?UTF-8?q?ronouce=20German=20Stra=C3=9Fe=20(=3DStreet)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index def1eafe29..b9c8549edc 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -428,6 +428,7 @@ public class VoiceRouter { if(res != null) { res = res.replace('-', ' '); res = res.replace(':', ' '); + res = res.replace('', 'ss'); // this should help non-German tts voices to pronounce German "Strae" (=street) } return res; } From c6c971a4ebc1fae19576029dce9ad8445304ea2f Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 15:25:01 +0200 Subject: [PATCH 22/38] fix character issue --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index b9c8549edc..ad9f22a82f 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -428,7 +428,7 @@ public class VoiceRouter { if(res != null) { res = res.replace('-', ' '); res = res.replace(':', ' '); - res = res.replace('', 'ss'); // this should help non-German tts voices to pronounce German "Strae" (=street) + res = res.replace('ß', 'ss'); // this should help non-German tts voices to pronounce German "Strae" (=street) } return res; } From bb883c0c4baf0233ea8fdcad6cdae496ad84ae88 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 15:29:18 +0200 Subject: [PATCH 23/38] =?UTF-8?q?use=20unicode=20=C3=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index ad9f22a82f..2922bd45dc 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -428,7 +428,7 @@ public class VoiceRouter { if(res != null) { res = res.replace('-', ' '); res = res.replace(':', ' '); - res = res.replace('ß', 'ss'); // this should help non-German tts voices to pronounce German "Strae" (=street) + res = res.replace('\u00df', 'ss'); // this should help non-German tts voices to pronounce German "Strae" (=street) } return res; } From 2aa8e1bd0e20ac2c156e97ed1c97c7562be63012 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 15:39:23 +0200 Subject: [PATCH 24/38] use replaceAll --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index 2922bd45dc..f709d6638f 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -428,7 +428,7 @@ public class VoiceRouter { if(res != null) { res = res.replace('-', ' '); res = res.replace(':', ' '); - res = res.replace('\u00df', 'ss'); // this should help non-German tts voices to pronounce German "Strae" (=street) + res = res.replaceAll("", "ss"); // this should help non-German tts voices to pronounce German "Strae" (=street) } return res; } From 5bab9775720827bfaae48a6c7c72175f6ad71113 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 22:16:25 +0200 Subject: [PATCH 25/38] use replace --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index f709d6638f..a1847195f9 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -428,7 +428,7 @@ public class VoiceRouter { if(res != null) { res = res.replace('-', ' '); res = res.replace(':', ' '); - res = res.replaceAll("", "ss"); // this should help non-German tts voices to pronounce German "Strae" (=street) + res = res.replace("", "ss"); // helps non-German tts voices to pronounce German Strae (=street) } return res; } From 8f7f326bdc0132ef98f448639d4bb754197825a3 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 22:58:08 +0200 Subject: [PATCH 26/38] =?UTF-8?q?add=20unicode=20and=20html=20coded=20?= =?UTF-8?q?=C3=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index a1847195f9..8e0cef8ce8 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -429,6 +429,8 @@ public class VoiceRouter { res = res.replace('-', ' '); res = res.replace(':', ' '); res = res.replace("", "ss"); // helps non-German tts voices to pronounce German Strae (=street) + res = res.replace("\u00df", "ss"); + res = res.replace("ß", "ss"); } return res; } From 81c2e8227d47abb56f8d74db19c9832407a4bf52 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 23:18:42 +0200 Subject: [PATCH 27/38] combine some identical code --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index 8e0cef8ce8..0dd87347a8 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -426,11 +426,7 @@ public class VoiceRouter { } // replace characters which may produce unwanted tts sounds: if(res != null) { - res = res.replace('-', ' '); - res = res.replace(':', ' '); - res = res.replace("", "ss"); // helps non-German tts voices to pronounce German Strae (=street) - res = res.replace("\u00df", "ss"); - res = res.replace("ß", "ss"); + res = getSpeakablePointName(res) } return res; } @@ -440,6 +436,7 @@ public class VoiceRouter { if(pn != null) { pn = pn.replace('-', ' '); pn = pn.replace(':', ' '); + pn = pn.replace("ß", "ss"); // helps non-German tts voices to pronounce German Strae (=street) } return pn; } From 9d7e6d0be23c09cef1fe73670bd1e05a84bf226b Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 23:22:07 +0200 Subject: [PATCH 28/38] fix typo --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index 0dd87347a8..58a5fef95c 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -426,7 +426,7 @@ public class VoiceRouter { } // replace characters which may produce unwanted tts sounds: if(res != null) { - res = getSpeakablePointName(res) + res = getSpeakablePointName(res); } return res; } From c1772089122d844b5d42b982494a863311f2ea52 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 20 Aug 2013 23:29:17 +0200 Subject: [PATCH 29/38] use utf --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index 58a5fef95c..47af6420f2 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -436,7 +436,7 @@ public class VoiceRouter { if(pn != null) { pn = pn.replace('-', ' '); pn = pn.replace(':', ' '); - pn = pn.replace("ß", "ss"); // helps non-German tts voices to pronounce German Strae (=street) + pn = pn.replace("\u00df", "ss"); // helps non-German tts voices to pronounce German Strae (=street) } return pn; } From 37712a8a426ef75dac80d529cc87953ef230d74b Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 10:10:52 +0200 Subject: [PATCH 30/38] Fix Audio Video notes --- .../audionotes/AudioVideoNotesPlugin.java | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 54b6db830d..71317fff01 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -879,17 +879,17 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } stopRecording(mapActivity); SHOW_RECORDINGS.set(true); - indexFile(f); + indexFile(true, f); mapActivity.getMapView().refreshMap(); updateWidgetIcon(recordControl); } }); } - public void indexFile(File f) { + public boolean indexSingleFile(File f) { boolean oldFileExist = recordingByFileName.containsKey(f.getName()); if (oldFileExist) { - return; + return false; } Recording r = new Recording(f); String encodeName = f.getName(); @@ -918,6 +918,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } recordings.registerObject(r.lat, r.lon, r); recordingByFileName.put(f.getName(), r); + return true; } @Override @@ -943,31 +944,35 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { File[] files = avPath.listFiles(); if (files != null) { for (File f : files) { - if (f.getName().endsWith(THREEGP_EXTENSION) || f.getName().endsWith(MPEG4_EXTENSION) - || f.getName().endsWith(IMG_EXTENSION)) { - indexFile(f); - if (registerNew) { - Recording rec = recordingByFileName.get(f.getName()); - if (rec != null && app.getSettings().SAVE_TRACK_TO_GPX.get() - && OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) { - String name = f.getName(); - SavingTrackHelper savingTrackHelper = app.getSavingTrackHelper(); - - savingTrackHelper.insertPointData(rec.lat, rec.lon, System.currentTimeMillis(), name); - if (app.getSettings().SHOW_CURRENT_GPX_TRACK.get()) { - app.getFavorites().addFavoritePointToGPXFile(new FavouritePoint(rec.lat, rec.lon, name, "")); - } - } - } - - } - } + indexFile(registerNew, f); + } } } return null; } - public DataTileManager getRecordings() { + private void indexFile(boolean registerInGPX, File f) { + if (f.getName().endsWith(THREEGP_EXTENSION) || f.getName().endsWith(MPEG4_EXTENSION) + || f.getName().endsWith(IMG_EXTENSION)) { + boolean newFileIndexed = indexSingleFile(f); + if (newFileIndexed && registerInGPX) { + Recording rec = recordingByFileName.get(f.getName()); + if (rec != null && app.getSettings().SAVE_TRACK_TO_GPX.get() + && OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) { + String name = f.getName(); + SavingTrackHelper savingTrackHelper = app.getSavingTrackHelper(); + + savingTrackHelper.insertPointData(rec.lat, rec.lon, System.currentTimeMillis(), name); + if (app.getSettings().SHOW_CURRENT_GPX_TRACK.get()) { + app.getFavorites().addFavoritePointToGPXFile(new FavouritePoint(rec.lat, rec.lon, name, "")); + } + } + } + + } + } + + public DataTileManager getRecordings() { return recordings; } @@ -1008,7 +1013,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { @Override public void onMapActivityExternalResult(int requestCode, int resultCode, Intent data) { - if (requestCode == 205) { + if (requestCode == 205 || requestCode == 105) { indexingFiles(null, true, true); } } @@ -1209,7 +1214,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { FileOutputStream fos = new FileOutputStream(pictureFile); fos.write(data); fos.close(); - indexingFiles(null, true, true); + indexFile(true, pictureFile); dlg.dismiss(); // play sound after photo - sound file must be loaded at this time: if (AV_PHOTO_PLAY_SOUND.get()) { From f4b65ef81ab437bd99c09f75b626f82b0a95035f Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 10:42:24 +0200 Subject: [PATCH 31/38] Remove extra settings plugin --- OsmAnd/OsmAnd.iml | 2 +- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 18 +- .../plus/activities/LocalIndexesActivity.java | 2 - .../extrasettings/OsmandExtraSettings.java | 81 +----- .../net/osmand/plus/views/MapInfoLayer.java | 222 ++------------- .../mapwidgets/AppearanceWidgetsFactory.java | 261 ++++++++++++++++++ 6 files changed, 293 insertions(+), 293 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java diff --git a/OsmAnd/OsmAnd.iml b/OsmAnd/OsmAnd.iml index 4b2429a0e9..f65424b6ed 100644 --- a/OsmAnd/OsmAnd.iml +++ b/OsmAnd/OsmAnd.iml @@ -1,7 +1,7 @@ - + diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index d0f608013f..beea75ca2e 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -1,11 +1,9 @@ package net.osmand.plus; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - +import android.content.Intent; +import android.content.pm.PackageManager.NameNotFoundException; +import android.preference.PreferenceScreen; import net.osmand.IProgress; import net.osmand.PlatformUtil; import net.osmand.access.AccessibilityPlugin; @@ -17,7 +15,6 @@ import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.audionotes.AudioVideoNotesPlugin; import net.osmand.plus.development.OsmandDevelopmentPlugin; import net.osmand.plus.distancecalculator.DistanceCalculatorPlugin; -import net.osmand.plus.extrasettings.OsmandExtraSettings; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.osmodroid.OsMoDroidPlugin; @@ -25,12 +22,11 @@ import net.osmand.plus.parkingpoint.ParkingPositionPlugin; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.srtmplugin.SRTMPlugin; import net.osmand.plus.views.OsmandMapTileView; - import org.apache.commons.logging.Log; -import android.content.Intent; -import android.content.pm.PackageManager.NameNotFoundException; -import android.preference.PreferenceScreen; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; public abstract class OsmandPlugin { @@ -68,7 +64,7 @@ public abstract class OsmandPlugin { OsmandRasterMapsPlugin rasterMapsPlugin = new OsmandRasterMapsPlugin(app); installedPlugins.add(rasterMapsPlugin); installedPlugins.add(new OsmandMonitoringPlugin(app)); - installedPlugins.add(new OsmandExtraSettings(app)); +// installedPlugins.add(new OsmandExtraSettings(app)); installedPlugins.add(new AccessibilityPlugin(app)); if(!installPlugin(SRTM_PLUGIN_COMPONENT_PAID, SRTMPlugin.ID, app, new SRTMPlugin(app, true))) { diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java index ba7b835fc0..bc119d9e0b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java @@ -77,8 +77,6 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity { private ContextMenuAdapter optionsMenuAdapter; private ActionMode actionMode; - - @SuppressWarnings("unchecked") @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/OsmAnd/src/net/osmand/plus/extrasettings/OsmandExtraSettings.java b/OsmAnd/src/net/osmand/plus/extrasettings/OsmandExtraSettings.java index bb16c85a00..137ddd4f94 100644 --- a/OsmAnd/src/net/osmand/plus/extrasettings/OsmandExtraSettings.java +++ b/OsmAnd/src/net/osmand/plus/extrasettings/OsmandExtraSettings.java @@ -5,6 +5,7 @@ import java.util.Arrays; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -43,91 +44,13 @@ public class OsmandExtraSettings extends OsmandPlugin { public String getName() { return app.getString(R.string.extra_settings); } + @Override public void registerLayers(final MapActivity activity) { registerControls = true; final OsmandMapTileView view = activity.getMapView(); final MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer(); final MapWidgetRegistry mapInfoControls = mapInfoLayer.getMapInfoControls(); - - final OsmandPreference textSizePref = view.getSettings().MAP_TEXT_SIZE; - final MapWidgetRegInfo textSize = mapInfoControls.registerAppearanceWidget(R.drawable.widget_text_size, R.string.map_text_size, - "text_size", textSizePref); - textSize.setStateChangeListener(new Runnable() { - @Override - public void run() { - final Float[] floatValues = new Float[] {0.6f, 0.8f, 1.0f, 1.2f, 1.5f, 1.75f, 2f}; - String[] entries = new String[floatValues.length]; - for (int i = 0; i < floatValues.length; i++) { - entries[i] = (int) (floatValues[i] * 100) +" %"; - } - Builder b = new AlertDialog.Builder(view.getContext()); - b.setTitle(R.string.map_text_size); - int i = Arrays.binarySearch(floatValues, textSizePref.get()); - b.setSingleChoiceItems(entries, i, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - textSizePref.set(floatValues[which]); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - dialog.dismiss(); - } - }); - b.show(); - } - }); - - final MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(R.drawable.widget_ruler, R.string.map_widget_show_ruler, - "showRuler", view.getSettings().SHOW_RULER); - showRuler.setStateChangeListener(new Runnable() { - @Override - public void run() { - view.getSettings().SHOW_RULER.set(!view.getSettings().SHOW_RULER.get()); - view.refreshMap(); - } - }); - - final MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow, - "show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW); - showDestinationArrow.setStateChangeListener(new Runnable() { - @Override - public void run() { - view.getSettings().SHOW_DESTINATION_ARROW.set(!view.getSettings().SHOW_DESTINATION_ARROW.get()); - mapInfoLayer.recreateControls(); - } - }); - - final MapWidgetRegInfo transparent = mapInfoControls.registerAppearanceWidget(R.drawable.widget_transparent_skin, R.string.map_widget_transparent, - "transparent", view.getSettings().TRANSPARENT_MAP_THEME); - transparent.setStateChangeListener(new Runnable() { - @Override - public void run() { - view.getSettings().TRANSPARENT_MAP_THEME.set(!view.getSettings().TRANSPARENT_MAP_THEME.get()); - mapInfoLayer.recreateControls(); - } - }); - -// final MapInfoControlRegInfo posMap = mapInfoControls.registerAppearanceWidget(R.drawable.widget_position_marker, R.string.position_on_map, -// "position_on_map", textSizePref); -// posMap.setStateChangeListener(new Runnable() { -// @Override -// public void run() { -// String[] entries = new String[] { activity.getString(R.string.position_on_map_center), activity.getString(R.string.position_on_map_bottom) }; -// final Integer[] vals = new Integer[] { OsmandSettings.CENTER_CONSTANT, OsmandSettings.BOTTOM_CONSTANT }; -// Builder b = new AlertDialog.Builder(view.getContext()); -// int i = Arrays.binarySearch(vals, posPref.get()); -// b.setSingleChoiceItems(entries, i, new OnClickListener() { -// @Override -// public void onClick(DialogInterface dialog, int which) { -// posPref.set(vals[which]); -// activity.updateApplicationModeSettings(); -// view.refreshMap(true); -// dialog.dismiss(); -// } -// }); -// b.show(); -// } -// }); } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java index b248a7b2db..54dd9232da 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java @@ -1,52 +1,11 @@ package net.osmand.plus.views; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.EnumSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import net.osmand.access.AccessibleToast; -import net.osmand.plus.ApplicationMode; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.OsmandSettings; -import net.osmand.plus.OsmandSettings.CommonPreference; -import net.osmand.plus.R; -import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.activities.MapActivityActions; -import net.osmand.plus.activities.SettingsActivity; -import net.osmand.plus.extrasettings.OsmandExtraSettings; -import net.osmand.plus.routing.RoutingHelper; -import net.osmand.plus.views.mapwidgets.BaseMapWidget; -import net.osmand.plus.views.mapwidgets.ImageViewWidget; -import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; -import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView; -import net.osmand.plus.views.mapwidgets.MapWidgetRegistry; -import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo; -import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget; -import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory; -import net.osmand.plus.views.mapwidgets.StackWidgetView; -import net.osmand.plus.views.mapwidgets.TextInfoWidget; -import net.osmand.plus.views.mapwidgets.UpdateableWidget; -import net.osmand.render.RenderingRuleProperty; -import net.osmand.render.RenderingRulesStorage; -import net.osmand.util.Algorithms; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; +import android.graphics.*; import android.graphics.Paint.Style; -import android.graphics.Rect; -import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.util.DisplayMetrics; import android.view.Gravity; @@ -54,20 +13,27 @@ import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.view.WindowManager; -import android.widget.AdapterView; +import android.widget.*; import android.widget.AdapterView.OnItemClickListener; -import android.widget.ArrayAdapter; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.ListView; import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; -import android.widget.ListAdapter; -import android.widget.TextView; -import android.widget.Toast; +import net.osmand.plus.ApplicationMode; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.MapActivityActions; +import net.osmand.plus.routing.RoutingHelper; +import net.osmand.plus.views.mapwidgets.*; +import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView; +import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo; +import net.osmand.util.Algorithms; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.LinkedHashSet; +import java.util.Set; public class MapInfoLayer extends OsmandMapLayer { @@ -100,7 +66,7 @@ public class MapInfoLayer extends OsmandMapLayer { private MonitoringInfoControl monitoringServices; - private String ADDITIONAL_VECTOR_RENDERING_CATEGORY; + @@ -117,7 +83,6 @@ public class MapInfoLayer extends OsmandMapLayer { scaleCoefficient *= 1.5f; } - ADDITIONAL_VECTOR_RENDERING_CATEGORY = map.getString(R.string.map_widget_vector_attributes); paintText = new Paint(); paintText.setStyle(Style.FILL_AND_STROKE); paintText.setColor(Color.BLACK); @@ -250,150 +215,10 @@ public class MapInfoLayer extends OsmandMapLayer { "street_name", MapWidgetRegistry.MAIN_CONTROL, all, 100); // Register appearance widgets - registerAppearanceWidgets(); + AppearanceWidgetsFactory.INSTANCE.registerAppearanceWidgets(map, this, mapInfoControls); } - private void registerAppearanceWidgets() { - final MapWidgetRegInfo vectorRenderer = mapInfoControls.registerAppearanceWidget(R.drawable.widget_rendering_style, R.string.map_widget_renderer, - "renderer", view.getSettings().RENDERER); - final OsmandApplication app = view.getApplication(); - vectorRenderer.setStateChangeListener(new Runnable() { - @Override - public void run() { - Builder bld = new AlertDialog.Builder(view.getContext()); - bld.setTitle(R.string.renderers); - Collection rendererNames = app.getRendererRegistry().getRendererNames(); - final String[] items = rendererNames.toArray(new String[rendererNames.size()]); - int i = -1; - for(int j = 0; j< items.length; j++) { - if(items[j].equals(app.getRendererRegistry().getCurrentSelectedRenderer().getName())) { - i = j; - break; - } - } - bld.setSingleChoiceItems(items, i, new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - String renderer = items[which]; - RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(renderer); - if (loaded != null) { - view.getSettings().RENDERER.set(renderer); - app.getRendererRegistry().setCurrentSelectedRender(loaded); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - } else { - AccessibleToast.makeText(app, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show(); - } - createCustomRenderingProperties(loaded); - dialog.dismiss(); - } - }); - bld.show(); - } - }); - - final MapWidgetRegInfo dayNight = mapInfoControls.registerAppearanceWidget(R.drawable.widget_day_night_mode, R.string.map_widget_day_night, - "dayNight", view.getSettings().DAYNIGHT_MODE); - dayNight.setStateChangeListener(new Runnable() { - @Override - public void run() { - Builder bld = new AlertDialog.Builder(view.getContext()); - bld.setTitle(R.string.daynight); - final String[] items = new String[OsmandSettings.DayNightMode.values().length]; - for (int i = 0; i < items.length; i++) { - items[i] = OsmandSettings.DayNightMode.values()[i].toHumanString(map.getMyApplication()); - } - int i = view.getSettings().DAYNIGHT_MODE.get().ordinal(); - bld.setSingleChoiceItems(items, i, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - view.getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.values()[which]); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - dialog.dismiss(); - } - }); - bld.show(); - } - }); - - final MapWidgetRegInfo displayViewDirections = mapInfoControls.registerAppearanceWidget(R.drawable.widget_viewing_direction, R.string.map_widget_view_direction, - "viewDirection", view.getSettings().SHOW_VIEW_ANGLE); - displayViewDirections.setStateChangeListener(new Runnable() { - @Override - public void run() { - view.getSettings().SHOW_VIEW_ANGLE.set(!view.getSettings().SHOW_VIEW_ANGLE.get()); - map.getMapViewTrackingUtilities().updateSettings(); - } - }); - - RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer(); - if(renderer != null) { - createCustomRenderingProperties(renderer); - } - } - - private void createCustomRenderingProperties(RenderingRulesStorage renderer) { - String categoryName = ADDITIONAL_VECTOR_RENDERING_CATEGORY; - mapInfoControls.removeApperanceWidgets(categoryName); - final OsmandApplication app = view.getApplication(); - List customRules = renderer.PROPS.getCustomRules(); - for (final RenderingRuleProperty p : customRules) { - String propertyName = SettingsActivity.getStringPropertyName(view.getContext(), p.getAttrName(), p.getName()); - //test old descr as title - final String propertyDescr = SettingsActivity.getStringPropertyDescription(view.getContext(), p.getAttrName(), p.getName()); - if(p.isBoolean()) { - final CommonPreference pref = view.getApplication().getSettings().getCustomRenderBooleanProperty(p.getAttrName()); - int icon = 0; - try { - Field f = R.drawable.class.getField("widget_" + p.getAttrName().toLowerCase()); - icon = f.getInt(null); - } catch(Exception e){ - } - MapWidgetRegInfo w = mapInfoControls.registerAppearanceWidget(icon, propertyName, "rend_"+p.getAttrName(), pref, categoryName); - w.setStateChangeListener(new Runnable() { - @Override - public void run() { - pref.set(!pref.get()); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - } - }); - - } else { - final CommonPreference pref = view.getApplication().getSettings().getCustomRenderProperty(p.getAttrName()); - int icon = 0; - try { - Field f = R.drawable.class.getField("widget_" + p.getAttrName().toLowerCase()); - icon = f.getInt(null); - } catch(Exception e){ - } - MapWidgetRegInfo w = mapInfoControls.registerAppearanceWidget(icon, propertyName, "rend_"+p.getAttrName(), pref, categoryName); - w.setStateChangeListener(new Runnable() { - @Override - public void run() { - Builder b = new AlertDialog.Builder(view.getContext()); - //test old descr as title - b.setTitle(propertyDescr); - int i = Arrays.asList(p.getPossibleValues()).indexOf(pref.get()); - b.setSingleChoiceItems(p.getPossibleValues(), i, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - pref.set(p.getPossibleValues()[which]); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - dialog.dismiss(); - } - }); - b.show(); - } - }); - } - } - } - public void recreateControls(){ rightStack.clearAllViews(); @@ -408,7 +233,7 @@ public class MapInfoLayer extends OsmandMapLayer { mapInfoControls.populateStatusBar(statusBar); updateColorShadowsOfText(null); } - + public void createControls() { // 1. Create view groups and controls statusBar.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_top)); @@ -482,9 +307,6 @@ public class MapInfoLayer extends OsmandMapLayer { s.add(ms.getCategory()); } } - if(OsmandPlugin.getEnabledPlugin(OsmandExtraSettings.class) == null){ - s.remove(ADDITIONAL_VECTOR_RENDERING_CATEGORY); - } return s; } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java new file mode 100644 index 0000000000..f88de1d92a --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java @@ -0,0 +1,261 @@ +package net.osmand.plus.views.mapwidgets; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.widget.Toast; +import net.osmand.access.AccessibleToast; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SettingsActivity; +import net.osmand.plus.views.MapInfoLayer; +import net.osmand.plus.views.OsmandMapTileView; +import net.osmand.render.RenderingRuleProperty; +import net.osmand.render.RenderingRulesStorage; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +public class AppearanceWidgetsFactory { + + public static AppearanceWidgetsFactory INSTANCE = new AppearanceWidgetsFactory(); + private String ADDITIONAL_VECTOR_RENDERING_CATEGORY; + public static boolean EXTRA_SETTINGS = true; + + + public void registerAppearanceWidgets(final MapActivity map, final MapInfoLayer mapInfoLayer, + final MapWidgetRegistry mapInfoControls) { + final OsmandMapTileView view = map.getMapView(); + final MapWidgetRegistry.MapWidgetRegInfo vectorRenderer = mapInfoControls.registerAppearanceWidget(R.drawable.widget_rendering_style, R.string.map_widget_renderer, + "renderer", view.getSettings().RENDERER); + final OsmandApplication app = view.getApplication(); + vectorRenderer.setStateChangeListener(new Runnable() { + @Override + public void run() { + AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); + bld.setTitle(R.string.renderers); + Collection rendererNames = app.getRendererRegistry().getRendererNames(); + final String[] items = rendererNames.toArray(new String[rendererNames.size()]); + int i = -1; + for(int j = 0; j< items.length; j++) { + if(items[j].equals(app.getRendererRegistry().getCurrentSelectedRenderer().getName())) { + i = j; + break; + } + } + bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + String renderer = items[which]; + RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(renderer); + if (loaded != null) { + view.getSettings().RENDERER.set(renderer); + app.getRendererRegistry().setCurrentSelectedRender(loaded); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + } else { + AccessibleToast.makeText(app, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show(); + } + if(EXTRA_SETTINGS) { + createCustomRenderingProperties(loaded, map, mapInfoLayer, mapInfoControls); + } + dialog.dismiss(); + } + }); + bld.show(); + } + }); + + final MapWidgetRegistry.MapWidgetRegInfo dayNight = mapInfoControls.registerAppearanceWidget(R.drawable.widget_day_night_mode, R.string.map_widget_day_night, + "dayNight", view.getSettings().DAYNIGHT_MODE); + dayNight.setStateChangeListener(new Runnable() { + @Override + public void run() { + AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); + bld.setTitle(R.string.daynight); + final String[] items = new String[OsmandSettings.DayNightMode.values().length]; + for (int i = 0; i < items.length; i++) { + items[i] = OsmandSettings.DayNightMode.values()[i].toHumanString(map.getMyApplication()); + } + int i = view.getSettings().DAYNIGHT_MODE.get().ordinal(); + bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + view.getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.values()[which]); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + dialog.dismiss(); + } + }); + bld.show(); + } + }); + + final MapWidgetRegistry.MapWidgetRegInfo displayViewDirections = mapInfoControls.registerAppearanceWidget(R.drawable.widget_viewing_direction, R.string.map_widget_view_direction, + "viewDirection", view.getSettings().SHOW_VIEW_ANGLE); + displayViewDirections.setStateChangeListener(new Runnable() { + @Override + public void run() { + view.getSettings().SHOW_VIEW_ANGLE.set(!view.getSettings().SHOW_VIEW_ANGLE.get()); + map.getMapViewTrackingUtilities().updateSettings(); + } + }); + + if (EXTRA_SETTINGS) { + // previous extra settings + final OsmandSettings.OsmandPreference textSizePref = view.getSettings().MAP_TEXT_SIZE; + final MapWidgetRegistry.MapWidgetRegInfo textSize = mapInfoControls.registerAppearanceWidget(R.drawable.widget_text_size, R.string.map_text_size, + "text_size", textSizePref); + textSize.setStateChangeListener(new Runnable() { + @Override + public void run() { + final Float[] floatValues = new Float[] {0.6f, 0.8f, 1.0f, 1.2f, 1.5f, 1.75f, 2f}; + String[] entries = new String[floatValues.length]; + for (int i = 0; i < floatValues.length; i++) { + entries[i] = (int) (floatValues[i] * 100) +" %"; + } + AlertDialog.Builder b = new AlertDialog.Builder(view.getContext()); + b.setTitle(R.string.map_text_size); + int i = Arrays.binarySearch(floatValues, textSizePref.get()); + b.setSingleChoiceItems(entries, i, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + textSizePref.set(floatValues[which]); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + dialog.dismiss(); + } + }); + b.show(); + } + }); + + final MapWidgetRegistry.MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(R.drawable.widget_ruler, R.string.map_widget_show_ruler, + "showRuler", view.getSettings().SHOW_RULER); + showRuler.setStateChangeListener(new Runnable() { + @Override + public void run() { + view.getSettings().SHOW_RULER.set(!view.getSettings().SHOW_RULER.get()); + view.refreshMap(); + } + }); + + final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow, + "show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW); + showDestinationArrow.setStateChangeListener(new Runnable() { + @Override + public void run() { + view.getSettings().SHOW_DESTINATION_ARROW.set(!view.getSettings().SHOW_DESTINATION_ARROW.get()); + mapInfoLayer.recreateControls(); + } + }); + + final MapWidgetRegistry.MapWidgetRegInfo transparent = mapInfoControls.registerAppearanceWidget(R.drawable.widget_transparent_skin, R.string.map_widget_transparent, + "transparent", view.getSettings().TRANSPARENT_MAP_THEME); + transparent.setStateChangeListener(new Runnable() { + @Override + public void run() { + view.getSettings().TRANSPARENT_MAP_THEME.set(!view.getSettings().TRANSPARENT_MAP_THEME.get()); + mapInfoLayer.recreateControls(); + } + }); + +// final OsmandSettings.OsmandPreference posPref = view.getSettings().POSITION_ON_MAP; +// final MapWidgetRegistry.MapWidgetRegInfo posMap = mapInfoControls.registerAppearanceWidget(R.drawable.widget_position_marker, R.string.position_on_map, +// "position_on_map", textSizePref); +// posMap.setStateChangeListener(new Runnable() { +// @Override +// public void run() { +// String[] entries = new String[] {map.getString(R.string.position_on_map_center), map.getString(R.string.position_on_map_bottom) }; +// final Integer[] vals = new Integer[] { OsmandSettings.CENTER_CONSTANT, OsmandSettings.BOTTOM_CONSTANT }; +// AlertDialog.Builder b = new AlertDialog.Builder(view.getContext()); +// int i = Arrays.binarySearch(vals, posPref.get()); +// b.setSingleChoiceItems(entries, i, new DialogInterface.OnClickListener() { +// @Override +// public void onClick(DialogInterface dialog, int which) { +// posPref.set(vals[which]); +// map.updateApplicationModeSettings(); +// view.refreshMap(true); +// dialog.dismiss(); +// } +// }); +// b.show(); +// } +// }); + + } + + RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer(); + if(renderer != null && EXTRA_SETTINGS) { + createCustomRenderingProperties(renderer, map, mapInfoLayer, mapInfoControls); + } + } + + private void createCustomRenderingProperties(RenderingRulesStorage renderer, final MapActivity map, + final MapInfoLayer mapInfoLayer, final MapWidgetRegistry mapInfoControls) { + final OsmandMapTileView view = map.getMapView(); + if(ADDITIONAL_VECTOR_RENDERING_CATEGORY == null) { + ADDITIONAL_VECTOR_RENDERING_CATEGORY = map.getString(R.string.map_widget_vector_attributes); + } + String categoryName = ADDITIONAL_VECTOR_RENDERING_CATEGORY; + mapInfoControls.removeApperanceWidgets(categoryName); + final OsmandApplication app = view.getApplication(); + List customRules = renderer.PROPS.getCustomRules(); + for (final RenderingRuleProperty p : customRules) { + String propertyName = SettingsActivity.getStringPropertyName(view.getContext(), p.getAttrName(), p.getName()); + //test old descr as title + final String propertyDescr = SettingsActivity.getStringPropertyDescription(view.getContext(), p.getAttrName(), p.getName()); + if(p.isBoolean()) { + final OsmandSettings.CommonPreference pref = view.getApplication().getSettings().getCustomRenderBooleanProperty(p.getAttrName()); + int icon = 0; + try { + Field f = R.drawable.class.getField("widget_" + p.getAttrName().toLowerCase()); + icon = f.getInt(null); + } catch(Exception e){ + } + MapWidgetRegistry.MapWidgetRegInfo w = mapInfoControls.registerAppearanceWidget(icon, propertyName, "rend_"+p.getAttrName(), pref, categoryName); + w.setStateChangeListener(new Runnable() { + @Override + public void run() { + pref.set(!pref.get()); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + } + }); + + } else { + final OsmandSettings.CommonPreference pref = view.getApplication().getSettings().getCustomRenderProperty(p.getAttrName()); + int icon = 0; + try { + Field f = R.drawable.class.getField("widget_" + p.getAttrName().toLowerCase()); + icon = f.getInt(null); + } catch(Exception e){ + } + MapWidgetRegistry.MapWidgetRegInfo w = mapInfoControls.registerAppearanceWidget(icon, propertyName, "rend_"+p.getAttrName(), pref, categoryName); + w.setStateChangeListener(new Runnable() { + @Override + public void run() { + AlertDialog.Builder b = new AlertDialog.Builder(view.getContext()); + //test old descr as title + b.setTitle(propertyDescr); + int i = Arrays.asList(p.getPossibleValues()).indexOf(pref.get()); + b.setSingleChoiceItems(p.getPossibleValues(), i, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + pref.set(p.getPossibleValues()[which]); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + dialog.dismiss(); + } + }); + b.show(); + } + }); + } + } + } +} From 9e43e5f9a23b396af9176be2b72a42841f83ea7f Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 10:42:40 +0200 Subject: [PATCH 32/38] Remove extra settings plugin --- OsmAnd-java/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd-java/.gitignore b/OsmAnd-java/.gitignore index 7c771eb8cc..5be8d80c05 100644 --- a/OsmAnd-java/.gitignore +++ b/OsmAnd-java/.gitignore @@ -1,4 +1,5 @@ bin c-src OsmAnd-core.jar +OsmAnd-core-android.jar src/net/osmand/core/jni/* From 34d267ad568f55190d900ca1bbd74a55d374d1a0 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 16:11:52 +0200 Subject: [PATCH 33/38] take next name for roundabout (not roundabout name) --- .../plus/routing/RouteCalculationResult.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index e0bd9a659d..49c4df613b 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -246,14 +246,19 @@ public class RouteCalculationResult { if(turn != null) { RouteDirectionInfo info = new RouteDirectionInfo(s.getSegmentSpeed(), turn); - if(routeInd + 1< list.size()) { - RouteSegmentResult next = list.get(routeInd); - info.setRef(next.getObject().getRef()); - info.setStreetName(next.getObject().getName()); - info.setDestinationName(next.getObject().getDestinationName()); - } - - String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(), + if (routeInd + 1 < list.size()) { + int lind = routeInd; + if(turn.isRoundAbout() && routeInd + 2 < list.size()) { + // take next name for roundabout (not roundabout name) + lind = routeInd + 1; + } + RouteSegmentResult next = list.get(lind); + info.setRef(next.getObject().getRef()); + info.setStreetName(next.getObject().getName()); + info.setDestinationName(next.getObject().getDestinationName()); + } + + String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(), info.getRef(), info.getDestinationName()); info.setDescriptionRoute(description); info.routePointOffset = prevLocationSize; From 12c873189bd60716803718f06c49c3f1fe3094e1 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 16:16:56 +0200 Subject: [PATCH 34/38] Fix last road name --- .../src/net/osmand/plus/routing/RouteCalculationResult.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index 49c4df613b..b4341fc08e 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -246,9 +246,9 @@ public class RouteCalculationResult { if(turn != null) { RouteDirectionInfo info = new RouteDirectionInfo(s.getSegmentSpeed(), turn); - if (routeInd + 1 < list.size()) { + if (routeInd < list.size()) { int lind = routeInd; - if(turn.isRoundAbout() && routeInd + 2 < list.size()) { + if(turn.isRoundAbout() && routeInd + 1 < list.size()) { // take next name for roundabout (not roundabout name) lind = routeInd + 1; } From 3b363b6b5eb762b0044ed2f88de793b65b48384b Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 20:35:36 +0200 Subject: [PATCH 35/38] Add iml structure --- OsmAnd/OsmAnd.iml | 24 ++++++++++--------- SherlockBar/SherlockBar.iml | 10 +------- .../OsmAnd-AddressPlugin.iml | 1 + .../Osmand-ParkingPlugin.iml | 1 + .../Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml | 1 + 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/OsmAnd/OsmAnd.iml b/OsmAnd/OsmAnd.iml index f65424b6ed..d3c5532245 100644 --- a/OsmAnd/OsmAnd.iml +++ b/OsmAnd/OsmAnd.iml @@ -2,6 +2,7 @@ + @@ -25,7 +26,19 @@ + + + + + + + + + + + + @@ -39,17 +52,6 @@ - - - - - - - - - - - diff --git a/SherlockBar/SherlockBar.iml b/SherlockBar/SherlockBar.iml index b8800f7b15..839e8cb99a 100644 --- a/SherlockBar/SherlockBar.iml +++ b/SherlockBar/SherlockBar.iml @@ -25,15 +25,7 @@ - - - - - - - - - + diff --git a/plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml b/plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml index fcb91eb6fe..4d1bed3008 100644 --- a/plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml +++ b/plugins/OsmAnd-AddressPlugin/OsmAnd-AddressPlugin.iml @@ -23,6 +23,7 @@ + diff --git a/plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml b/plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml index fcb91eb6fe..66a878fcb5 100644 --- a/plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml +++ b/plugins/Osmand-ParkingPlugin/Osmand-ParkingPlugin.iml @@ -23,6 +23,7 @@ + diff --git a/plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml b/plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml index fcb91eb6fe..4d1bed3008 100644 --- a/plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml +++ b/plugins/Osmand-SRTMPlugin/Osmand-SRTMPlugin.iml @@ -23,6 +23,7 @@ + From 19348411a1c9bb02c72ab3c4ee3f6de703d2385d Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 20:36:24 +0200 Subject: [PATCH 36/38] Replace non utf character --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index 47af6420f2..cccf7db349 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -436,7 +436,7 @@ public class VoiceRouter { if(pn != null) { pn = pn.replace('-', ' '); pn = pn.replace(':', ' '); - pn = pn.replace("\u00df", "ss"); // helps non-German tts voices to pronounce German Strae (=street) + pn = pn.replace("\u00df", "ss"); // helps non-German tts voices to pronounce German Strasse (=street) } return pn; } From 0590943dd56aced9ce99330ae847c4f76dd07d6a Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 21:02:30 +0200 Subject: [PATCH 37/38] Save intermediate points --- .../osmand/plus/routing/RouteProvider.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 3ab0e3a1d6..29c86908ca 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -27,17 +27,12 @@ import net.osmand.PlatformUtil; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.data.DataTileManager; import net.osmand.data.LatLon; -import net.osmand.plus.ApplicationMode; -import net.osmand.plus.ClientContext; -import net.osmand.plus.GPXUtilities; +import net.osmand.plus.*; import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GPXUtilities.Route; import net.osmand.plus.GPXUtilities.Track; import net.osmand.plus.GPXUtilities.TrkSegment; import net.osmand.plus.GPXUtilities.WptPt; -import net.osmand.plus.OsmandSettings; -import net.osmand.plus.R; -import net.osmand.plus.Version; import net.osmand.router.GeneralRouter; import net.osmand.router.GeneralRouter.GeneralRouterProfile; import net.osmand.router.RoutePlannerFrontEnd; @@ -673,7 +668,7 @@ public class RouteProvider { return new RouteCalculationResult(res, null, params.start, params.end, null, null, null, params.ctx, params.leftSide, true); } - public GPXFile createOsmandRouterGPX(RouteCalculationResult srcRoute){ + public GPXFile createOsmandRouterGPX(RouteCalculationResult srcRoute, TargetPointsHelper helper, ClientContext ctx){ int currentRoute = srcRoute.currentRoute; List routeNodes = srcRoute.getImmutableLocations(); List directionInfo = srcRoute.getDirections(); @@ -728,7 +723,21 @@ public class RouteProvider { route.points.add(pt); } } - return gpx; + List ps = helper.getIntermediatePointsWithTarget(); + List psNames = helper.getIntermediatePointNamesWithTarget(); + for(int k = 0; k < ps.size(); k++) { + WptPt pt = new WptPt(); + pt.lat = ps.get(k).getLatitude(); + pt.lon = ps.get(k).getLongitude(); + if(k < psNames.size()) { + pt.name = psNames.get(k) +""; + pt.name = k == ps.size() - 1? ctx.getString(R.string.destination_point, pt.name ) : + ctx.getString(R.string.target_point, pt.name ); + pt.desc = pt.name; + + } + } + return gpx; } From c9ec000af7a0b49d84817563365fc48a4a2d8cf3 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 23 Aug 2013 21:41:41 +0200 Subject: [PATCH 38/38] If no streets found, select building --- .../search/SearchBuildingByNameActivity.java | 1 + .../search/SearchStreetByNameActivity.java | 8 ++++---- .../src/net/osmand/plus/routing/RoutingHelper.java | 12 ++++++++---- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 4 +++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java index af087e9ed8..3b4aa13351 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java @@ -44,6 +44,7 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity 0){ if(ref != null && ref.length() > 0) { name = ref + " " + name; - } + } getCurrentSegmentResult return name; } else { if(ref == null) { @@ -650,7 +650,7 @@ public class RoutingHelper { String dn = n.directionInfo.getDestinationName(); return formatStreetName(nm, rf, dn); } - RouteSegmentResult rs = route.getCurrentSegmentResult(); + RouteSegmentResult rs = getCurrentSegmentResult(); if(rs != null) { String nm = rs.getObject().getName(); String rf = rs.getObject().getRef(); @@ -659,8 +659,12 @@ public class RoutingHelper { } return null; } - - public synchronized NextDirectionInfo getNextRouteDirectionInfoAfter(NextDirectionInfo previous, NextDirectionInfo to, boolean toSpeak){ + + public RouteSegmentResult getCurrentSegmentResult() { + return route.getCurrentSegmentResult(); + } + + public synchronized NextDirectionInfo getNextRouteDirectionInfoAfter(NextDirectionInfo previous, NextDirectionInfo to, boolean toSpeak){ NextDirectionInfo i = route.getNextRouteDirectionInfoAfter(previous, to, toSpeak); if(i != null) { i.imminent = voiceRouter.calculateImminent(i.distanceTo, null); diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index cccf7db349..fd40a13f1b 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -9,6 +9,7 @@ import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo; import net.osmand.plus.voice.AbstractPrologCommandPlayer; import net.osmand.plus.voice.CommandBuilder; import net.osmand.plus.voice.CommandPlayer; +import net.osmand.router.RouteSegmentResult; import net.osmand.router.TurnType; import net.osmand.util.Algorithms; @@ -271,7 +272,8 @@ public class VoiceRouter { NextDirectionInfo nextInfo = router.getNextRouteDirectionInfo(new NextDirectionInfo(), true); - // after last turn say: + RouteSegmentResult currentSegment = router.getCurrentSegmentResult(); + // after last turn say: if (nextInfo == null || nextInfo.directionInfo == null || nextInfo.directionInfo.distance == 0) { // if(currentStatus <= STATUS_UNKNOWN && currentDirection > 0){ This caused this prompt to be suppressed when coming back from a if (repeat || currentStatus <= STATUS_UNKNOWN) {