Merge branch 'master' of ssh://github.com/osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2014-07-08 02:15:13 +02:00
commit ddb5bc09c9
16 changed files with 285 additions and 106 deletions

View file

@ -1871,4 +1871,11 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
<string name="osmo_auto_connect">Аўтаматычнае падлучэньне</string> <string name="osmo_auto_connect">Аўтаматычнае падлучэньне</string>
<string name="osmo_start_service">Служба OsMo</string> <string name="osmo_start_service">Служба OsMo</string>
<string name="osmo_gpx_track_downloaded">Загружаны %1$s сьлед OsMo.</string> <string name="osmo_gpx_track_downloaded">Загружаны %1$s сьлед OsMo.</string>
<string name="osmo_group_by_invite">Уваход па запрашэньнi</string>
<string name="osmo_group_information">Калі ласка, прачытайце перад стварэньнем групы!</string>
<string name="osmo_group_information_desc">" - Усе створаныя групы з\\\'яўляюцца алульнымі! Калі вы хочаце заставацца ананімным, падлучайце прыладу наўпрост праз Tracker-ідэнтыфікатар.
\n - Група мажа быць зарэгістраваная на 16 чалавек.
\n - У выпадку бяздзейнасці або актыўнасці толькі 1 чалавека на працягу 2 тыдняў, група будзе выдаленая.
\n - Вы можаце абмежаваць ўваход у групу, напррыклад па запрашэнні, але для кантрольню групай, вам неабходна скарыстацца кансольлю адміністратара.
\n - Калі вам трэба стварыць групу з іншымі ўмовамі, калі ласка, звяртайцеся на http://osmo.mobi"</string>
</resources> </resources>

View file

@ -1874,4 +1874,7 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
<string name="osmo_start_service">Servei OsMo</string> <string name="osmo_start_service">Servei OsMo</string>
<string name="osmo_gpx_track_downloaded">Traça OsMo %1$s descarregada.</string> <string name="osmo_gpx_track_downloaded">Traça OsMo %1$s descarregada.</string>
<string name="osmo_not_signed_in">Inici sessió OsMo erroni</string> <string name="osmo_not_signed_in">Inici sessió OsMo erroni</string>
<string name="osmo_group_by_invite">Entreu per convidar</string>
<string name="osmo_group_information_desc">" - Tots els grups creats són públics! Si es vol ser anònim, afegiu directament els aparells via identificació de Tracker.\n - Dins el grup es poden registrar fins un màxim de 16 persones.\n - Cas d\'inactivitat o d\'activitat d\'una sola persona durant 2 setmanes, el grup serà esborrat.\n - Es pot restringir l\'entrada al grup, a només per invitació, però per controlar el grup es necessitarà accedir a la consola d\'administració.\n - Si us cal crear un grup, però amb altres condicions, contacteu http://osmo.mobi"</string>
<string name="osmo_group_information">Si us plau, llegiu abans de crear un grup!</string>
</resources> </resources>

View file

@ -1599,7 +1599,7 @@ s často kladenými otázkami.</string>
<string name="map_widget_plain_time">Aktuální čas</string> <string name="map_widget_plain_time">Aktuální čas</string>
<string name="delay_navigation_start">Spustit navigaci se zpožděním</string> <string name="delay_navigation_start">Spustit navigaci se zpožděním</string>
<string name="selected">vybrané</string> <string name="selected">vybrané</string>
<string name="gpx_split_interval">Vyberte interval na rozdělení</string> <string name="gpx_split_interval">Rozdělit interval</string>
<string name="gpx_info_subtracks">Podtrasy: %1$s </string> <string name="gpx_info_subtracks">Podtrasy: %1$s </string>
<string name="gpx_info_waypoints">Bodů na trase: %1$s </string> <string name="gpx_info_waypoints">Bodů na trase: %1$s </string>
<string name="gpx_info_distance">Vzdálenost: %1$s (%2$s bodů) </string> <string name="gpx_info_distance">Vzdálenost: %1$s (%2$s bodů) </string>
@ -1628,4 +1628,9 @@ s často kladenými otázkami.</string>
<string name="create_poi_link_to_osm_doc"><u>Online OSM</u> mapová klasifikace s obrázky</string> <string name="create_poi_link_to_osm_doc"><u>Online OSM</u> mapová klasifikace s obrázky</string>
<string name="show_zoom_buttons_navigation_descr">Zobrazit tlačítka lupy během navigace</string> <string name="show_zoom_buttons_navigation_descr">Zobrazit tlačítka lupy během navigace</string>
<string name="show_zoom_buttons_navigation">Zobrazit tlačítka lupy</string> <string name="show_zoom_buttons_navigation">Zobrazit tlačítka lupy</string>
<string name="sort_by_distance">Třídit podle vzdálenosti</string>
<string name="sort_by_name">Třídit podle jména</string>
<string name="visible_element">Zobrazit na mapě</string>
<string name="local_index_select_gpx_file">Vybrat k zobrazení</string>
<string name="local_index_unselect_gpx_file">Odznačit</string>
</resources> </resources>

View file

@ -1907,4 +1907,7 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
<string name="osmo_start_service">OsMo tjeneste</string> <string name="osmo_start_service">OsMo tjeneste</string>
<string name="osmo_gpx_track_downloaded">OsMo spor %1$s hentet.</string> <string name="osmo_gpx_track_downloaded">OsMo spor %1$s hentet.</string>
<string name="osmo_not_signed_in">OsMo logind mislykkedes</string> <string name="osmo_not_signed_in">OsMo logind mislykkedes</string>
<string name="osmo_group_information">Læs dette før du opretter en gruppe!</string>
<string name="osmo_group_by_invite">Tilslut med invitation</string>
<string name="osmo_group_information_desc">" -Alle grupper der oprettes er offentlige! Hvis de skal være anonyme, tilsluttes enheder direkte via sporings-id\'er.\n -Op til 16 personer kan registreres i gruppen.\n -I tilfælde af inaktivitet eller aktivitet af kun 1 person i 2 uger, vil gruppen blive slettet.\n -Du kan begrænse adgangen til gruppen, til kun med invitation, men for at kontrollere gruppen skal man bruge administrationskonsollen.\n -Hvis du har brug at oprette en gruppe, men med andre betingelser, kontakt http://osmo.mobi"</string>
</resources> </resources>

View file

@ -1877,4 +1877,18 @@ OsmAnd منبع باز است و فعالانه در حال توسعه است.
<string name="none_selected_gpx">هیچ فایل GPX انتخاب نشده است. جهت انتخاب فشار دهید و نگه دارید در مسیر در دسترس.</string> <string name="none_selected_gpx">هیچ فایل GPX انتخاب نشده است. جهت انتخاب فشار دهید و نگه دارید در مسیر در دسترس.</string>
<string name="local_index_unselect_gpx_file">لغو</string> <string name="local_index_unselect_gpx_file">لغو</string>
<string name="local_index_select_gpx_file">برای نمایش انتخاب کنید</string> <string name="local_index_select_gpx_file">برای نمایش انتخاب کنید</string>
<string name="osmo_group_by_invite">ورود با دعوت</string>
<string name="osmo_group_information_desc">" - تمامی گروه های ایجاد شده عمومی می باشد! اگر می خواهید به صورت ناشناس وارد شوید، باید دستگاه را به طور مستقیم از طریق شناسه های آنلاین متصل نمایید. ↵
\n  - گروه را می توان با 16 نفر ثبت کرد ↵.
\n  - در صورت عدم فعالیت و یا تنها فعالیت 1 نفر به مدت 2 هفته، گروه حذف خواهد شد ↵.
\n  - شما می توانید عضویت در گروه را تنها توسط دعوت محدود نمایید ، اما برای این کار نیاز به تغییر تنظیمات کنترل دارد ↵.
\n  - اگر شما نیاز به ایجاد یک گروه دارید، با شرایط ما آشنا شوید http://osmo.mobi"</string>
<string name="osmo_group_information">لطفا قبل از ایجاد گروه مطالع نمایید!</string>
<string name="osmo_not_signed_in">OsMo ورود شکست خورد</string>
<string name="osmo_gpx_points_downloaded">OsMo نقاط %1$s دانلود شده.</string>
<string name="osmo_auto_connect_descr">اتصال به صورت خودکار پس از راه اندازی نرم افزار</string>
<string name="osmo_auto_connect">اتصال خودکار</string>
<string name="osmo_start_service">سرویس OsMo</string>
<string name="osmo_gpx_track_downloaded">OsMo مسیر %1$s دانلود نمایید.</string>
<string name="no_index_file_to_download">هیچ چیز برای دانلود وجود ندارد، لطفا اتصال به اینترنت را بررسی نمایید.</string>
</resources> </resources>

View file

@ -1896,4 +1896,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="osmo_start_service">Servizio OsMo</string> <string name="osmo_start_service">Servizio OsMo</string>
<string name="osmo_gpx_track_downloaded">Scaricate %1$s tracce OsMo.</string> <string name="osmo_gpx_track_downloaded">Scaricate %1$s tracce OsMo.</string>
<string name="osmo_not_signed_in">Login a OsMo fallito</string> <string name="osmo_not_signed_in">Login a OsMo fallito</string>
<string name="osmo_group_by_invite">Accedere su invito</string>
<string name="osmo_group_information_desc">" - Tutti i gruppi creati sono pubblici! Se volete rimanere anonimi connettete i dispositivi direttamente tramite gli id di tracciamento.\n - Al gruppo possono essere registrate fino a 16 persone.\n - Nel caso di inattività o di attività di una sola persona per due settimane, il gruppo sarà cancellato.\n - È possibile limitare l\'accesso al gruppo, tipo solo su invito, per amministrare il gruppo devi andare al pannello di amministrazione.\n - Se avete bisogno di creare un gruppo ma ad altre condizioni per favore visitate http://osmo.mobi"</string>
<string name="osmo_group_information">Per favore leggere prima di creare un gruppo!</string>
</resources> </resources>

View file

@ -1892,4 +1892,8 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="osmo_auto_connect">Automatiškai jungtis</string> <string name="osmo_auto_connect">Automatiškai jungtis</string>
<string name="osmo_start_service">OsMo paslauga</string> <string name="osmo_start_service">OsMo paslauga</string>
<string name="osmo_gpx_track_downloaded">OsMo įrašas %1$s parsiųstas.</string> <string name="osmo_gpx_track_downloaded">OsMo įrašas %1$s parsiųstas.</string>
<string name="osmo_group_by_invite">Prisijungti su pakvietimais</string>
<string name="osmo_group_information_desc">" - Visos sukurtos grupės yra viešos! Jei jungtis anonimiškai, tai darykite naudodami sekiklio ID.\n- Grupėje gali būti iki 16 asmenų.\n- Jei grupėje nebus jokios veiklos arba tik vienas asmuo dvi savaites, ji bus panaikinta.\n- Narystę grupėje galima apriboti pakvietimais, tačiau valdyti grupę bus galima tik iš administravimo konsolės.\n- Jei jums reikia sukuti grupę su kitokiais reikalavimais, susisiekite su http://osmo.mobi"</string>
<string name="osmo_group_information">Perskaitykite prieš kurdami grupę!</string>
<string name="osmo_not_signed_in">Prisijungimas prie OsMo nepavyko</string>
</resources> </resources>

View file

@ -1834,7 +1834,7 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant
<string name="gpx_selection_track">%1$s \nTrasa %2$s</string> <string name="gpx_selection_track">%1$s \nTrasa %2$s</string>
<string name="gpx_available_current_track">Zapisywanie bieżącej trasy</string> <string name="gpx_available_current_track">Zapisywanie bieżącej trasy</string>
<string name="selected_gpx_info_show">\n\nNaciśnij i przytrzymaj, aby zobaczyć na mapie</string> <string name="selected_gpx_info_show">\n\nNaciśnij i przytrzymaj, aby zobaczyć na mapie</string>
<string name="delay_navigation_start">Rozpocznij nawigację z opóźnieniem</string> <string name="delay_navigation_start">Rozpocznij nawigację automatycznie</string>
<string name="selected">wybrano</string> <string name="selected">wybrano</string>
<string name="gpx_split_interval">Interwał podziału</string> <string name="gpx_split_interval">Interwał podziału</string>
<string name="loading_smth">Ładowanie %1$s …</string> <string name="loading_smth">Ładowanie %1$s …</string>
@ -1851,4 +1851,14 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant
<string name="none_selected_gpx">Nie wybrano żadnych plików GPX. W celu wyboru naciśnij i przytrzymaj dostępną ścieżkę.</string> <string name="none_selected_gpx">Nie wybrano żadnych plików GPX. W celu wyboru naciśnij i przytrzymaj dostępną ścieżkę.</string>
<string name="local_index_unselect_gpx_file">Odznacz</string> <string name="local_index_unselect_gpx_file">Odznacz</string>
<string name="local_index_select_gpx_file">Wybierz aby wyświetlić</string> <string name="local_index_select_gpx_file">Wybierz aby wyświetlić</string>
<string name="osmo_group_by_invite">Wpisz przez zaproszenie</string>
<string name="osmo_group_information_desc">" - Wszystkie grupy są publiczne! Jeśli chcesz być anonimowy, podłącz urządzeń bezpośrednio poprzez identyfikator Tracker ids.↵\n - Grupa może posiadać do 16 zarejestrowanych osób.↵\n - W przypadku bezczynności lub aktywności tylko 1 osoby przez okres 2 tygodnie, grupa zostanie usunięta.↵\n - Można ograniczyć dostęp grupy, i zapraszać tylko wybrane osoby. Do kontroli potrzebujesz konsoli administracyjnej.↵\n - Jeśli trzeba utworzyć grupę, ale z innymi warunkami, prosimy o kontakt http://osmo.mobi"</string>
<string name="osmo_group_information">Proszę przeczytać przed założeniem grupy!</string>
<string name="osmo_not_signed_in">Nie powiodło się logowanie do OsMo</string>
<string name="osmo_gpx_points_downloaded">OsMo pobrano %1$s punktów.</string>
<string name="osmo_auto_connect_descr">Automatycznie połącz to serwisu po uruchomieniu aplikacji</string>
<string name="osmo_auto_connect">Auto-podłączenie</string>
<string name="osmo_start_service">Serwis OsMo</string>
<string name="osmo_gpx_track_downloaded">Pobrano %1$s ścieżek OsMo.</string>
<string name="no_index_file_to_download">Brak danych do pobrania, proszę sprawdź połączenie internetowe.</string>
</resources> </resources>

View file

@ -1606,4 +1606,8 @@
<string name="osmo_start_service">OsMo-tjänst</string> <string name="osmo_start_service">OsMo-tjänst</string>
<string name="osmo_gpx_track_downloaded">OsMo-spår %1$s nedladdat.</string> <string name="osmo_gpx_track_downloaded">OsMo-spår %1$s nedladdat.</string>
<string name="tip_map_switch_t_v2">"Kartkälla och kartlager som ska visas ändras via \'Meny\' → \'Kartlager\'.\n\nUnder \'Kartkälla...\' kan du välja mellan de förladdade offline vektorkartorna (standard, krävs också för offline-navigering), eller fördefinierade (online eller cachade offline) kartbitskällor (aktivera insticksmodulen \'Online-kartor\' under \'Inställningar\'→ \'Plugin\' för detta), eller kartor skapade manuellt med t.ex. OsmaAndMapCreator på en PC.\n\nOsmAnd stöder också egna källor. "</string> <string name="tip_map_switch_t_v2">"Kartkälla och kartlager som ska visas ändras via \'Meny\' → \'Kartlager\'.\n\nUnder \'Kartkälla...\' kan du välja mellan de förladdade offline vektorkartorna (standard, krävs också för offline-navigering), eller fördefinierade (online eller cachade offline) kartbitskällor (aktivera insticksmodulen \'Online-kartor\' under \'Inställningar\'→ \'Plugin\' för detta), eller kartor skapade manuellt med t.ex. OsmaAndMapCreator på en PC.\n\nOsmAnd stöder också egna källor. "</string>
</resources> <string name="osmo_not_signed_in">Inloggningen till OsMo misslyckades</string>
<string name="osmo_group_by_invite">Anslut via inbjudan</string>
<string name="osmo_group_information_desc">" - Alla skapade grupper är offentliga! Om du vill vara anonym, anslut enheter direkt via Tracker-id-\n- Upp till 16 personer kan vara registrerade i gruppen.\n- Grupper tas bort i fall av inaktivitet eller aktivitet av endast 1 person på 2 veckor.\n- Du kan begränsa inträde i grupp men för att kontrollera gruppen måste du gå till adminkonsollen.\n- Om du behöver skapa en grupp, men i övrigt kontakta http://osmo.mobi"</string>
<string name="osmo_group_information">Läs detta innan du skapar en grupp!</string>
</resources>

View file

@ -1885,4 +1885,8 @@ OsmAnd 是開放原始碼,而且正在積極的開發。應用程式從報告
<string name="osmo_auto_connect">自動連線</string> <string name="osmo_auto_connect">自動連線</string>
<string name="osmo_start_service">OsMo 服務</string> <string name="osmo_start_service">OsMo 服務</string>
<string name="osmo_gpx_track_downloaded">OsMo 軌跡 %1$s 已下載。</string> <string name="osmo_gpx_track_downloaded">OsMo 軌跡 %1$s 已下載。</string>
<string name="osmo_group_by_invite">輸入邀請</string>
<string name="osmo_group_information_desc">" - 所有建立的群組都是公開的!如果您希望匿名,透過追蹤 IDS 直接連接裝置。\n - 群組可以註冊多達16人。\n - 假使閒置或僅一人於二個星期裡活動,那群組將會被刪除。\n - 因為只能靠邀請,您可以限制群組的進入,但要控管群組您需要去管理主控台。\n - 如果您需要建立一個群組,但是具有其它條件,請連絡 http://osmo.mobi"</string>
<string name="osmo_group_information">請在建立群組之前,仔細閱讀!</string>
<string name="osmo_not_signed_in">OsMo 登入失敗</string>
</resources> </resources>

View file

@ -1746,23 +1746,6 @@ public class OsmandSettings {
return false; return false;
} }
public static String getVoiceName(Context ctx, String basename) {
try {
String nm = basename.replace('-', '_').replace(' ', '_');
if (nm.endsWith("_tts") || nm.endsWith("-tts")) {
nm = nm.substring(0, nm.length() - 4);
}
Field f = R.string.class.getField("lang_"+nm);
if (f != null) {
Integer in = (Integer) f.get(null);
return ctx.getString(in);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
return basename;
}
public enum DayNightMode { public enum DayNightMode {
AUTO(R.string.daynight_mode_auto), AUTO(R.string.daynight_mode_auto),
DAY(R.string.daynight_mode_day), DAY(R.string.daynight_mode_day),

View file

@ -18,6 +18,7 @@ import net.osmand.plus.*;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType; import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -72,7 +73,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US); MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
private ContextMenuAdapter optionsMenuAdapter; private ContextMenuAdapter optionsMenuAdapter;
private ActionMode actionMode; private ActionMode actionMode;
private OsmandRegions osmandRegions;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
@ -87,7 +88,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
descriptionLoader = new LoadLocalIndexDescriptionTask(); descriptionLoader = new LoadLocalIndexDescriptionTask();
listAdapter = new LocalIndexesAdapter(this); listAdapter = new LocalIndexesAdapter(this);
osmandRegions = ((OsmandApplication) getApplication()).getResourceManager().getOsmandRegions();
getExpandableListView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { getExpandableListView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@ -881,7 +882,8 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
} }
TextView viewName = ((TextView) v.findViewById(R.id.local_index_name)); TextView viewName = ((TextView) v.findViewById(R.id.local_index_name));
String mapDescr = getMapDescription(child.getFileName()); String mapDescr = getMapDescription(child.getFileName());
String mapName = getMapName(child.getFileName()); String mapName = FileNameTranslationHelper.getFileName(ctx, ((OsmandApplication) getApplication()).getResourceManager().getOsmandRegions(), child.getFileName());
if (mapDescr.length() > 0){ if (mapDescr.length() > 0){
viewName.setText(mapDescr + " - " + mapName); viewName.setText(mapDescr + " - " + mapName);
} else { } else {
@ -1017,37 +1019,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
return true; return true;
} }
private String getMapName(String fileName){
String mapname = getBasename(fileName);
String lc = mapname.toLowerCase();
String std = getStandardMapName(ctx,lc);
if (std != null){
return std;
}
return osmandRegions.getLocaleName(mapname);
}
private String getBasename(String fileName) {
if (fileName.endsWith(IndexConstants.EXTRA_ZIP_EXT)) {
return fileName.substring(0, fileName.length() - IndexConstants.EXTRA_ZIP_EXT.length());
}
if (fileName.endsWith(IndexConstants.SQLITE_EXT)) {
return fileName.substring(0, fileName.length() - IndexConstants.SQLITE_EXT.length()).replace('_', ' ');
}
int ls = fileName.lastIndexOf('-');
if (ls >= 0) {
return fileName.substring(0, ls);
} else {
ls = fileName.lastIndexOf(".");
if (ls >= 0){
return fileName.substring(0,ls);
}
}
return fileName;
}
private String getMapDescription(String fileName){ private String getMapDescription(String fileName){
int ls = fileName.lastIndexOf("."); int ls = fileName.lastIndexOf(".");
@ -1062,21 +1034,5 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
return ""; return "";
} }
private String getStandardMapName(Context ctx, String basename) {
if(basename.equals("world-ski")) {
return ctx.getString(R.string.index_item_world_ski);
} else if(basename.equals("world_altitude_correction_ww15mgh")) {
return ctx.getString(R.string.index_item_world_altitude_correction);
} else if(basename.equals("world_basemap")) {
return ctx.getString(R.string.index_item_world_basemap);
} else if(basename.equals("world_bitcoin_payments")) {
return ctx.getString(R.string.index_item_world_bitcoin_payments);
} else if(basename.equals("world_seamarks")) {
return ctx.getString(R.string.index_item_world_seamarks);
}
return null;
}
} }
} }

View file

@ -23,6 +23,7 @@ import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.plus.base.SuggestExternalDirectoryDialog; import net.osmand.plus.base.SuggestExternalDirectoryDialog;
import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.render.NativeOsmandLibrary; import net.osmand.plus.render.NativeOsmandLibrary;
import net.osmand.plus.voice.CommandPlayer; import net.osmand.plus.voice.CommandPlayer;
import net.osmand.render.RenderingRulesStorage; import net.osmand.render.RenderingRulesStorage;
@ -563,8 +564,8 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
entrieValues[k] = OsmandSettings.VOICE_PROVIDER_NOT_USE; entrieValues[k] = OsmandSettings.VOICE_PROVIDER_NOT_USE;
entries[k++] = getString(R.string.voice_not_use); entries[k++] = getString(R.string.voice_not_use);
for (String s : voiceFiles) { for (String s : voiceFiles) {
entries[k] = (s.contains("tts") ? getString(R.string.ttsvoice) +" ":"") + entries[k] = (s.contains("tts") ? getString(R.string.ttsvoice) +" ":"") +
OsmandSettings.getVoiceName(this, s); FileNameTranslationHelper.getVoiceName(this, s);
entrieValues[k] = s; entrieValues[k] = s;
k++; k++;
} }

View file

@ -18,6 +18,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -194,16 +195,16 @@ public class DownloadActivityType {
if (this == VOICE_FILE) { if (this == VOICE_FILE) {
if (fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP)) { if (fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP)) {
return ctx.getString(R.string.voice) + "\n" + return ctx.getString(R.string.voice) + "\n" +
OsmandSettings.getVoiceName(ctx, getBasename(indexItem)); FileNameTranslationHelper.getVoiceName(ctx, getBasename(indexItem));
} else if (fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) { } else if (fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) {
return ctx.getString(R.string.ttsvoice) + "\n" + return ctx.getString(R.string.ttsvoice) + "\n" +
OsmandSettings.getVoiceName(ctx, getBasename(indexItem)); FileNameTranslationHelper.getVoiceName(ctx, getBasename(indexItem));
} }
return getBasename(indexItem); return getBasename(indexItem);
} }
final String bn = getBasename(indexItem); final String bn = getBasename(indexItem);
final String lc = bn.toLowerCase(); final String lc = bn.toLowerCase();
String std = getStandardMapName(ctx, lc); String std = FileNameTranslationHelper.getStandardMapName(ctx, lc);
if (std != null) { if (std != null) {
return std; return std;
} }
@ -217,21 +218,6 @@ public class DownloadActivityType {
return osmandRegions.getLocaleName(bn); return osmandRegions.getLocaleName(bn);
} }
private String getStandardMapName(Context ctx, String basename) {
if(basename.equals("world-ski")) {
return ctx.getString(R.string.index_item_world_ski);
} else if(basename.equals("world_altitude_correction_ww15mgh")) {
return ctx.getString(R.string.index_item_world_altitude_correction);
} else if(basename.equals("world_basemap")) {
return ctx.getString(R.string.index_item_world_basemap);
} else if(basename.equals("world_bitcoin_payments")) {
return ctx.getString(R.string.index_item_world_bitcoin_payments);
} else if(basename.equals("world_seamarks")) {
return ctx.getString(R.string.index_item_world_seamarks);
}
return null;
}
public String getTargetFileName(IndexItem item) { public String getTargetFileName(IndexItem item) {
String fileName = item.fileName; String fileName = item.fileName;
// if(fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP) || // if(fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP) ||

View file

@ -0,0 +1,195 @@
package net.osmand.plus.helpers;
import android.content.Context;
import net.osmand.IndexConstants;
import net.osmand.map.OsmandRegions;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import java.lang.reflect.Field;
/**
* Created by Barsik on 07.07.2014.
*/
public class FileNameTranslationHelper {
public static String getFileName(Context ctx, OsmandRegions regions, String fileName) {
String basename = getBasename(fileName);
if (basename.endsWith("_wiki")) { //wiki files
String wikiName = getStandardLangName(ctx, basename.substring(0, basename.indexOf("_wiki")));
String wikiWord = ctx.getString(R.string.amenity_type_osmwiki);
int index = wikiWord.indexOf("(");
if (index >= 0) {
//removing word in "()" from recourse file
return wikiWord.substring(0, index) + wikiName;
}
return ctx.getString(R.string.amenity_type_osmwiki) + " " + wikiName;
} else if (fileName.endsWith("tts")) { //tts files
return getVoiceName(ctx, fileName);
} else if (fileName.length() == 2) { //voice recorded files
try {
Field f = R.string.class.getField("lang_"+fileName);
if (f != null) {
Integer in = (Integer) f.get(null);
return ctx.getString(in);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
//if nothing else
String lc = basename.toLowerCase();
String std = getStandardMapName(ctx, lc);
if (std != null) {
return std;
}
if (regions != null) {
return regions.getLocaleName(basename);
}
return null;
}
public static String getVoiceName(Context ctx, String basename) {
try {
String nm = basename.replace('-', '_').replace(' ', '_');
if (nm.endsWith("_tts") || nm.endsWith("-tts")) {
nm = nm.substring(0, nm.length() - 4);
}
Field f = R.string.class.getField("lang_"+nm);
if (f != null) {
Integer in = (Integer) f.get(null);
return ctx.getString(in);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
return basename;
}
private static String getBasename(String fileName) {
if (fileName.endsWith(IndexConstants.EXTRA_ZIP_EXT)) {
return fileName.substring(0, fileName.length() - IndexConstants.EXTRA_ZIP_EXT.length());
}
if (fileName.endsWith(IndexConstants.SQLITE_EXT)) {
return fileName.substring(0, fileName.length() - IndexConstants.SQLITE_EXT.length()).replace('_', ' ');
}
int ls = fileName.lastIndexOf('-');
if (ls >= 0) {
return fileName.substring(0, ls);
} else {
ls = fileName.lastIndexOf(".");
if (ls >= 0) {
return fileName.substring(0, ls);
}
}
return fileName;
}
private static String getStandardLangName(Context ctx, String filename) {
if (filename.equals("Croatian")) {
return ctx.getString(R.string.lang_hr);
} else if (filename.equals("Chinese")) {
return ctx.getString(R.string.lang_zh);
} else if (filename.equals("Portuguese")) {
return ctx.getString(R.string.lang_pt_br);
} else if (filename.equals("English")) {
return ctx.getString(R.string.lang_en);
} else if (filename.equals("Afrikaans") || filename.equals("Africaans")) {
return ctx.getString(R.string.lang_af);
} else if (filename.equals("Armenian")) {
return ctx.getString(R.string.lang_hy);
} else if (filename.equals("Basque")) {
return ctx.getString(R.string.lang_eu);
} else if (filename.equals("Belarusian")) {
return ctx.getString(R.string.lang_be);
} else if (filename.equals("Bosnian")) {
return ctx.getString(R.string.lang_bs);
} else if (filename.equals("Bulgarian")) {
return ctx.getString(R.string.lang_bg);
} else if (filename.equals("Catalan")) {
return ctx.getString(R.string.lang_ca);
} else if (filename.equals("Czech")) {
return ctx.getString(R.string.lang_cs);
} else if (filename.equals("Danish")) {
return ctx.getString(R.string.lang_da);
} else if (filename.equals("Dutch")) {
return ctx.getString(R.string.lang_nl);
} else if (filename.equals("Finnish")) {
return ctx.getString(R.string.lang_fi);
} else if (filename.equals("French")) {
return ctx.getString(R.string.lang_fr);
} else if (filename.equals("Georgian")) {
return ctx.getString(R.string.lang_ka);
} else if (filename.equals("German")) {
return ctx.getString(R.string.lang_de);
} else if (filename.equals("Greek")) {
return ctx.getString(R.string.lang_el);
} else if (filename.equals("Hebrew")) {
return ctx.getString(R.string.lang_iw);
} else if (filename.equals("Hindi")) {
return ctx.getString(R.string.lang_hi);
} else if (filename.equals("Hungarian")) {
return ctx.getString(R.string.lang_hu);
} else if (filename.equals("Indonesian")) {
return ctx.getString(R.string.lang_id);
} else if (filename.equals("Italian")) {
return ctx.getString(R.string.lang_it);
} else if (filename.equals("Japanese")) {
return ctx.getString(R.string.lang_ja);
} else if (filename.equals("Korean")) {
return ctx.getString(R.string.lang_ko);
} else if (filename.equals("Latvian")) {
return ctx.getString(R.string.lang_lv);
} else if (filename.equals("Lithuanian")) {
return ctx.getString(R.string.lang_lt);
} else if (filename.equals("Marathi")) {
return ctx.getString(R.string.lang_mr);
} else if (filename.equals("Norwegian")) {
return ctx.getString(R.string.lang_no);
} else if (filename.equals("Polish")) {
return ctx.getString(R.string.lang_pl);
} else if (filename.equals("Portuguese")) {
return ctx.getString(R.string.lang_pt);
} else if (filename.equals("Romanian")) {
return ctx.getString(R.string.lang_ro);
} else if (filename.equals("Russian")) {
return ctx.getString(R.string.lang_ru);
} else if (filename.equals("Slovak")) {
return ctx.getString(R.string.lang_sk);
} else if (filename.equals("Slovenian")) {
return ctx.getString(R.string.lang_sl);
} else if (filename.equals("Spanish")) {
return ctx.getString(R.string.lang_es);
} else if (filename.equals("Swedish")) {
return ctx.getString(R.string.lang_sv);
} else if (filename.equals("Turkish")) {
return ctx.getString(R.string.lang_tr);
} else if (filename.equals("Ukrainian")) {
return ctx.getString(R.string.lang_uk);
} else if (filename.equals("Vietnamese")) {
return ctx.getString(R.string.lang_vi);
} else if (filename.equals("Welsh")) {
return ctx.getString(R.string.lang_cy);
}
return null;
}
public static String getStandardMapName(Context ctx, String basename) {
if (basename.equals("world-ski")) {
return ctx.getString(R.string.index_item_world_ski);
} else if (basename.equals("world_altitude_correction_ww15mgh")) {
return ctx.getString(R.string.index_item_world_altitude_correction);
} else if (basename.equals("world_basemap")) {
return ctx.getString(R.string.index_item_world_basemap);
} else if (basename.equals("world_bitcoin_payments")) {
return ctx.getString(R.string.index_item_world_bitcoin_payments);
} else if (basename.equals("world_seamarks")) {
return ctx.getString(R.string.index_item_world_seamarks);
}
return null;
}
}

View file

@ -51,6 +51,9 @@ public class RoutePointsPlugin extends OsmandPlugin {
private RoutePointsLayer routePointsLayer; private RoutePointsLayer routePointsLayer;
private RoutePoint lastReachedPoint;
public RoutePointsPlugin(OsmandApplication app) { public RoutePointsPlugin(OsmandApplication app) {
ApplicationMode.regWidget("route_steps", ApplicationMode.CAR, ApplicationMode.DEFAULT); ApplicationMode.regWidget("route_steps", ApplicationMode.CAR, ApplicationMode.DEFAULT);
this.app = app; this.app = app;
@ -78,7 +81,10 @@ public class RoutePointsPlugin extends OsmandPlugin {
btnY.setOnClickListener(new View.OnClickListener() { btnY.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
currentRoute.navigateToNextPoint(true); if (lastReachedPoint != null){
lastReachedPoint.setDelivered(true);
lastReachedPoint = null;
}
FrameLayout layout = (FrameLayout) mapActivity.getLayout(); FrameLayout layout = (FrameLayout) mapActivity.getLayout();
layout.removeView(deliveredView); layout.removeView(deliveredView);
} }
@ -89,7 +95,10 @@ public class RoutePointsPlugin extends OsmandPlugin {
btnN.setOnClickListener(new View.OnClickListener() { btnN.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
currentRoute.navigateToNextPoint(false); if (lastReachedPoint != null){
lastReachedPoint.setDelivered(false);
lastReachedPoint = null;
}
FrameLayout layout = (FrameLayout) mapActivity.getLayout(); FrameLayout layout = (FrameLayout) mapActivity.getLayout();
layout.removeView(deliveredView); layout.removeView(deliveredView);
} }
@ -100,10 +109,16 @@ public class RoutePointsPlugin extends OsmandPlugin {
@Override @Override
public boolean destinationReached() { public boolean destinationReached() {
if (currentRoute != null) { if (currentRoute != null) {
if (currentRoute.currentPoints != null && !currentRoute.currentPoints.isEmpty()){
lastReachedPoint = currentRoute.currentPoints.get(0);
}
FrameLayout layout = (FrameLayout) mapActivity.getLayout(); FrameLayout layout = (FrameLayout) mapActivity.getLayout();
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
layout.addView(deliveredView, params); layout.addView(deliveredView, params);
//if it's possible to navigate to next point - navigation continues
return !currentRoute.navigateToNextPoint();
} }
return true; return true;
@ -463,20 +478,6 @@ public class RoutePointsPlugin extends OsmandPlugin {
return null; return null;
} }
public boolean navigateToNextPoint(boolean delivered) {
if (currentPoints.isEmpty()) {
return false;
}
RoutePoint rp = currentPoints.get(0);
if (rp.isNextNavigate) {
rp.setDelivered(delivered);
return navigateToNextPoint();
}
return false;
}
public void saveGPXAsync() { public void saveGPXAsync() {
new AsyncTask<RoutePointsPlugin.SelectedRouteGpxFile, Void, Void>() { new AsyncTask<RoutePointsPlugin.SelectedRouteGpxFile, Void, Void>() {