diff --git a/DataExtractionOSM/src/net/osmand/ToDoConstants.java b/DataExtractionOSM/src/net/osmand/ToDoConstants.java index a451b8f036..e3231fa30a 100644 --- a/DataExtractionOSM/src/net/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/net/osmand/ToDoConstants.java @@ -16,7 +16,8 @@ public class ToDoConstants { // Polish UI with new building address search ...(Better completely new address search) // Search for city in all indexes // Test GeoIndexActivity - // TODO images in the map index ? + // TODO images in the map index ? + // Plugin OsmEditingPlugin Send GPX files // == Osmand application (TODO 127) == diff --git a/DataExtractionOSM/src/net/osmand/render/default.render.xml b/DataExtractionOSM/src/net/osmand/render/default.render.xml index 32e3643f83..ed07a507ba 100644 --- a/DataExtractionOSM/src/net/osmand/render/default.render.xml +++ b/DataExtractionOSM/src/net/osmand/render/default.render.xml @@ -416,9 +416,9 @@ - + - + @@ -1049,7 +1049,7 @@ - + @@ -1072,15 +1072,10 @@ - - - - - - - + + @@ -1088,6 +1083,10 @@ + + + + @@ -1107,11 +1106,9 @@ - - - + @@ -1119,6 +1116,8 @@ + + @@ -1130,50 +1129,63 @@ + + - + - + + + + + - + + + - + + - + + - - + + - + + + - + + diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index c30ebc27ce..34b982bd9f 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -18,7 +18,7 @@ @@ -64,11 +64,11 @@ - + - + - + @@ -81,7 +81,7 @@ - + diff --git a/OsmAnd/res/layout/plugins_list_item.xml b/OsmAnd/res/layout/plugins_list_item.xml index 8a38f5b32b..42a93ea4f4 100644 --- a/OsmAnd/res/layout/plugins_list_item.xml +++ b/OsmAnd/res/layout/plugins_list_item.xml @@ -2,12 +2,12 @@ - - + android:layout_marginLeft="4dp" > + + + android:maxLines="7" android:layout_height="wrap_content" android:textSize="16sp" > diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index f27aa0ef00..822851b26e 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -158,10 +158,6 @@ Nastavení profilu Uživatelský profil Vyberte profil aplikace. (V každém profilu je možno upravit mapy, sledování a navigaci.) - - Mapa - Nastavení zdroje mapy a způsobu vykreslování - - Zobrazení - Nastavení vzhledu a chování aplikace a zobrazení mapy - Záznam trasy Nastavení záznamu trasy na SD kartu - Navigace @@ -615,8 +611,6 @@ Vyberte mapu zobrazenou nad základní mapou - Vektorové mapy - Použít stažené vektorové mapy Mapa je již nainstalovaná, aktualizuji nastavení diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 892ea97050..f5adb90f85 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -158,10 +158,6 @@ Profilspezifische Einstellungen Nutzerprofil Verwendungszweck. (Einstellungen für Karten, Logging und Navigation werden für jedes Profil separat gespeichert.) - - Kartenkonfiguration - Kartenquellen und -parametrisierung - - Anzeigenkonfiguration - Kartendarstellung und Anzeigeelemente - Positions-Logging Positions-Logging konfigurieren - Navigation @@ -406,8 +402,6 @@ Keine Overlay-Karte Wähle Overlay-Karte - Offline-Vektor-Karten - Verwende Offline-Vektor-Karten Karte schon installiert, Einstellungen werden aktualisiert Kartenauswahl (Installation oder Update) Internet Verbindung erforderlich aber nicht verfügbar diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml index e474b31c43..4af84a6683 100644 --- a/OsmAnd/res/values-es/strings.xml +++ b/OsmAnd/res/values-es/strings.xml @@ -67,10 +67,6 @@ Opciones específicas por perfil Perfil de usuario Selecciona un perfil de uso. (Las opciones de Mapa, Seguimiento y Navegación puede cambiarse para cada perfil) -- Configuración de Mapa -Configura los mapas y los orígenes de mapas -- Aspecto de mapas -Configura la presentación de mapas - Seguimiento Especifica los parámetros de seguimiento - Navegación @@ -319,8 +315,6 @@ Ninguno Mapa superpuesto Elija mapa superpuesto -Mapas descargados -Usar mapas vectoriales descargados El mapa ya está instalado, se actualizarán las opciones Seleccione mapas (teselas) a instalar o actualizar No está disponible la conexión a Internet que se necesita para la operación diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 0a1e6b54a1..70876cd7fa 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -67,10 +67,6 @@ Paramètres de profil Profil d\'utilisation Sélectionner un profil d\'utilisation. (Pour chaque profil, il est possible de configurer une source de carte, le suivi et la navigation, voir plus bas.) - - Sources de carte - Configurer la source et les propriétés des cartes - - Style d\'affichage - Configurer le style de l\'affichage de la carte - Traces Configurer les paramètres d\'enregistrement du parcours - Navigation @@ -306,8 +302,6 @@ Aucune Sur-couche de la carte Chosir la carte en sur-couche -Cartes vectorielles -Utiliser les cartes vectorielles téléchargées Carte déjà installée, paramètres seront mis à jour Sélectioner les cartes à installer ou mettre à jour Connexion Internet nécessaire pour cette opération non disponible diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 4ab23e99ca..6a7c63bca6 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -150,10 +150,6 @@ Felhasználási módnak megfelelő beállítások Felhasználási mód Felhasználási mód kiválasztása. (Minden módban a térkép, útvonalrögzítés és navigáció beállításai alább személyre szabhatók.) - - Térképbeállítások - Térképbeállítások és térképforrások - - Térkép megjelenítés - Térkép megjelenésének beállításai - Útvonalrögzítés Útvonalrögzítés beállításai - Navigáció @@ -402,8 +398,6 @@ Nincs Rátét térkép Rátét térkép kiválasztás - Vektoros térképek - Letöltött vektoros térképek használata A térkép már telepítve van, a beállítások frissítésre kerülnek Térkép kiválasztása telepítéshez, frissítéshez A művelet elvégzéséhez internetelérés szükséges diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 4d884963cd..4b4f8a9479 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -51,10 +51,6 @@ Impostazioni particolari per il profilo Profilo d\'uso Seleziona un profilo d\'uso. (Ogni impostazione del profilo per la Mappa, Tracking, e Navigazione può essere personalizzato sotto.) - Configura mappa - Configura mappe e sorgenti delle mappe - Aspetto della mappa - Configura l\'aspetto della mappa Tracking Specifica le impostazioni di tracking Navigazione @@ -300,8 +296,6 @@ Nessuna Mappa di overlay Scegli mappa di overlay - Mappe vettoriali offline - Usa le mappe vettoriali scaricate La mappa è già installata, verrà aggiornata Seleziona le mappe (tile) da installare o aggiornare Connessione internet richiesta ma non disponibile diff --git a/OsmAnd/res/values-jp/strings.xml b/OsmAnd/res/values-jp/strings.xml index dc6b79cf4f..dadef65d76 100644 --- a/OsmAnd/res/values-jp/strings.xml +++ b/OsmAnd/res/values-jp/strings.xml @@ -68,8 +68,6 @@ name="internet_connection_required_for_online_route">オンライン経路案内 無し オーバーレイマップ オーバーレイマップを選択 - オフラインベクターマップ - ダウンロードしたベクターマップを使用 マップは既に インストール済です、設定を更新します インストールまたは @@ -308,8 +306,7 @@ MB)をダウンロードしますか? インターネット利用、表示オプション、その他の構成 全般設定 - マップソースと外観の構成 - - マップ + オフライン用のデータを取得/更新 オフラインデータ 背景サービス diff --git a/OsmAnd/res/values-ko/strings.xml b/OsmAnd/res/values-ko/strings.xml index ce8b563eef..1aece5de62 100644 --- a/OsmAnd/res/values-ko/strings.xml +++ b/OsmAnd/res/values-ko/strings.xml @@ -158,10 +158,6 @@ 특정 설정 프로파일 사용자 프로파일 사용자 프로파일을 선택합니다. (각 프로파일의 맵, 트래킹, 네비게이션 설정은 아래처럼 지정할 수 있습니다.) - - 맵 설정 - 맵과 맵 소스를 설정합니다 - - 맵 모양 - 맵 모양을 설정합니다 - 트래킹 트래킹 옵션을 설정합니다 - 네비게이션 @@ -408,8 +404,6 @@ 없음 오버레이 맵 오버레이 맵을 선택합니다 - 오프라인 벡터 맵 - 다운로드한 벡터 맵을 사용합니다 맵이 이미 설치되어, 설정이 갱신될 것입니다 설치 또는 갱신할 (타일) 맵을 선택합니다 동작에 필요한 인터넷 연결이 되지 않습니다 diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index ce18c1e2f3..5753807df8 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -9,7 +9,7 @@ Test stem-instructies Geen offline vectorkaart aanwezig voor deze locatie. Je kan deze downloaden via Instellingen (Offline gegevens), of overschakelen naar online kaarten. Wijzigingen in 0.7.2 : -\n\t- Interne kaartgeneratie voor alle apparaten +\n\t- Interne kaartgeneratie op alle apparaten \n\t- Offline interessepunt-bewerking \n\t- Toegankelijkheidsopties \n\t- Veel bugs opgelost @@ -135,10 +135,10 @@ Europa Europa - Frankrijk Europa - Duitsland - Europa/Azi렭 Rusland + Europa/Azië - Rusland Afrika - Azi뼯 - Oceani뼯 + Azië + Oceanië Wereldkaart en topografische kaart Wereldwijde Wikipedia Stembestanden (opnamen) @@ -150,10 +150,6 @@ Profielspecifieke instellingen Gebruiksprofiel Selecteer een profiel. (Elke profielinstelling, kaart, tracking en navigatie kan hieronder ingesteld worden.) - - Kaartconfiguratie - Configureer kaarten en kaartbronnen - - Kaartpresentatie - Configureer kaartpresentatie - Tracking Specifieke tracking-instellingen - Navigatie @@ -190,7 +186,7 @@ Verbeter OSM gegevens \tOsmAnd gebruikt kaarten, gebaseerd op Openstreetmap.org (OSM) gegevens en kan -behalve voor kaartweergave en navigatie- gebruikt worden om de kwaliteit van OSM gegevens te verbeteren. U kunt eenvoudig met een paar klikken interessepunten of OSM foutrapporten uploaden! \n\tHiervoor moet u eerst uw OSM login informatie opgeven bij \'Instellingen\' -> \'Algemene instellingen\' -> \'OSM\'. - \n\tOm een nieuw interessepunt toe te voegen, gebruik de optie \'Cre즲 interessepunt\' in het kaartcontextmenu. Vervolg met het ingeven van de informatie over het interessepunt bij \'Cre즲 interessepunt\' en sla deze wijziging op. + \n\tOm een nieuw interessepunt toe te voegen, gebruik de optie \'Creëer interessepunt\' in het kaartcontextmenu. Vervolg met het ingeven van de informatie over het interessepunt bij \'Creëer interessepunt\' en sla deze wijziging op. \n\tFouten in de kaarten kunnen direct worden gerapporteerd via OSM bug, de OSM groep kan het probleem dan sneller oplossen. \n\Om een fout te rapporteren, gebruik de optie \'Open OSM bug\' in het kaartcontextmenu. Geef daar een gedetailleerde beschrijving van het probleem en stuur het op met de \'Toevoegen\' knop. \n\tEr is een Internetverbinding nodig voor het aanmelden van bugs en interessepunten. @@ -252,7 +248,7 @@ Bestandsnaam kan niet worden gewijzigd. Er bestaat al een bestand met die naam. GPX route - Meerdere interessepunt categorie쮠gevonden in zoekaktie : + Meerdere interessepunt categorieën gevonden in zoekaktie : Locale gegevens voor het zoeken van interessepunten is niet aanwezig. Zoek op naam Het interessepuntenbestand \'%1$s\' is redundant en kan worden verwijderd. @@ -361,9 +357,9 @@ Installeren nieuwe gegevens… Een online route-service is geselecteerd, maar er is geen internetverbinding beschikbaar. Taal niet ondersteund - De geselecteerde taal is niet ondersteund door de ge௳talleerde Android stemgenerator. Wilt u een andere stemgenerator zoeken in de Market? Anders wordt de huidige stemgenerator gebruikt. + De geselecteerde taal is niet ondersteund door de geïnstalleerde Android stemgenerator. Wilt u een andere stemgenerator zoeken in de Market? Anders wordt de huidige stemgenerator gebruikt. Ontbrekende gegevens - Geen gegevens voor de geselecteerde taal ge௳talleerd. Wilt u naar de Market gaan om deze te installeren? + Geen gegevens voor de geselecteerde taal geïnstalleerd. Wilt u naar de Market gaan om deze te installeren? Keer GPX richting om Gebruik huidige bestemming Toon het gehele spoor @@ -386,9 +382,7 @@ Geen Overlay kaart Selecteer overlay kaart - Offline vectorkaarten - Gebruik downloaded vectorkaarten - Kaart is al ge௳talleerd, instellingen worden geactualiseerd + Kaart is al geïnstalleerd, instellingen worden geactualiseerd Selecteer (kaartsegment) kaarten om te installeren of te actualiseren De benodigde Internetverbinding voor deze actie is niet beschikbaar Installeer meer… @@ -398,8 +392,8 @@ \n\tDe beschikbaarheid van updates wordt weergegeven in de volgende kleuren: \n\t\'Groen\' - De gegevens op uw apparaat en op de server zijn identiek \n\t\'Blauw\' - Er is een update beschikbaar op de server - \n\t\'Donker Groen\' - gedeactiveerde kaart: is up to date - \n\t\'Donker Blauw\' - gedeactiveerde kaart: Er is een update beschikbaar + \n\t\'Donker Groen\' - gedeactiveerde kaart, deze is up-to-date + \n\t\'Donker Blauw\' - gedeactiveerde kaart, er is een update beschikbaar Minimum zoomniveau om vectorkaarten inplaats van (raster)kaartsegmenten te gebruiken. Min. vector zoomniveau @@ -407,7 +401,7 @@ \tU kunt de locatie van interessepunten op uw tocht delen met familie of vrienden. \n\tOm een locatie te delen: \n\tGebruik het \'Kaart contextmenu\' -> \'Deel locatie\' menu. - \n\tSelecteer dan de methode van delen van uw locatie. De opties zijn: E-Mail, SMS(tekst), of kopieer de locatieco��naten naar het prikbord. + \n\tSelecteer dan de methode van delen van uw locatie. De opties zijn: E-Mail, SMS(tekst), of kopieer de locatiecoördinaten naar het prikbord. Favorieten \tVaak gebruikte punten kunnen worden bewaard als Favorieten. \n\tOm een punt als Favoriet te bewaren, ga naar het kaartcontextmenu, selecteer de optie \'Voeg toe aan favorieten\' en geef het dan een naam. Nadat het bewaard is, is het te toegankelijk via \'Hoofdmenu\' -> \'Favorieten\'. @@ -426,7 +420,7 @@ \n\tOsmAnd ondersteunt ook eigen kaartbronnen. Gebruikersprofiel \tOsmAnd ondersteunt verschillende (aanpasbare) programmaprofielen voor verschillende toepassingen. -\n\tU kunt profielen wijzigen in \'Menu\' -> \'Instellingen\' -> \'Gebruikersprofiel\', of bij het cre쳥n van een route. +\n\tU kunt profielen wijzigen in \'Menu\' -> \'Instellingen\' -> \'Gebruikersprofiel\', of bij het creëren van een route. Navigatie \tVoordat u een navigatie start (routing), moet u eerst een bestemming kiezen. Druk daarna op \'Menu\' -> \'Navigeer\' op de kaart en selecteer het type navigatie. Zoeken @@ -434,7 +428,7 @@ \n\tDoor in het hoofdmenu op \'Zoeken\' te drukken, worden de zoekacties geopend. Voor elk gevonden resultaat, biedt het contextmenu 2 opties: \'Selecteer als bestemming\' of \'Toon op kaart\'. Kaart-ContextMenu \tHet kaart-contextmenu is beschikbaar door een lange druk op de kaart of door op de trackball knop te drukken. -\n\tDit toont een venster met de puntco��naten. Om de kaart-contextmenu dialoog te openen, druk er op. (Een lange druk verbergt het venster weer) +\n\tDit toont een venster met de puntcoördinaten. Om de kaart-contextmenu dialoog te openen, druk er op. (Een lange druk verbergt het venster weer) \n\tHet kaart-contextmenu bevat alle acties met betrekking tot een punt (locatie). Tips and Trucs \tOsmAnd is a navigatieprogramma met vele features. @@ -479,10 +473,10 @@ Horeca Toerisme Vervoer - adres wordt ge௤exeerd… - kaart wordt ge௤exeerd… - interessepunt wordt ge௤exeerd… - vervoer wordt ge௤exeerd… + adres wordt geïndexeerd… + kaart wordt geïndexeerd… + interessepunt wordt geïndexeerd… + vervoer wordt geïndexeerd… datatransportfout opgetreden km km/u @@ -504,15 +498,15 @@ Kan de opgegeven directory niet vinden. Opslagdirectory Wijziging van de opslagdirectory verplaatst of verwijdert de gegevens niet. Dit moet u afzonderlijk en buiten OsmAnd doen. Toch doorgaan? - Een oudere OsmAnd versie is al ge௳talleerd. Alle offline gegevens worden ondersteund door het nieuwe programma, maar Favorieten moeten worden ge칰orteerd in het oude programma en later worden geரorteerd door het nieuwe. - Versie {0} succesvol ge௳talleerd ({1}). + Een oudere OsmAnd versie is al geïnstalleerd. Alle offline gegevens worden ondersteund door het nieuwe programma, maar Favorieten moeten worden geëxporteerd in het oude programma en later worden geïmporteerd door het nieuwe. + Versie {0} succesvol geïnstalleerd ({1}). Downloading versie… Doorgaan met de installatie van OsmAnd - {0} van {1} {2} MB ? Het ophalen van de lijst van OsmAndversies is mislukt OsmAnd versies… worden geladen Selecteer een van de OsmAnd versies om te installeren Speciale actie voor contributie-versies - GPS Status programma niet ge௳talleerd. Zoeken in Market? + GPS Status programma niet geïnstalleerd. Zoeken in Market? Stem-begeleiding is niet aanwezig. Ga naar instellingen, selecteer een stem-gegevens pakket, en download deze. Geen stem-begeleiding geselecteerd Dag @@ -574,7 +568,7 @@ Selecteer hoe de kaart roteert Kaartrotatie Route-details - Favorieten succesvol geரorteerd + Favorieten succesvol geïmporteerd GPX bestand met favorieten niet gevonden op {0} Favorieten succesvol opgeslagen in {0} Geen favorieten om op te slaan @@ -595,7 +589,7 @@ interessepunt… Kaartbron… Definieer beeld - Vorige route was niet be쪮digd. Doorgaan met die route? + Vorige route was niet beëindigd. Doorgaan met die route? Zoek interessepunt Toon route vanaf hier Gebruik trackball om de kaart te verschuiven @@ -648,7 +642,7 @@ Zelfde als apparaat-instelling Staand Liggend - Kaartscherm-ori쯴atie + Kaartscherm-oriëntatie Selecteer scherm-orientation Openingtijden-formaat kan niet gewijzigd worden Voeg nieuwe regel toe @@ -737,7 +731,7 @@ Fout: berekende route is leeg Nieuwe route berekend, afstand U bent aangekomen op uw bestemming - Co��naten zijn ongeldig! + Coördinaten zijn ongeldig! Ga terug naar de OsmAnd kaart Sluiten Gegevens worden geladen… @@ -800,7 +794,7 @@ Toon locatie Kaart Instellingen - Toon GPS co��naten op kaart + Toon GPS coördinaten op kaart Gebruik het Internet om ontbrekende kaartsegmenten te downloaden Navigatieprogramma Afsluiten @@ -843,7 +837,7 @@ Voeg toe aan favorieten Actualiseer kaart Open OSM bug - Cre즲 interessepunt + Creëer interessepunt Ja Annuleer Toepassen @@ -873,7 +867,7 @@ Bug is afgesloten Fout opgetreden: bug is niet afgesloten Bewerk interessepunt - Cre즲 interessepunt + Creëer interessepunt Punt niet gevonden of voorziening is niet een enkel punt Verwijderen {0} (geef commentaar)? Verwijder interessepunt diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 5bdc641021..80b9b19565 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -18,8 +18,6 @@ Pokaż wysokość Użyj przezroczystych kontrolek mapy Przezroczysty styl -Konfiguruj wygląd aplikacji -- Wygląd Biblioteka renderowania natywnego nie jest obsługiwana na tym urządzeniu. Inicjalizacja biblioteki renderowania natywnego… @@ -203,8 +201,6 @@ Brak Nakładka Wybierz nakładkę (overlay) -Wektorowe mapy offline -Użyj pobranych map wektorowych Mapa jest już zainstalowana, ustawienia zostaną zaktualizowane Zaznacz mapy (kafelkowe) do zainstalowania lub zaktualizowania Połączenie internetowe, wymagane dla tej operacji, jest niedostępne @@ -370,8 +366,6 @@ Skonfiguruj użycie Internetu, opcje wyświetlania i inne Ustawienia główne -Skonfiguruj źródło mapy i wygląd -- Mapy Pobierz/zarządzaj mapami i danymi offline Dane offline Usługa w tle diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml index 3e23ead01e..4463a11600 100644 --- a/OsmAnd/res/values-pt/strings.xml +++ b/OsmAnd/res/values-pt/strings.xml @@ -59,8 +59,6 @@ Atualizar Configurar o uso da Internet, opções de visualização, e mais Configurações Gerais - Configurar a origem do mapa e sua aparência - - Mapas Obter ou atualizar dados para uso offline Dados offline Serviço de segundo plano diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 7ed4c5ebdd..deb8266a84 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -108,8 +108,7 @@ Показывать высоты Использовать прозрачные информационные элементы на карте Прозрачная тема - Настроить внешний вид карты - - Внешний вид + Нативная библиотека не поддерживается на этом устройстве. Инициализация нативной библиотеки… Настройки автовозрата карты @@ -273,8 +272,6 @@ Нет Карта покрытия Выберите слой для покрытия основной карты - Векторные карты - Использовать загруженные векторные карты Карта уже установлена, настройки будут обновлены Выберите карты для установки или обновления Интернет соединение не доступно @@ -409,9 +406,7 @@ Перезагрузить Настроить использование интернета, выбрать ориентацию экрана, вращение карты и другое Общие - Выбрать источник карты и конфигурацию - - Настройка карты - Загрузить и обновить данные для офлайн использования + Загрузить и обновить данные для офлайн использования Данные Фоновый режим Запустить OsmAnd в фоновом режиме для записи трека и навигации diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index dfcdd7fa33..675de15a96 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -1,5 +1,16 @@  + Zásuvné moduly + Ťuknutím na zásuvný modul ho aktivujete. Pre aplikovanie zmien je vyžadovaný reštart aplikácie. + Zás. moduly povoľujú extra funkcie vstavané do aplikácie ako stopovanie, mapové dlaždice, funkcie šetrenia batérie, prístupnosť a mnoho iného. + Zásuvné moduly + Zmeny v 0.8.0 : + \n\t- Funkcia zásuvných modulov + \n\t- Podpora nových offline mapových dát + \n\t- Mnoho opravených chýb + + Tento zás. modul je zameraný na zlepšovanie OSM kvality. Umožňuje zbierať/upravovať OSM POI objekty, otvoriť/komentovať OSM chyby a odosielať zaznamenané GPX (vyžaduje OSM prihlásenie). + Osm upravovanie Vektorové mapy môžu byť zobrazované rýchlejšie. Nemusí správne fungovať na niektorých zariadeniach. Ručné simulovanie priebehu cesty Prehranie povelov pre aktuálne zvolený hlas @@ -178,8 +189,7 @@ Použije priehľadné ovládače mapy Priehľadná téma - Konfiguruje mapové zobrazenie - - Vzhľad mapy + Natívna knižnica nie je podporovaná na tomto zariadení. Inicializácia natívnej knižnice… Automatické nasledovanie @@ -361,8 +371,6 @@ Žiadna Prekrývacia mapa Výber mapy na prekrytie - Offline vektorové mapy - Použitie stiahnutých vektorových máp Mapa je už nainštalovaná, nastavenia budú zaktualizované Vyberte mapy na inštaláciu alebo aktualizáciu Internetové pripojenie potrebné pre operáciu nie je dostupné @@ -525,8 +533,6 @@ Konfigurácia zobrazenia a iných globálnych nastavení Všeobecné nastavenia -Konfigurácia mapy a mapových zdrojov -- Konfigurácia mapy Stiahnutie a správa offline máp a iných údajov ako sú GPX stopy Offline údaje Služba na pozadí diff --git a/OsmAnd/res/values-vi/strings.xml b/OsmAnd/res/values-vi/strings.xml index e0d24d9f41..f0ebd3dc60 100644 --- a/OsmAnd/res/values-vi/strings.xml +++ b/OsmAnd/res/values-vi/strings.xml @@ -190,8 +190,6 @@ Translator: Le Viet Thanh; email: lethanhx2k@gmail.com --> Không Chồng phủ bản đồ Chọn bản đồ cần chồng phủ - Bản đồ vector Offline - Sử dụng bản đồ vector đã tải Bản đồ đã được cài, các thiết lập sẽ được cập nhật Chọn bản đồ cần cài đặt hoặc cập nhật Không vào được Internet @@ -366,8 +364,6 @@ Translator: Le Viet Thanh; email: lethanhx2k@gmail.com --> Các thiết lập chung cho ứng dụng Thiết lập chung - Các thiết lập và hiển thị cho bản đồ - - Bản đồ Tải và Quản lý bản đồ Offline hoặc các dữ liệu khác(GPX) Dữ liệu Offline Chạy ngầm diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index d8c6bb1893..d607a3676d 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,22 +1,51 @@  - Plugins - Touch a plugin item to activate it. Application restart is needed to take an effect. - Plugins enable extra functionality builtin in the application such as Tracking, Tile Maps, Battery Saving features, Accessibility and many others. - Plugins + + Enable online maps plugin to select different map sources + Online maps + Use online maps (download and save them on sdcard) + Online Map + Configure online or cached tile map sources + - Map Settings + Configure the map display + + This plugin facilitates using a variety of online or cached tile maps as base map or as overlay / underlay maps. The maps can also be prepared offline and copied to the Osmand folder. + Online Maps + This plugin allows navigating and tracking in power saving (screen off) mode. It runs a background service periodically waking up the GPS to record a track point or give a navigation prompt. + Screen Off Features + This plugin configures special accessibility features. + Accessibility + Extra settings + This plugin facilitates recording your trips to GPX files or live monitoring using a web service. + Tracking + Monitoring + This plugin facilitates extra customization of the map appearance enables more device-specific settings. + Extra Settings + This plugin enables development and debugging features like animated navigation or rendering performance display. + Osmand Development + Plugin Manager + Touch a Plugin to activate or deactivate it. (Restarting Osmand may be required.) + Plugins provide extra functionality already contained in the application like tracking, tile maps, screen off mode, accessibility settings, and others. + Plugin Manager Changes in 0.8.0 : \n\t- Plugin functionality \n\t- New offline map data support \n\t- Lots of bug fixes - This plugin is intented to improve OSM quality. It allows to collect/modify OSM POI objects, open/comment OSM bugs and send recorded GPX (requires OSM credentials). + This plugin facilitates OSM feedback. It allows to collect/modify OSM POI objects, open/comment OSM bugs, and contribute recorded GPX files (requires OSM credentials). Osm Editing Vector maps may display faster. May not work well on some devices. Simulate route progression manually Play commands of currently selected voice OsmAnd debugging and development Native rendering - Animate routing + Animate navigation Test voice prompts No offline vector map present for this location. You can download one in Settings (Offline data), or switch to online maps. Changes in 0.7.2 : @@ -130,11 +159,11 @@ Show and manage OSM POIs noted in local database Send tracking to a specified web service - Online Live Tracking - Specify Live Tracking interval - Live Tracking interval + Online live tracking + Specify live tracking interval + Live tracking interval Specify the web address with parameter syntax : lat={0}, lon={1}, timestamp={2}, hdop={3}, altitude={4}, speed={5} - Live Tracking web address + Live tracking web address Please enable \'Log track to GPX\' Tracking settings Show current track Changes in 0.7.0 : @@ -169,16 +198,13 @@ Profile Specific Settings User Profile Select a user profile. Each profile contains specific settings, which can be customized below. - - Map configuration - Configure maps and map sources - - Map appearance - Configure map display + - Tracking Specify tracking settings - Navigation Specify navigation options Global Settings - Offline Data + Offline Data (Download) Download and manage offline maps and other data such as GPX tracks General Settings Configure global settings @@ -187,7 +213,7 @@ Needed for openstreetmap.org submissions Your OSM password Needed for openstreetmap.org submissions - Background settings + Background Settings Use to run OsmAnd while screen is off @@ -419,8 +445,6 @@ None Overlay map Choose overlay map - Offline vector maps - Use downloaded vector maps Map is already installed, settings will be updated Select (tile) maps to install or update Internet connection required for operation is not available diff --git a/OsmAnd/res/xml/settings_pref.xml b/OsmAnd/res/xml/settings_pref.xml index 45d13407e7..8d9929d479 100644 --- a/OsmAnd/res/xml/settings_pref.xml +++ b/OsmAnd/res/xml/settings_pref.xml @@ -2,71 +2,20 @@ - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/OsmAnd/src/net/osmand/access/AccessibilityPlugin.java b/OsmAnd/src/net/osmand/access/AccessibilityPlugin.java new file mode 100644 index 0000000000..7c8821e189 --- /dev/null +++ b/OsmAnd/src/net/osmand/access/AccessibilityPlugin.java @@ -0,0 +1,115 @@ +package net.osmand.access; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SettingsActivity; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceCategory; +import android.preference.PreferenceScreen; + +public class AccessibilityPlugin extends OsmandPlugin { + private static final String ID = "osmand.accessibility"; + private OsmandSettings settings; + private OsmandApplication app; + private ListPreference accessibilityModePreference; + private ListPreference directionStylePreference; + + public AccessibilityPlugin(OsmandApplication app) { + this.app = app; + } + + @Override + public boolean init(OsmandApplication app) { + settings = app.getSettings(); + return true; + } + + @Override + public String getId() { + return ID; + } + @Override + public String getDescription() { + return app.getString(R.string.osmand_accessibility_description); + } + @Override + public String getName() { + return app.getString(R.string.osmand_accessibility_name); + } + @Override + public void registerLayers(MapActivity activity) { + } + + + @Override + public void settingsActivityUpdate(SettingsActivity activity) { + if(accessibilityModePreference != null) { + accessibilityModePreference.setSummary(app.getString(R.string.accessibility_mode_descr) + " [" + settings.ACCESSIBILITY_MODE.get().toHumanString(app) + "]"); + } + if(directionStylePreference != null) { + directionStylePreference.setSummary(app.getString(R.string.settings_direction_style_descr) + " [" + settings.DIRECTION_STYLE.get().toHumanString(app) + "]"); + } + } + + @Override + public void settingsActivityCreate(final SettingsActivity activity, final PreferenceScreen screen) { + PreferenceScreen grp = screen.getPreferenceManager().createPreferenceScreen(activity); + grp.setTitle(R.string.accessibility_preferences); + grp.setSummary(R.string.accessibility_preferences_descr); + grp.setKey("accessibility_preferences"); + ((PreferenceCategory)screen.findPreference("global_settings")).addPreference(grp); + + String[] entries = new String[AccessibilityMode.values().length]; + for (int i = 0; i < entries.length; i++) { + entries[i] = AccessibilityMode.values()[i].toHumanString(activity); + } + accessibilityModePreference = activity.createListPreference(settings.ACCESSIBILITY_MODE, entries, AccessibilityMode.values(), + R.string.accessibility_mode, R.string.accessibility_mode_descr); + accessibilityModePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + PreferenceCategory accessibilityOptions = ((PreferenceCategory)(screen.findPreference("accessibility_options"))); + if (accessibilityOptions != null) + accessibilityOptions.setEnabled(app.accessibilityEnabled()); + accessibilityModePreference.setSummary(app.getString(R.string.accessibility_mode_descr) + " [" + settings.ACCESSIBILITY_MODE.get().toHumanString(app) + "]"); + return true; + } + }); + + grp.addPreference(accessibilityModePreference); + PreferenceCategory cat = new PreferenceCategory(activity); + cat.setKey("accessibility_options"); + grp.addPreference(cat); + + entries = new String[RelativeDirectionStyle.values().length]; + for (int i = 0; i < entries.length; i++) { + entries[i] = RelativeDirectionStyle.values()[i].toHumanString(activity); + } + directionStylePreference = activity.createListPreference(settings.DIRECTION_STYLE, entries, RelativeDirectionStyle.values(), + R.string.settings_direction_style, R.string.settings_direction_style_descr); + directionStylePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + directionStylePreference.setSummary(app.getString(R.string.settings_direction_style_descr) + " [" + settings.DIRECTION_STYLE.get().toHumanString(app) + "]"); + return true; + } + }); + cat.addPreference(directionStylePreference); + + cat.addPreference(activity.createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball, + R.string.zoom_by_trackball_descr)); + cat.addPreference(activity.createCheckBoxPreference(settings.SCROLL_MAP_BY_GESTURES, R.string.scroll_map_by_gestures, + R.string.scroll_map_by_gestures_descr)); + cat.addPreference(activity.createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.use_short_object_names, + R.string.use_short_object_names_descr)); + cat.addPreference(activity.createCheckBoxPreference(settings.ACCESSIBILITY_EXTENSIONS, R.string.accessibility_extensions, + R.string.accessibility_extensions)); + } + + +} diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index f589f7d20f..e5f1354f89 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -1,15 +1,17 @@ package net.osmand.plus; +import gnu.trove.list.array.TIntArrayList; + import java.util.ArrayList; -import gnu.trove.list.array.TIntArrayList; import android.content.Context; +import android.content.DialogInterface; public class ContextMenuAdapter { public interface OnContextMenuClick { - public void onContextMenuClick(int itemId, int pos, boolean isChecked); + public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog); } private final Context ctx; diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 15f9424bb4..91de332b0c 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -7,9 +7,18 @@ import java.util.Set; import org.apache.commons.logging.Log; +import android.preference.PreferenceScreen; + import net.osmand.LogUtil; +import net.osmand.access.AccessibilityPlugin; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SettingsActivity; +import net.osmand.plus.background.OsmandBackgroundServicePlugin; +import net.osmand.plus.development.OsmandDevelopmentPlugin; +import net.osmand.plus.extrasettings.OsmandExtraSettings; +import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.osmedit.OsmEditingPlugin; +import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.views.OsmandMapTileView; public abstract class OsmandPlugin { @@ -34,10 +43,20 @@ public abstract class OsmandPlugin { */ public abstract boolean init(OsmandApplication app); + public void disable(OsmandApplication app) {}; + public static void initPlugins(OsmandApplication app) { OsmandSettings settings = app.getSettings(); + OsmandRasterMapsPlugin rasterMapsPlugin = new OsmandRasterMapsPlugin(app); + installedPlugins.add(rasterMapsPlugin); + installedPlugins.add(new OsmandMonitoringPlugin(app)); installedPlugins.add(new OsmEditingPlugin(app)); + installedPlugins.add(new OsmandBackgroundServicePlugin(app)); + installedPlugins.add(new AccessibilityPlugin(app)); + installedPlugins.add(new OsmandExtraSettings(app)); + installedPlugins.add(new OsmandDevelopmentPlugin(app)); + Set enabledPlugins = settings.getEnabledPlugins(); for (OsmandPlugin plugin : installedPlugins) { if (enabledPlugins.contains(plugin.getId())) { @@ -52,17 +71,21 @@ public abstract class OsmandPlugin { } } - /** - * ???? - */ - public abstract void updateLayers(OsmandMapTileView mapView); - - public static void refreshLayers(OsmandMapTileView mapView) { - for (OsmandPlugin plugin : activePlugins) { - plugin.updateLayers(mapView); + public static boolean enablePlugin(OsmandApplication app, OsmandPlugin plugin, boolean enable) { + if (enable) { + if (!plugin.init(app)) { + return false; + } + activePlugins.add(plugin); + } else { + plugin.disable(app); + activePlugins.remove(plugin); } + app.getSettings().enablePlugin(plugin.getId(), enable); + return true; } - + + public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {}; public abstract void registerLayers(MapActivity activity); @@ -74,10 +97,21 @@ public abstract class OsmandPlugin { public void mapActivityDestroy(MapActivity activity) { } + public void settingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {} - public abstract void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter); + public void settingsActivityDestroy(final SettingsActivity activity){} - public abstract void registerMapContextMenuActions(MapActivity mapActivity, double latitude, double longitude, ContextMenuAdapter adapter, Object selectedObj); + public void settingsActivityUpdate(final SettingsActivity activity){} + + public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, MapActivity mapActivity) {} + + public void registerMapContextMenuActions(MapActivity mapActivity, double latitude, double longitude, ContextMenuAdapter adapter, Object selectedObj) {} + + public static void refreshLayers(OsmandMapTileView mapView, MapActivity activity) { + for (OsmandPlugin plugin : activePlugins) { + plugin.updateLayers(mapView, activity); + } + } public static List getAvailablePlugins(){ return installedPlugins; @@ -122,6 +156,25 @@ public abstract class OsmandPlugin { } + public static void onSettingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) { + for (OsmandPlugin plugin : activePlugins) { + plugin.settingsActivityCreate(activity, screen); + } + } + + public static void onSettingsActivityDestroy(SettingsActivity activity) { + for (OsmandPlugin plugin : activePlugins) { + plugin.settingsActivityDestroy(activity); + } + } + + public static void onSettingsActivityUpdate(SettingsActivity activity) { + for (OsmandPlugin plugin : activePlugins) { + plugin.settingsActivityUpdate(activity); + } + } + + public static void createLayers(OsmandMapTileView mapView, MapActivity activity) { for (OsmandPlugin plugin : activePlugins) { plugin.registerLayers(activity); @@ -134,9 +187,10 @@ public abstract class OsmandPlugin { } } - public static void registerLayerContextMenu(OsmandMapTileView mapView, ContextMenuAdapter adapter) { + public static void registerLayerContextMenu(OsmandMapTileView mapView, ContextMenuAdapter adapter, MapActivity mapActivity) { for (OsmandPlugin plugin : activePlugins) { - plugin.registerLayerContextMenuActions(mapView, adapter); + plugin.registerLayerContextMenuActions(mapView, adapter, mapActivity); } } + } diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 9db71877c7..e9ab79051f 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -545,8 +545,6 @@ public class OsmandSettings { public final OsmandPreference OFFLINE_POI_EDITION = new BooleanPreference("offline_poi_edition", false, true); - public static final String LOCAL_OPENSTREETMAP_POINTS = "local_openstreetmap_points"; - // this value string is synchronized with settings_pref.xml preference name public final CommonPreference DAYNIGHT_MODE = @@ -575,11 +573,6 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final CommonPreference SAVE_TRACK_TO_GPX = new BooleanPreference("save_track_to_gpx", false, false); - { - SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.CAR, true); - SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.BICYCLE, true); - SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true); - } // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true, false); @@ -691,24 +684,24 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public final CommonPreference MAP_VECTOR_DATA = new BooleanPreference("map_vector_data", - false, false); + public final CommonPreference MAP_ONLINE_DATA = new BooleanPreference("map_online_data", + false, true); // this value string is synchronized with settings_pref.xml preference name public final CommonPreference MAP_OVERLAY = new StringPreference("map_overlay", - null, false); + null, true); // this value string is synchronized with settings_pref.xml preference name public final CommonPreference MAP_UNDERLAY = new StringPreference("map_underlay", - null, false); + null, true); // this value string is synchronized with settings_pref.xml preference name public final CommonPreference MAP_OVERLAY_TRANSPARENCY = new IntPreference("overlay_transparency", - 200, false); + 200, true); // this value string is synchronized with settings_pref.xml preference name public final CommonPreference MAP_TRANSPARENCY = new IntPreference("map_transparency", - 255, false); + 255, true); // this value string is synchronized with settings_pref.xml preference name public final CommonPreference MAP_TILE_SOURCES = new StringPreference("map_tile_sources", diff --git a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java index 9842cc144d..9d1c7764dd 100644 --- a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java @@ -620,11 +620,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity { if (vectorMapsToReindex) { ResourceManager manager = getMyApplication().getResourceManager(); List warnings = manager.indexingMaps(progress); - if (warnings.isEmpty() && !settings.MAP_VECTOR_DATA.get()) { - warnings.add(getString(R.string.binary_map_download_success)); - // Is it proper way to switch every tome to vector data? - settings.MAP_VECTOR_DATA.set(true); - } if (!warnings.isEmpty()) { return warnings.get(0); } diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java index e3f584d91b..549a34e14f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java @@ -13,13 +13,15 @@ import java.util.Set; import net.osmand.Algoritms; import net.osmand.GPXUtilities.WptPt; import net.osmand.IProgress; -import net.osmand.OpenstreetmapRemoteUtil; import net.osmand.access.AccessibleToast; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.ResourceManager; import net.osmand.plus.activities.LocalIndexHelper.LocalIndexInfo; import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType; +import net.osmand.plus.development.OsmandDevelopmentPlugin; +import net.osmand.plus.osmedit.OpenstreetmapRemoteUtil; import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; @@ -166,7 +168,9 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity { final List menu = new ArrayList(); if(info.getType() == LocalIndexType.GPX_DATA){ menu.add(R.string.show_gpx_route); - menu.add(R.string.local_index_mi_upload_gpx); + if(OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) instanceof OsmandDevelopmentPlugin) { + menu.add(R.string.local_index_mi_upload_gpx); + } descriptionLoader = new LoadLocalIndexDescriptionTask(); descriptionLoader.execute(info); } @@ -442,6 +446,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity { if (!isCancelled()) { String warning = null; File file = new File(info.getPathToData()); + // FIXME should be plugin functionality and do not use remote util directly warning = new OpenstreetmapRemoteUtil(LocalIndexesActivity.this, null).uploadGPXFile(tagstring, description, visibility, file); total++; if (warning == null) { @@ -557,7 +562,9 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity { menu.add(0, R.string.local_index_mi_restore, 1, getString(R.string.local_index_mi_restore)+"..."); menu.add(0, R.string.local_index_mi_delete, 2, getString(R.string.local_index_mi_delete)+"..."); menu.add(0, R.string.local_index_mi_reload, 3, R.string.local_index_mi_reload); - menu.add(0, R.string.local_index_mi_upload_gpx, 4, getString(R.string.local_index_mi_upload_gpx)+"..."); + if(OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) instanceof OsmandDevelopmentPlugin) { + menu.add(0, R.string.local_index_mi_upload_gpx, 4, getString(R.string.local_index_mi_upload_gpx)+"..."); + } return true; } diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index e3703f7899..c3e180ce90 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -164,16 +164,6 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe startProgressDialog = new ProgressDialog(this); startProgressDialog.setCancelable(true); ((OsmandApplication) getApplication()).checkApplicationIsBeingInitialized(this, startProgressDialog); - // Do some action on close - startProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - OsmandApplication app = ((OsmandApplication) getApplication()); - if (settings.MAP_VECTOR_DATA.get() && app.getResourceManager().getRenderer().isEmpty()) { - AccessibleToast.makeText(MapActivity.this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show(); - } - } - }); parseLaunchIntentLocation(); mapView = (OsmandMapTileView) findViewById(R.id.MapView); @@ -183,7 +173,14 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe showAndHideMapPosition(); return MapActivity.this.onTrackballEvent(e); } - + }); + + // Do some action on close + startProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + mapView.refreshMap(); + } }); getMyApplication().getResourceManager().getMapTileDownloader().addDownloaderCallback(new IMapDownloaderCallback(){ @@ -260,7 +257,6 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe setVolumeControlStream(AudioManager.STREAM_MUSIC); } - mapLayers.updateMapSource(mapView, null); updateApplicationModeSettings(); mapLayers.getPoiMapLayer().setFilter(settings.getPoiFilterForMap((OsmandApplication) getApplication())); @@ -1001,7 +997,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe registerUnregisterSensor(getLastKnownLocation()); mapLayers.getMapInfoLayer().applyTheme(); mapLayers.updateLayers(mapView); - mapLayers.updateMapSource(mapView, settings.MAP_TILE_SOURCES); + getMyApplication().getDaynightHelper().setDayNightMode(settings.DAYNIGHT_MODE.get()); } diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 67377c6c15..68e0688652 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -200,7 +200,7 @@ public class MapActivityActions implements DialogProvider { return b.create(); } - protected void addWaypoint(final double latitude, final double longitude){ + public void addWaypoint(final double latitude, final double longitude){ String name = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectName(); enhance(dialogBundle,latitude,longitude, name); mapActivity.showDialog(DIALOG_ADD_WAYPOINT); @@ -234,58 +234,13 @@ public class MapActivityActions implements DialogProvider { return builder.create(); } - protected void reloadTile(final int zoom, final double latitude, final double longitude){ + public void reloadTile(final int zoom, final double latitude, final double longitude){ enhance(dialogBundle,latitude,longitude,zoom); mapActivity.showDialog(DIALOG_RELOAD_TITLE); } - private Dialog createReloadTitleDialog(final Bundle args) { - Builder builder = new AccessibleAlertBuilder(mapActivity); - builder.setMessage(R.string.context_menu_item_update_map_confirm); - builder.setNegativeButton(R.string.default_buttons_cancel, null); - final OsmandMapTileView mapView = mapActivity.getMapView(); - builder.setPositiveButton(R.string.context_menu_item_update_map, new DialogInterface.OnClickListener(){ - @Override - public void onClick(DialogInterface dialog, int which) { - int zoom = args.getInt(KEY_ZOOM); - BaseMapLayer mainLayer = mapView.getMainLayer(); - if(!(mainLayer instanceof MapTileLayer) || !((MapTileLayer) mainLayer).isVisible()){ - AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show(); - return; - } - final ITileSource mapSource = ((MapTileLayer) mainLayer).getMap(); - if(mapSource == null || !mapSource.couldBeDownloadedFromInternet()){ - AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show(); - return; - } - Rect pixRect = new Rect(0, 0, mapView.getWidth(), mapView.getHeight()); - RectF tilesRect = new RectF(); - mapView.calculateTileRectangle(pixRect, mapView.getCenterPointX(), mapView.getCenterPointY(), - mapView.getXTile(), mapView.getYTile(), tilesRect); - int left = (int) FloatMath.floor(tilesRect.left); - int top = (int) FloatMath.floor(tilesRect.top); - int width = (int) (FloatMath.ceil(tilesRect.right) - left); - int height = (int) (FloatMath.ceil(tilesRect.bottom) - top); - for (int i = 0; i preference, float layerOrder, boolean warnWhenSelected) { - ITileSource overlay = settings.getTileSourceByName(preference.get(), warnWhenSelected); - if(!Algoritms.objectEquals(overlay, layer.getMap())){ - if(overlay == null){ - mapView.removeLayer(layer); - } else { - mapView.addLayer(layer, layerOrder); - } - layer.setMap(overlay); - mapView.refreshMap(); - } - } public void openLayerSelectionDialog(final OsmandMapTileView mapView){ final OsmandSettings settings = getApplication().getSettings(); final ContextMenuAdapter adapter = new ContextMenuAdapter(activity); - adapter.registerSelectedItem(R.string.layer_map, -1, R.drawable.list_activities_map_src); adapter.registerSelectedItem(R.string.layer_poi, settings.SHOW_POI_OVER_MAP.get() ? 1 : 0, R.drawable.list_activities_poi); adapter.registerSelectedItem(R.string.layer_poi_label, settings.SHOW_POI_LABEL.get() ? 1 : 0, @@ -270,12 +240,7 @@ public class MapActivityLayers { } - adapter.registerSelectedItem(R.string.layer_overlay, overlayLayer.getMap() != null ? 1 : 0, - R.drawable.list_activities_overlay_map); - adapter.registerSelectedItem(R.string.layer_underlay, underlayLayer.getMap() != null ? 1 : 0, - R.drawable.list_activities_underlay_map); - - OsmandPlugin.registerLayerContextMenu(mapView, adapter); + OsmandPlugin.registerLayerContextMenu(mapView, adapter, activity); final OnMultiChoiceClickListener listener = new DialogInterface.OnMultiChoiceClickListener() { @@ -284,10 +249,7 @@ public class MapActivityLayers { int itemId = adapter.getItemId(item); OnContextMenuClick clck = adapter.getClickAdapter(item); if(clck != null) { - clck.onContextMenuClick(itemId, item, isChecked); - } else if (itemId == R.string.layer_map) { - dialog.dismiss(); - selectMapLayer(mapView); + clck.onContextMenuClick(itemId, item, isChecked, dialog); } else if(itemId == R.string.layer_poi){ if(isChecked){ selectPOIFilterLayer(mapView); @@ -311,24 +273,6 @@ public class MapActivityLayers { transportInfoLayer.setVisible(isChecked); } else if(itemId == R.string.layer_transport){ settings.SHOW_TRANSPORT_OVER_MAP.set(isChecked); - } else if(itemId == R.string.layer_overlay){ - if(overlayLayer.getMap() != null){ - settings.MAP_OVERLAY.set(null); - updateMapSource(mapView, null); - } else { - dialog.dismiss(); - selectMapOverlayLayer(mapView, settings.MAP_OVERLAY, settings.MAP_OVERLAY_TRANSPARENCY, - overlayLayer); - } - } else if(itemId == R.string.layer_underlay){ - if(underlayLayer.getMap() != null){ - settings.MAP_UNDERLAY.set(null); - updateMapSource(mapView, null); - } else { - dialog.dismiss(); - selectMapOverlayLayer(mapView, settings.MAP_UNDERLAY,settings.MAP_TRANSPARENCY, - mapTileLayer, mapVectorLayer); - } } updateLayers(mapView); mapView.refreshMap(); @@ -561,10 +505,15 @@ public class MapActivityLayers { } public void selectMapLayer(final OsmandMapTileView mapView){ + if(OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) { + AccessibleToast.makeText(activity, R.string.map_online_plugin_is_not_installed, Toast.LENGTH_LONG).show(); + return; + } final OsmandSettings settings = getApplication().getSettings(); final LinkedHashMap entriesMap = new LinkedHashMap(); + final String layerOsmVector = "LAYER_OSM_VECTOR"; final String layerInstallMore = "LAYER_INSTALL_MORE"; @@ -579,7 +528,7 @@ public class MapActivityLayers { String selectedTileSourceKey = settings.MAP_TILE_SOURCES.get(); int selectedItem = -1; - if (settings.MAP_VECTOR_DATA.get()) { + if (!settings.MAP_ONLINE_DATA.get()) { selectedItem = 0; } else { @@ -608,13 +557,7 @@ public class MapActivityLayers { public void onClick(DialogInterface dialog, int which) { String layerKey = entriesMapList.get(which).getKey(); if (layerKey.equals(layerOsmVector)) { - MapRenderRepositories r = ((OsmandApplication) getApplication()).getResourceManager().getRenderer(); - if (r.isEmpty()) { - AccessibleToast.makeText(activity, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show(); - return; - } else { - settings.MAP_VECTOR_DATA.set(true); - } + settings.MAP_ONLINE_DATA.set(false); updateMapSource(mapView, null); } else if (layerKey.equals(layerInstallMore)) { SettingsActivity.installMapLayers(activity, new ResultMatcher() { @@ -625,7 +568,7 @@ public class MapActivityLayers { if(object == null){ if(count == 1){ settings.MAP_TILE_SOURCES.set(template.getName()); - settings.MAP_VECTOR_DATA.set(false); + settings.MAP_ONLINE_DATA.set(true); updateMapSource(mapView, settings.MAP_TILE_SOURCES); } else { selectMapLayer(mapView); @@ -644,7 +587,7 @@ public class MapActivityLayers { }); } else { settings.MAP_TILE_SOURCES.set(layerKey); - settings.MAP_VECTOR_DATA.set(false); + settings.MAP_ONLINE_DATA.set(true); updateMapSource(mapView, settings.MAP_TILE_SOURCES); } @@ -655,62 +598,6 @@ public class MapActivityLayers { builder.show(); } - private void selectMapOverlayLayer(final OsmandMapTileView mapView, - final CommonPreference mapPref, final CommonPreference transparencyPref, - final BaseMapLayer... transparencyToChange){ - final OsmandSettings settings = getApplication().getSettings(); - Map entriesMap = settings.getTileSourceEntries(); - final ArrayList keys = new ArrayList(entriesMap.keySet()); - Builder builder = new AlertDialog.Builder(activity); - final String[] items = new String[entriesMap.size() + 1]; - int i = 0; - for(String it : entriesMap.values()){ - items[i++] = it; - } - - items[i] = getString(R.string.install_more); - builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener(){ - @Override - public void onClick(DialogInterface dialog, int which) { - if (which == items.length - 1){ - SettingsActivity.installMapLayers(activity, new ResultMatcher() { - TileSourceTemplate template = null; - int count = 0; - @Override - public boolean publish(TileSourceTemplate object) { - if(object == null){ - if(count == 1){ - mapPref.set(template.getName()); - mapControlsLayer.showAndHideTransparencyBar(transparencyPref, transparencyToChange); - updateMapSource(mapView, mapPref); - } else { - selectMapOverlayLayer(mapView, mapPref, transparencyPref, transparencyToChange); - } - } else { - count ++; - template = object; - } - return false; - } - - @Override - public boolean isCancelled() { - return false; - } - }); - } else { - mapPref.set(keys.get(which)); - mapControlsLayer.showAndHideTransparencyBar(transparencyPref, transparencyToChange); - updateMapSource(mapView, mapPref); - } - - dialog.dismiss(); - } - - }); - builder.show(); - } - private String getString(int resId) { return activity.getString(resId); @@ -739,6 +626,18 @@ public class MapActivityLayers { return mapInfoLayer; } + public MapControlsLayer getMapControlsLayer() { + return mapControlsLayer; + } + + public MapTileLayer getMapTileLayer() { + return mapTileLayer; + } + + public MapVectorLayer getMapVectorLayer() { + return mapVectorLayer; + } + public POIMapLayer getPoiMapLayer() { return poiMapLayer; } diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java b/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java index bd5b313890..ed521e3d8f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java @@ -17,6 +17,7 @@ import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; +import android.widget.Toast; public class PluginsActivity extends OsmandListActivity { @@ -45,14 +46,16 @@ public class PluginsActivity extends OsmandListActivity { protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); OsmandPlugin item = getListAdapter().getItem(position); - boolean enable = true; - if(restartPlugins.contains(item.getId())) { - restartPlugins.remove(item.getId()); - enable = false; - } else { - restartPlugins.add(item.getId()); + boolean enable = !restartPlugins.contains(item.getId()); + + boolean ok = OsmandPlugin.enablePlugin(((OsmandApplication) getApplication()), item, enable); + if (ok) { + if (!enable) { + restartPlugins.remove(item.getId()); + } else { + restartPlugins.add(item.getId()); + } } - ((OsmandApplication) getApplication()).getSettings().enablePlugin(item.getId(), enable); getListAdapter().notifyDataSetInvalidated(); } @@ -86,9 +89,9 @@ public class PluginsActivity extends OsmandListActivity { description.setText(plugin.getDescription()); boolean enabled = enabledPlugins.contains(plugin.getId()); boolean toBeEnabled = restartPlugins.contains(plugin.getId()); - description.setTextColor(toBeEnabled? colorGreen : Color.GRAY); - nameView.setTextColor(toBeEnabled? colorGreen : Color.GRAY); - description.setTypeface(enabled? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); + description.setTextColor(toBeEnabled? colorGreen : Color.LTGRAY); + nameView.setTextColor(toBeEnabled? colorGreen : Color.LTGRAY); +// description.setTypeface(enabled? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); nameView.setTypeface(enabled? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); return row; diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index 94f79b77c8..d7648e40d7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -12,13 +12,11 @@ import java.util.Set; import net.osmand.ResultMatcher; import net.osmand.Version; -import net.osmand.access.AccessibilityMode; import net.osmand.access.AccessibleToast; -import net.osmand.access.RelativeDirectionStyle; import net.osmand.map.TileSourceManager; import net.osmand.map.TileSourceManager.TileSourceTemplate; -import net.osmand.plus.NavigationService; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.OsmandSettings.DayNightMode; @@ -27,7 +25,6 @@ import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.ProgressDialogImplementation; import net.osmand.plus.R; import net.osmand.plus.ResourceManager; -import net.osmand.plus.render.MapRenderRepositories; import net.osmand.plus.render.NativeOsmandLibrary; import net.osmand.plus.routing.RouteProvider.RouteService; import net.osmand.plus.views.SeekBarPreference; @@ -37,16 +34,10 @@ import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.ProgressDialog; -import android.content.BroadcastReceiver; -import android.content.ComponentName; -import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; -import android.content.IntentFilter; import android.content.pm.ActivityInfo; -import android.location.LocationManager; -import android.media.AudioManager; import android.os.AsyncTask; import android.os.Bundle; import android.preference.CheckBoxPreference; @@ -67,30 +58,21 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference public static final int SCREEN_NAVIGATION_SETTINGS = 2; public static final int SCREEN_MONITORING_SETTINGS = 3; - private static final String MORE_VALUE = "MORE_VALUE"; + public static final String SCREEN_ID_GENERAL_SETTINGS = "general_settings"; + public static final String SCREEN_ID_NAVIGATION_SETTINGS = "routing_settings"; + public static final String SCREEN_ID_MONITORING_SETTINGS = "monitor_settings"; + public static final String MORE_VALUE = "MORE_VALUE"; - private Preference saveCurrentTrack; - private Preference testVoiceCommands; - private Preference localOpenstreetmapPoints; private Preference bidforfix; private Preference plugins; private EditTextPreference applicationDir; private ListPreference applicationModePreference; - private ListPreference tileSourcePreference; - private ListPreference overlayPreference; - private ListPreference underlayPreference; private ListPreference dayNightModePreference; private ListPreference routerServicePreference; - private ListPreference accessibilityModePreference; - private ListPreference directionStylePreference; - - private CheckBoxPreference routeServiceEnabled; - private BroadcastReceiver broadcastReceiver; - - private ProgressDialog progressDlg; + public ProgressDialog progressDlg; private OsmandSettings osmandSettings; @@ -102,7 +84,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference private Map> listPrefValues = new LinkedHashMap>(); - private CheckBoxPreference registerBooleanPreference(OsmandPreference b, PreferenceScreen screen){ + public CheckBoxPreference registerBooleanPreference(OsmandPreference b, PreferenceScreen screen){ CheckBoxPreference p = (CheckBoxPreference) screen.findPreference(b.getId()); p.setOnPreferenceChangeListener(this); screenPreferences.put(b.getId(), p); @@ -110,15 +92,49 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference return p; } - private void registerSeekBarPreference(OsmandPreference b, PreferenceScreen screen){ + public CheckBoxPreference createCheckBoxPreference(OsmandPreference b, int title, int summary){ + CheckBoxPreference p = new CheckBoxPreference(this); + p.setTitle(title); + p.setSummary(summary); + p.setOnPreferenceChangeListener(this); + screenPreferences.put(b.getId(), p); + booleanPreferences.put(b.getId(), b); + return p; + } + + public void registerSeekBarPreference(OsmandPreference b, PreferenceScreen screen){ SeekBarPreference p = (SeekBarPreference) screen.findPreference(b.getId()); p.setOnPreferenceChangeListener(this); screenPreferences.put(b.getId(), p); seekBarPreferences.put(b.getId(), b); } - private void registerListPreference(OsmandPreference b, PreferenceScreen screen, String[] names, T[] values){ + public SeekBarPreference createSeekBarPreference(OsmandPreference b, int title, int summary, int dialogTextId, + int defValue, int maxValue){ + SeekBarPreference p = new SeekBarPreference(this, dialogTextId, defValue, maxValue); + p.setTitle(title); + p.setSummary(summary); + p.setOnPreferenceChangeListener(this); + screenPreferences.put(b.getId(), p); + seekBarPreferences.put(b.getId(), b); + return p; + } + + public void registerListPreference(OsmandPreference b, PreferenceScreen screen, String[] names, T[] values){ ListPreference p = (ListPreference) screen.findPreference(b.getId()); + prepareListPreference(b, names, values, p); + } + + public ListPreference createListPreference(OsmandPreference b, String[] names, T[] values, int title, int summary){ + ListPreference p = new ListPreference(this); + p.setTitle(title); + p.setDialogTitle(title); + p.setSummary(summary); + prepareListPreference(b, names, values, p); + return p; + } + + private void prepareListPreference(OsmandPreference b, String[] names, T[] values, ListPreference p) { p.setOnPreferenceChangeListener(this); LinkedHashMap vals = new LinkedHashMap(); screenPreferences.put(b.getId(), p); @@ -130,14 +146,26 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference } } - private void registerEditTextPreference(OsmandPreference b, PreferenceScreen screen){ + public void registerEditTextPreference(OsmandPreference b, PreferenceScreen screen){ EditTextPreference p = (EditTextPreference) screen.findPreference(b.getId()); p.setOnPreferenceChangeListener(this); screenPreferences.put(b.getId(), p); editTextPreferences.put(b.getId(), b); } - private void registerTimeListPreference(OsmandPreference b, PreferenceScreen screen, int[] seconds, int[] minutes, int coeff){ + public EditTextPreference createEditTextPreference(OsmandPreference b, int title, int summary){ + EditTextPreference p = new EditTextPreference(this); + p.setTitle(title); + p.setDialogTitle(title); + p.setSummary(summary); + p.setOnPreferenceChangeListener(this); + screenPreferences.put(b.getId(), p); + editTextPreferences.put(b.getId(), b); + return p; + } + + + public void registerTimeListPreference(OsmandPreference b, PreferenceScreen screen, int[] seconds, int[] minutes, int coeff){ int minutesLength = minutes == null? 0 : minutes.length; int secondsLength = seconds == null? 0 : seconds.length; Integer[] ints = new Integer[secondsLength + minutesLength]; @@ -153,6 +181,22 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference registerListPreference(b, screen, intDescriptions, ints); } + public ListPreference createTimeListPreference(OsmandPreference b, int[] seconds, int[] minutes, int coeff, int title, int summary){ + int minutesLength = minutes == null? 0 : minutes.length; + int secondsLength = seconds == null? 0 : seconds.length; + Integer[] ints = new Integer[secondsLength + minutesLength]; + String[] intDescriptions = new String[ints.length]; + for (int i = 0; i < secondsLength; i++) { + ints[i] = seconds[i] * coeff; + intDescriptions[i] = seconds[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$ + } + for (int i = 0; i < minutesLength; i++) { + ints[secondsLength + i] = (minutes[i] * 60) * coeff; + intDescriptions[secondsLength + i] = minutes[i] + " " + getString(R.string.int_min); //$NON-NLS-1$ + } + return createListPreference(b, intDescriptions, ints, title, summary); + } + private Set getVoiceFiles(){ // read available voice data File extStorage = osmandSettings.extendOsmandPath(ResourceManager.VOICE_PATH); @@ -181,45 +225,23 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference // BidForFixHelper bidForFixHelper = getMyApplication().getBidForFix(); // bidForFixHelper.generatePreferenceList(screen, getString(R.string.support_new_features), this); + OsmandPlugin.onSettingsActivityCreate(this, screen); registerBooleanPreference(osmandSettings.SHOW_VIEW_ANGLE,screen); - registerBooleanPreference(osmandSettings.USE_TRACKBALL_FOR_MOVEMENTS,screen); - registerBooleanPreference(osmandSettings.ZOOM_BY_TRACKBALL,screen); - registerBooleanPreference(osmandSettings.SCROLL_MAP_BY_GESTURES,screen); - registerBooleanPreference(osmandSettings.USE_SHORT_OBJECT_NAMES,screen); - registerBooleanPreference(osmandSettings.ACCESSIBILITY_EXTENSIONS,screen); - registerBooleanPreference(osmandSettings.USE_HIGH_RES_MAPS,screen); registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen); registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen); - // try without AUTO_FOLLOW_ROUTE_NAV (see forum discussion 'Simplify our navigation preference menu') - //registerBooleanPreference(osmandSettings.AUTO_FOLLOW_ROUTE_NAV,screen); - registerBooleanPreference(osmandSettings.SAVE_TRACK_TO_GPX,screen); - registerBooleanPreference(osmandSettings.LIVE_MONITORING,screen); - registerBooleanPreference(osmandSettings.DEBUG_RENDERING_INFO,screen); registerBooleanPreference(osmandSettings.FAST_ROUTE_MODE,screen); registerBooleanPreference(osmandSettings.USE_OSMAND_ROUTING_SERVICE_ALWAYS,screen); - registerBooleanPreference(osmandSettings.USE_INTERNET_TO_DOWNLOAD_TILES,screen); - registerBooleanPreference(osmandSettings.MAP_VECTOR_DATA,screen); - registerBooleanPreference(osmandSettings.TRANSPARENT_MAP_THEME,screen); - registerBooleanPreference(osmandSettings.TEST_ANIMATE_ROUTING,screen); + + registerBooleanPreference(osmandSettings.SHOW_ALTITUDE_INFO,screen); - registerBooleanPreference(osmandSettings.FLUORESCENT_OVERLAYS,screen); - registerBooleanPreference(osmandSettings.SHOW_RULER,screen); + CheckBoxPreference nativeCheckbox = registerBooleanPreference(osmandSettings.NATIVE_RENDERING,screen); //disable the checkbox if the library cannot be used if ((NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) || osmandSettings.NATIVE_RENDERING_FAILED.get()) { nativeCheckbox.setEnabled(false); } - - registerEditTextPreference(osmandSettings.USER_NAME, screen); - registerEditTextPreference(osmandSettings.USER_PASSWORD, screen); - registerBooleanPreference(osmandSettings.OFFLINE_POI_EDITION, screen); - registerEditTextPreference(osmandSettings.LIVE_MONITORING_URL, screen); - - - registerSeekBarPreference(osmandSettings.MAP_OVERLAY_TRANSPARENCY, screen); - registerSeekBarPreference(osmandSettings.MAP_TRANSPARENCY, screen); // List preferences registerListPreference(osmandSettings.ROTATE_MAP, screen, @@ -230,14 +252,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference new String[] {getString(R.string.map_orientation_portrait), getString(R.string.map_orientation_landscape), getString(R.string.map_orientation_default)}, new Integer[] {ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED}); - registerListPreference(osmandSettings.POSITION_ON_MAP, screen, - new String[] {getString(R.string.position_on_map_center), getString(R.string.position_on_map_bottom)}, - new Integer[] {OsmandSettings.CENTER_CONSTANT, OsmandSettings.BOTTOM_CONSTANT}); - - registerListPreference(osmandSettings.AUDIO_STREAM_GUIDANCE, screen, - new String[] {getString(R.string.voice_stream_music), getString(R.string.voice_stream_notification), - getString(R.string.voice_stream_voice_call)}, - new Integer[] {AudioManager.STREAM_MUSIC, AudioManager.STREAM_NOTIFICATION, AudioManager.STREAM_VOICE_CALL}); entries = new String[DayNightMode.values().length]; for(int i=0; i custom = getMyApplication().getSettings().getCustomRenderProperty(p.getAttrName()); - ListPreference lp = new ListPreference(this); - lp.setOnPreferenceChangeListener(this); - lp.setKey(custom.getId()); - lp.setTitle(p.getName()); - lp.setSummary(p.getDescription()); - cat.addPreference(lp); - - LinkedHashMap vals = new LinkedHashMap(); - screenPreferences.put(custom.getId(), lp); - listPreferences.put(custom.getId(), custom); - listPrefValues.put(custom.getId(), vals); - String[] names = p.getPossibleValues(); - for(int i=0; i custom = getMyApplication().getSettings().getCustomRenderProperty(p.getAttrName()); + ListPreference lp = new ListPreference(this); + lp.setOnPreferenceChangeListener(this); + lp.setKey(custom.getId()); + lp.setTitle(p.getName()); + lp.setSummary(p.getDescription()); + cat.addPreference(lp); + + LinkedHashMap vals = new LinkedHashMap(); + screenPreferences.put(custom.getId(), lp); + listPreferences.put(custom.getId(), custom); + listPrefValues.put(custom.getId(), vals); + String[] names = p.getPossibleValues(); + for (int i = 0; i < names.length; i++) { + vals.put(names[i], names[i]); + } + + } + if (update) { + updateAllSettings(); } - - } - if(update) { - updateAllSettings(); } } @@ -476,8 +418,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference @Override protected void onDestroy() { + OsmandPlugin.onSettingsActivityDestroy(this); super.onDestroy(); - unregisterReceiver(broadcastReceiver); } public void updateAllSettings(){ @@ -514,83 +456,16 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference pref.setText(s.get()); } - // Specific properties - routeServiceEnabled.setChecked(getMyApplication().getNavigationService() != null); - - updateTileSourceSummary(); + OsmandPlugin.onSettingsActivityUpdate(this); updateApplicationDirTextAndSummary(); applicationModePreference.setTitle(getString(R.string.settings_preset) + " [" + osmandSettings.APPLICATION_MODE.get().toHumanString(this) + "]"); dayNightModePreference.setSummary(getString(R.string.daynight_descr) + " [" + osmandSettings.DAYNIGHT_MODE.get().toHumanString(this) + "]"); routerServicePreference.setSummary(getString(R.string.router_service_descr) + " [" + osmandSettings.ROUTER_SERVICE.get() + "]"); - - accessibilityModePreference.setSummary(getString(R.string.accessibility_mode_descr) + " [" + osmandSettings.ACCESSIBILITY_MODE.get().toHumanString(this) + "]"); - directionStylePreference.setSummary(getString(R.string.settings_direction_style_descr) + " [" + osmandSettings.DIRECTION_STYLE.get().toHumanString(this) + "]"); - -/* - // TODO: Add Profile name to screen title (only, not to Preference title) of Profile specific settings - PreferenceScreen screen = getPreferenceScreen(); - if (screen.getKey().toString().equals("map_settings")) { - screen.setTitle(getString(R.string.rendering_settings) + " [" + ApplicationMode.toHumanString(osmandSettings.APPLICATION_MODE.get(), this) + "]"); - } else if (screen.getKey().toString().equals("appearance_settings")) { - screen.setTitle(getString(R.string.appearance_settings) + " [" + ApplicationMode.toHumanString(osmandSettings.APPLICATION_MODE.get(), this) + "]"); - } else if (screen.getKey().toString().equals("monitor_settings")) { - screen.setTitle(getString(R.string.monitor_preferences) + " [" + ApplicationMode.toHumanString(osmandSettings.APPLICATION_MODE.get(), this) + "]"); - } else if (screen.getKey().toString().equals("routing_settings")) { - screen.setTitle(getString(R.string.routing_settings) + " [" + ApplicationMode.toHumanString(osmandSettings.APPLICATION_MODE.get(), this) + "]"); - } -*/ } - private void updateTileSourceSummary() { - fillTileSourcesToPreference(tileSourcePreference, osmandSettings.MAP_TILE_SOURCES.get(), false); - fillTileSourcesToPreference(overlayPreference, osmandSettings.MAP_OVERLAY.get(), true); - fillTileSourcesToPreference(underlayPreference, osmandSettings.MAP_UNDERLAY.get(), true); - -// String mapName = " " + osmandSettings.MAP_TILE_SOURCES.get(); //$NON-NLS-1$ -// String summary = tileSourcePreference.getSummary().toString(); -// if (summary.lastIndexOf(':') != -1) { -// summary = summary.substring(0, summary.lastIndexOf(':') + 1); -// } -// tileSourcePreference.setSummary(summary + mapName); - tileSourcePreference.setSummary(getString(R.string.map_tile_source_descr) + " [" + osmandSettings.MAP_TILE_SOURCES.get() + "]"); - overlayPreference.setSummary(getString(R.string.map_overlay_descr) + " [" + osmandSettings.MAP_OVERLAY.get() + "]"); - underlayPreference.setSummary(getString(R.string.map_underlay_descr) + " [" + osmandSettings.MAP_UNDERLAY.get() + "]"); - } - - private void fillTileSourcesToPreference(ListPreference tileSourcePreference, String value, boolean addNone) { - Map entriesMap = osmandSettings.getTileSourceEntries(); - int add = addNone ? 1 : 0; - String[] entries = new String[entriesMap.size() + 1 + add]; - String[] values = new String[entriesMap.size() + 1 + add]; - int ki = 0; - if(addNone){ - entries[ki] = getString(R.string.default_none); - values[ki] = ""; - ki++; - } - if (value == null) { - value = ""; - } - - for(Map.Entry es : entriesMap.entrySet()){ - entries[ki] = es.getValue(); - values[ki] = es.getKey(); - ki++; - } - entries[ki] = getString(R.string.install_more); - values[ki] = MORE_VALUE; - fill(tileSourcePreference, entries, values, value); - } - - private void fill(ListPreference component, String[] list, String[] values, String selected) { - component.setEntries(list); - component.setEntryValues(values); - component.setValue(selected); - } - @SuppressWarnings("unchecked") @Override @@ -602,13 +477,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference OsmandPreference editPref = editTextPreferences.get(preference.getKey()); if(boolPref != null){ boolPref.set((Boolean)newValue); - if (boolPref.getId().equals(osmandSettings.MAP_VECTOR_DATA.getId())) { - MapRenderRepositories r = ((OsmandApplication)getApplication()).getResourceManager().getRenderer(); - if(r.isEmpty()){ - AccessibleToast.makeText(this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show(); - return false; - } - } if (boolPref.getId().equals(osmandSettings.NATIVE_RENDERING.getId())) { if(((Boolean)newValue).booleanValue()) { loadNativeLibrary(); @@ -649,13 +517,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference dayNightModePreference.setSummary(getString(R.string.daynight_descr) + " [" + osmandSettings.DAYNIGHT_MODE.get().toHumanString(this) + "]"); } else if (listPref.getId().equals(osmandSettings.ROUTER_SERVICE.getId())) { routerServicePreference.setSummary(getString(R.string.router_service_descr) + " [" + osmandSettings.ROUTER_SERVICE.get() + "]"); - } else if (listPref.getId().equals(osmandSettings.ACCESSIBILITY_MODE.getId())) { - PreferenceCategory accessibilityOptions = ((PreferenceCategory)(getPreferenceScreen().findPreference("accessibility_options"))); - if (accessibilityOptions != null) - accessibilityOptions.setEnabled(getMyApplication().accessibilityEnabled()); - accessibilityModePreference.setSummary(getString(R.string.accessibility_mode_descr) + " [" + osmandSettings.ACCESSIBILITY_MODE.get().toHumanString(this) + "]"); - } else if (listPref.getId().equals(osmandSettings.DIRECTION_STYLE.getId())) { - directionStylePreference.setSummary(getString(R.string.settings_direction_style_descr) + " [" + osmandSettings.DIRECTION_STYLE.get().toHumanString(this) + "]"); } } if (listPref.getId().equals(osmandSettings.RENDERER.getId())) { @@ -669,48 +530,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference } else if(preference == applicationDir){ warnAboutChangingStorage((String) newValue); return false; - } else if (preference == routeServiceEnabled) { - Intent serviceIntent = new Intent(this, NavigationService.class); - if ((Boolean) newValue) { - ComponentName name = startService(serviceIntent); - if (name == null) { - routeServiceEnabled.setChecked(getMyApplication().getNavigationService() != null); - } - } else { - if(!stopService(serviceIntent)){ - routeServiceEnabled.setChecked(getMyApplication().getNavigationService() != null); - } - } - } else if (preference == tileSourcePreference || preference == overlayPreference - || preference == underlayPreference) { - if(MORE_VALUE.equals(newValue)){ - SettingsActivity.installMapLayers(this, new ResultMatcher() { - @Override - public boolean isCancelled() { return false;} - - @Override - public boolean publish(TileSourceTemplate object) { - if(object == null){ - updateTileSourceSummary(); - } - return true; - } - }); - } else if(preference == tileSourcePreference){ - osmandSettings.MAP_TILE_SOURCES.set((String) newValue); - updateTileSourceSummary(); - } else { - if(((String) newValue).length() == 0){ - newValue = null; - } - if(preference == underlayPreference){ - osmandSettings.MAP_UNDERLAY.set(((String) newValue)); - underlayPreference.setSummary(getString(R.string.map_underlay_descr) + " [" + osmandSettings.MAP_UNDERLAY.get() + "]"); - } else if(preference == overlayPreference){ - osmandSettings.MAP_OVERLAY.set(((String) newValue)); - overlayPreference.setSummary(getString(R.string.map_overlay_descr) + " [" + osmandSettings.MAP_OVERLAY.get() + "]"); - } - } } return true; } @@ -849,20 +668,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference if(preference.getKey().equals(OsmandSettings.LOCAL_INDEXES)){ startActivity(new Intent(this, LocalIndexesActivity.class)); return true; - } else if(preference == testVoiceCommands){ - startActivity(new Intent(this, TestVoiceActivity.class)); - return true; - } else if(preference == saveCurrentTrack){ - SavingTrackHelper helper = new SavingTrackHelper(this); - if (helper.hasDataToSave()) { - saveCurrentTracks(); - } else { - helper.close(); - } - return true; - } else if(preference == localOpenstreetmapPoints){ - startActivity(new Intent(this, LocalOpenstreetmapActivity.class)); - return true; } else if(preference == bidforfix){ startActivity(new Intent(this, OsmandBidForFixActivity.class)); return true; @@ -873,26 +678,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference return false; } - private void saveCurrentTracks() { - progressDlg = ProgressDialog.show(this, getString(R.string.saving_gpx_tracks), getString(R.string.saving_gpx_tracks), true); - final ProgressDialogImplementation impl = new ProgressDialogImplementation(progressDlg); - impl.setRunnable("SavingGPX", new Runnable() { //$NON-NLS-1$ - @Override - public void run() { - try { - SavingTrackHelper helper = new SavingTrackHelper(SettingsActivity.this); - helper.saveDataToGpx(); - helper.close(); - } finally { - if (progressDlg != null) { - progressDlg.dismiss(); - progressDlg = null; - } - } - } - }); - impl.run(); - } public static void installMapLayers(final Activity activity, final ResultMatcher result){ final OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings(); diff --git a/OsmAnd/src/net/osmand/plus/background/OsmandBackgroundServicePlugin.java b/OsmAnd/src/net/osmand/plus/background/OsmandBackgroundServicePlugin.java new file mode 100644 index 0000000000..e79f73f4ab --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/background/OsmandBackgroundServicePlugin.java @@ -0,0 +1,120 @@ +package net.osmand.plus.background; + +import net.osmand.plus.NavigationService; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SettingsActivity; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.location.LocationManager; +import android.preference.CheckBoxPreference; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceCategory; +import android.preference.PreferenceScreen; + +public class OsmandBackgroundServicePlugin extends OsmandPlugin { + private static final String ID = "osmand.backgroundservice"; + private OsmandSettings settings; + private OsmandApplication app; + private BroadcastReceiver broadcastReceiver; + private CheckBoxPreference routeServiceEnabled; + + public OsmandBackgroundServicePlugin(OsmandApplication app) { + this.app = app; + } + + @Override + public boolean init(OsmandApplication app) { + settings = app.getSettings(); + return true; + } + + @Override + public String getId() { + return ID; + } + @Override + public String getDescription() { + return app.getString(R.string.osmand_background_plugin_description); + } + @Override + public String getName() { + return app.getString(R.string.osmand_background_plugin_name); + } + @Override + public void registerLayers(MapActivity activity) { + } + + @Override + public void settingsActivityDestroy(final SettingsActivity activity){ + if(broadcastReceiver != null) { + activity.unregisterReceiver(broadcastReceiver); + } + } + + @Override + public void settingsActivityUpdate(final SettingsActivity activity){ + if(routeServiceEnabled != null) { + routeServiceEnabled.setChecked(app.getNavigationService() != null); + } + } + + + @Override + public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) { + PreferenceScreen grp = screen.getPreferenceManager().createPreferenceScreen(activity); + grp.setTitle(R.string.osmand_service); + grp.setSummary(R.string.osmand_service_descr); + ((PreferenceCategory) screen.findPreference("global_settings")).addPreference(grp); + + routeServiceEnabled = new CheckBoxPreference(activity); + broadcastReceiver = new BroadcastReceiver(){ + @Override + public void onReceive(Context context, Intent intent) { + routeServiceEnabled.setChecked(false); + } + + }; + activity.registerReceiver(broadcastReceiver, new IntentFilter(NavigationService.OSMAND_STOP_SERVICE_ACTION)); + routeServiceEnabled.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + Intent serviceIntent = new Intent(activity, NavigationService.class); + if ((Boolean) newValue) { + ComponentName name = activity.startService(serviceIntent); + if (name == null) { + routeServiceEnabled.setChecked(app.getNavigationService() != null); + } + } else { + if(!activity.stopService(serviceIntent)){ + routeServiceEnabled.setChecked(app.getNavigationService() != null); + } + } + return true; + } + }); + routeServiceEnabled.setTitle(R.string.background_router_service); + routeServiceEnabled.setSummary(R.string.background_router_service_descr); + routeServiceEnabled.setKey("service_off_enabled"); + grp.addPreference(routeServiceEnabled); + + String[] entries = new String[]{app.getString(R.string.gps_provider), app.getString(R.string.network_provider)}; + String[] entrieValues = new String[]{LocationManager.GPS_PROVIDER, LocationManager.NETWORK_PROVIDER}; + grp.addPreference(activity.createListPreference(settings.SERVICE_OFF_PROVIDER, entries, entrieValues, + R.string.background_service_provider, R.string.background_service_provider_descr)); + + grp.addPreference(activity.createTimeListPreference(settings.SERVICE_OFF_INTERVAL,new int[]{0, 30, 45, 60}, new int[]{2, 3, 5, 10, 15, 30, 45, 60, 90}, 1000, + R.string.background_service_int, R.string.background_service_int_descr)); + grp.addPreference(activity.createTimeListPreference(settings.SERVICE_OFF_WAIT_INTERVAL,new int[]{15, 30, 45, 60, 90}, new int[]{2, 3, 5, 10}, 1000, + R.string.background_service_wait_int, R.string.background_service_wait_int_descr)); + } + +} diff --git a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java new file mode 100644 index 0000000000..d1e2c0064b --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java @@ -0,0 +1,76 @@ +package net.osmand.plus.development; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SettingsActivity; +import android.content.Intent; +import android.preference.CheckBoxPreference; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceClickListener; +import android.preference.PreferenceCategory; +import android.preference.PreferenceScreen; + +public class OsmandDevelopmentPlugin extends OsmandPlugin { + private static final String ID = "osmand.development"; + private OsmandSettings settings; + private OsmandApplication app; + + public OsmandDevelopmentPlugin(OsmandApplication app) { + this.app = app; + } + + @Override + public boolean init(OsmandApplication app) { + settings = app.getSettings(); + return true; + } + + @Override + public String getId() { + return ID; + } + @Override + public String getDescription() { + return app.getString(R.string.osmand_development_plugin_description); + } + @Override + public String getName() { + return app.getString(R.string.osmand_development_plugin_name); + } + @Override + public void registerLayers(MapActivity activity) { + } + + + @Override + public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) { + PreferenceScreen general = (PreferenceScreen) screen.findPreference(SettingsActivity.SCREEN_ID_GENERAL_SETTINGS); + + PreferenceCategory cat = new PreferenceCategory(app); + cat.setTitle(R.string.debugging_and_development); + general.addPreference(cat); + + CheckBoxPreference dbg = activity.createCheckBoxPreference(settings.DEBUG_RENDERING_INFO, + R.string.trace_rendering, R.string.trace_rendering_descr); + cat.addPreference(dbg); + CheckBoxPreference animate = activity.createCheckBoxPreference(settings.TEST_ANIMATE_ROUTING, + R.string.animate_routing, R.string.simulate_route_progression_manually); + cat.addPreference(animate); + + Preference pref = new Preference(app); + pref.setTitle(R.string.test_voice_prompts); + pref.setSummary(R.string.play_commands_of_currently_selected_voice); + pref.setKey("test_voice_commands"); + pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + activity.startActivity(new Intent(activity, TestVoiceActivity.class)); + return true; + } + }); + cat.addPreference(pref); + } +} diff --git a/OsmAnd/src/net/osmand/plus/activities/TestVoiceActivity.java b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java similarity index 99% rename from OsmAnd/src/net/osmand/plus/activities/TestVoiceActivity.java rename to OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java index 14e843606a..f978c26778 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TestVoiceActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java @@ -1,7 +1,7 @@ /** * */ -package net.osmand.plus.activities; +package net.osmand.plus.development; import net.osmand.access.AccessibleToast; import net.osmand.plus.OsmandApplication; diff --git a/OsmAnd/src/net/osmand/plus/extrasettings/OsmandExtraSettings.java b/OsmAnd/src/net/osmand/plus/extrasettings/OsmandExtraSettings.java new file mode 100644 index 0000000000..28d6644728 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/extrasettings/OsmandExtraSettings.java @@ -0,0 +1,89 @@ +package net.osmand.plus.extrasettings; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SettingsActivity; +import android.media.AudioManager; +import android.preference.ListPreference; +import android.preference.PreferenceCategory; +import android.preference.PreferenceScreen; + +public class OsmandExtraSettings extends OsmandPlugin { + private static final String ID = "osmand.extrasettings"; + private OsmandSettings settings; + private OsmandApplication app; + + public OsmandExtraSettings(OsmandApplication app) { + this.app = app; + } + + @Override + public boolean init(OsmandApplication app) { + settings = app.getSettings(); + return true; + } + + @Override + public String getId() { + return ID; + } + @Override + public String getDescription() { + return app.getString(R.string.osmand_extra_settings_description); + } + @Override + public String getName() { + return app.getString(R.string.osmand_extra_settings_name); + } + @Override + public void registerLayers(MapActivity activity) { + } + + + @Override + public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) { + PreferenceScreen general = (PreferenceScreen) screen.findPreference(SettingsActivity.SCREEN_ID_GENERAL_SETTINGS); + + PreferenceCategory cat = new PreferenceCategory(app); + cat.setTitle(R.string.extra_settings); + general.addPreference(cat); + + cat.addPreference(activity.createCheckBoxPreference(settings.USE_HIGH_RES_MAPS, + R.string.use_high_res_maps, R.string.use_high_res_maps_descr)); + cat.addPreference(activity.createCheckBoxPreference(settings.USE_TRACKBALL_FOR_MOVEMENTS, + R.string.use_trackball, R.string.use_trackball_descr)); + + ListPreference lp = activity.createListPreference(settings.AUDIO_STREAM_GUIDANCE, + new String[] {app.getString(R.string.voice_stream_music), app.getString(R.string.voice_stream_notification), + app.getString(R.string.voice_stream_voice_call)}, + new Integer[] {AudioManager.STREAM_MUSIC, AudioManager.STREAM_NOTIFICATION, AudioManager.STREAM_VOICE_CALL}, + R.string.choose_audio_stream, R.string.choose_audio_stream_descr); + cat.addPreference(lp); + + + PreferenceScreen appearance = (PreferenceScreen) screen.findPreference("appearance_settings"); + cat = new PreferenceCategory(app); + cat.setTitle(R.string.extra_settings); + appearance.addPreference(cat); + + cat.addPreference(activity.createCheckBoxPreference(settings.TRANSPARENT_MAP_THEME, + R.string.use_transparent_map_theme, R.string.use_transparent_map_theme_descr)); + cat.addPreference(activity.createCheckBoxPreference(settings.SHOW_RULER, + R.string.show_ruler_level, R.string.show_ruler_level_descr)); + cat.addPreference(activity.createCheckBoxPreference(settings.FLUORESCENT_OVERLAYS, + R.string.use_fluorescent_overlays, R.string.use_fluorescent_overlays_descr)); + + cat.addPreference(activity.createListPreference(settings.POSITION_ON_MAP, + new String[] { activity.getString(R.string.position_on_map_center), activity.getString(R.string.position_on_map_bottom) }, + new Integer[] { OsmandSettings.CENTER_CONSTANT, OsmandSettings.BOTTOM_CONSTANT }, R.string.position_on_map, + R.string.position_on_map_descr)); + + PreferenceCategory vectorSettings = new PreferenceCategory(app); + vectorSettings.setTitle(R.string.pref_vector_rendering); + vectorSettings.setKey("custom_vector_rendering"); + appearance.addPreference(vectorSettings); + } +} diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java new file mode 100644 index 0000000000..36603ca11a --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -0,0 +1,140 @@ +package net.osmand.plus.monitoring; + +import net.osmand.plus.ContextMenuAdapter; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.ProgressDialogImplementation; +import net.osmand.plus.R; +import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; +import net.osmand.plus.activities.ApplicationMode; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SavingTrackHelper; +import net.osmand.plus.activities.SettingsActivity; +import android.app.ProgressDialog; +import android.content.DialogInterface; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceClickListener; +import android.preference.PreferenceCategory; +import android.preference.PreferenceScreen; + +public class OsmandMonitoringPlugin extends OsmandPlugin { + private static final String ID = "osmand.monitoring"; + private OsmandSettings settings; + private OsmandApplication app; + + public OsmandMonitoringPlugin(OsmandApplication app) { + this.app = app; + } + + @Override + public boolean init(OsmandApplication app) { + settings = app.getSettings(); + settings.SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.CAR, true); + settings.SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.BICYCLE, true); + settings.SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true); + return true; + } + + @Override + public String getId() { + return ID; + } + @Override + public String getDescription() { + return app.getString(R.string.osmand_monitoring_description); + } + @Override + public String getName() { + return app.getString(R.string.osmand_monitoring_name); + } + @Override + public void registerLayers(MapActivity activity) { + } + + @Override + public void registerMapContextMenuActions(final MapActivity mapActivity, final double latitude, final double longitude, ContextMenuAdapter adapter, + Object selectedObj) { + OnContextMenuClick listener = new OnContextMenuClick() { + @Override + public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) { + if (resId == R.string.context_menu_item_add_waypoint) { + mapActivity.getMapActions().addWaypoint(latitude, longitude); + } + } + }; + adapter.registerItem(R.string.context_menu_item_add_waypoint, 0, listener, -1); + } + + + @Override + public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) { + PreferenceScreen grp = screen.getPreferenceManager().createPreferenceScreen(activity); + grp.setTitle(R.string.monitor_preferences); + grp.setSummary(R.string.monitor_preferences_descr); + grp.setKey("monitor_settings"); + ((PreferenceCategory) screen.findPreference("profile_dep_cat")).addPreference(grp); + + PreferenceCategory cat = new PreferenceCategory(activity); + cat.setTitle(R.string.save_track_to_gpx); + grp.addPreference(cat); + + cat.addPreference(activity.createCheckBoxPreference(settings.SAVE_TRACK_TO_GPX, R.string.save_track_to_gpx, + R.string.save_track_to_gpx_descrp)); + + cat.addPreference(activity.createTimeListPreference(settings.SAVE_TRACK_INTERVAL, new int[] { 1, 2, 3, 5, 10, 15, 20, 30 }, + new int[] { 1, 2, 3, 5 }, 1, R.string.save_track_interval, R.string.save_track_interval_descr)); + + Preference pref = new Preference(activity); + pref.setTitle(R.string.save_current_track); + pref.setSummary(R.string.save_current_track_descr); + pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { + + @Override + public boolean onPreferenceClick(Preference preference) { + SavingTrackHelper helper = new SavingTrackHelper(activity); + if (helper.hasDataToSave()) { + saveCurrentTracks(activity); + } else { + helper.close(); + } + return true; + } + }); + cat.addPreference(pref); + + cat = new PreferenceCategory(activity); + cat.setTitle(R.string.live_monitoring); + grp.addPreference(cat); + + cat.addPreference(activity.createCheckBoxPreference(settings.LIVE_MONITORING, R.string.live_monitoring, + R.string.live_monitoring_descr)); + cat.addPreference(activity.createEditTextPreference(settings.LIVE_MONITORING_URL, R.string.live_monitoring_url, + R.string.live_monitoring_url_descr)); + + cat.addPreference(activity.createTimeListPreference(settings.LIVE_MONITORING_INTERVAL, new int[] { 1, 2, 3, 5, 10, 15, 20, 30 }, + new int[] { 1, 2, 3, 5 }, 1, R.string.live_monitoring_interval, R.string.live_monitoring_interval_descr)); + + } + + private void saveCurrentTracks(final SettingsActivity activity) { + activity.progressDlg = ProgressDialog.show(activity, activity.getString(R.string.saving_gpx_tracks), activity.getString(R.string.saving_gpx_tracks), true); + final ProgressDialogImplementation impl = new ProgressDialogImplementation(activity.progressDlg); + impl.setRunnable("SavingGPX", new Runnable() { //$NON-NLS-1$ + @Override + public void run() { + try { + SavingTrackHelper helper = new SavingTrackHelper(activity); + helper.saveDataToGpx(); + helper.close(); + } finally { + if (activity.progressDlg != null) { + activity.progressDlg.dismiss(); + activity.progressDlg = null; + } + } + } + }); + impl.run(); + } +} diff --git a/OsmAnd/src/net/osmand/AbstractOpenstreetmapUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java similarity index 98% rename from OsmAnd/src/net/osmand/AbstractOpenstreetmapUtil.java rename to OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java index fadbedae56..9ee6a6ab5a 100644 --- a/OsmAnd/src/net/osmand/AbstractOpenstreetmapUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java @@ -1,4 +1,5 @@ -package net.osmand; +package net.osmand.plus.osmedit; + import java.util.ArrayList; import java.util.List; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java index 901d94b76a..1a53945d61 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java @@ -7,9 +7,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import net.osmand.OpenstreetmapLocalUtil; -import net.osmand.OpenstreetmapRemoteUtil; -import net.osmand.OpenstreetmapUtil; import net.osmand.OsmAndFormatter; import net.osmand.access.AccessibleToast; import net.osmand.data.Amenity; diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalOpenstreetmapActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java similarity index 97% rename from OsmAnd/src/net/osmand/plus/activities/LocalOpenstreetmapActivity.java rename to OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java index 25fcef3ec5..de9c1ee675 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalOpenstreetmapActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java @@ -1,4 +1,4 @@ -package net.osmand.plus.activities; +package net.osmand.plus.osmedit; import java.text.MessageFormat; import java.util.ArrayList; @@ -7,18 +7,15 @@ import java.util.List; import java.util.Map; import net.osmand.LogUtil; -import net.osmand.OpenstreetmapPoint; -import net.osmand.OpenstreetmapRemoteUtil; -import net.osmand.OpenstreetmapUtil; import net.osmand.access.AccessibleToast; import net.osmand.osm.EntityInfo; import net.osmand.osm.Node; import net.osmand.plus.AmenityIndexRepositoryOdb; -import net.osmand.plus.OpenstreetmapsDbHelper; -import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.ProgressDialogImplementation; import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.OsmandExpandableListActivity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.DialogInterface; @@ -199,7 +196,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { } } - return new Integer(uploaded); + return Integer.valueOf(uploaded); } @Override diff --git a/OsmAnd/src/net/osmand/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java similarity index 97% rename from OsmAnd/src/net/osmand/OpenstreetmapLocalUtil.java rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java index 0ccb6551b7..bf42e3e25d 100644 --- a/OsmAnd/src/net/osmand/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java @@ -1,7 +1,9 @@ -package net.osmand; +package net.osmand.plus.osmedit; import java.util.Map; + +import net.osmand.LogUtil; import net.osmand.data.Amenity; import net.osmand.data.AmenityType; import net.osmand.osm.EntityInfo; @@ -9,7 +11,6 @@ import net.osmand.osm.MapRenderingTypes; import net.osmand.osm.MapUtils; import net.osmand.osm.Node; import net.osmand.osm.OSMSettings.OSMTagKey; -import net.osmand.plus.OpenstreetmapsDbHelper; import org.apache.commons.logging.Log; diff --git a/OsmAnd/src/net/osmand/OpenstreetmapPoint.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java similarity index 98% rename from OsmAnd/src/net/osmand/OpenstreetmapPoint.java rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java index 89f589a104..e7870bec1c 100644 --- a/OsmAnd/src/net/osmand/OpenstreetmapPoint.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java @@ -1,4 +1,4 @@ -package net.osmand; +package net.osmand.plus.osmedit; import java.io.Serializable; diff --git a/OsmAnd/src/net/osmand/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java similarity index 99% rename from OsmAnd/src/net/osmand/OpenstreetmapRemoteUtil.java rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java index 33e164f49e..c031e6fa27 100644 --- a/OsmAnd/src/net/osmand/OpenstreetmapRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java @@ -1,4 +1,4 @@ -package net.osmand; +package net.osmand.plus.osmedit; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -18,6 +18,10 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; +import net.osmand.Algoritms; +import net.osmand.Base64; +import net.osmand.LogUtil; +import net.osmand.Version; import net.osmand.access.AccessibleToast; import net.osmand.data.Amenity; import net.osmand.osm.Entity; diff --git a/OsmAnd/src/net/osmand/OpenstreetmapUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java similarity index 93% rename from OsmAnd/src/net/osmand/OpenstreetmapUtil.java rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java index 66c6f96e1b..58162c8908 100644 --- a/OsmAnd/src/net/osmand/OpenstreetmapUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java @@ -1,4 +1,4 @@ -package net.osmand; +package net.osmand.plus.osmedit; import net.osmand.data.Amenity; import net.osmand.osm.EntityInfo; diff --git a/OsmAnd/src/net/osmand/plus/OpenstreetmapsDbHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java similarity index 98% rename from OsmAnd/src/net/osmand/plus/OpenstreetmapsDbHelper.java rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java index b688768e42..ec490534cf 100644 --- a/OsmAnd/src/net/osmand/plus/OpenstreetmapsDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java @@ -1,11 +1,9 @@ -package net.osmand.plus; +package net.osmand.plus.osmedit; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import net.osmand.OpenstreetmapPoint; -import net.osmand.OpenstreetmapRemoteUtil; import net.osmand.osm.Node; import net.osmand.osm.OSMSettings.OSMTagKey; import android.content.Context; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 704f1c61a7..f8532f51fd 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -457,7 +457,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider OnContextMenuClick listener = new OnContextMenuClick() { @Override - public void onContextMenuClick(int itemId, int pos, boolean isChecked) { + public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { if (itemId == R.string.osb_comment_menu_item) { commentBug(bug); } else if (itemId == R.string.osb_close_menu_item) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index a33dcdd9c8..a70dc714d0 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -1,5 +1,14 @@ package net.osmand.plus.osmedit; +import android.content.DialogInterface; +import android.content.Intent; +import android.preference.CheckBoxPreference; +import android.preference.EditTextPreference; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceClickListener; +import android.preference.PreferenceCategory; +import android.preference.PreferenceScreen; +import android.text.InputType; import net.osmand.data.Amenity; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; @@ -8,6 +17,7 @@ import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.views.OsmandMapTileView; public class OsmEditingPlugin extends OsmandPlugin { @@ -34,7 +44,7 @@ public class OsmEditingPlugin extends OsmandPlugin { private EditingPOIActivity poiActions; @Override - public void updateLayers(OsmandMapTileView mapView){ + public void updateLayers(OsmandMapTileView mapView, MapActivity activity){ if(mapView.getLayers().contains(osmBugsLayer) != settings.SHOW_OSM_BUGS.get()){ if(settings.SHOW_OSM_BUGS.get()){ mapView.addLayer(osmBugsLayer, 2); @@ -54,7 +64,37 @@ public class OsmEditingPlugin extends OsmandPlugin { poiActions = new EditingPOIActivity(activity); activity.addDialogProvider(poiActions); activity.addDialogProvider(osmBugsLayer); + } + + @Override + public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) { + PreferenceScreen general = (PreferenceScreen) screen.findPreference(SettingsActivity.SCREEN_ID_GENERAL_SETTINGS); + PreferenceCategory cat = new PreferenceCategory(app); + cat.setTitle(R.string.osm_settings); + general.addPreference(cat); + EditTextPreference userName = activity.createEditTextPreference(settings.USER_NAME, R.string.user_name, R.string.user_name_descr); + cat.addPreference(userName); + EditTextPreference pwd = activity.createEditTextPreference(settings.USER_PASSWORD, R.string.user_password, R.string.user_password_descr); + pwd.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); + cat.addPreference(pwd); + + CheckBoxPreference poiEdit = activity.createCheckBoxPreference(settings.OFFLINE_POI_EDITION, + R.string.offline_poi_edition, R.string.offline_poi_edition_descr); + cat.addPreference(poiEdit); + + Preference pref = new Preference(app); + pref.setTitle(R.string.local_openstreetmap_settings); + pref.setSummary(R.string.local_openstreetmap_settings_descr); + pref.setKey("local_openstreetmap_points"); + pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + activity.startActivity(new Intent(activity, LocalOpenstreetmapActivity.class)); + return true; + } + }); + cat.addPreference(pref); } public EditingPOIActivity getPoiActions() { @@ -69,7 +109,7 @@ public class OsmEditingPlugin extends OsmandPlugin { OnContextMenuClick alist = new OnContextMenuClick() { @Override - public void onContextMenuClick(int resId, int pos, boolean isChecked) { + public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) { if (resId == R.string.poi_context_menu_delete) { getPoiActions().showDeleteDialog(a); } else if (resId == R.string.poi_context_menu_modify) { @@ -83,7 +123,7 @@ public class OsmEditingPlugin extends OsmandPlugin { OnContextMenuClick listener = new OnContextMenuClick() { @Override - public void onContextMenuClick(int resId, int pos, boolean isChecked) { + public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) { if (resId == R.string.context_menu_item_create_poi) { poiActions.showCreateDialog(latitude, longitude); } else if (resId == R.string.context_menu_item_open_bug) { @@ -96,12 +136,12 @@ public class OsmEditingPlugin extends OsmandPlugin { } @Override - public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter) { + public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, MapActivity mapActivity) { adapter.registerSelectedItem(R.string.layer_osm_bugs, settings.SHOW_OSM_BUGS.get() ? 1 : 0, R.drawable.list_activities_osm_bugs, new OnContextMenuClick() { @Override - public void onContextMenuClick(int itemId, int pos, boolean isChecked) { + public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { if (itemId == R.string.layer_osm_bugs) { settings.SHOW_OSM_BUGS.set(isChecked); } diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java new file mode 100644 index 0000000000..efe79b38a0 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java @@ -0,0 +1,398 @@ +package net.osmand.plus.rastermaps; + +import java.util.ArrayList; +import java.util.Map; + +import net.osmand.Algoritms; +import net.osmand.ResultMatcher; +import net.osmand.map.ITileSource; +import net.osmand.map.TileSourceManager.TileSourceTemplate; +import net.osmand.plus.ContextMenuAdapter; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; +import net.osmand.plus.OsmandSettings.CommonPreference; +import net.osmand.plus.activities.DownloadTilesDialog; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.MapActivityLayers; +import net.osmand.plus.activities.SettingsActivity; +import net.osmand.plus.views.BaseMapLayer; +import net.osmand.plus.views.MapTileLayer; +import net.osmand.plus.views.OsmandMapTileView; +import net.osmand.plus.views.SeekBarPreference; +import android.app.AlertDialog; +import android.app.AlertDialog.Builder; +import android.content.DialogInterface; +import android.preference.CheckBoxPreference; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceCategory; +import android.preference.PreferenceGroup; +import android.preference.PreferenceScreen; + +public class OsmandRasterMapsPlugin extends OsmandPlugin { + private static final String ID = "osmand.rastermaps"; + private OsmandSettings settings; + private OsmandApplication app; + private ListPreference tileSourcePreference; + private ListPreference overlayPreference; + private ListPreference underlayPreference; + + private MapTileLayer overlayLayer; + private MapTileLayer underlayLayer; + + public OsmandRasterMapsPlugin(OsmandApplication app) { + this.app = app; + } + + @Override + public boolean init(OsmandApplication app) { + settings = app.getSettings(); + return true; + } + + @Override + public String getId() { + return ID; + } + @Override + public String getDescription() { + return app.getString(R.string.osmand_rastermaps_plugin_description); + } + @Override + public String getName() { + return app.getString(R.string.osmand_rastermaps_plugin_name); + } + @Override + public void registerLayers(MapActivity activity) { + underlayLayer = new MapTileLayer(false); + // mapView.addLayer(underlayLayer, -0.5f); + overlayLayer = new MapTileLayer(false); + // mapView.addLayer(overlayLayer, 0.7f); + } + + @Override + public void updateLayers(OsmandMapTileView mapView, MapActivity activity) { + updateMapLayers(mapView, null, activity.getMapLayers()); + } + + + public void updateMapLayers(OsmandMapTileView mapView, CommonPreference settingsToWarnAboutMap, + final MapActivityLayers layers) { + overlayLayer.setAlpha(settings.MAP_OVERLAY_TRANSPARENCY.get()); + updateLayer(mapView, settings, overlayLayer, settings.MAP_OVERLAY, 0.7f, settings.MAP_OVERLAY == settingsToWarnAboutMap); + updateLayer(mapView, settings, underlayLayer, settings.MAP_UNDERLAY, -0.5f, settings.MAP_UNDERLAY == settingsToWarnAboutMap); + layers.updateMapSource(mapView, settingsToWarnAboutMap); + } + + public void updateLayer(OsmandMapTileView mapView, OsmandSettings settings, + MapTileLayer layer, CommonPreference preference, float layerOrder, boolean warnWhenSelected) { + ITileSource overlay = settings.getTileSourceByName(preference.get(), warnWhenSelected); + if(!Algoritms.objectEquals(overlay, layer.getMap())){ + if(overlay == null){ + mapView.removeLayer(layer); + } else { + mapView.addLayer(layer, layerOrder); + } + layer.setMap(overlay); + mapView.refreshMap(); + } + } + + public void selectMapOverlayLayer(final OsmandMapTileView mapView, + final CommonPreference mapPref, final CommonPreference transparencyPref, + final MapActivity activity, + final BaseMapLayer... transparencyToChange){ + final OsmandSettings settings = app.getSettings(); + final MapActivityLayers layers = activity.getMapLayers(); + Map entriesMap = settings.getTileSourceEntries(); + final ArrayList keys = new ArrayList(entriesMap.keySet()); + Builder builder = new AlertDialog.Builder(activity); + final String[] items = new String[entriesMap.size() + 1]; + int i = 0; + for(String it : entriesMap.values()){ + items[i++] = it; + } + + items[i] = app.getString(R.string.install_more); + builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog, int which) { + if (which == items.length - 1){ + SettingsActivity.installMapLayers(activity, new ResultMatcher() { + TileSourceTemplate template = null; + int count = 0; + @Override + public boolean publish(TileSourceTemplate object) { + if(object == null){ + if(count == 1){ + mapPref.set(template.getName()); + layers.getMapControlsLayer().showAndHideTransparencyBar(transparencyPref, transparencyToChange); + updateMapLayers(mapView, mapPref, layers); + } else { + selectMapOverlayLayer(mapView, mapPref, transparencyPref, activity, transparencyToChange); + } + } else { + count ++; + template = object; + } + return false; + } + + @Override + public boolean isCancelled() { + return false; + } + }); + } else { + mapPref.set(keys.get(which)); + layers.getMapControlsLayer().showAndHideTransparencyBar(transparencyPref, transparencyToChange); + updateMapLayers(mapView, mapPref, layers); + } + dialog.dismiss(); + } + + }); + builder.show(); + } + + @Override + public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) { + final MapActivityLayers layers = mapActivity.getMapLayers(); + OnContextMenuClick listener = new OnContextMenuClick() { + @Override + public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { + if (itemId == R.string.layer_map) { + dialog.dismiss(); + layers.selectMapLayer(mapView); + } else if(itemId == R.string.layer_overlay){ + if(overlayLayer.getMap() != null){ + settings.MAP_OVERLAY.set(null); + updateMapLayers(mapView, null, layers); + } else { + dialog.dismiss(); + selectMapOverlayLayer(mapView, settings.MAP_OVERLAY, settings.MAP_OVERLAY_TRANSPARENCY, mapActivity, + overlayLayer); + } + } else if(itemId == R.string.layer_underlay){ + if(underlayLayer.getMap() != null){ + settings.MAP_UNDERLAY.set(null); + updateMapLayers(mapView, null, layers); + } else { + dialog.dismiss(); + selectMapOverlayLayer(mapView, settings.MAP_UNDERLAY,settings.MAP_TRANSPARENCY, + mapActivity, layers.getMapTileLayer(), layers.getMapVectorLayer()); + } + } + } + }; + adapter.registerSelectedItem(R.string.layer_map, -1, R.drawable.list_activities_map_src, listener, 0); + adapter.registerSelectedItem(R.string.layer_overlay, overlayLayer.getMap() != null ? 1 : 0, + R.drawable.list_activities_overlay_map, listener, -1); + adapter.registerSelectedItem(R.string.layer_underlay, underlayLayer.getMap() != null ? 1 : 0, + R.drawable.list_activities_underlay_map, listener, -1); + } + + + @Override + public void registerMapContextMenuActions(final MapActivity mapActivity, final double latitude, final double longitude, ContextMenuAdapter adapter, + Object selectedObj) { + final OsmandMapTileView mapView = mapActivity.getMapView(); + if (mapView.getMainLayer() instanceof MapTileLayer) { + OnContextMenuClick listener = new OnContextMenuClick() { + @Override + public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) { + if (resId == R.string.context_menu_item_update_map) { + mapActivity.getMapActions().reloadTile(mapView.getZoom(), latitude, longitude); + } else if (resId == R.string.context_menu_item_download_map) { + DownloadTilesDialog dlg = new DownloadTilesDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), mapView); + dlg.openDialog(); + } + } + }; + adapter.registerItem(R.string.context_menu_item_update_map, 0, listener, -1); + adapter.registerItem(R.string.context_menu_item_download_map, 0, listener, -1); + } + } + + @Override + public void settingsActivityUpdate(SettingsActivity activity) { + updateTileSourceSummary(); + } + + @Override + public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) { + PreferenceGroup general = (PreferenceGroup) screen.findPreference("global_settings"); + + PreferenceGroup grp = screen.getPreferenceManager().createPreferenceScreen(activity); + grp.setSummary(R.string.online_map_settings_descr); + grp.setTitle(R.string.online_map_settings); + grp.setKey("map_settings"); + grp.setOrder(0); + general.addPreference(grp); + + + OnPreferenceChangeListener listener = createPreferenceListener(activity); + + PreferenceCategory cat = new PreferenceCategory(activity); + cat.setTitle(R.string.pref_raster_map); + grp.addPreference(cat); + + CheckBoxPreference mapVectorData = activity.createCheckBoxPreference(settings.MAP_ONLINE_DATA, + R.string.map_online_data, R.string.map_online_data_descr); +// final OnPreferenceChangeListener parent = mapVectorData.getOnPreferenceChangeListener(); +// MapRenderRepositories r = app.getResourceManager().getRenderer(); +// if(r.isEmpty()){ +// AccessibleToast.makeText(this, app.getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show(); +// return false; +// } + cat.addPreference(mapVectorData); + + tileSourcePreference = new ListPreference(activity); + tileSourcePreference.setSummary(R.string.map_tile_source_descr); + tileSourcePreference.setTitle(R.string.map_tile_source); + tileSourcePreference.setOnPreferenceChangeListener(listener); + cat.addPreference(tileSourcePreference); + + cat.addPreference(activity.createCheckBoxPreference(settings.USE_INTERNET_TO_DOWNLOAD_TILES, + R.string.use_internet, R.string.use_internet_to_download_tile)); + + int startZoom = 1; + int endZoom = 18; + String[] entries = new String[endZoom - startZoom + 1]; + Integer[] intValues = new Integer[endZoom - startZoom + 1]; + for (int i = startZoom; i <= endZoom; i++) { + entries[i - startZoom] = i + ""; //$NON-NLS-1$ + intValues[i - startZoom] = i ; + } + ListPreference lp = activity.createListPreference(settings.LEVEL_TO_SWITCH_VECTOR_RASTER, + entries, intValues, R.string.level_to_switch_vector_raster, R.string.level_to_switch_vector_raster_descr); + cat.addPreference(lp); + + // try without, Issue 823: +// int startZoom = 12; +// int endZoom = 19; +// entries = new String[endZoom - startZoom + 1]; +// Integer[] intValues = new Integer[endZoom - startZoom + 1]; +// for (int i = startZoom; i <= endZoom; i++) { +// entries[i - startZoom] = i + ""; //$NON-NLS-1$ +// intValues[i - startZoom] = i ; +// } + // registerListPreference(osmandSettings.MAX_LEVEL_TO_DOWNLOAD_TILE, screen, entries, intValues); + + + cat = new PreferenceCategory(activity); + cat.setTitle(R.string.pref_overlay); + grp.addPreference(cat); + + overlayPreference = new ListPreference(activity); + overlayPreference.setSummary(R.string.map_overlay_descr); + overlayPreference.setTitle(R.string.map_overlay); + overlayPreference.setOnPreferenceChangeListener(listener); + cat.addPreference(overlayPreference); + underlayPreference = new ListPreference(activity); + underlayPreference.setSummary(R.string.map_underlay_descr); + underlayPreference.setTitle(R.string.map_underlay); + underlayPreference.setOnPreferenceChangeListener(listener); + cat.addPreference(underlayPreference); + + SeekBarPreference sp = activity.createSeekBarPreference(settings.MAP_OVERLAY_TRANSPARENCY, R.string.overlay_transparency, R.string.overlay_transparency_descr, + R.string.modify_transparency, 0, 255); + cat.addPreference(sp); + sp = activity.createSeekBarPreference(settings.MAP_TRANSPARENCY, R.string.map_transparency, R.string.map_transparency_descr, + R.string.modify_transparency, 0, 255); + cat.addPreference(sp); + } + + private OnPreferenceChangeListener createPreferenceListener(final SettingsActivity activity) { + return new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (preference == tileSourcePreference || preference == overlayPreference + || preference == underlayPreference) { + if(SettingsActivity.MORE_VALUE.equals(newValue)){ + SettingsActivity.installMapLayers(activity, new ResultMatcher() { + @Override + public boolean isCancelled() { return false;} + + @Override + public boolean publish(TileSourceTemplate object) { + if(object == null){ + updateTileSourceSummary(); + } + return true; + } + }); + } else if(preference == tileSourcePreference){ + settings.MAP_TILE_SOURCES.set((String) newValue); + updateTileSourceSummary(); + } else { + if(((String) newValue).length() == 0){ + newValue = null; + } + if(preference == underlayPreference){ + settings.MAP_UNDERLAY.set(((String) newValue)); + underlayPreference.setSummary(app.getString(R.string.map_underlay_descr) + " [" + settings.MAP_UNDERLAY.get() + "]"); + } else if(preference == overlayPreference){ + settings.MAP_OVERLAY.set(((String) newValue)); + overlayPreference.setSummary(app.getString(R.string.map_overlay_descr) + " [" + settings.MAP_OVERLAY.get() + "]"); + } + } + } + return true; + } + }; + } + + private void updateTileSourceSummary() { + if (tileSourcePreference != null) { + fillTileSourcesToPreference(tileSourcePreference, settings.MAP_TILE_SOURCES.get(), false); + fillTileSourcesToPreference(overlayPreference, settings.MAP_OVERLAY.get(), true); + fillTileSourcesToPreference(underlayPreference, settings.MAP_UNDERLAY.get(), true); + + // String mapName = " " + settings.MAP_TILE_SOURCES.get(); //$NON-NLS-1$ + // String summary = tileSourcePreference.getSummary().toString(); + // if (summary.lastIndexOf(':') != -1) { + // summary = summary.substring(0, summary.lastIndexOf(':') + 1); + // } + // tileSourcePreference.setSummary(summary + mapName); + tileSourcePreference.setSummary(app.getString(R.string.map_tile_source_descr) + " [" + settings.MAP_TILE_SOURCES.get() + "]"); + overlayPreference.setSummary(app.getString(R.string.map_overlay_descr) + " [" + settings.MAP_OVERLAY.get() + "]"); + underlayPreference.setSummary(app.getString(R.string.map_underlay_descr) + " [" + settings.MAP_UNDERLAY.get() + "]"); + } + } + + private void fillTileSourcesToPreference(ListPreference tileSourcePreference, String value, boolean addNone) { + Map entriesMap = settings.getTileSourceEntries(); + int add = addNone ? 1 : 0; + String[] entries = new String[entriesMap.size() + 1 + add]; + String[] values = new String[entriesMap.size() + 1 + add]; + int ki = 0; + if (addNone) { + entries[ki] = app.getString(R.string.default_none); + values[ki] = ""; + ki++; + } + if (value == null) { + value = ""; + } + + for (Map.Entry es : entriesMap.entrySet()) { + entries[ki] = es.getValue(); + values[ki] = es.getKey(); + ki++; + } + entries[ki] = app.getString(R.string.install_more); + values[ki] = SettingsActivity.MORE_VALUE; + fill(tileSourcePreference, entries, values, value); + } + + private void fill(ListPreference component, String[] list, String[] values, String selected) { + component.setEntries(list); + component.setEntryValues(values); + component.setValue(selected); + } +} diff --git a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java index 906c8615bb..65b1c10040 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java +++ b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java @@ -1,6 +1,5 @@ package net.osmand.plus.render; -import net.osmand.access.AccessibleToast; import net.osmand.osm.MapUtils; import net.osmand.plus.ResourceManager; import net.osmand.plus.RotatedTileBox; @@ -85,19 +84,17 @@ public class MapVectorLayer extends BaseMapLayer { @Override public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, DrawSettings drawSettings) { - if(!visible){ + if (!visible) { return; } - if(!isVectorDataVisible() && tileLayer != null){ + if (!isVectorDataVisible() && tileLayer != null) { tileLayer.drawTileMap(canvas, tilesRect); resourceManager.getRenderer().interruptLoadingMap(); } else { if (!view.isZooming()) { pixRect.set(0, 0, view.getWidth(), view.getHeight()); updateRotatedTileBox(); - //TODO passing of nithMode and appMode could be probably something more general? These are - //renderer properties, so, we should check if renderer properties are changed somehow... - if (resourceManager.updateRenderedMapNeeded(rotatedTileBox,drawSettings)) { + if (resourceManager.updateRenderedMapNeeded(rotatedTileBox, drawSettings)) { // pixRect.set(-view.getWidth(), -view.getHeight() / 2, 2 * view.getWidth(), 3 * view.getHeight() / 2); pixRect.set(-view.getWidth() / 3, -view.getHeight() / 4, 4 * view.getWidth() / 3, 5 * view.getHeight() / 4); updateRotatedTileBox(); @@ -105,7 +102,7 @@ public class MapVectorLayer extends BaseMapLayer { } } - + MapRenderRepositories renderer = resourceManager.getRenderer(); drawRenderedMap(canvas, renderer.getBitmap(), renderer.getBitmapLocation()); drawRenderedMap(canvas, renderer.getPrevBitmap(), renderer.getPrevBmpLocation()); @@ -113,7 +110,8 @@ public class MapVectorLayer extends BaseMapLayer { } - private void drawRenderedMap(Canvas canvas, Bitmap bmp, RotatedTileBox bmpLoc) { + private boolean drawRenderedMap(Canvas canvas, Bitmap bmp, RotatedTileBox bmpLoc) { + boolean shown = false; if (bmp != null && bmpLoc != null) { float rot = bmpLoc.getRotate(); float mult = (float) MapUtils.getPowZoom(view.getZoom() - bmpLoc.getZoom()); @@ -134,9 +132,11 @@ public class MapVectorLayer extends BaseMapLayer { * view.getTileSize()); if(!bmp.isRecycled()){ canvas.drawBitmap(bmp, null, destImage, paintImg); + shown = true; } canvas.rotate(rot, view.getCenterPointX(), view.getCenterPointY()); } + return shown; } diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 6625112840..5fb6878f53 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -21,6 +21,7 @@ import net.osmand.plus.render.RenderingIcons; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -302,7 +303,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon final Amenity a = (Amenity) o; OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() { @Override - public void onContextMenuClick(int itemId, int pos, boolean isChecked) { + public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { if (itemId == R.string.poi_context_menu_call) { try { Intent intent = new Intent(Intent.ACTION_VIEW); diff --git a/OsmAnd/src/net/osmand/plus/views/SeekBarPreference.java b/OsmAnd/src/net/osmand/plus/views/SeekBarPreference.java index 63acbc259b..9ee016c98d 100644 --- a/OsmAnd/src/net/osmand/plus/views/SeekBarPreference.java +++ b/OsmAnd/src/net/osmand/plus/views/SeekBarPreference.java @@ -61,6 +61,25 @@ public class SeekBarPreference extends DialogPreference implements maxValue = attrs.getAttributeIntValue(ANDROID_NS, MAX_VALUE_ID, 100); } + + /** + * Default constructor. + * + * @param context + * The application context. + * @param attrs + * The attribute set, containing the text, title, values, and + * range for the slider dialog. + */ + public SeekBarPreference(final Context context, int dialogTextId, int defValue, int maxValue) { + super(context, null); + this.context = context; + dialogText = context.getResources().getString(dialogTextId); + valueText = null; + this.defaultValue = defValue; + this.maxValue = maxValue; + + } public int getMax() { return maxValue; @@ -120,7 +139,7 @@ public class SeekBarPreference extends DialogPreference implements if (shouldPersist()) { persistInt(valueToSave); } - callChangeListener(new Integer(valueToSave)); + callChangeListener(Integer.valueOf(valueToSave)); } else { this.valueToSave = value; }