From 895ea226079a200b9fe936c83ed83788c7b51523 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 25 Apr 2011 14:20:50 +0200 Subject: [PATCH] Refactor osmand messages remove Messages from MapCreator related to OsmAnd --- DataExtractionOSM/src/messages.properties | 80 ----------------- DataExtractionOSM/src/messages_cs.properties | 76 ---------------- DataExtractionOSM/src/messages_de.properties | 62 ------------- DataExtractionOSM/src/messages_es.properties | 76 ---------------- DataExtractionOSM/src/messages_fr.properties | 78 ----------------- DataExtractionOSM/src/messages_hu.properties | 76 ---------------- DataExtractionOSM/src/messages_pt.properties | 78 ----------------- DataExtractionOSM/src/messages_ru.properties | 78 ----------------- DataExtractionOSM/src/messages_sk.properties | 76 ---------------- .../src/net/osmand/Messages.java | 16 ---- .../src/net/osmand/ToDoConstants.java | 3 +- .../src/net/osmand/data/Amenity.java | 14 +-- .../src/net/osmand/data/AmenityType.java | 54 +++++------- .../src/net/osmand/osm/MapUtils.java | 15 ---- OsmAnd/res/values-cs/strings.xml | 41 +++++++++ OsmAnd/res/values-de/strings.xml | 41 +++++++++ OsmAnd/res/values-es/strings.xml | 42 +++++++++ OsmAnd/res/values-fr/strings.xml | 40 +++++++++ OsmAnd/res/values-hu/strings.xml | 40 +++++++++ OsmAnd/res/values-pt/strings.xml | 40 +++++++++ OsmAnd/res/values-ru/strings.xml | 50 +++++++++++ OsmAnd/res/values-sk/strings.xml | 42 +++++++++ OsmAnd/res/values/strings.xml | 42 +++++++++ OsmAnd/src/net/osmand/OsmAndFormatter.java | 87 +++++++++++++++++++ .../net/osmand/plus/NameFinderPoiFilter.java | 7 +- OsmAnd/src/net/osmand/plus/PoiFilter.java | 12 ++- .../src/net/osmand/plus/PoiFiltersHelper.java | 12 +-- .../src/net/osmand/plus/ResourceManager.java | 35 ++++---- .../activities/DownloadIndexActivity.java | 1 - .../activities/EditPOIFilterActivity.java | 3 +- .../plus/activities/EditingPOIActivity.java | 10 ++- .../plus/activities/FavouritesActivity.java | 3 +- .../osmand/plus/activities/MapActivity.java | 3 +- .../osmand/plus/activities/RouteProvider.java | 5 +- .../osmand/plus/activities/RoutingHelper.java | 3 +- .../activities/ShowRouteInfoActivity.java | 5 +- .../search/SearchAddressOnlineActivity.java | 3 +- .../search/SearchCityByNameActivity.java | 3 +- .../search/SearchHistoryActivity.java | 3 +- .../activities/search/SearchPOIActivity.java | 17 ++-- .../search/SearchTransportActivity.java | 24 ++--- .../net/osmand/plus/views/MapInfoLayer.java | 10 +-- .../net/osmand/plus/views/POIMapLayer.java | 5 +- 43 files changed, 578 insertions(+), 833 deletions(-) delete mode 100644 DataExtractionOSM/src/messages.properties delete mode 100644 DataExtractionOSM/src/messages_cs.properties delete mode 100644 DataExtractionOSM/src/messages_de.properties delete mode 100644 DataExtractionOSM/src/messages_es.properties delete mode 100644 DataExtractionOSM/src/messages_fr.properties delete mode 100644 DataExtractionOSM/src/messages_hu.properties delete mode 100644 DataExtractionOSM/src/messages_pt.properties delete mode 100644 DataExtractionOSM/src/messages_ru.properties delete mode 100644 DataExtractionOSM/src/messages_sk.properties delete mode 100644 DataExtractionOSM/src/net/osmand/Messages.java create mode 100644 OsmAnd/src/net/osmand/OsmAndFormatter.java diff --git a/DataExtractionOSM/src/messages.properties b/DataExtractionOSM/src/messages.properties deleted file mode 100644 index 6ce904d50a..0000000000 --- a/DataExtractionOSM/src/messages.properties +++ /dev/null @@ -1,80 +0,0 @@ - -amenity_type_administrative = Administrative - -amenity_type_barrier = Barrier - -amenity_type_education = Education - -amenity_type_emergency = Emergency - -amenity_type_entertainment = Entertainment - -amenity_type_finance = Finance - -amenity_type_geocache = Geocache - -amenity_type_healthcare = Healthcare - -amenity_type_historic = Historic - -amenity_type_landuse = Landuse - -amenity_type_leisure = Leisure - -amenity_type_manmade = Man made - -amenity_type_military = Military - -amenity_type_natural = Natural - -amenity_type_office = Office - -amenity_type_other = Other - -amenity_type_shop = Shop - -amenity_type_sport = Sport - -amenity_type_sustenance = Sustenance - -amenity_type_tourism = Tourism - -amenity_type_transportation = Transportation - -indexing_address = Indexing address - -indexing_map = Indexing map - -indexing_poi = Indexing POI - -indexing_transport = Indexing transport - -input_output_error = Input output error occurred - -km = km - -km_h = km/h - -m = m - -old_map_index_is_not_supported = Deprecated format map data ''{0}'' is not supported - -poi_filter_car_aid = Car aid - -poi_filter_closest_poi = Closest poi - -poi_filter_custom_filter = Custom filter - -poi_filter_food_shop = Food shop - -poi_filter_for_tourists = For tourists - -poi_filter_fuel = Fuel - -poi_filter_namefinder = Online NameFinder - -reading_cached_tiles = Reading cached tiles... - -version_index_is_not_supported = The version of index ''{0}'' is not supported - -version_index_is_big_for_memory = The index ''{0}'' did not fit into memory diff --git a/DataExtractionOSM/src/messages_cs.properties b/DataExtractionOSM/src/messages_cs.properties deleted file mode 100644 index 618a7441bb..0000000000 --- a/DataExtractionOSM/src/messages_cs.properties +++ /dev/null @@ -1,76 +0,0 @@ - -amenity_type_administrative = Administrativa - -amenity_type_barrier = P\u0159ek\u00E1\u017Eky - -amenity_type_education = \u0160kolstv\u00ED - -amenity_type_emergency = Pomoc v nouzi - -amenity_type_entertainment = Z\u00E1bava - -amenity_type_finance = Finance - -amenity_type_healthcare = Zdravotnictv\u00ED - -amenity_type_historic = Historie - -amenity_type_landuse = Vyu\u017Eit\u00E9 \u00FAzem\u00ED - -amenity_type_leisure = Voln\u00FD \u010Das - -amenity_type_manmade = Lidsk\u00E1 d\u00EDla - -amenity_type_military = Arm\u00E1da - -amenity_type_natural = P\u0159\u00EDroda - -amenity_type_office = Kancel\u00E1\u0159e - -amenity_type_other = Jin\u00E9 - -amenity_type_shop = Obchod - -amenity_type_sport = Sport - -amenity_type_sustenance = Stravov\u00E1n\u00ED - -amenity_type_tourism = Turistika - -amenity_type_transportation = Doprava - -indexing_address = Indexuji adresy - -indexing_map = Indexuji mapu - -indexing_poi = Indexuji POI - -indexing_transport = Indexuji dopravu - -input_output_error = Do\u0161lo k chyb\u011B vstupu/v\u00FDstupu - -km = km - -km_h = km/h - -m = m - -old_map_index_is_not_supported = Zastaral\u00FD form\u00E1t mapov\u00FDch dat ''{0}'' nen\u00ED podporov\u00E1n - -poi_filter_car_aid = Autoservis - -poi_filter_closest_poi = Nejbli\u017E\u0161\u00ED POI - -poi_filter_custom_filter = Vlastn\u00ED filtr - -poi_filter_food_shop = Potraviny - -poi_filter_for_tourists = Pro turisty - -poi_filter_fuel = \u010Cerpac\u00ED stanice - -poi_filter_namefinder = Online NameFinder - -reading_cached_tiles = Na\u010D\u00EDt\u00E1m ulo\u017Een\u00E9 dla\u017Edice... - -version_index_is_not_supported = Verze indexu ''{0}'' nen\u00ED podporov\u00E1na diff --git a/DataExtractionOSM/src/messages_de.properties b/DataExtractionOSM/src/messages_de.properties deleted file mode 100644 index b7cccfeb20..0000000000 --- a/DataExtractionOSM/src/messages_de.properties +++ /dev/null @@ -1,62 +0,0 @@ - -amenity_type_education = Bildung - -amenity_type_entertainment = Unterhaltung - -amenity_type_finance = Finanzen - -amenity_type_healthcare = Gesundheit - -amenity_type_historic = Denkmal - -amenity_type_leisure = Leisure - -amenity_type_natural = Natur - -amenity_type_other = Sonstiges - -amenity_type_shop = Einkaufen - -amenity_type_sport = Sport - -amenity_type_sustenance = Ern\u00E4hrung - -amenity_type_tourism = Tourismus - -amenity_type_transportation = Nahverkehr - -indexing_address = Indexing address - -indexing_map = Indexing map - -indexing_poi = Indexing POI - -indexing_transport = Indexing transport - -input_output_error = Input output error occurred - -km = km - -km_h = km/h - -m = m - -old_map_index_is_not_supported = Deprecated format map data ''{0}'' is not supported - -poi_filter_car_aid = Auto - -poi_filter_closest_poi = Closest poi - -poi_filter_custom_filter = Benutzerdefinierter Filter - -poi_filter_food_shop = Lebensmittel - -poi_filter_for_tourists = Touristen - -poi_filter_fuel = Benzin - -poi_filter_namefinder = Onlinesuche - -reading_cached_tiles = Reading cached tiles... - -version_index_is_not_supported = The version of index ''{0}'' is not supported diff --git a/DataExtractionOSM/src/messages_es.properties b/DataExtractionOSM/src/messages_es.properties deleted file mode 100644 index 6ff9c77691..0000000000 --- a/DataExtractionOSM/src/messages_es.properties +++ /dev/null @@ -1,76 +0,0 @@ - -amenity_type_administrative = Administrativo - -amenity_type_barrier = Barrera - -amenity_type_education = Educaci\u00F3n - -amenity_type_emergency = Emergencia - -amenity_type_entertainment = Entretenimiento - -amenity_type_finance = Financiero - -amenity_type_healthcare = Salud - -amenity_type_historic = Hist\u00F3rico - -amenity_type_landuse = Uso de Suelo - -amenity_type_leisure = Placer - -amenity_type_manmade = Artificial - -amenity_type_military = Militar - -amenity_type_natural = Natural - -amenity_type_office = Oficinas - -amenity_type_other = Otro - -amenity_type_shop = Tienda - -amenity_type_sport = Deporte - -amenity_type_sustenance = Sostenimiento - -amenity_type_tourism = Turismo - -amenity_typoe_transportation = Transporte - -indexing_address = \u00CDndice de direcciones - -indexing_map = \u00CDndice de mapa - -indexing_poi = \u00CDndice de POI - -indexing_transport = \u00CDndice de transporte - -input_output_error = Ocurri\u00F3 un error de entrada salida - -km = km - -km_h = km/h - -m = m - -old_map_index_is_not_supported = No se soporta la versi\u00F3n ''{0}'' de \u00EDndices - -poi_filter_car_aid = Asistencia de auto - -poi_filter_closest_poi = \ Poi m\u00E1s cercano - -poi_filter_custom_filter = Filtro propio - -poi_filter_food_shop = Tienda de comida - -poi_filter_for_tourists = Para turistas - -poi_filter_fuel = Gasolinera - -poi_filter_namefinder = Namefinder en l\u00EDnea - -reading_cached_tiles = Leyendo im\u00E1genes en cach\u00E9... - -version_index_is_not_supported = No se soporta la versi\u00F3n ''{0}'' de \u00EDndices diff --git a/DataExtractionOSM/src/messages_fr.properties b/DataExtractionOSM/src/messages_fr.properties deleted file mode 100644 index acb0a6015a..0000000000 --- a/DataExtractionOSM/src/messages_fr.properties +++ /dev/null @@ -1,78 +0,0 @@ - -amenity_type_administrative = Administrative - -amenity_type_barrier = Barri\u00e8re - -amenity_type_education = \u00c9ducation - -amenity_type_emergency = Urgence - -amenity_type_entertainment = Divertissement - -amenity_type_finance = Finance - -amenity_type_geocache = Cache g\u00e9ographique - -amenity_type_healthcare = Sant\u00e9 - -amenity_type_historic = Historique - -amenity_type_landuse = Agriculture - -amenity_type_leisure = Plaisance - -amenity_type_manmade = Artisanat - -amenity_type_military = Militaire - -amenity_type_natural = Nature - -amenity_type_office = Bureau - -amenity_type_other = Autre - -amenity_type_shop = Magasin - -amenity_type_sport = Sport - -amenity_type_sustenance = Restauration - -amenity_type_tourism = Tourisme - -amenity_type_transportation = Transport - -indexing_address = Indexation de l'adresse - -indexing_map = Indexation de la carte - -indexing_poi = Indexation du PI - -indexing_transport = Indexation du transport - -input_output_error = Erreur d'entr\u00e9e/sortie - -km = km - -km_h = km/h - -m = m - -old_map_index_is_not_supported = Le format d\u00e9conseill\u00e9 de la carte ''{0}'' n'est pas support\u00e9 - -poi_filter_car_aid = Aide voiture - -poi_filter_closest_poi = PI le plus pr\u00e8s - -poi_filter_custom_filter = Filtre Personnalis\u00e9 - -poi_filter_food_shop = \u00c9picerie - -poi_filter_for_tourists = Pour touristes - -poi_filter_fuel = Essence - -poi_filter_namefinder = Recherche PI en-ligne - -reading_cached_tiles = Lecture carreaux en cache... - -version_index_is_not_supported = La version ''{0}'' de l'index n'est pas support\u00e9 diff --git a/DataExtractionOSM/src/messages_hu.properties b/DataExtractionOSM/src/messages_hu.properties deleted file mode 100644 index 405d83cc57..0000000000 --- a/DataExtractionOSM/src/messages_hu.properties +++ /dev/null @@ -1,76 +0,0 @@ - -amenity_type_administrative = Adminisztr\u00E1ci\u00F3 - -amenity_type_barrier = Hat\u00E1r - -amenity_type_education = Oktat\u00E1s - -amenity_type_emergency = V\u00E9szhelyzet - -amenity_type_entertainment = Sz\u00F3rakoztat\u00E1s - -amenity_type_finance = P\u00E9nz\u00FCgy - -amenity_type_healthcare = Eg\u00E9szs\u00E9g\u00FCgy - -amenity_type_historic = T\u00F6rt\u00E9nelem - -amenity_type_landuse = Ter\u00FClet - -amenity_type_leisure = Szabadid\u0151 - -amenity_type_manmade = Ember alkotta - -amenity_type_military = Katonai - -amenity_type_natural = Term\u00E9szet - -amenity_type_office = Iroda - -amenity_type_other = Egy\u00E9b - -amenity_type_shop = \u00DCzlet - -amenity_type_sport = Sport - -amenity_type_sustenance = Ell\u00E1t\u00E1s - -amenity_type_tourism = Turizmus - -amenity_type_transportation = K\u00F6zleked\u00E9si eszk\u00F6z - -indexing_address = C\u00EDmek indexel\u00E9se - -indexing_map = T\u00E9rk\u00E9p indexel\u00E9se - -indexing_poi = POI indexel\u00E9se - -indexing_transport = K\u00F6zleked\u00E9si eszk\u00F6z indexel\u00E9se - -input_output_error = Be-kimeneti hiba t\u00F6rt\u00E9nt - -km = km - -km_h = km/\u00F3 - -m = m - -old_map_index_is_not_supported = Az elavult t\u00E9rk\u00E9p form\u00E1tum ''{0}'' nem t\u00E1mogatott - -poi_filter_car_aid = Aut\u00F3 seg\u00EDts\u00E9g - -poi_filter_closest_poi = K\u00F6zeli POI - -poi_filter_custom_filter = Egy\u00E9ni sz\u0171r\u0151 - -poi_filter_food_shop = \u00C9lelmiszer \u00FCzlet - -poi_filter_for_tourists = Turist\u00E1knak - -poi_filter_fuel = \u00DCzemanyag - -poi_filter_namefinder = Online n\u00E9vkeres\u0151 - -reading_cached_tiles = Elmentett t\u00E9rk\u00E9pszeletek olvas\u00E1sa... - -version_index_is_not_supported = ''{0}'' index verzi\u00F3ja nem t\u00E1mogatott diff --git a/DataExtractionOSM/src/messages_pt.properties b/DataExtractionOSM/src/messages_pt.properties deleted file mode 100644 index 14b7c12abc..0000000000 --- a/DataExtractionOSM/src/messages_pt.properties +++ /dev/null @@ -1,78 +0,0 @@ - -amenity_type_administrative = Administrativo - -amenity_type_barrier = Barri\u00e8re - -amenity_type_education = Educa\u00e7\u00e3o - -amenity_type_emergency = Emerg\u00eAncia - -amenity_type_entertainment = Entretenimento - -amenity_type_finance = Finan\u00e7as - -amenity_type_geocache = Cache geogr\u00e1fico - -amenity_type_healthcare = Sa\u00fade - -amenity_type_historic = Historico - -amenity_type_landuse = Agricultura - -amenity_type_leisure = Plaisance - -amenity_type_manmade = Artisanato - -amenity_type_military = Militar - -amenity_type_natural = Natureza - -amenity_type_office = (office) escrit\u00f3rio - -amenity_type_other = Outro - -amenity_type_shop = Loja - -amenity_type_sport = Desporto - -amenity_type_sustenance = Restauração - -amenity_type_tourism = Turismo - -amenity_type_transportation = Transporte - -indexing_address = Indexa\u00e7\u00e3o do endere\u00e7o - -indexing_map = Indexa\u00e7\u00e3o do mapa - -indexing_poi = Indexa\u00e7\u00e3o do PI - -indexing_transport = Indexa\u00e7\u00e3o do transporte - -input_output_error = Erro de entrada/saida - -km = km - -km_h = km/h - -m = m - -old_map_index_is_not_supported = O formato do mapa ''{0}'' n\u00e3o \u00e9 suportado - -poi_filter_car_aid = Ajuda carro - -poi_filter_closest_poi = PI mais perto - -poi_filter_custom_filter = Filtro Personalisado - -poi_filter_food_shop = Supermercado - -poi_filter_for_tourists = Para touristas - -poi_filter_fuel = Gasolina - -poi_filter_namefinder = Pesquisa PI on-line - -reading_cached_tiles = Leitura do cache telha... - -version_index_is_not_supported = A ver\u00e7\u00e3o ''{0}'' do índice não é suportado diff --git a/DataExtractionOSM/src/messages_ru.properties b/DataExtractionOSM/src/messages_ru.properties deleted file mode 100644 index 04206f41c3..0000000000 --- a/DataExtractionOSM/src/messages_ru.properties +++ /dev/null @@ -1,78 +0,0 @@ - -amenity_type_administrative = \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043D\u043E\u0435 - -amenity_type_barrier = \u041F\u0440\u0435\u043F\u044F\u0442\u0441\u0442\u0432\u0438\u0435 - -amenity_type_education = \u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435 - -amenity_type_emergency = \u042D\u043A\u0441\u0442\u0440\u0435\u043D\u043D\u044B\u0435 \u0441\u043B\u0443\u0436\u0431\u044B - -amenity_type_entertainment = \u0420\u0430\u0437\u0432\u043B\u0435\u0447\u0435\u043D\u0438\u044F - -amenity_type_finance = \u0424\u0438\u043D\u0430\u043D\u0441\u044B - -amenity_type_geocache = \u0413\u0435\u043E\u0442\u0430\u0439\u043D\u0438\u043A - -amenity_type_healthcare = \u0417\u0434\u043E\u0440\u043E\u0432\u044C\u0435 - -amenity_type_historic = \u0418\u0441\u0442\u043E\u0440\u0438\u0447\u0435\u0441\u043A\u043E\u0435 - -amenity_type_landuse = \u0417\u0435\u043C\u043B\u0435\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435 - -amenity_type_leisure = \u0414\u043E\u0441\u0443\u0433 - -amenity_type_manmade = \u0421\u043E\u043E\u0440\u0443\u0436\u0435\u043D\u0438\u044F - -amenity_type_military = \u0412\u043E\u0435\u043D\u043D\u043E\u0435 - -amenity_type_natural = \u041F\u0440\u0438\u0440\u043E\u0434\u0430 - -amenity_type_office = \u041E\u0444\u0438\u0441 - -amenity_type_other = \u0414\u0440\u0443\u0433\u043E\u0435 - -amenity_type_shop = \u041C\u0430\u0433\u0430\u0437\u0438\u043D\u044B - -amenity_type_sport = \u0421\u043F\u043E\u0440\u0442 - -amenity_type_sustenance = \u0415\u0434\u0430 - -amenity_type_tourism = \u0422\u0443\u0440\u0438\u0437\u043C - -amenity_type_transportation = \u0422\u0440\u0430\u043D\u0441\u043F\u043E\u0440\u0442 - -indexing_address = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u0430\u0434\u0440\u0435\u0441 - -indexing_map = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u044E\u0442\u0441\u044F \u043A\u0430\u0440\u0442\u044B - -indexing_poi = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u044E\u0442\u0441\u044F POI - -indexing_transport = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u0442\u0440\u0430\u043D\u0441\u043F\u043E\u0440\u0442 - -input_output_error = \u041F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430 \u0432\u0432\u043E\u0434\u0430/\u0432\u044B\u0432\u043E\u0434\u0430 - -km = \u043A\u043C - -km_h = \u043A\u043C/\u0447 - -m = \u043C - -old_map_index_is_not_supported = \u041A\u0430\u0440\u0442\u0430 \u0441\u0442\u0430\u0440\u043E\u0433\u043E \u0444\u043E\u0440\u043C\u0430\u0442\u0430 ''{0}'' \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F - -poi_filter_car_aid = \u0410\u0432\u0442\u043E\u043F\u043E\u043C\u043E\u0449\u044C - -poi_filter_closest_poi = \u0411\u043B\u0438\u0436\u0430\u0439\u0448\u0438\u0435 poi - -poi_filter_custom_filter = \u041D\u043E\u0432\u044B\u0439 \u0444\u0438\u043B\u044C\u0442\u0440 - -poi_filter_food_shop = \u041F\u0440\u043E\u0434\u0443\u043A\u0442\u043E\u0432\u044B\u0435 \u043C\u0430\u0433\u0430\u0437\u0438\u043D\u044B - -poi_filter_for_tourists = \u0414\u043B\u044F \u0442\u0443\u0440\u0438\u0441\u0442\u043E\u0432 - -poi_filter_fuel = \u0417\u0430\u043F\u0440\u0430\u0432\u043A\u0438 - -poi_filter_namefinder = Online NameFinder - -reading_cached_tiles = \u0427\u0442\u0435\u043D\u0438\u0435 \u043A\u044D\u0448\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0442\u0430\u0439\u043B\u043E\u0432... - -version_index_is_not_supported = \u0412\u0435\u0440\u0441\u0438\u044F \u0438\u043D\u0434\u0435\u043A\u0441\u0430 ''{0}'' \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F diff --git a/DataExtractionOSM/src/messages_sk.properties b/DataExtractionOSM/src/messages_sk.properties deleted file mode 100644 index 1dd044d60d..0000000000 --- a/DataExtractionOSM/src/messages_sk.properties +++ /dev/null @@ -1,76 +0,0 @@ - -amenity_type_administrative = Administrat\u00EDva - -amenity_type_barrier = Prek\u00E1\u017Eky - -amenity_type_education = V\u00FDuka - -amenity_type_emergency = Pomoc v n\u00FAdzi - -amenity_type_entertainment = Z\u00E1bava - -amenity_type_finance = Peniaze - -amenity_type_healthcare = Zdravie - -amenity_type_historic = Hist\u00F3ria - -amenity_type_landuse = Vyu\u017Eitie \u00FAzemia - -amenity_type_leisure = Vo\u013En\u00FD \u010Das - -amenity_type_manmade = \u010Clovekom vytvoren\u00E9 - -amenity_type_military = Arm\u00E1da - -amenity_type_natural = Pr\u00EDroda - -amenity_type_office = Kancel\u00E1ria - -amenity_type_other = In\u00E9 - -amenity_type_shop = Nakupovanie - -amenity_type_sport = \u0160port - -amenity_type_sustenance = Jedlo - -amenity_type_tourism = Turistika - -amenity_type_transportation = Doprava - -indexing_address = Indexovanie adries - -indexing_map = Indexovanie m\u00E1p - -indexing_poi = Indexovanie POI - -indexing_transport = Indexovanie dopravy - -input_output_error = Vyskytla sa vstupno/v\u00FDstupn\u00E1 chyba - -km = km - -km_h = km/h - -m = m - -old_map_index_is_not_supported = Verzia indexu ''{0}'' nie je podporovan\u00E1 - -poi_filter_car_aid = Pomoc s automobilom - -poi_filter_closest_poi = Najbli\u017Es\u00ED bod z\u00E1ujmu - -poi_filter_custom_filter = Vlastn\u00FD filter - -poi_filter_food_shop = Obchody s jedlom - -poi_filter_for_tourists = Pre turistov - -poi_filter_fuel = Palivo - -poi_filter_namefinder = Online h\u013Eada\u010D mien - -reading_cached_tiles = \u010C\u00EDtaj\u00FA sa dla\u017Edice zo z\u00E1sobn\u00EDka... - -version_index_is_not_supported = Verzia indexu ''{0}'' nie je podporovan\u00E1 diff --git a/DataExtractionOSM/src/net/osmand/Messages.java b/DataExtractionOSM/src/net/osmand/Messages.java deleted file mode 100644 index a8c541cfa0..0000000000 --- a/DataExtractionOSM/src/net/osmand/Messages.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.osmand; - -import java.util.ResourceBundle; - -public class Messages { - - private static ResourceBundle bundle = ResourceBundle.getBundle("messages"); //$NON-NLS-1$ - public static final String KEY_M = "m"; //$NON-NLS-1$ - public static final String KEY_KM = "km"; //$NON-NLS-1$ - public static final String KEY_KM_H = "km_h"; //$NON-NLS-1$ - - public static String getMessage(String key){ - return bundle.getString(key); - } - -} diff --git a/DataExtractionOSM/src/net/osmand/ToDoConstants.java b/DataExtractionOSM/src/net/osmand/ToDoConstants.java index c3d8ad77df..4d6f25e0cd 100644 --- a/DataExtractionOSM/src/net/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/net/osmand/ToDoConstants.java @@ -8,10 +8,11 @@ package net.osmand; public class ToDoConstants { -// == Osmand application (TODO 124) == +// == Osmand application (TODO 126) == // === Refactoring issues === // || 116 || Move all messages.properties related Android application inside strings.xml to have better access with their translation || +// || 125 || Introduce service layer rather than singletons and put all related into new package (services). Review architecture. Split some big classes. || // === Common issues === diff --git a/DataExtractionOSM/src/net/osmand/data/Amenity.java b/DataExtractionOSM/src/net/osmand/data/Amenity.java index 9656d5290e..66e926ec18 100644 --- a/DataExtractionOSM/src/net/osmand/data/Amenity.java +++ b/DataExtractionOSM/src/net/osmand/data/Amenity.java @@ -130,21 +130,9 @@ public class Amenity extends MapObject { } - public String getSimpleFormat(boolean en){ - return AmenityType.toPublicString(type) + " : " + getStringWithoutType(en); //$NON-NLS-1$ - } - - public String getStringWithoutType(boolean en){ - String n = getName(en); - if(n.length() == 0){ - return getSubType(); - } - return getSubType() + " " + n; //$NON-NLS-1$ - } - @Override public String toString() { - return getSimpleFormat(false); + return type.toString() + " : " + subType + " "+ getName(); } public String getSite() { diff --git a/DataExtractionOSM/src/net/osmand/data/AmenityType.java b/DataExtractionOSM/src/net/osmand/data/AmenityType.java index 3e603d6c98..97128350c8 100644 --- a/DataExtractionOSM/src/net/osmand/data/AmenityType.java +++ b/DataExtractionOSM/src/net/osmand/data/AmenityType.java @@ -4,7 +4,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Map; -import net.osmand.Messages; import net.osmand.osm.MapRenderingTypes; @@ -12,34 +11,32 @@ import net.osmand.osm.MapRenderingTypes; // POI tags : amenity, leisure, shop, sport, tourism, historic; accessories (internet-access), natural ? public enum AmenityType { // Some of those types are subtypes of Amenity tag - SUSTENANCE("amenity_type_sustenance", "amenity"), // restaurant, cafe ... //$NON-NLS-1$ //$NON-NLS-2$ - EDUCATION("amenity_type_education", "amenity"), // school, ... //$NON-NLS-1$ //$NON-NLS-2$ - TRANSPORTATION("amenity_type_transportation", "amenity"), // car_wash, parking, ... //$NON-NLS-1$ //$NON-NLS-2$ - FINANCE("amenity_type_finance", "amenity"), // bank, atm, ... //$NON-NLS-1$ //$NON-NLS-2$ - HEALTHCARE("amenity_type_healthcare", "amenity"), // hospital ... //$NON-NLS-1$ //$NON-NLS-2$ - ENTERTAINMENT("amenity_type_entertainment", "amenity"), // cinema, ... (+! sauna, brothel) //$NON-NLS-1$ //$NON-NLS-2$ - TOURISM("amenity_type_tourism", "tourism"), // [TAG] tourism hotel, sights, museum .. //$NON-NLS-1$ //$NON-NLS-2$ - HISTORIC("amenity_type_historic", "historic"), // [TAG] historic places, monuments (should we unify tourism/historic) //$NON-NLS-1$ //$NON-NLS-2$ - NATURAL("amenity_type_natural", "natural"), // [TAG] natural places, monuments (should we unify tourism/historic) //$NON-NLS-1$ //$NON-NLS-2$ - SHOP("amenity_type_shop", "shop"), // [TAG] amenity convenience (product), clothes... //$NON-NLS-1$ //$NON-NLS-2$ - LEISURE("amenity_type_leisure", "leisure"), // [TAG] leisure //$NON-NLS-1$ //$NON-NLS-2$ - SPORT("amenity_type_sport", "sport"), // [TAG] sport //$NON-NLS-1$ //$NON-NLS-2$ - BARRIER("amenity_type_barrier", "barrier"), // [TAG] barrier + traffic_calming //$NON-NLS-1$ //$NON-NLS-2$ - LANDUSE("amenity_type_landuse", "landuse"), // [TAG] landuse //$NON-NLS-1$ //$NON-NLS-2$ - MAN_MADE("amenity_type_manmade", "man_made"), // [TAG] man_made and others //$NON-NLS-1$ //$NON-NLS-2$ - OFFICE("amenity_type_office", "office"), // [TAG] office //$NON-NLS-1$ //$NON-NLS-2$ - EMERGENCY("amenity_type_emergency", "emergency"), // [TAG] emergency //$NON-NLS-1$ //$NON-NLS-2$ - MILITARY("amenity_type_military", "military"), // [TAG] military //$NON-NLS-1$ //$NON-NLS-2$ - ADMINISTRATIVE("amenity_type_administrative", "administrative"), // [TAG] administrative //$NON-NLS-1$ //$NON-NLS-2$ - GEOCACHE("amenity_type_geocache", "geocache"), //$NON-NLS-1$//$NON-NLS-2$ - OTHER("amenity_type_other", "amenity"), // grave-yard, police, post-office [+Internet_access] //$NON-NLS-1$ //$NON-NLS-2$ + SUSTENANCE("amenity"), // restaurant, cafe ... //$NON-NLS-1$ //$NON-NLS-2$ + EDUCATION("amenity"), // school, ... //$NON-NLS-1$ //$NON-NLS-2$ + TRANSPORTATION("amenity"), // car_wash, parking, ... //$NON-NLS-1$ //$NON-NLS-2$ + FINANCE("amenity"), // bank, atm, ... //$NON-NLS-1$ //$NON-NLS-2$ + HEALTHCARE("amenity"), // hospital ... //$NON-NLS-1$ //$NON-NLS-2$ + ENTERTAINMENT("amenity"), // cinema, ... (+! sauna, brothel) //$NON-NLS-1$ //$NON-NLS-2$ + TOURISM("tourism"), // [TAG] tourism hotel, sights, museum .. //$NON-NLS-1$ //$NON-NLS-2$ + HISTORIC("historic"), // [TAG] historic places, monuments (should we unify tourism/historic) //$NON-NLS-1$ //$NON-NLS-2$ + NATURAL("natural"), // [TAG] natural places, monuments (should we unify tourism/historic) //$NON-NLS-1$ //$NON-NLS-2$ + SHOP("shop"), // [TAG] amenity convenience (product), clothes... //$NON-NLS-1$ //$NON-NLS-2$ + LEISURE("leisure"), // [TAG] leisure //$NON-NLS-1$ //$NON-NLS-2$ + SPORT("sport"), // [TAG] sport //$NON-NLS-1$ //$NON-NLS-2$ + BARRIER("barrier"), // [TAG] barrier + traffic_calming //$NON-NLS-1$ //$NON-NLS-2$ + LANDUSE("landuse"), // [TAG] landuse //$NON-NLS-1$ //$NON-NLS-2$ + MAN_MADE("man_made"), // [TAG] man_made and others //$NON-NLS-1$ //$NON-NLS-2$ + OFFICE("office"), // [TAG] office //$NON-NLS-1$ //$NON-NLS-2$ + EMERGENCY("emergency"), // [TAG] emergency //$NON-NLS-1$ //$NON-NLS-2$ + MILITARY("military"), // [TAG] military //$NON-NLS-1$ //$NON-NLS-2$ + ADMINISTRATIVE("administrative"), // [TAG] administrative //$NON-NLS-1$ //$NON-NLS-2$ + GEOCACHE("geocache"), //$NON-NLS-1$//$NON-NLS-2$ + OTHER("amenity"), // grave-yard, police, post-office [+Internet_access] //$NON-NLS-1$ //$NON-NLS-2$ ; - private final String name; private final String defaultTag; - private AmenityType(String name, String defaultTag) { - this.name = name; + private AmenityType(String defaultTag) { this.defaultTag = defaultTag; } @@ -72,11 +69,4 @@ public enum AmenityType { } - public static String toPublicString(AmenityType t){ -// return Algoritms.capitalizeFirstLetterAndLowercase(t.toString().replace('_', ' ')); - return Messages.getMessage(t.name); - } - - - } \ No newline at end of file diff --git a/DataExtractionOSM/src/net/osmand/osm/MapUtils.java b/DataExtractionOSM/src/net/osmand/osm/MapUtils.java index 1a5fc4ee54..987a1f0e4a 100644 --- a/DataExtractionOSM/src/net/osmand/osm/MapUtils.java +++ b/DataExtractionOSM/src/net/osmand/osm/MapUtils.java @@ -1,13 +1,11 @@ package net.osmand.osm; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; -import net.osmand.Messages; import net.osmand.data.MapObject; @@ -297,17 +295,4 @@ public class MapUtils { } - public static String getFormattedDistance(int meters){ - if(meters >= 100000){ - return meters / 1000 + " " + Messages.getMessage(Messages.KEY_KM); //$NON-NLS-1$ - } else if(meters >= 10000){ - return MessageFormat.format("{0,number,#.#} "+Messages.getMessage(Messages.KEY_KM), ((float) meters) / 1000); //$NON-NLS-1$ - } else if(meters > 1500){ - return MessageFormat.format("{0,number,#.#} "+Messages.getMessage(Messages.KEY_KM), ((float) meters) / 1000); //$NON-NLS-1$ - } else if(meters > 900){ - return MessageFormat.format("{0,number,#.##} "+Messages.getMessage(Messages.KEY_KM), ((float) meters) / 1000); //$NON-NLS-1$ - } else { - return meters + " "+Messages.getMessage(Messages.KEY_M); //$NON-NLS-1$ - } - } } diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index 333fa8bee3..4f3c9c30af 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -1,5 +1,46 @@ + + Administrativa + Překážky + Školství + Pomoc v nouzi + Zábava + Finance + Geocache + Zdravotnictví + Historie + Využité území + Volný čas + Lidská díla + Armáda + Příroda + Kanceláře + Jiné + Obchod + Sport + Stravování + Turistika + Doprava + Indexuji adresy + Indexuji mapu + Indexuji POI + Indexuji dopravu + Došlo k chybě vstupu/výstupu + km + km/h + m + Zastaralý formát mapových dat \'\'{0}\'\' není podporován + Autoservis + Nejbližší POI + Vlastní filtr + Potraviny + Pro turisty + Čerpací stanice + Online NameFinder + Načítám uložené dlaždice... + The index \'\'{0}\'\' did not fit into memory + Verze indexu \'\'{0}\'\' není podporována Stahování seznamu balíčků selhalo. Načítám balíčky... Vyberte balíček OsmAnd k nainstalování diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 31e85aa28e..cb65ba402a 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -1,5 +1,46 @@ + + Administrative + Barrier + Bildung + Emergency + Unterhaltung + Finanzen + Geocache + Gesundheit + Denkmal + Landuse + Leisure + Man made + Military + Natur + Office + Sonstiges + Einkaufen + Sport + Ernährung + Tourismus + Nahverkehr + Indexing address + Indexing map + Indexing POI + Indexing transport + Input output error occurred + km + km/h + m + Deprecated format map data \'\'{0}\'\' is not supported + Auto + Closest poi + Benutzerdefinierter Filter + Lebensmittel + Touristen + Benzin + Onlinesuche + Reading cached tiles... + The index \'\'{0}\'\' did not fit into memory + The version of index \'\'{0}\'\' is not supported OSM Fehler Ändern POI Löschen POI diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml index decf08e579..7cab0433e5 100644 --- a/OsmAnd/res/values-es/strings.xml +++ b/OsmAnd/res/values-es/strings.xml @@ -1,5 +1,47 @@ + + Administrativo + Barrera + Educación + Emergencia + Entretenimiento + Financiero + Geocache + Salud + Histórico + Uso de Suelo + Placer + Artificial + Militar + Natural + Oficinas + Otro + Tienda + Deporte + Sostenimiento + Turismo + Transportation + Índice de direcciones + Índice de mapa + Índice de POI + Índice de transporte + Ocurrió un error de entrada salida + km + km/h + m + No se soporta la versión \'\'{0}\'\' de índices + Asistencia de auto + Poi más cercano + Filtro propio + Tienda de comida + Para turistas + Gasolinera + Namefinder en línea + Leyendo imágenes en caché... + The index \'\'{0}\'\' did not fit into memory + No se soporta la versión \'\'{0}\'\' de índices + #FF0000 #FFFFFF #FF9030 diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index a673d55657..24aefec15e 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -1,5 +1,45 @@ + Administrative + Barrière + Éducation + Urgence + Divertissement + Finance + Cache géographique + Santé + Historique + Agriculture + Plaisance + Artisanat + Militaire + Nature + Bureau + Autre + Magasin + Sport + Restauration + Tourisme + Transport + Indexation de l\'adresse + Indexation de la carte + Indexation du PI + Indexation du transport + Erreur d\'entrée/sortie + km + km/h + m + Le format déconseillé de la carte \'\'{0}\'\' n\'est pas supporté + Aide voiture + PI le plus près + Filtre Personnalisé + Épicerie + Pour touristes + Essence + Recherche PI en-ligne + Lecture carreaux en cache... + The index \'\'{0}\'\' did not fit into memory + La version \'\'{0}\'\' de l\'index n\'est pas supporté Navigation hors-ligne OsmAnd Utiliser la navigation hors-ligne pour les longues distances (expérimental) La navigation hors-ligne OsmAnd est une fonction expérimentale ne fonctionnant pas pour une distance de plus de 20 km.\n Le service utilise alors automatiquement le service en-ligne Cloudmade. diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 140dd5502d..29bbae0f1c 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -1,5 +1,45 @@ + Adminisztráció + Határ + Oktatás + Vészhelyzet + Szórakoztatás + Pénzügy + Geocache + Egészségügy + Történelem + Terület + Szabadidő + Ember alkotta + Katonai + Természet + Iroda + Egyéb + Üzlet + Sport + Ellátás + Turizmus + Közlekedési eszköz + Címek indexelése + Térkép indexelése + POI indexelése + Közlekedési eszköz indexelése + Be-kimeneti hiba történt + km + km/ó + m + Az elavult térkép formátum \'\'{0}\'\' nem támogatott + Autó segítség + Közeli POI + Egyéni szűrő + Élelmiszer üzlet + Turistáknak + Üzemanyag + Online névkereső + Elmentett térképszeletek olvasása... + The index \'\'{0}\'\' did not fit into memory + \'\'{0}\'\' index verziója nem támogatott Ön már telepített egy korbábbi OsmAnd verziót. Minden Internettől független adat használható az új alkalmazással. A Kedvenc pontokat a régi alkalmazásból érdemes kimenteni és az újba betölteni OsmAnd verzió {0} sikeresen telepítve ({1}). OsmAnd verzió letöltése... diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml index 902b2f7b44..64d09dc30d 100644 --- a/OsmAnd/res/values-pt/strings.xml +++ b/OsmAnd/res/values-pt/strings.xml @@ -1,5 +1,45 @@ + Administrativo + Barrière + Educação + Emergência + Entretenimento + Finanças + Cache geográfico + Saúde + Historico + Agricultura + Plaisance + Artisanato + Militar + Natureza + (office) escritório + Outro + Loja + Desporto + Restauração + Turismo + Transporte + Indexação do endereço + Indexação do mapa + Indexação do PI + Indexação do transporte + Erro de entrada/saida + km + km/h + m + O formato do mapa \'\'{0}\'\' não é suportado + Ajuda carro + PI mais perto + Filtro Personalisado + Supermercado + Para touristas + Gasolina + Pesquisa PI on-line + Leitura do cache telha... + The index \'\'{0}\'\' did not fit into memory + A verção \'\'{0}\'\' do índice não é suportado Nenhuma voz instalada. Por favor, vá até configurações e escolher os dados de voz para download. Nenhum dado voz especificado Utilize este guia para verificar o desempenho de renderização diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index a8fcc76adc..ff053d1edd 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -1,5 +1,55 @@ + + Административное + Препятствие + Образование + Экстренные службы + Развлечения + Финансы + Геотайник + Здоровье + Историческое + Землепользование + Досуг + Сооружения + Военное + Природа + Офис + Другое + Магазины + Спорт + Еда + Туризм + Транспорт + Индексируется адрес + Индексируются карты + Индексируются POI + Индексируется транспорт + Произошла ошибка ввода/вывода + км + км/ч + м + Карта старого формата \'\'{0}\'\' не поддерживается + Автопомощь + Ближайшие poi + Новый фильтр + Продуктовые магазины + Для туристов + Заправки + NameFinder (интернет) + Чтение кэшированных тайлов... + Индекс \'\'{0}\'\' не помещается в памяти + Версия индекса \'\'{0}\'\' не поддерживается + + + OsmAnd offline навигация + Использовать offline навигацию на длинные расстояние (экспериментально) + OsmAnd offline навигация является экспериментальной и не работает на расстояния более 20 километров.\n В этом случае автоматически переключается на Cloudmade. + Невозможно найти указанную директорию. + Директория приложения + Изменение директории не переносит файлы автоматически. Вы должны это сделать самостоятельно. Продолжить? + У вас имеется предыдущая версия OsmAnd. Все офлайн данные поддерживаются новым приложением. Избранные точки можно экспортировать в старом и импортировать в новом. Сборка {0} успешно установлена ({1}). Загружается сборка... diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index c8abd7ae1c..8510c63d08 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -1,5 +1,47 @@ + + Administratíva + Prekážky + Výuka + Pomoc v núdzi + Zábava + Peniaze + Geocache + Zdravie + História + Využitie územia + Voľný čas + Človekom vytvorené + Armáda + Príroda + Kancelária + Iné + Nakupovanie + Šport + Jedlo + Turistika + Doprava + Indexovanie adries + Indexovanie máp + Indexovanie POI + Indexovanie dopravy + Vyskytla sa vstupno/výstupná chyba + km + km/h + m + Verzia indexu \'\'{0}\'\' nie je podporovaná + Pomoc s automobilom + Najbližsí bod záujmu + Vlastný filter + Obchody s jedlom + Pre turistov + Palivo + Online hľadač mien + Čítajú sa dlaždice zo zásobníka... + The index \'\'{0}\'\' did not fit into memory + Verzia indexu \'\'{0}\'\' nie je podporovaná + OsmAnd offline rutovanie Použitie offline rutovania na dlhé vzdialenosti (experimentálne) OsmAnd offline rutovanie je experimentálna funkcia a nefunguje na vzdialenosť väčšiu ako 20 km.\n Rutovacia služba je automaticky prpenutá na online Cloudmade. diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 939c0b9cab..39ed53dd11 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,47 @@ + + Administrative + Barrier + Education + Emergency + Entertainment + Finance + Geocache + Healthcare + Historic + Landuse + Leisure + Man made + Military + Natural + Office + Other + Shop + Sport + Sustenance + Tourism + Transportation + Indexing address + Indexing map + Indexing POI + Indexing transport + Input output error occurred + km + km/h + m + Deprecated format map data \'\'{0}\'\' is not supported + Car aid + Closest poi + Custom filter + Food shop + For tourists + Fuel + Online NameFinder + Reading cached tiles... + The index \'\'{0}\'\' did not fit into memory + The version of index \'\'{0}\'\' is not supported + OsmAnd offline routing Use offline routing for long distances (experimental) OsmAnd offline routing is experimental feature and it doesn\'t work for distance more than 20 km.\n Routing service is automatically switched to online Cloudmade. diff --git a/OsmAnd/src/net/osmand/OsmAndFormatter.java b/OsmAnd/src/net/osmand/OsmAndFormatter.java new file mode 100644 index 0000000000..13981938ab --- /dev/null +++ b/OsmAnd/src/net/osmand/OsmAndFormatter.java @@ -0,0 +1,87 @@ +package net.osmand; + +import java.text.MessageFormat; + +import net.osmand.data.Amenity; +import net.osmand.data.AmenityType; +import net.osmand.plus.R; + +import android.content.Context; + +public class OsmAndFormatter { + + public static String getFormattedDistance(int meters, Context ctx) { + if (meters >= 100000) { + return meters / 1000 + " " + ctx.getString(R.string.km); //$NON-NLS-1$ + } else if (meters >= 10000) { + return MessageFormat.format("{0,number,#.#} " + ctx.getString(R.string.km), ((float) meters) / 1000); //$NON-NLS-1$ + } else if (meters > 1500) { + return MessageFormat.format("{0,number,#.#} " + ctx.getString(R.string.km), ((float) meters) / 1000); //$NON-NLS-1$ + } else if (meters > 900) { + return MessageFormat.format("{0,number,#.##} " + ctx.getString(R.string.km), ((float) meters) / 1000); //$NON-NLS-1$ + } else { + return meters + " " + ctx.getString(R.string.m); //$NON-NLS-1$ + } + } + + public static String toPublicString(AmenityType t, Context ctx) { + switch (t) { + case SUSTENANCE: + return ctx.getString(R.string.amenity_type_sustenance); + case EDUCATION: + return ctx.getString(R.string.amenity_type_education); + case TRANSPORTATION: + return ctx.getString(R.string.amenity_type_transportation); + case FINANCE: + return ctx.getString(R.string.amenity_type_finance); + case HEALTHCARE: + return ctx.getString(R.string.amenity_type_healthcare); + case ENTERTAINMENT: + return ctx.getString(R.string.amenity_type_entertainment); + case TOURISM: + return ctx.getString(R.string.amenity_type_tourism); + case HISTORIC: + return ctx.getString(R.string.amenity_type_historic); + case NATURAL: + return ctx.getString(R.string.amenity_type_natural); + case SHOP: + return ctx.getString(R.string.amenity_type_shop); + case LEISURE: + return ctx.getString(R.string.amenity_type_leisure); + case SPORT: + return ctx.getString(R.string.amenity_type_sport); + case BARRIER: + return ctx.getString(R.string.amenity_type_barrier); + case LANDUSE: + return ctx.getString(R.string.amenity_type_landuse); + case MAN_MADE: + return ctx.getString(R.string.amenity_type_manmade); + case OFFICE: + return ctx.getString(R.string.amenity_type_office); + case EMERGENCY: + return ctx.getString(R.string.amenity_type_emergency); + case MILITARY: + return ctx.getString(R.string.amenity_type_military); + case ADMINISTRATIVE: + return ctx.getString(R.string.amenity_type_administrative); + case GEOCACHE: + return ctx.getString(R.string.amenity_type_geocache); + case OTHER: + return ctx.getString(R.string.amenity_type_other); + } + return ""; + } + + + public static String getPoiSimpleFormat(Amenity amenity, Context ctx, boolean en){ + return toPublicString(amenity.getType(), ctx) + " : " + getPoiStringWithoutType(amenity, en); //$NON-NLS-1$ + } + + public static String getPoiStringWithoutType(Amenity amenity, boolean en){ + String n = amenity.getName(en); + if(n.length() == 0){ + return amenity.getSubType(); + } + return amenity.getSubType() + " " + n; //$NON-NLS-1$ + } +} diff --git a/OsmAnd/src/net/osmand/plus/NameFinderPoiFilter.java b/OsmAnd/src/net/osmand/plus/NameFinderPoiFilter.java index 3e39acde6f..1a8553c004 100644 --- a/OsmAnd/src/net/osmand/plus/NameFinderPoiFilter.java +++ b/OsmAnd/src/net/osmand/plus/NameFinderPoiFilter.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.List; import net.osmand.LogUtil; -import net.osmand.Messages; import net.osmand.data.Amenity; import net.osmand.data.AmenityType; import net.osmand.osm.MapUtils; @@ -33,7 +32,7 @@ public class NameFinderPoiFilter extends PoiFilter { public NameFinderPoiFilter(OsmandApplication application) { super(null, application); - this.name = Messages.getMessage("poi_filter_namefinder"); //$NON-NLS-1$ + this.name = application.getString(R.string.poi_filter_namefinder); //$NON-NLS-1$ this.filterId = FILTER_ID; } @@ -114,10 +113,10 @@ public class NameFinderPoiFilter extends PoiFilter { stream.close(); } catch (IOException e) { log.error("Error loading name finder poi", e); //$NON-NLS-1$ - return Messages.getMessage("input_output_error"); //$NON-NLS-1$ + return getApplication().getString(R.string.input_output_error); //$NON-NLS-1$ } catch (XmlPullParserException e) { log.error("Error parsing name finder poi", e); //$NON-NLS-1$ - return Messages.getMessage("input_output_error"); //$NON-NLS-1$ + return getApplication().getString(R.string.input_output_error); //$NON-NLS-1$ } MapUtils.sortListOfMapObject(searchedAmenities, latitude, longitude); return null; diff --git a/OsmAnd/src/net/osmand/plus/PoiFilter.java b/OsmAnd/src/net/osmand/plus/PoiFilter.java index bbcdb6f388..0b9607d84b 100644 --- a/OsmAnd/src/net/osmand/plus/PoiFilter.java +++ b/OsmAnd/src/net/osmand/plus/PoiFilter.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import net.osmand.Messages; +import net.osmand.OsmAndFormatter; import net.osmand.data.Amenity; import net.osmand.data.AmenityType; import net.osmand.data.index.IndexConstants; @@ -39,7 +39,7 @@ public class PoiFilter { this.application = application; isStandardFilter = true; filterId = STD_PREFIX + type; - name = type == null ? Messages.getMessage("poi_filter_closest_poi") : AmenityType.toPublicString(type); //$NON-NLS-1$ + name = type == null ? application.getString(R.string.poi_filter_closest_poi) : OsmAndFormatter.toPublicString(type, application); //$NON-NLS-1$ if(type == null){ initSearchAll(); } else { @@ -85,9 +85,9 @@ public class PoiFilter { public String getSearchArea(){ if(zoom <= 14){ int d = (int) (1 * (1 << (14 - zoom))); - return " < " + d + " " + Messages.getMessage(Messages.KEY_KM); //$NON-NLS-1$//$NON-NLS-2$ + return " < " + d + " " + application.getString(R.string.km); //$NON-NLS-1$//$NON-NLS-2$ } else { - return " < 500 " + Messages.getMessage(Messages.KEY_M); //$NON-NLS-1$ + return " < 500 " + application.getString(R.string.m); //$NON-NLS-1$ } } @@ -238,4 +238,8 @@ public class PoiFilter { return isStandardFilter; } + public OsmandApplication getApplication() { + return application; + } + } diff --git a/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java b/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java index 46de3873e3..94ee642921 100644 --- a/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java +++ b/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java @@ -1,5 +1,6 @@ package net.osmand.plus; + import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; @@ -7,7 +8,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import net.osmand.Messages; import net.osmand.data.AmenityType; import net.osmand.plus.activities.OsmandApplication; import android.content.Context; @@ -72,7 +72,7 @@ public class PoiFiltersHelper { list.add("car"); //$NON-NLS-1$ list.add("car_repair"); //$NON-NLS-1$ types.put(AmenityType.SHOP, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_car_aid"), null, types, application)); //$NON-NLS-1$ + filters.add(new PoiFilter(application.getString(R.string.poi_filter_car_aid), null, types, application)); //$NON-NLS-1$ types.clear(); @@ -92,13 +92,13 @@ public class PoiFiltersHelper { list.add("waste_basket"); //$NON-NLS-1$ list.add("waste_disposal"); //$NON-NLS-1$ types.put(AmenityType.OTHER, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_for_tourists"), null, types, application)); //$NON-NLS-1$ + filters.add(new PoiFilter(application.getString(R.string.poi_filter_for_tourists), null, types, application)); //$NON-NLS-1$ types.clear(); list = new LinkedHashSet(); list.add("fuel"); //$NON-NLS-1$ types.put(AmenityType.TRANSPORTATION, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_fuel"), null, types, application)); //$NON-NLS-1$ + filters.add(new PoiFilter(application.getString(R.string.poi_filter_fuel), null, types, application)); //$NON-NLS-1$ types.clear(); list = new LinkedHashSet(); @@ -116,7 +116,7 @@ public class PoiFiltersHelper { list.add("supermarket"); //$NON-NLS-1$ list.add("variety_store"); //$NON-NLS-1$ types.put(AmenityType.SHOP, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_food_shop"), null, types, application)); //$NON-NLS-1$ + filters.add(new PoiFilter(application.getString(R.string.poi_filter_food_shop), null, types, application)); //$NON-NLS-1$ types.clear(); return filters; @@ -127,7 +127,7 @@ public class PoiFiltersHelper { ////ctx.deleteDatabase(PoiFilterDbHelper.DATABASE_NAME); cacheUserDefinedFilters = new ArrayList(); - PoiFilter filter = new PoiFilter(Messages.getMessage("poi_filter_custom_filter"), PoiFilter.CUSTOM_FILTER_ID, new LinkedHashMap>(), application); //$NON-NLS-1$ + PoiFilter filter = new PoiFilter(application.getString(R.string.poi_filter_custom_filter), PoiFilter.CUSTOM_FILTER_ID, new LinkedHashMap>(), application); //$NON-NLS-1$ cacheUserDefinedFilters.add(filter); PoiFilterDbHelper helper = openDbHelper(); cacheUserDefinedFilters.addAll(helper.getFilters()); diff --git a/OsmAnd/src/net/osmand/plus/ResourceManager.java b/OsmAnd/src/net/osmand/plus/ResourceManager.java index 31dc07a0d0..58a909bc4f 100644 --- a/OsmAnd/src/net/osmand/plus/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/ResourceManager.java @@ -16,7 +16,6 @@ import java.util.TreeMap; import net.osmand.IProgress; import net.osmand.LogUtil; -import net.osmand.Messages; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.data.Amenity; import net.osmand.data.TransportStop; @@ -35,8 +34,6 @@ import net.osmand.plus.views.POIMapLayer; import org.apache.commons.logging.Log; -import android.content.SharedPreferences; -import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.database.sqlite.SQLiteException; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -116,7 +113,7 @@ public class ResourceManager { ////////////////////////////////////////////// Working with tiles //////////////////////////////////////////////// public void indexingImageTiles(IProgress progress){ - progress.startTask(Messages.getMessage("reading_cached_tiles"), -1); //$NON-NLS-1$ + progress.startTask(context.getString(R.string.reading_cached_tiles), -1); //$NON-NLS-1$ imagesOnFS.clear(); for(File c : dirWithTiles.listFiles()){ indexImageTilesFS("", c); //$NON-NLS-1$ @@ -387,11 +384,11 @@ public class ResourceManager { if (file.exists() && file.canRead()) { for (File f : file.listFiles()) { if (f.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) { - progress.startTask(Messages.getMessage("indexing_map") + f.getName(), -1); //$NON-NLS-1$ + progress.startTask(context.getString(R.string.indexing_map) + " " + f.getName(), -1); //$NON-NLS-1$ try { BinaryMapIndexReader index = renderer.initializeNewResource(progress, f); if (index == null) { - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } else { indexFileNames.put(f.getName(), MessageFormat.format("{0,date,dd.MM.yyyy}", new Date(f.lastModified()))); //$NON-NLS-1$ for(String rName : index.getRegionNames()) { @@ -405,7 +402,7 @@ public class ResourceManager { transportRepositories.add(new TransportIndexRepositoryBinary(new BinaryMapIndexReader(raf))); } catch (IOException e) { log.error("Exception reading " + f.getAbsolutePath(), e); //$NON-NLS-1$ - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } if(index.containsMapData()){ @@ -422,13 +419,13 @@ public class ResourceManager { } } catch (SQLiteException e) { log.error("Exception reading " + f.getAbsolutePath(), e); //$NON-NLS-1$ - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } catch (OutOfMemoryError oome) { log.error("Exception reading " + f.getAbsolutePath(), oome); //$NON-NLS-1$ - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_big_for_memory"), f.getName())); + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_big_for_memory), f.getName())); } } else if(f.getName().endsWith(".map.odb")){ //$NON-NLS-1$ - warnings.add(MessageFormat.format(Messages.getMessage("old_map_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.old_map_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } } @@ -453,18 +450,18 @@ public class ResourceManager { if (f.getName().endsWith(IndexConstants.POI_INDEX_EXT)) { AmenityIndexRepositoryOdb repository = new AmenityIndexRepositoryOdb(); - progress.startTask(Messages.getMessage("indexing_poi") + f.getName(), -1); //$NON-NLS-1$ + progress.startTask(context.getString(R.string.indexing_poi) + " " + f.getName(), -1); //$NON-NLS-1$ try { boolean initialized = repository.initialize(progress, f); if (initialized) { amenityRepositories.add(repository); indexFileNames.put(f.getName(), MessageFormat.format("{0,date,dd.MM.yyyy}", new Date(f.lastModified()))); //$NON-NLS-1$ } else { - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } catch (SQLiteException e) { log.error("Exception reading " + f.getAbsolutePath(), e); //$NON-NLS-1$ - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } } @@ -491,18 +488,18 @@ public class ResourceManager { public void indexingAddress(final IProgress progress, List warnings, File f) { if (f.getName().endsWith(IndexConstants.ADDRESS_INDEX_EXT)) { RegionAddressRepositoryOdb repository = new RegionAddressRepositoryOdb(); - progress.startTask(Messages.getMessage("indexing_address") + f.getName(), -1); //$NON-NLS-1$ + progress.startTask(context.getString(R.string.indexing_address) + " " + f.getName(), -1); //$NON-NLS-1$ try { boolean initialized = repository.initialize(progress, f); if (initialized) { addressMap.put(repository.getName(), repository); indexFileNames.put(f.getName(), MessageFormat.format("{0,date,dd.MM.yyyy}", new Date(f.lastModified()))); //$NON-NLS-1$ } else { - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } catch (SQLiteException e) { log.error("Exception reading " + f.getAbsolutePath(), e); //$NON-NLS-1$ - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } } @@ -523,18 +520,18 @@ public class ResourceManager { public void indexingTransport(final IProgress progress, List warnings, File f) { if (f.getName().endsWith(IndexConstants.TRANSPORT_INDEX_EXT)) { TransportIndexRepositoryOdb repository = new TransportIndexRepositoryOdb(); - progress.startTask(Messages.getMessage("indexing_transport") + f.getName(), -1); //$NON-NLS-1$ + progress.startTask(context.getString(R.string.indexing_transport) + " " + f.getName(), -1); //$NON-NLS-1$ try { boolean initialized = repository.initialize(progress, f); if (initialized) { transportRepositories.add(repository); indexFileNames.put(f.getName(), MessageFormat.format("{0,date,dd.MM.yyyy}", new Date(f.lastModified()))); //$NON-NLS-1$ } else { - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } catch (SQLiteException e) { log.error("Exception reading " + f.getAbsolutePath(), e); //$NON-NLS-1$ - warnings.add(MessageFormat.format(Messages.getMessage("version_index_is_not_supported"), f.getName())); //$NON-NLS-1$ + warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } } } diff --git a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java index 4493b1a043..0c9d635b57 100644 --- a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java @@ -39,7 +39,6 @@ import java.util.zip.ZipInputStream; import net.osmand.IProgress; import net.osmand.LogUtil; -import net.osmand.data.index.DownloaderIndexFromGoogleCode; import net.osmand.data.index.IndexConstants; import net.osmand.plus.DownloadOsmandIndexesHelper; import net.osmand.plus.OsmandSettings; diff --git a/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java b/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java index dac39c29ca..108f4e2065 100644 --- a/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java @@ -7,6 +7,7 @@ import java.text.MessageFormat; import java.util.LinkedHashSet; import java.util.Set; +import net.osmand.OsmAndFormatter; import net.osmand.data.AmenityType; import net.osmand.osm.LatLon; import net.osmand.osm.MapRenderingTypes; @@ -255,7 +256,7 @@ public class EditPOIFilterActivity extends ListActivity { check.setChecked(filter.isTypeAccepted(model)); TextView text = (TextView) row.findViewById(R.id.filter_poi_label); - text.setText(AmenityType.toPublicString(model)); + text.setText(OsmAndFormatter.toPublicString(model, EditPOIFilterActivity.this)); addRowListener(model, text, check); return (row); } diff --git a/OsmAnd/src/net/osmand/plus/activities/EditingPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/EditingPOIActivity.java index 53ba850049..66452c2f2a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/EditingPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/EditingPOIActivity.java @@ -21,6 +21,7 @@ import java.util.Set; import net.osmand.Base64; import net.osmand.LogUtil; +import net.osmand.OsmAndFormatter; import net.osmand.Version; import net.osmand.data.Amenity; import net.osmand.data.AmenityType; @@ -134,7 +135,8 @@ public class EditingPOIActivity { } Builder builder = new AlertDialog.Builder(ctx); - builder.setTitle(MessageFormat.format(this.view.getResources().getString(R.string.poi_remove_confirm_template), a.getStringWithoutType(OsmandSettings.usingEnglishNames(OsmandSettings.getPrefs(ctx))))); + builder.setTitle(MessageFormat.format(this.view.getResources().getString(R.string.poi_remove_confirm_template), + OsmAndFormatter.getPoiStringWithoutType(a, OsmandSettings.usingEnglishNames(OsmandSettings.getPrefs(ctx))))); final EditText comment = new EditText(ctx); comment.setText(R.string.poi_remove_title); builder.setView(comment); @@ -189,7 +191,7 @@ public class EditingPOIActivity { AmenityType t = MapRenderingTypes.getDefault().getAmenityNameToType().get(str); if(t != null && a.getType() != t){ a.setType(t); - typeButton.setText(AmenityType.toPublicString(t)); + typeButton.setText(OsmAndFormatter.toPublicString(t, ctx)); updateSubTypesAdapter(t); } @@ -212,7 +214,7 @@ public class EditingPOIActivity { Builder builder = new AlertDialog.Builder(ctx); String[] vals = new String[AmenityType.values().length]; for(int i=0; i 80){ diff --git a/OsmAnd/src/net/osmand/plus/activities/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/activities/RoutingHelper.java index dc4fa05494..6dd5ad89f4 100644 --- a/OsmAnd/src/net/osmand/plus/activities/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/RoutingHelper.java @@ -5,6 +5,7 @@ import java.util.Collections; import java.util.List; import net.osmand.LogUtil; +import net.osmand.OsmAndFormatter; import net.osmand.osm.LatLon; import net.osmand.osm.MapUtils; import net.osmand.plus.OsmandSettings; @@ -462,7 +463,7 @@ public class RoutingHelper { int[] dist = res.getListDistance(); int l = dist != null && dist.length > 0 ? dist[0] : 0; showMessage(context.getString(R.string.new_route_calculated_dist) - + " : " + MapUtils.getFormattedDistance(l)); //$NON-NLS-1$ + + " : " + OsmAndFormatter.getFormattedDistance(l, context)); //$NON-NLS-1$ if (uiActivity instanceof MapActivity) { // be aware that is non ui thread ((MapActivity) uiActivity).getMapView().refreshMap(); diff --git a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java index 42d9dd5497..b8e65431df 100644 --- a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java @@ -6,6 +6,7 @@ package net.osmand.plus.activities; import java.text.MessageFormat; import java.util.List; +import net.osmand.OsmAndFormatter; import net.osmand.osm.MapUtils; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; @@ -64,7 +65,7 @@ public class ShowRouteInfoActivity extends ListActivity { int dist = helper.getLeftDistance(); int hours = helper.getLeftTime() / (60 * 60); int minutes = (helper.getLeftTime() / 60) % 60; - header.setText(MessageFormat.format(getString(R.string.route_general_information), MapUtils.getFormattedDistance(dist), + header.setText(MessageFormat.format(getString(R.string.route_general_information), OsmAndFormatter.getFormattedDistance(dist, this), hours, minutes)); float f = Math.min(dm.widthPixels/(dm.density*160),dm.heightPixels/(dm.density*160)); if (f >= 3) { @@ -158,7 +159,7 @@ public class ShowRouteInfoActivity extends ListActivity { icon.setImageDrawable(new RouteDrawable()); } ((RouteDrawable) icon.getDrawable()).setRouteType(model.turnType); - distanceLabel.setText(MapUtils.getFormattedDistance(model.distance)); + distanceLabel.setText(OsmAndFormatter.getFormattedDistance(model.distance, ShowRouteInfoActivity.this)); label.setText(model.descriptionRoute); int seconds = model.expectedTime % 60; int min = (model.expectedTime / 60) % 60; diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineActivity.java index b2b0c72eaf..f269f687ff 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineActivity.java @@ -10,6 +10,7 @@ import java.util.Locale; import net.osmand.Algoritms; import net.osmand.LogUtil; +import net.osmand.OsmAndFormatter; import net.osmand.Version; import net.osmand.osm.LatLon; import net.osmand.osm.MapUtils; @@ -184,7 +185,7 @@ public class SearchAddressOnlineActivity extends ListActivity { TextView distanceLabel = (TextView) row.findViewById(R.id.distance_label); if(location != null){ int dist = (int) (MapUtils.getDistance(location, model.lat, model.lon)); - distanceLabel.setText(MapUtils.getFormattedDistance(dist)); + distanceLabel.setText(OsmAndFormatter.getFormattedDistance(dist, SearchAddressOnlineActivity.this)); } else { distanceLabel.setText(""); //$NON-NLS-1$ } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java index a5d0805b5c..2235daec16 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchCityByNameActivity.java @@ -3,6 +3,7 @@ package net.osmand.plus.activities.search; import java.util.ArrayList; import java.util.List; +import net.osmand.OsmAndFormatter; import net.osmand.data.City; import net.osmand.data.MapObject; import net.osmand.data.PostCode; @@ -41,7 +42,7 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity 2 && location != null && l != null) { txt.setText(obj.getName(region.useEnglishNames()) + " - " + //$NON-NLS-1$ - MapUtils.getFormattedDistance((int) MapUtils.getDistance(l, location))); + OsmAndFormatter.getFormattedDistance((int) MapUtils.getDistance(l, location), this)); } else { txt.setText(obj.getName(region.useEnglishNames())); } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryActivity.java index f9e7ffe959..d887f0185a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryActivity.java @@ -2,6 +2,7 @@ package net.osmand.plus.activities.search; import java.util.List; +import net.osmand.OsmAndFormatter; import net.osmand.osm.LatLon; import net.osmand.osm.MapUtils; import net.osmand.plus.OsmandSettings; @@ -126,7 +127,7 @@ public class SearchHistoryActivity extends ListActivity { final HistoryEntry model = getItem(position); if(location != null){ int dist = (int) (MapUtils.getDistance(location, model.lat, model.lon)); - distanceLabel.setText(MapUtils.getFormattedDistance(dist)); + distanceLabel.setText(OsmAndFormatter.getFormattedDistance(dist, SearchHistoryActivity.this)); } else { distanceLabel.setText(""); //$NON-NLS-1$ } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index 7da1096870..6c8a060210 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -10,9 +10,9 @@ import java.util.List; import net.osmand.Algoritms; import net.osmand.LogUtil; +import net.osmand.OsmAndFormatter; import net.osmand.data.Amenity; import net.osmand.osm.LatLon; -import net.osmand.osm.MapUtils; import net.osmand.osm.OpeningHoursParser; import net.osmand.osm.OpeningHoursParser.OpeningHoursRule; import net.osmand.plus.NameFinderPoiFilter; @@ -216,7 +216,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen @Override public boolean onItemLongClick(AdapterView av, View v, int pos, long id) { final Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(pos); - String format = amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(settings)); + String format = OsmAndFormatter.getPoiSimpleFormat(amenity, SearchPOIActivity.this, OsmandSettings.usingEnglishNames(settings)); if (amenity.getOpeningHours() != null) { format += " "+getString(R.string.opening_hours) + " : " + amenity.getOpeningHours(); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -229,9 +229,10 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen public void onClick(DialogInterface dialog, int which) { if(which == 0){ int z = OsmandSettings.getLastKnownMapZoom(settings); + String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, SearchPOIActivity.this, OsmandSettings.usingEnglishNames(settings)); OsmandSettings.setMapLocationToShow(SearchPOIActivity.this, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), - Math.max(16, z), getString(R.string.poi)+" : " + amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(settings))); //$NON-NLS-1$ + Math.max(16, z), getString(R.string.poi)+" : " + poiSimpleFormat); //$NON-NLS-1$ } else if(which == 1){ LatLon l = amenity.getLocation(); OsmandSettings.setPointToNavigate(SearchPOIActivity.this, l.getLatitude(), l.getLongitude()); @@ -484,8 +485,9 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen } int z = OsmandSettings.getLastKnownMapZoom(settings); Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position); + String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, this, OsmandSettings.usingEnglishNames(settings)); OsmandSettings.setMapLocationToShow(this, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), - Math.max(16, z), getString(R.string.poi)+" : " + amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(settings))); //$NON-NLS-1$ + Math.max(16, z), getString(R.string.poi)+" : " + poiSimpleFormat); //$NON-NLS-1$ Intent newIntent = new Intent(SearchPOIActivity.this, MapActivity.class); startActivity(newIntent); } @@ -596,8 +598,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen LatLon l = amenity.getLocation(); Location.distanceBetween(l.getLatitude(), l.getLongitude(), location.getLatitude(), location.getLongitude(), mes); } - - String str = amenity.getStringWithoutType(OsmandSettings.usingEnglishNames(settings)); + String str = OsmAndFormatter.getPoiStringWithoutType(amenity, OsmandSettings.usingEnglishNames(settings)); label.setText(str); int opened = -1; if (amenity.getOpeningHours() != null) { @@ -638,7 +639,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen if(mes == null){ distanceLabel.setText(""); //$NON-NLS-1$ } else { - distanceLabel.setText(" " + MapUtils.getFormattedDistance((int) mes[0])); //$NON-NLS-1$ + distanceLabel.setText(" " + OsmAndFormatter.getFormattedDistance((int) mes[0], SearchPOIActivity.this)); //$NON-NLS-1$ } return (row); } @@ -663,7 +664,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen .toLowerCase(); List filter = new ArrayList(); for (Amenity item : originalAmenityList) { - String lower = item.getStringWithoutType(OsmandSettings.usingEnglishNames(settings)).toLowerCase(); + String lower = OsmAndFormatter.getPoiStringWithoutType(item, OsmandSettings.usingEnglishNames(settings)).toLowerCase(); if(lower.indexOf(lowerCase) != -1){ filter.add(item); } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchTransportActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchTransportActivity.java index 172a578cef..91a0105aba 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchTransportActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchTransportActivity.java @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.List; import net.osmand.Algoritms; -import net.osmand.Messages; +import net.osmand.OsmAndFormatter; import net.osmand.data.TransportRoute; import net.osmand.data.TransportStop; import net.osmand.osm.LatLon; @@ -142,7 +142,7 @@ public class SearchTransportActivity extends ListActivity { } public String getSearchArea(){ - return " < " + 125 * (1 << (17 - zoom)) + " " + Messages.getMessage(Messages.KEY_M); //$NON-NLS-1$//$NON-NLS-2$ + return " < " + 125 * (1 << (17 - zoom)) + " " + getString(R.string.m); //$NON-NLS-1$//$NON-NLS-2$ } public boolean isSearchFurtherAvailable() { return zoom >= finalZoom; @@ -228,18 +228,18 @@ public class SearchTransportActivity extends ListActivity { } ind++; } - text.append(getString(R.string.transport_route_distance)).append(" ").append(MapUtils.getFormattedDistance((int) dist)); //$NON-NLS-1$/ + text.append(getString(R.string.transport_route_distance)).append(" ").append(OsmAndFormatter.getFormattedDistance((int) dist, this)); //$NON-NLS-1$/ if(!part){ text.append(", ").append(getString(R.string.transport_stops_to_pass)).append(" ").append(eInd - stInd); //$NON-NLS-1$ //$NON-NLS-2$ LatLon endStop = getEndStop(position - 1); if (endStop != null) { - String before = MapUtils.getFormattedDistance((int) MapUtils.getDistance(endStop, route.getStart().getLocation())); + String before = OsmAndFormatter.getFormattedDistance((int) MapUtils.getDistance(endStop, route.getStart().getLocation()), SearchTransportActivity.this); text.append(", ").append(getString(R.string.transport_to_go_before)).append(" ").append(before); //$NON-NLS-2$//$NON-NLS-1$ } LatLon stStop = getStartStop(position + 1); if (stStop != null) { - String after = MapUtils.getFormattedDistance((int) MapUtils.getDistance(stStop, route.getStop().getLocation())); + String after = OsmAndFormatter.getFormattedDistance((int) MapUtils.getDistance(stStop, route.getStop().getLocation()), SearchTransportActivity.this); text.append(", ").append(getString(R.string.transport_to_go_after)).append(" ").append(after); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -268,9 +268,9 @@ public class SearchTransportActivity extends ListActivity { String name = st.getName(OsmandSettings.usingEnglishNames(settings)); if(locationToGo != null){ n.append(name).append(" - ["); //$NON-NLS-1$ - n.append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToGo, st.getLocation()))).append("]"); //$NON-NLS-1$ + n.append(OsmAndFormatter.getFormattedDistance((int) MapUtils.getDistance(locationToGo, st.getLocation()), SearchTransportActivity.this)).append("]"); //$NON-NLS-1$ } else if(locationToStart != null){ - n.append("[").append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToStart, st.getLocation()))).append("] - "); //$NON-NLS-1$ //$NON-NLS-2$ + n.append("[").append(OsmAndFormatter.getFormattedDistance((int) MapUtils.getDistance(locationToStart, st.getLocation()), SearchTransportActivity.this)).append("] - "); //$NON-NLS-1$ //$NON-NLS-2$ n.append(name); } else { n.append(name); @@ -455,7 +455,7 @@ public class SearchTransportActivity extends ListActivity { labelW.append(" - ["); //$NON-NLS-1$ if (locationToGo != null) { - labelW.append(MapUtils.getFormattedDistance(stop.getDistToLocation())); + labelW.append(OsmAndFormatter.getFormattedDistance(stop.getDistToLocation(), SearchTransportActivity.this)); } else { labelW.append(getString(R.string.transport_search_none)); } @@ -469,7 +469,7 @@ public class SearchTransportActivity extends ListActivity { } int dist = locationToStart == null ? 0 : (int) (MapUtils.getDistance(stop.getStart().getLocation(), locationToStart)); - distanceLabel.setText(" " + MapUtils.getFormattedDistance(dist)); //$NON-NLS-1$ + distanceLabel.setText(" " + OsmAndFormatter.getFormattedDistance(dist, SearchTransportActivity.this)); //$NON-NLS-1$ return (row); } @@ -491,7 +491,7 @@ public class SearchTransportActivity extends ListActivity { if(st != null && end != null){ int dist = (int) MapUtils.getDistance(st, end); - text.setText(MessageFormat.format(getString(R.string.transport_searching_route), MapUtils.getFormattedDistance(dist))); + text.setText(MessageFormat.format(getString(R.string.transport_searching_route), OsmAndFormatter.getFormattedDistance(dist, SearchTransportActivity.this))); } else { text.setText(getString(R.string.transport_searching_transport)); } @@ -538,12 +538,12 @@ public class SearchTransportActivity extends ListActivity { labelW.append(" ("); //$NON-NLS-1$ labelW.append(info.getStopNumbers()).append(" ").append(getString(R.string.transport_stops)).append(", "); //$NON-NLS-1$ //$NON-NLS-2$ int startDist = (int) MapUtils.getDistance(getEndStop(position - 1), info.getStart().getLocation()); - labelW.append(getString(R.string.transport_to_go_before)).append(" ").append(MapUtils.getFormattedDistance(startDist)); //$NON-NLS-1$ + labelW.append(getString(R.string.transport_to_go_before)).append(" ").append(OsmAndFormatter.getFormattedDistance(startDist, SearchTransportActivity.this)); //$NON-NLS-1$ if (position == getCount() - 1) { LatLon stop = getStartStop(position + 1); if(stop != null) { int endDist = (int) MapUtils.getDistance(stop, info.getStop().getLocation()); - labelW.append(", ").append(getString(R.string.transport_to_go_after)).append(" ").append(MapUtils.getFormattedDistance(endDist)); //$NON-NLS-1$ //$NON-NLS-2$ + labelW.append(", ").append(getString(R.string.transport_to_go_after)).append(" ").append(OsmAndFormatter.getFormattedDistance(endDist, SearchTransportActivity.this)); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java index 32a6e804c7..f450c9787b 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java @@ -1,7 +1,7 @@ package net.osmand.plus.views; import net.osmand.Algoritms; -import net.osmand.Messages; +import net.osmand.OsmAndFormatter; import net.osmand.osm.LatLon; import net.osmand.osm.MapUtils; import net.osmand.plus.OsmandSettings; @@ -208,7 +208,7 @@ public class MapInfoLayer implements OsmandMapLayer { cachedMeters = 0; cachedDistString = null; } else { - cachedDistString = MapUtils.getFormattedDistance(cachedMeters); + cachedDistString = OsmAndFormatter.getFormattedDistance(cachedMeters, map); float right = paintBlack.measureText(cachedDistString) + 25 * scaleCoefficient + boundsForDist.left; if(cachedSpeedString != null){ boundsForSpeed.right = boundsForDist.right = Math.max(right, boundsForDist.right); @@ -235,7 +235,7 @@ public class MapInfoLayer implements OsmandMapLayer { if(map.getLastKnownLocation() != null && map.getLastKnownLocation().hasSpeed()){ if(Math.abs(map.getLastKnownLocation().getSpeed() - cachedSpeed) > .3f){ cachedSpeed = map.getLastKnownLocation().getSpeed(); - cachedSpeedString = ((int) (cachedSpeed * 3.6f)) + Messages.getMessage(Messages.KEY_KM_H); + cachedSpeedString = ((int) (cachedSpeed * 3.6f)) + map.getString(R.string.km_h); float right = paintBlack.measureText(cachedSpeedString) + 8 * scaleCoefficient + boundsForSpeed.left; boundsForSpeed.right = boundsForDist.right = Math.max(right, boundsForDist.right); } @@ -312,7 +312,7 @@ public class MapInfoLayer implements OsmandMapLayer { } rulerDistPix = (int) (view.getWidth() * screenPercent / dist * baseDist); - rulerDistName = MapUtils.getFormattedDistance(baseDist); + rulerDistName = OsmAndFormatter.getFormattedDistance(baseDist, map); rulerBaseLine = (int) (view.getHeight() - 70 * dm.density); if(view.getParent() instanceof View){ View zoomControls = ((View) view.getParent()).findViewById(R.id.ZoomControls); @@ -368,7 +368,7 @@ public class MapInfoLayer implements OsmandMapLayer { canvas.drawText(cachedExitOut, boundsForMiniRoute.centerX() - 6 * scaleCoefficient, boundsForMiniRoute.centerY() - 9 * scaleCoefficient, paintBlack); } - canvas.drawText(MapUtils.getFormattedDistance(d), boundsForMiniRoute.left + 10 * scaleCoefficient, + canvas.drawText(OsmAndFormatter.getFormattedDistance(d, map), boundsForMiniRoute.left + 10 * scaleCoefficient, boundsForMiniRoute.bottom - 9 * scaleCoefficient, paintBlack); } } diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 94273575b3..ad67261b7e 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import net.osmand.LogUtil; +import net.osmand.OsmAndFormatter; import net.osmand.data.Amenity; import net.osmand.osm.LatLon; import net.osmand.plus.OsmandSettings; @@ -82,7 +83,7 @@ public class POIMapLayer implements OsmandMapLayer, ContextMenuLayer.IContextMen public boolean onTouchEvent(PointF point) { Amenity n = getAmenityFromPoint(point); if(n != null){ - String format = n.getSimpleFormat(OsmandSettings.usingEnglishNames(view.getSettings())); + String format = OsmAndFormatter.getPoiSimpleFormat(n, view.getContext(), OsmandSettings.usingEnglishNames(view.getSettings())); if(n.getOpeningHours() != null){ format += "\n" + view.getContext().getString(R.string.opening_hours) +" : "+ n.getOpeningHours(); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -212,7 +213,7 @@ public class POIMapLayer implements OsmandMapLayer, ContextMenuLayer.IContextMen @Override public String getObjectDescription(Object o) { if(o instanceof Amenity){ - return ((Amenity)o).getSimpleFormat(OsmandSettings.usingEnglishNames(view.getSettings())); + return OsmAndFormatter.getPoiSimpleFormat((Amenity) o, view.getContext(), OsmandSettings.usingEnglishNames(view.getSettings())); } return null; }