diff --git a/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java index fd5667f0a4..0d2b9f7c9e 100644 --- a/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java @@ -135,7 +135,6 @@ public class BinaryRoutePlanner { checkIfGraphIsEmpty(ctx, ctx.getPlanRoadDirection() >= 0, graphDirectSegments, start, visitedDirectSegments, "Route is not found from selected start point."); if (ctx.planRouteIn2Directions()) { - if(!graphDirectSegments.isEmpty() && !graphReverseSegments.isEmpty()) forwardSearch = (nonHeuristicSegmentsComparator.compare(graphDirectSegments.peek(), graphReverseSegments.peek()) < 0); // if (graphDirectSegments.size() * 2 > graphReverseSegments.size()) { // forwardSearch = false; diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index a564893fb8..a1c02e9b27 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -226,7 +226,6 @@ - diff --git a/OsmAnd/res/layout/activity_gl.xml b/OsmAnd/res/layout/activity_gl.xml deleted file mode 100644 index 9152181e0b..0000000000 --- a/OsmAnd/res/layout/activity_gl.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - \ No newline at end of file diff --git a/OsmAnd/res/layout/atlas_map_renderer_view.xml b/OsmAnd/res/layout/atlas_map_renderer_view.xml new file mode 100644 index 0000000000..49aad8f57c --- /dev/null +++ b/OsmAnd/res/layout/atlas_map_renderer_view.xml @@ -0,0 +1,6 @@ + + diff --git a/OsmAnd/res/layout/dash_search_fragment.xml b/OsmAnd/res/layout/dash_search_fragment.xml index 95408d7fd7..df0f6a8f7e 100644 --- a/OsmAnd/res/layout/dash_search_fragment.xml +++ b/OsmAnd/res/layout/dash_search_fragment.xml @@ -7,12 +7,16 @@ android:background="@drawable/bg_cardui" android:orientation="vertical" > - + + + - - - \ No newline at end of file diff --git a/OsmAnd/res/layout/main.xml b/OsmAnd/res/layout/main.xml index fe649dba0e..26f704d15d 100644 --- a/OsmAnd/res/layout/main.xml +++ b/OsmAnd/res/layout/main.xml @@ -12,9 +12,9 @@ android:orientation="vertical"> diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index 49e58ecd1f..8a8ea1b511 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -1,4 +1,4 @@ - + Без аўтаматычнага масштабіраваньня Зачыніць Для сярэдняга масштаба @@ -1915,7 +1915,6 @@ OsmAnd мае адкрыты зыходны код і актыўна разві Задаць дапушчальнае значэньне перавышэньня хуткасьці, пры якім вы атрымаеце галасавое паведамленьне. Назва ўлюбёнай кропкі была зьменена на %1$s для магчымасьці захаваньня радка з эматыконам ў файл. Паказаць маршрут - Тэст натыўнай візуалізацыі Дубляваньне назвы ўлюбёнага пункту Назва ўлюбёнага пункту %1$s была зьменена для прадухіленьня дубляваньня імёнаў. Выкарыстоўваць натыўную візуалізацыю @@ -1926,7 +1925,6 @@ OsmAnd мае адкрыты зыходны код і актыўна разві Вы ўвайшлі як %1$s Сэрвіс OsMo не даступны:\n- Праверце спалучэньне;\n- Праверце налады;\n- Праверце наш Twitter: https://twitter.com/OsMomobi Ананімнаму карыстальніку недаступныя:\n- Вытварэньне груп;\n- Сінхранізацыя груп і прыстасаваньняў з серверам;\n- Кіраваньне групамі і прыстасаваньнямі ў асабістым кабінеце. - Пачаць працу з натыўнай візуалізацыяй Настройка мапы Паблізу ад Падрабязнасьці diff --git a/OsmAnd/res/values-bg/strings.xml b/OsmAnd/res/values-bg/strings.xml index 117fc310e9..692e326873 100644 --- a/OsmAnd/res/values-bg/strings.xml +++ b/OsmAnd/res/values-bg/strings.xml @@ -1,4 +1,4 @@ - + Промени в 1.5: \n\t* Гласови предупреждения за пътни ограничения и камери \n\t* Гласово обявяване имената на улиците diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index d9b39b8fcd..4ee1b80953 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -1,4 +1,4 @@ - + Mostra els missatges d\'avís… Rutes amb fluorescència Mostra el regle @@ -1856,8 +1856,6 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània, Mida del text Nom de punt preferit duplicat S\'ha canviat el nom del vostre punt preferit a %1$s per evitar duplicitats. - Prova de renderització nativa - Inicia l\'activitat amb renderització nativa Utilitza la renderització nativa Ús de renderització C++ en comptes de Java El nom del vostre punt preferit s\'ha canviat a %1$s per facilitar el desar bé la cadena amb emoticones en un fitxer. diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index 0d96cc4e51..4ec1105bd0 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -1,4 +1,4 @@ - + Vektorové mapy toto místo neobsahují. Mapová data můžete stáhnout v Nastaveních (Spravovat mapové soubory), nebo se přepněte na online mapy. "Změny ve verzi 0.7.2 : \n\t- Native rendering pro všechna zařízení @@ -1732,8 +1732,6 @@ s často kladenými otázkami. Nastavit velikost písma na mapě. Název oblíbeného bodu je již použit Aby nevznikla duplicita, oblíbený bod byl uložen jako %1$s. - Test nativního vykreslování - Spustí činnost s nativním vykreslováním Použít nativní vykreslování Použít C++ vykreslování místo Javy Vytisknout trasu diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index 8342197de1..2b31683213 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -1,4 +1,4 @@ - + Overvej at købe Højdekurve udvidelsen (\'Contour lines\') på Google Play for at støtte den videre udvikling. Optag video Optag audio @@ -1805,8 +1805,6 @@ Tekststørrelse Favoritnavn dublet Favoritnavn er ændret til %1$s for at undgå dubletter. - Test indbygget optegning - Start aktivitet med indbygget optegning Brug indbygget optegning Brug C++ optegning i stedet for Java Udskriv rute diff --git a/OsmAnd/res/values-de/bidforfix.xml b/OsmAnd/res/values-de/bidforfix.xml index fe70ecec4a..499b81b491 100644 --- a/OsmAnd/res/values-de/bidforfix.xml +++ b/OsmAnd/res/values-de/bidforfix.xml @@ -2,5 +2,5 @@ Lädt gerade %1$d Unterstützer - bereits gespendet: %d%% + Bereits gespendet: %d%% diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml index 6010f5f353..7ba393a2d9 100644 --- a/OsmAnd/res/values-de/phrases.xml +++ b/OsmAnd/res/values-de/phrases.xml @@ -18,7 +18,7 @@ Krankenhaus Jugendherberge Hotel - Historisches bergwerk + Historisches Bergwerk Kloster Motel Monument diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 1e8f2f214a..3c027aead9 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -1,4 +1,4 @@ - + Geschwindigkeitsbegrenzung Grenzkontrolle @@ -999,7 +999,7 @@ Gesamtentfernung: %1$s\nReisezeit: %2$d h %3$d min Online- oder Offline-Dienst zur Routenberechnung wählen Navigationsdienst - Auf den Daten-Ordner auf der SD-Karte kann nicht zugegriffen werden + Auf den Daten-Ordner auf der SD-Karte kann nicht zugegriffen werden! Herunterladen {0} - {1}? Offline Daten für {0} existieren schon ({1}). Wollen Sie die überschreiben ({2})? Adresse @@ -1535,7 +1535,7 @@ Autobahnen vermeiden Gewichtsbeschränkung Angabe eines Fahrzeuggewichts für die Zulässigkeit Route - "Seit Android 4.4 (KitKat) können neue Karten-Downloads nicht mehr am Speicherort früherer Android-Versionen gespeichert werden (%s). Jetzt den zulässigen Speicherort wählen und alle OsmAnd Dateien dorthin kopieren? + "Seit Android 4.4 (KitKat) können neue Karten-Downloads nicht mehr am Speicherort früherer Android-Versionen gespeichert werden (%s). Jetzt den zulässigen Speicherort wählen und alle OsmAnd-Dateien dorthin kopieren? \n Hinweis 1: Die ursprünglichen Dateien bleiben hiervon unberührt, können aber nachfolgend manuell gelöscht werden. \n Hinweis 2: Die Dateien können dann nicht mehr von OsmAnd und OsmAnd+ gemeinsam genutzt werden." Soll Osmand auch die Dateien an den neuen Speicherort verschieben? @@ -1975,8 +1975,6 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an Schriftgröße Doppelung beim Favoriten-Namen Name des Favoriten bereits vergeben, er wurde auf %1$s geändert. - Nativen Renderer testen - Nutzt den nativen Renderer Nativen Renderer benutzen C++ Renderer statt Java-Renderer nutzen Der Name des Favoriten wurde auf %1$s geändert, denn Zeichenketten mit Emoticons können nicht gespeichert werden. @@ -2005,7 +2003,7 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an Bildschirm bei Navigationsanweisung aktivieren Niemals Auswählen auf der Karte - Straße blockieren … + Straße blockieren… Straßen- und Eisenbahnlinien Eisenbahn-Strecken Sammeltaxi-Routen @@ -2014,6 +2012,9 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an Ausblenden %1$s benötigt diese Berechtigung, um den Bildschirm auszuschalten (Energiesparfunktion). Erweitert + Start + Koordinaten + Nächstgelegene Straße konnte nicht gefunden werden Sichere Verbindung zum Server Nutze https Karten @@ -2021,4 +2022,4 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an ALLES ANZEIGEN Koordinaten Suche nach - + diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml index 7dfdb12676..fdff9d345f 100644 --- a/OsmAnd/res/values-el/strings.xml +++ b/OsmAnd/res/values-el/strings.xml @@ -1,4 +1,4 @@ - + Προσθήκη Ετικέτας Λειτουργία για προχωρημένους… Στάθμευση diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml index ec52d10d98..f8f253523b 100644 --- a/OsmAnd/res/values-es/strings.xml +++ b/OsmAnd/res/values-es/strings.xml @@ -1,4 +1,4 @@ - + Configura pantalla @@ -1839,8 +1839,6 @@ Afganistán, Albania, Alemania, Andorra, Angola, Anguila, Antigua y Barbuda, Ant Tamaño de texto Nombre de punto favorito duplicado Hemos cambiado el nombre de tu punto favorito a %1$s para evitar nombres duplicados. - Probar renderización nativa - Iniciar la actividad con renderización nativa Usar renderización nativa Usar el renderizado C++ en lugar de Java Imprimir ruta diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 6570fe58ed..a075575dce 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -1,4 +1,4 @@ - + Modifications hors-ligne Toujours utiliser l\'édition hors-ligne "Changements en 0.7.1 : @@ -1821,8 +1821,6 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et Ce nom est déjà utilisé pour un favori. Nous avons modifié le nom de votre favori en %1$s pour éviter les doublons. Sélectionnez la taille du texte sur la carte. - Tester le moteur de rendu natif - Démarrer l\'activité avec le moteur de rendu natif Utiliser le moteur natif de rendu Utiliser le moteur de rendu C++ au lieu de Java Exporter l\'itinéraire diff --git a/OsmAnd/res/values-gl/strings.xml b/OsmAnd/res/values-gl/strings.xml index a12a21e50f..f647426e64 100644 --- a/OsmAnd/res/values-gl/strings.xml +++ b/OsmAnd/res/values-gl/strings.xml @@ -1,4 +1,4 @@ - + O nome do punto favorito foi cambiado a %1$s para evitar os duplicados. Configurar o tamaño da letra no mapa. Tamaño da letra @@ -16,8 +16,6 @@ "Pódense buscar sitios directamente no mapa con «Empregar o lugar» → «Buscar preto de aquí» ou chamando pola pantalla de busca mediante «Menú» → «Buscar».\n\nA pantalla de busca fornece modelos para buscar\n\t* polo enderezo\n\t* mediante coordenadas\n\t* como punto de interese (PDI, por tipo ou polo nome)\n\t* mediante o historial de buscas\n\t* ou mediante os favoritos predefinidos.\n\nCon todas as coincidencias hai un menú de contexto ou barra de accións que ofrece opcións tipo «Indicacións a» ou «Mostrar no mapa», etc. " Cambiamos o punto favorito a %1$s para facilitar que se garde a cadea con emoticonas nun ficheiro. Imprimir o itinerario - Probar o renderizador nativo - Inicia a actividade cun renderizador nativo O nome do punto favorito está duplicado Empregar o renderizador nativo Empregar o renderizador en C++ en troques de en Java diff --git a/OsmAnd/res/values-hr/strings.xml b/OsmAnd/res/values-hr/strings.xml index 1a3c5a301a..f49f9e1fb3 100644 --- a/OsmAnd/res/values-hr/strings.xml +++ b/OsmAnd/res/values-hr/strings.xml @@ -1,4 +1,4 @@ - + GPS informacije Vrijeme dolaska provjereno diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index ef5879f782..7283f229db 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -1,4 +1,4 @@ - + "A 0.7.2 kiadás változásai: \n\t- Natív renderelő minden eszközre \n\t- Offline POI szerkesztés @@ -1767,9 +1767,7 @@ Forgalomcsillapító Traffipax Forgalmi figyelmeztetés - Natív renderelés tesztelése - Natív renderelő elindítása - Kedevenc hely név duplikáció + Kedevenc hely név duplikáció A duplikáció elkerülése érdekében módosítottuk a kedvenc hely nevét erre: %1$s. Natív renderelő használata C++ renderelő használata Java helyett diff --git a/OsmAnd/res/values-hy/strings.xml b/OsmAnd/res/values-hy/strings.xml index 565c73e8d3..8ca9a4dbb9 100644 --- a/OsmAnd/res/values-hy/strings.xml +++ b/OsmAnd/res/values-hy/strings.xml @@ -1,4 +1,4 @@ - + Տարածքի ռելիեֆ Տարածքի մգեցված ռելիեֆով քարտեզներ Սկիզբ diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 52dde9d2c9..336d25b06f 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -1,4 +1,4 @@ - + Sovrapposizioni fluorescenti Usa colori fluorescenti per visualizzare tracce e percorsi Modifiche offline @@ -792,9 +792,9 @@ \n\t- Il rendering delle mappe è ora più veloce e preciso (la gran parte delle linee costiere e le zone allagate sono state sistemate). \n\t- Devi scaricare dati offline completamente nuovi (i vecchi non saranno più supportati) \n\t- *Calcolo dei percorsi offline* - \n\t - Il calcolo dei percorsi offline diventa più solido + \n\t- Il calcolo dei percorsi offline diventa più solido \n\t- *Miglioramento usabilità e UI* - \n\t - Miglioramenti in svariate aree + \n\t- Miglioramenti in svariate aree Visualizza le impostazioni necessarie per contributi a OSM come la raccolta/modifica dei PDI di OSM, aprire/commentare errori di OSM e inviare file GPX registrati (richiede le credenziali di OSM). Le mappe vettoriali dovrebbero apparire più velocemente. Su certi dispositivi potrebbero non funzionare bene. @@ -1964,7 +1964,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz Annuncia PDI nelle vicinanze Itinerari Tutto - Registra le tue tracce con il pulsante dedicato nello schermo della mappa. Mostra le impostazioni per la registrazione dei tuoi viaggi in file GPX localmente o online utilizzando un servizio web. + Registra le tue tracce con il pulsante dedicato nello schermo della mappa. Mostra le impostazioni per la registrazione dei vostri viaggi in file GPX localmente o online utilizzando un servizio web. Registra i tuoi viaggi h Durata @@ -1986,8 +1986,6 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz Clicca su un oggetto per visualizzare maggiori dettagli, tieni premuto per disattivarlo o cancellarlo. Dati attualmente nel dispositivo (%1$s liberi): Imposta la dimensione del testo sulla mappa. Dimensione del testo - Prova il rendering nativo - Inizia l\'attività con il rendering nativo Duplicato del nome del punto preferito Per evitare duplicati il nome del vostro punto preferito è stato modificato in %1$s. Usa il rendering nativo @@ -2032,7 +2030,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz MOSTRA TUTTO Coordinate Casa - Mappe + Mappe Cerca MOSTRA LA MAPPA diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml index 66c722437f..9aa2691a9e 100644 --- a/OsmAnd/res/values-ja/strings.xml +++ b/OsmAnd/res/values-ja/strings.xml @@ -1,4 +1,4 @@ - + 新しいデータを展開中… オンライン経路案内を使用しようとしていますが インターネット接続されていません。 @@ -2062,8 +2062,6 @@ OsmAndはオープンソースであり、活発に開発が進められいま 制限速度超過による警告音声の許容値を選択。 お気に入り地点名%1$sはファイルに絵文字を含む文字列を保存し、分かり易いよう変更されています。 経路印刷 - ネイティブレンダリングのテスト - ネイティブレンダリングを有効化して開始 お気に入り地点の重複 名前の重複を避けるために、%1$s にお気に入り地点の名前を変更しました。 ネイティブレンダリングを使用 diff --git a/OsmAnd/res/values-ko/strings.xml b/OsmAnd/res/values-ko/strings.xml index ab2b1440cd..e0cf98e9f5 100644 --- a/OsmAnd/res/values-ko/strings.xml +++ b/OsmAnd/res/values-ko/strings.xml @@ -1,4 +1,4 @@ - + 벡터 맵이 더욱 빠르게 표시됩니다. 하지만, 어떤 기기에서는 잘 작동하지 않을 수 있습니다. 현재 선택된 음성 명령을 재생합니다 @@ -2035,8 +2035,6 @@ 텍스트 크기 즐겨찾기 포인트 이름 중복 중복된 포인트 이름을 방지 하기 위해서 %1$s 에 즐겨찾기 포인트 이름을 변경합니다. - 기본 렌더링 테스트 - 기본 렌더링으로 활동(activity)을 시작합니다 기본 렌더링 사용 Java 대신 C++ 렌더링을 사용합니다 경로 인쇄 diff --git a/OsmAnd/res/values-ku/strings.xml b/OsmAnd/res/values-ku/strings.xml index 692bae9021..3ac26e7d9c 100644 --- a/OsmAnd/res/values-ku/strings.xml +++ b/OsmAnd/res/values-ku/strings.xml @@ -1,4 +1,4 @@ - + donya hich wafay bom niya, zhyan hich khoshi bom niya, mrdn jegay shanaziya زانیاری دەنگ/ڤیدیۆ diff --git a/OsmAnd/res/values-lt/strings.xml b/OsmAnd/res/values-lt/strings.xml index d984f7daa1..743658964f 100644 --- a/OsmAnd/res/values-lt/strings.xml +++ b/OsmAnd/res/values-lt/strings.xml @@ -1,4 +1,4 @@ - + Pradžios taškas yra per toli nuo artimiausio kelio. Bendrinta vieta Dėmesio @@ -1807,8 +1807,6 @@ Spustelėkite bet kurį elementą, norėdami gauti daugiau informacijos, paspauskite ir laikykite, norėdami išjungti arba ištrinti. Dabartiniai duomenys įrenginyje (%1$s laisva): Išspausdinti maršrutą Mes pakeitėme jūsų įsimintos vietos pavadinimą į %1$s, nes teksto su veidukais išsaugoti faile neįmanoma. - Testuoti aparatinį atvaizdavimą - Pradeda veiklą su aparatiniu atvaizdavimu Naudoti aparatinį atvaizdavimą Naudoti C++ vietoje Java atvaizdavimo Greičio ribojimo viršijimo reikšmė diff --git a/OsmAnd/res/values-lv/strings.xml b/OsmAnd/res/values-lv/strings.xml index 90bde3a9cf..7ebc5a23fe 100644 --- a/OsmAnd/res/values-lv/strings.xml +++ b/OsmAnd/res/values-lv/strings.xml @@ -1,4 +1,4 @@ - + Spraudņu pārvaldnieks Atzīmējiet spraudni, lai to aktivizētu (varētu būt nepieciešams OsmAnd restarts) Spraudņi iespējo aplikācijas papildus funkcijas un uzstādījumus kā piemēram sekošana, enerģijas taupīšana, pieejamība un daudzas citas diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index f60e447667..96e097cefa 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -1,4 +1,4 @@ - + Velg fargeskjema for veier: Veifargeskjema Vis retning til målet diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 5216dde306..f24655a51c 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -1,4 +1,4 @@ - + Configureer scherm @@ -1967,8 +1967,6 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A Tekstgrootte Favoriet bestaat al: de naam is veranderd in %1$s Favoriet met deze naam bestaat al - Test \"native weergave\" - Start activiteit met oorspronkelijke weergave Gebruik oorspronkelijke weergave Gebruik C++ weergave in plaats van Java Favoriet bewaard als %1s omdat vreemde tekens niet opgeslagen kunnen worden in een bestand. diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 7c46d17adf..c355ad4a9e 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -1,4 +1,4 @@ - + "Zmiany w 0.6.9: \n\t- poprawiono renderowanie map offline \n\t- szybkie renderowanie natywne (wersja eksperymentalna - może nie działać na niektórych urządzeniach) \n\t- poprawki w interfejsie \n\t- dodano wyświetlanie informacji o wysokości (altitude) \n\t- nowe tłumaczenia (polskie, wietnamskie) \n\t- inne, mniejsze poprawki " Przezroczysty styl @@ -1910,8 +1910,6 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant Rozmiar tekstu Zduplikowana nazwa ulubionego punktu Zmieniliśmy nazwa twojego ulubionego punktu na %1$s w celu uniknięcia duplikatów nazw. - Test renderowania natywnego - Rozpocznij aktywność z renderowaniem natywnym Użyj renderowania natywnego Użyj kodu renderowania C++ zamiast Java Tolerancja ograniczenia prędkości diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index e65fc71505..c760e4b43e 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -1,4 +1,4 @@ - + Использовать безопасное соединение с сервером Использовать https @@ -1776,8 +1776,7 @@ Ограничение скорости Выберите допустимое значение превышения скорости выше которого вы получите голосовое предупреждение. Допустимое значение превышения скорости - Тест нативной визуализации - Название избранной точки было изменено на %1$s для возможности сохранения строки со смайликом в файл. + Название избранной точки было изменено на %1$s для возможности сохранения строки со смайликом в файл. Печать маршрута Дублирование названия избранной точки Название избранной точки %1$s было изменено для предотвращения дублирования имен. @@ -1786,8 +1785,7 @@ Установите размер текста для карты. Размер текста Нажмите на любой элемент списка для просмотра более подробной информации, нажмите и удерживайте, чтобы поместить в архив или удалить. Текущие данные на устройстве (%1$s свободно): - Запустить activity с нативной визуализацией - Устройство не обнаружено + Устройство не обнаружено Анонимный пользователь Сервис OsMo не доступен:\n- проверьте соединение;\n- проверьте настройки;\n- проверьте наш Twitter: https://twitter.com/OsMomobi Анонимному пользователю недоступно:\n- создание групп;\n- синхронизация групп и устройств с сервером;\n- управление группами и устройствами в личном кабинете. diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index 26963e30b1..510cfdea5e 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -1,4 +1,4 @@ - + Ammustra sa positzione semper a su tzentru Boghe Mistura @@ -1742,8 +1742,6 @@ Si cussigiat de annànghere unu o prus puntos intermedios pro megiorare sas pres Mannària de su testu Amus cambiau su nùmene de su prefèrridu tuo a %1$s pro evitare nùmenes dòpios. Nùmene dòpiu in sos prefèrridos - Collàuda sa renderizatzione nativa - Incumentza s\'atividade cun sa renderizatzione nativa Imprea sa renderizatzione nativa Imprea sa renderizatzione C++ imbetzes de Java Imprenta àndala diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 7a0380ab11..d7ac706c28 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -1,4 +1,4 @@ - + Zobraziť Fotografia %1$s zachytená dňa %2$s Zachytiť fotografiu @@ -1952,8 +1952,6 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda, Veľkosť textu Duplicitný názov obľúbeného bodu Názov obľúbeného bodu bol zmenený na %1$s, aby nevznikla duplicita. - Testovať natívne vykresľovanie - Spustí činnosť s natívnym vykresľovaním Použiť natívne vykresľovanie Použiť vykresľovanie v C++ namiesto Javy Názov obľúbeného bodu bol upravený na %1$s, aby bolo možné správne uložiť názov s emotikonom do súboru. diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml index 1c5e549ca6..542b4ed742 100644 --- a/OsmAnd/res/values-sl/strings.xml +++ b/OsmAnd/res/values-sl/strings.xml @@ -1,4 +1,4 @@ - + Iskanje Iskanje Nastavitve @@ -1965,10 +1965,8 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A Toleranca omejitve hitrosti Izberite mejo tolerance omejitve hitrosti, nad katero boste prejeli glasovno opozorilo. Tiskanje poti - Poskus izvirnega upodabljanja Uporabi C++ upodabljanje namesto Java "Spremembe v 1.9:\n\t* Posodobljeni stili zemljevida s upodabljanjem površine cestišča, transportnih plasti in pohodniških simbolov\n\t* Iskanje POI na poti\n\t* Označi cesto kot neprehodno na sejo\n\t* Lažje nalaganje in posodabljanje zemljevidov\n\t* Vizualno in zvočno obvestilo, ki se izvede ko se približujete točkam\n\t* Tisk poti in informacij o zavojih\n\t* Podpora pasov za zavijanje\n\t* Podpora Android Wear\n\t* Veliko sprememb grafičnega vmesnika\n\t* Ločena povečava za velikost črk na zemljevidu\n\t* Posebna zvočna obvestila v primeru, da niste na poti\n\t* Funkcionalnost prijave v OsMo\n\t* Popravilo OsMo nezdružljivosti različic " - Začetek aktivnosti z izvirnim upodabljanjem Podvojeno ime priljubljene lokacije Ime vaše priljubljene lokacije je bilo spremenjeno v %1$s, da bi se izognili podvojenih imen. Uporabi izvirno upodabljanje diff --git a/OsmAnd/res/values-sv/strings.xml b/OsmAnd/res/values-sv/strings.xml index 9e3bf0d9e7..dd51b1923a 100644 --- a/OsmAnd/res/values-sv/strings.xml +++ b/OsmAnd/res/values-sv/strings.xml @@ -1,4 +1,4 @@ - + För att låsa upp skärmen tryck på låsikonen Välj land Välj stad @@ -1690,8 +1690,6 @@ Peta på en post för att se fler detaljer, tryck och håll för att inaktivera eller ta bort. Data på enheten (%1$s ledigt): Ange textstorlek på kartan. Textstorlek - Testa inbyggd rendering - Startar aktivitet med inbyggd rendering Duplicerat namn på favoritpunkt Namnet på din favoritpunkt %1$s ändrades för att undvika duplicerade namn. Använd inbyggd rendering diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml index 5758bd9f31..67b56c744b 100644 --- a/OsmAnd/res/values-tr/strings.xml +++ b/OsmAnd/res/values-tr/strings.xml @@ -1,4 +1,4 @@ - + Değişiklik listesini kapat ZXing Barcode Scanner uygulaması kurulu değil. Uygulama marketinde aramak ister misiniz? Yol renk şemasını seç: diff --git a/OsmAnd/res/values-vi/strings.xml b/OsmAnd/res/values-vi/strings.xml index e544cb5070..a022f190ac 100644 --- a/OsmAnd/res/values-vi/strings.xml +++ b/OsmAnd/res/values-vi/strings.xml @@ -1,4 +1,4 @@ - + diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 1c5cf16a1f..dfcf0e02ca 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -1,4 +1,4 @@ - + 選擇道路的色彩調配: 道路的色彩調配 顯示目的地方向 @@ -1793,8 +1793,6 @@ 文字大小 我的最愛標點,名稱重複 我們把我的最愛標點名稱,改為 %1$s 以避免名稱重複。 - 測試原生繪製 - 開始啟動原生繪製 使用原生繪製 使用 C++ 替代 JAVA 繪製 列印路線 diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 7c4a73ea0e..6d92ea79cf 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -214,6 +214,8 @@ Pier Surveillance + Observatory + Astronomical observatory Construction Works Mineshaft @@ -404,6 +406,8 @@ Caravan site Picnic site Spring + Hot spring + Geyser Cemetery Graveyard Shelter diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 29b6e282b2..2c8a381588 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Nearest road was not found Home Use secure connection with server Use https @@ -69,8 +70,6 @@ Select speed limit tolerance margin, above which you will receive a voice warning. The favorite point name has been modified to %1$s to facilitate properly saving the string with emoticons to a file. Print route - Test native rendering - Starts activity with native rendering Favorite point name duplicate We changed your favorite point name to %1$s to avoid duplicated names. Use native rendering diff --git a/OsmAnd/src/net/osmand/core/android/GLActivity.java b/OsmAnd/src/net/osmand/core/android/GLActivity.java deleted file mode 100644 index 2f1bb121d1..0000000000 --- a/OsmAnd/src/net/osmand/core/android/GLActivity.java +++ /dev/null @@ -1,508 +0,0 @@ -package net.osmand.core.android; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.egl.EGLDisplay; -import javax.microedition.khronos.egl.EGLSurface; -import javax.microedition.khronos.opengles.GL10; - -import net.osmand.core.jni.*; -import net.osmand.data.LatLon; -import net.osmand.data.QuadPoint; -import net.osmand.data.RotatedTileBox; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandSettings; -import net.osmand.plus.R; -import net.osmand.plus.helpers.TwoFingerTapDetector; -import net.osmand.plus.render.NativeOsmandLibrary; -import android.app.Activity; -import android.content.Context; -import android.opengl.EGL14; -import android.opengl.GLSurfaceView; -import android.os.Bundle; -import android.os.Environment; -import android.util.DisplayMetrics; -import android.util.Log; -import android.view.GestureDetector; -import android.view.GestureDetector.OnDoubleTapListener; -import android.view.Menu; -import android.view.MenuItem; -import android.view.MotionEvent; -import android.view.Window; -import android.view.WindowManager; - -import java.io.File; - -public class GLActivity extends Activity { - - static { - NativeOsmandLibrary.loadLibrary("gnustl_shared"); - NativeOsmandLibrary.loadLibrary("Qt5Core"); - NativeOsmandLibrary.loadLibrary("Qt5Network"); - NativeOsmandLibrary.loadLibrary("Qt5Sql"); - NativeOsmandLibrary.loadLibrary("OsmAndCoreWithJNI"); - } - private static final String TAG = "OsmAndCoreSample"; - - private CoreResourcesFromAndroidAssetsCustom _coreResources; - - private float _displayDensityFactor; - private int _referenceTileSize; - private int _rasterTileSize; - private IMapStylesCollection _mapStylesCollection; - private ResolvedMapStyle _mapStyle; - private ObfsCollection _obfsCollection; - private MapPresentationEnvironment _mapPresentationEnvironment; - private MapPrimitiviser _mapPrimitiviser; - private ObfMapObjectsProvider _obfMapObjectsProvider; - private MapPrimitivesProvider _mapPrimitivesProvider; - private MapObjectsSymbolsProvider _mapObjectsSymbolsProvider; - private MapRasterLayerProvider _mapRasterLayerProvider; - private OnlineRasterMapLayerProvider _onlineMapRasterLayerProvider; - private IMapRenderer _mapRenderer; - private GpuWorkerThreadPrologue _gpuWorkerThreadPrologue; - private GpuWorkerThreadEpilogue _gpuWorkerThreadEpilogue; - private RenderRequestCallback _renderRequestCallback; - private QIODeviceLogSink _fileLogSink; - private RotatedTileBox currentViewport = null; - - private GestureDetector gestureDetector; - - - protected OsmandApplication getApp() { - return (OsmandApplication) getApplication(); - } - - private boolean afterTwoFingerTap = false; - TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() { - @Override - public void onTwoFingerTap() { - afterTwoFingerTap = true; - currentViewport.setZoom(currentViewport.getZoom() - 1); - updateView(); - } - }; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - requestWindowFeature(Window.FEATURE_NO_TITLE); - OsmandSettings st = getApp().getSettings(); - WindowManager mgr = (WindowManager) getSystemService(Context.WINDOW_SERVICE); - DisplayMetrics dm = new DisplayMetrics(); - mgr.getDefaultDisplay().getMetrics(dm); - currentViewport = new RotatedTileBox.RotatedTileBoxBuilder(). - setLocation(st.getLastKnownMapLocation().getLatitude(), - st.getLastKnownMapLocation().getLongitude()).setZoomAndScale(st.getLastKnownMapZoom(), 0). - setPixelDimensions(dm.widthPixels, dm.heightPixels).build(); - currentViewport.setDensity(dm.density); - - - - gestureDetector = new GestureDetector(this, new android.view.GestureDetector.OnGestureListener() { - - @Override - public boolean onSingleTapUp(MotionEvent e) { - return false; - } - - @Override - public void onShowPress(MotionEvent e) { - } - - @Override - public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - final QuadPoint cp = currentViewport.getCenterPixelPoint(); - final LatLon latlon = currentViewport.getLatLonFromPixel(cp.x + distanceX, cp.y + distanceY); - currentViewport.setLatLonCenter(latlon.getLatitude(), latlon.getLongitude()); - updateView(); - return false; - } - - @Override - public void onLongPress(MotionEvent e) { - } - - @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - return false; - } - - @Override - public boolean onDown(MotionEvent e) { - return false; - } - }); - gestureDetector.setOnDoubleTapListener(new OnDoubleTapListener() { - @Override - public boolean onSingleTapConfirmed(MotionEvent e) { - return false; - } - - @Override - public boolean onDoubleTapEvent(MotionEvent e) { - return false; - } - - @Override - public boolean onDoubleTap(MotionEvent e) { - currentViewport.setZoom(currentViewport.getZoom() + 1); - updateView(); - return true; - } - }); - - setContentView(R.layout.activity_gl); - - // Get device display density factor - DisplayMetrics displayMetrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - _displayDensityFactor = displayMetrics.density; - _referenceTileSize = (int)(256 * _displayDensityFactor); - _rasterTileSize = Integer.highestOneBit(_referenceTileSize - 1) * 2; - Log.i(TAG, "displayDensityFactor = " + _displayDensityFactor); - Log.i(TAG, "referenceTileSize = " + _referenceTileSize); - Log.i(TAG, "rasterTileSize = " + _rasterTileSize); - - Log.i(TAG, "Initializing core..."); - _coreResources = CoreResourcesFromAndroidAssetsCustom.loadFromCurrentApplication(this); - OsmAndCore.InitializeCore(_coreResources.instantiateProxy()); - - File directory =getApp().getAppPath(""); - _fileLogSink = QIODeviceLogSink.createFileLogSink(directory.getAbsolutePath() + "/osmandcore.log"); - Logger.get().addLogSink(_fileLogSink); - - Log.i(TAG, "Going to resolve default embedded style..."); - _mapStylesCollection = new MapStylesCollection(); - _mapStyle = _mapStylesCollection.getResolvedStyleByName("default"); - if (_mapStyle == null) - { - Log.e(TAG, "Failed to resolve style 'default'"); - System.exit(0); - } - - Log.i(TAG, "Going to prepare OBFs collection"); - _obfsCollection = new ObfsCollection(); - - Log.i(TAG, "Will load OBFs from " + directory.getAbsolutePath()); - _obfsCollection.addDirectory(directory.getAbsolutePath(), false); - - Log.i(TAG, "Going to prepare all resources for renderer"); - _mapPresentationEnvironment = new MapPresentationEnvironment( - _mapStyle, - _displayDensityFactor, - "en"); //TODO: here should be current locale - //mapPresentationEnvironment->setSettings(configuration.styleSettings); - _mapPrimitiviser = new MapPrimitiviser( - _mapPresentationEnvironment); - _obfMapObjectsProvider = new ObfMapObjectsProvider( - _obfsCollection); - _mapPrimitivesProvider = new MapPrimitivesProvider( - _obfMapObjectsProvider, - _mapPrimitiviser, - _rasterTileSize); - _mapObjectsSymbolsProvider = new MapObjectsSymbolsProvider( - _mapPrimitivesProvider, - _rasterTileSize); - _mapRasterLayerProvider = new MapRasterLayerProvider_Software( - _mapPrimitivesProvider); - - _onlineMapRasterLayerProvider = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)"); - - Log.i(TAG, "Going to create renderer"); - _mapRenderer = OsmAndCore.createMapRenderer(MapRendererClass.AtlasMapRenderer_OpenGLES2); - if (_mapRenderer == null) - { - Log.e(TAG, "Failed to create map renderer 'AtlasMapRenderer_OpenGLES2'"); - System.exit(0); - } - - AtlasMapRendererConfiguration atlasRendererConfiguration = AtlasMapRendererConfiguration.Casts.upcastFrom(_mapRenderer.getConfiguration()); - atlasRendererConfiguration.setReferenceTileSizeOnScreenInPixels(_referenceTileSize); - _mapRenderer.setConfiguration(AtlasMapRendererConfiguration.Casts.downcastTo_MapRendererConfiguration(atlasRendererConfiguration)); - - _mapRenderer.addSymbolsProvider(_mapObjectsSymbolsProvider); - updateView(); - /* - IMapRasterLayerProvider mapnik = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)"); - if (mapnik == null) - Log.e(TAG, "Failed to create mapnik"); - */ - _mapRenderer.setMapLayerProvider(0, _mapRasterLayerProvider); - - _glSurfaceView = (GLSurfaceView) findViewById(R.id.glSurfaceView); - //TODO:_glSurfaceView.setPreserveEGLContextOnPause(true); - _glSurfaceView.setEGLContextClientVersion(2); - _glSurfaceView.setEGLContextFactory(new EGLContextFactory()); - _glSurfaceView.setRenderer(new Renderer()); - _glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); - } - - protected void updateView() { - _mapRenderer.setAzimuth(0.0f); - _mapRenderer.setElevationAngle(90); - _mapRenderer.setTarget(new PointI(currentViewport.getCenter31X(), currentViewport.getCenter31Y())); - _mapRenderer.setZoom((float)currentViewport.getZoom() + (float)currentViewport.getZoomScale()); - } - - private GLSurfaceView _glSurfaceView; - - @Override - public boolean onTouchEvent(MotionEvent event) { - if (twoFingerTapDetector.onTouchEvent(event)) { - return true; - } - return gestureDetector.onTouchEvent(event); - } - @Override - protected void onPause() { - super.onPause(); - _glSurfaceView.onPause(); - } - - @Override - protected void onResume() { - super.onResume(); - _glSurfaceView.onResume(); - } - - @Override - protected void onDestroy() { - if (_mapStylesCollection != null) { - _mapStylesCollection.delete(); - _mapStylesCollection = null; - } - - if (_mapStyle != null) { - _mapStyle.delete(); - _mapStyle = null; - } - - if (_obfsCollection != null) { - _obfsCollection.delete(); - _obfsCollection = null; - } - - if (_mapPresentationEnvironment != null) { - _mapPresentationEnvironment.delete(); - _mapPresentationEnvironment = null; - } - - if (_mapPrimitiviser != null) { - _mapPrimitiviser.delete(); - _mapPrimitiviser = null; - } - - if (_obfMapObjectsProvider != null) { - _obfMapObjectsProvider.delete(); - _obfMapObjectsProvider = null; - } - - if (_mapPrimitivesProvider != null) { - _mapPrimitivesProvider.delete(); - _mapPrimitivesProvider = null; - } - - if (_mapObjectsSymbolsProvider != null) { - _mapObjectsSymbolsProvider.delete(); - _mapObjectsSymbolsProvider = null; - } - - if (_mapRasterLayerProvider != null) { - _mapRasterLayerProvider.delete(); - _mapRasterLayerProvider = null; - } - - if (_mapRenderer != null) { - _mapRenderer.delete(); - _mapRenderer = null; - } - - OsmAndCore.ReleaseCore(); - - super.onDestroy(); - } - - private class RenderRequestCallback extends MapRendererSetupOptions.IFrameUpdateRequestCallback { - @Override - public void method(IMapRenderer mapRenderer) { - _glSurfaceView.requestRender(); - } - } - - public class GpuWorkerThreadPrologue extends MapRendererSetupOptions.IGpuWorkerThreadPrologue { - public GpuWorkerThreadPrologue(EGL10 egl, EGLDisplay eglDisplay, EGLContext context, EGLSurface surface) { - _egl = egl; - _eglDisplay = eglDisplay; - _context = context; - _eglSurface = surface; - } - - private final EGL10 _egl; - private final EGLDisplay _eglDisplay; - private final EGLContext _context; - private final EGLSurface _eglSurface; - - @Override - public void method(IMapRenderer mapRenderer) { - try { - if (!_egl.eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _context)) - Log.e(TAG, "Failed to set GPU worker context active: " + _egl.eglGetError()); - } catch (Exception e) { - Log.e(TAG, "Failed to set GPU worker context active", e); - } - } - } - - private class GpuWorkerThreadEpilogue extends MapRendererSetupOptions.IGpuWorkerThreadEpilogue { - public GpuWorkerThreadEpilogue(EGL10 egl) { - _egl = egl; - } - - private final EGL10 _egl; - - @Override - public void method(IMapRenderer mapRenderer) { - try { - if (!_egl.eglWaitGL()) - Log.e(TAG, "Failed to wait for GPU worker context: " + _egl.eglGetError()); - } catch (Exception e) { - Log.e(TAG, "Failed to wait for GPU worker context", e); - } - } - } - - private class EGLContextFactory implements GLSurfaceView.EGLContextFactory { - private EGLContext _gpuWorkerContext; - private EGLSurface _gpuWorkerFakeSurface; - - public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { - final String eglExtensions = egl.eglQueryString(display, EGL10.EGL_EXTENSIONS); - Log.i(TAG, "EGL extensions: " + eglExtensions); - final String eglVersion = egl.eglQueryString(display, EGL10.EGL_VERSION); - Log.i(TAG, "EGL version: " + eglVersion); - - Log.i(TAG, "Creating main context..."); - final int[] contextAttribList = { - EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, - EGL10.EGL_NONE }; - - EGLContext mainContext = null; - try { - mainContext = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, contextAttribList); - } catch (Exception e) { - Log.e(TAG, "Failed to create main context", e); - } - if (mainContext == null || mainContext == EGL10.EGL_NO_CONTEXT) { - Log.e(TAG, "Failed to create main context: " + egl.eglGetError()); - mainContext = null; - System.exit(0); - } - - Log.i(TAG, "Creating GPU worker context..."); - try { - _gpuWorkerContext = egl.eglCreateContext( - display, - eglConfig, - mainContext, - contextAttribList); - } catch (Exception e) { - Log.e(TAG, "Failed to create GPU worker context", e); - } - if (_gpuWorkerContext == null || _gpuWorkerContext == EGL10.EGL_NO_CONTEXT) - { - Log.e(TAG, "Failed to create GPU worker context: " + egl.eglGetError()); - _gpuWorkerContext = null; - } - - if (_gpuWorkerContext != null) - { - Log.i(TAG, "Creating GPU worker fake surface..."); - try { - final int[] surfaceAttribList = { - EGL10.EGL_WIDTH, 1, - EGL10.EGL_HEIGHT, 1, - EGL10.EGL_NONE }; - _gpuWorkerFakeSurface = egl.eglCreatePbufferSurface(display, eglConfig, surfaceAttribList); - } catch (Exception e) { - Log.e(TAG, "Failed to create GPU worker fake surface", e); - } - if (_gpuWorkerFakeSurface == null || _gpuWorkerFakeSurface == EGL10.EGL_NO_SURFACE) - { - Log.e(TAG, "Failed to create GPU worker fake surface: " + egl.eglGetError()); - _gpuWorkerFakeSurface = null; - } - } - - MapRendererSetupOptions rendererSetupOptions = new MapRendererSetupOptions(); - if (_gpuWorkerContext != null && _gpuWorkerFakeSurface != null) { - rendererSetupOptions.setGpuWorkerThreadEnabled(true); - _gpuWorkerThreadPrologue = new GpuWorkerThreadPrologue(egl, display, _gpuWorkerContext, _gpuWorkerFakeSurface); - rendererSetupOptions.setGpuWorkerThreadPrologue(_gpuWorkerThreadPrologue.getBinding()); - _gpuWorkerThreadEpilogue = new GpuWorkerThreadEpilogue(egl); - rendererSetupOptions.setGpuWorkerThreadEpilogue(_gpuWorkerThreadEpilogue.getBinding()); - } else { - rendererSetupOptions.setGpuWorkerThreadEnabled(false); - } - _renderRequestCallback = new RenderRequestCallback(); - rendererSetupOptions.setFrameUpdateRequestCallback(_renderRequestCallback.getBinding()); - _mapRenderer.setup(rendererSetupOptions); - - return mainContext; - } - - public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) { - egl.eglDestroyContext(display, context); - - if (_gpuWorkerContext != null) { - egl.eglDestroyContext(display, _gpuWorkerContext); - _gpuWorkerContext = null; - } - - if (_gpuWorkerFakeSurface != null) { - egl.eglDestroySurface(display, _gpuWorkerFakeSurface); - _gpuWorkerFakeSurface = null; - } - } - } - - private class Renderer implements GLSurfaceView.Renderer { - public void onSurfaceCreated(GL10 gl, EGLConfig config) { - Log.i(TAG, "onSurfaceCreated"); - if (_mapRenderer.isRenderingInitialized()) - _mapRenderer.releaseRendering(); - } - - public void onSurfaceChanged(GL10 gl, int width, int height) { - Log.i(TAG, "onSurfaceChanged"); - _mapRenderer.setViewport(new AreaI(0, 0, height, width)); - _mapRenderer.setWindowSize(new PointI(width, height)); - - if (!_mapRenderer.isRenderingInitialized()) - { - if (!_mapRenderer.initializeRendering()) - Log.e(TAG, "Failed to initialize rendering"); - } - } - - public void onDrawFrame(GL10 gl) { - _mapRenderer.update(); - - if (_mapRenderer.prepareFrame()) - _mapRenderer.renderFrame(); - - gl.glFlush(); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - return super.onOptionsItemSelected(item); - } -} diff --git a/OsmAnd/src/net/osmand/core/android/MapRendererContext.java b/OsmAnd/src/net/osmand/core/android/MapRendererContext.java new file mode 100644 index 0000000000..9719e523f6 --- /dev/null +++ b/OsmAnd/src/net/osmand/core/android/MapRendererContext.java @@ -0,0 +1,477 @@ +package net.osmand.core.android; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import net.osmand.core.jni.IMapTiledSymbolsProvider; +import net.osmand.core.jni.IObfsCollection; +import net.osmand.core.jni.IRasterMapLayerProvider; +import net.osmand.core.jni.MapObjectsSymbolsProvider; +import net.osmand.core.jni.MapPresentationEnvironment; +import net.osmand.core.jni.MapPrimitivesProvider; +import net.osmand.core.jni.MapPrimitiviser; +import net.osmand.core.jni.MapRasterLayerProvider_Software; +import net.osmand.core.jni.ObfMapObjectsProvider; +import net.osmand.core.jni.QStringStringHash; +import net.osmand.core.jni.MapPresentationEnvironment.LanguagePreference; +import net.osmand.core.jni.ResolvedMapStyle; + +/** + * Context container and utility class for MapRendererView and derivatives. + * + * @author Alexey Pelykh + * + */ +public class MapRendererContext { + + public MapRendererContext() { + } + + public MapRendererContext(MapRendererView mapRendererView) { + _mapRendererView = mapRendererView; + } + + /** + * Synchronisation object used to perform state changes atomically + */ + private final Object _syncObject = new Object(); + + /** + * Reference to map renderer view that is currently managed by this + * context + */ + private MapRendererView _mapRendererView; + + /** + * Get currently bound map renderer view + * @return Reference to MapRendererView + */ + public MapRendererView getMapRendererView() { + synchronized (_syncObject) { + return _mapRendererView; + } + } + + /** + * Bounds specified map renderer view to this context + * @param mapRendererView Reference to MapRendererView + */ + public void setMapRendererView(MapRendererView mapRendererView) { + synchronized (_syncObject) { + boolean update = (_mapRendererView != mapRendererView); + if (!update) + return; + + _mapRendererView = mapRendererView; + if (_mapRendererView != null) + apply(); + } + } + + /** + * Display density factor + */ + private float _displayDensityFactor = 1; + + /** + * Reference tile size on screen in pixels + */ + private float _referenceTileSize = 256; + + /** + * Raster tile size in texels + */ + private int _rasterTileSize = 256; + + /** + * Get current display density factor + * @return Display density factor + */ + public float getDisplayDensityFactor() { + synchronized (_syncObject) { + return _displayDensityFactor; + } + } + + /** + * Set display density factor and update context (if needed) + * @param displayDensityFactor New display density factor + */ + public void setDisplayDensityFactor(float displayDensityFactor) { + synchronized (_syncObject) { + boolean update = (_displayDensityFactor != displayDensityFactor); + if (!update) + return; + + _displayDensityFactor = displayDensityFactor; + _referenceTileSize = 256.0f * _displayDensityFactor; + _rasterTileSize = Integer.highestOneBit((int)_referenceTileSize - 1) * 2; + + if (_mapRendererView instanceof AtlasMapRendererView) + ((AtlasMapRendererView)_mapRendererView).setReferenceTileSizeOnScreenInPixels(_referenceTileSize); + if (_mapPresentationEnvironment != null) + updateMapPresentationEnvironment(); + } + } + + /** + * Reference to resolved map style (if used) + */ + private ResolvedMapStyle _mapStyle; + + /** + * Get current map style + * @return Reference to current map style + */ + public ResolvedMapStyle getMapStyle() { + synchronized (_syncObject) { + return _mapStyle; + } + } + + /** + * Set map style and update context (if needed) + * @param mapStyle + */ + public void setMapStyle(ResolvedMapStyle mapStyle) { + synchronized (_syncObject) { + boolean update = (_mapStyle != mapStyle); + if (!update) + return; + + _mapStyle = mapStyle; + if (_mapPresentationEnvironment != null) + updateMapPresentationEnvironment(); + } + } + + /** + * Reference to map style settings (if present) + */ + private Map _mapStyleSettings; + + /** + * Get current map style settings + * @return + */ + public Map getMapStyleSettings() { + synchronized (_syncObject) { + if (_mapStyleSettings == null) + return null; + return Collections.unmodifiableMap(_mapStyleSettings); + } + } + + /** + * Set map style settings and update context (if needed) + * @param mapStyleSettings Map style settings + */ + public void setMapStyleSettings(Map mapStyleSettings) { + synchronized (_syncObject) { + boolean update = !_mapStyleSettings.equals(mapStyleSettings); + if (!update) + return; + + _mapStyleSettings = new HashMap(mapStyleSettings); + if (_mapPresentationEnvironment != null) + updateMapPresentationEnvironment(); + } + } + + /** + * Locale language + */ + private String _localeLanguageId = "en"; + + /** + * Get current locale language + * @return Locale language identifier + */ + public String getLocaleLanguageId() { + synchronized (_syncObject) { + return _localeLanguageId; + } + } + + /** + * Set current locale language and update context (if needed) + * @param localeLanguageId Locale language identifier + */ + public void setLocaleLanguageId(String localeLanguageId) { + synchronized (_syncObject) { + boolean update = !_localeLanguageId.equals(localeLanguageId); + if (!update) + return; + + _localeLanguageId = localeLanguageId; + if (_mapPresentationEnvironment != null) + updateMapPresentationEnvironment(); + } + } + + /** + * Language preference + */ + private LanguagePreference _languagePreference = LanguagePreference.LocalizedAndNative; + + /** + * Get current language preference + * @return Language preference + */ + public LanguagePreference getLanguagePreference() { + synchronized (_syncObject) { + return _languagePreference; + } + } + + /** + * Set language preference and update context (if needed) + * @param languagePreference + */ + public void setLanguagePreference(LanguagePreference languagePreference) { + synchronized (_syncObject) { + boolean update = (_languagePreference != languagePreference); + if (!update) + return; + + _languagePreference = languagePreference; + if (_mapPresentationEnvironment != null) + updateMapPresentationEnvironment(); + } + } + + /** + * Reference to OBFs collection (if present) + */ + private IObfsCollection _obfsCollection; + + /** + * Get current OBFs collection + * @return OBFs collection + */ + public IObfsCollection getObfsCollection() { + synchronized (_syncObject) { + return _obfsCollection; + } + } + + /** + * Set OBFs collection and update context (if needed) + * @param obfsCollection + */ + public void setObfsCollection(IObfsCollection obfsCollection) { + synchronized (_syncObject) { + boolean update = (_obfsCollection != obfsCollection); + if (!update) + return; + + _obfsCollection = obfsCollection; + if (_obfMapObjectsProvider != null) + updateObfMapObjectsProvider(); + } + } + + /** + * Reference to map presentation environment (if used) + */ + private MapPresentationEnvironment _mapPresentationEnvironment; + + /** + * Update map presentation environment and everything that depends on it + */ + private void updateMapPresentationEnvironment() { + // Create new map presentation environment + _mapPresentationEnvironment = new MapPresentationEnvironment( + _mapStyle, + _displayDensityFactor, + _localeLanguageId, + _languagePreference); + + // Apply map style settings + if (_mapStyleSettings != null) { + QStringStringHash convertedStyleSettings = new QStringStringHash(); + for (Iterator> itSetting = _mapStyleSettings + .entrySet().iterator(); itSetting.hasNext();) { + Map.Entry setting = itSetting.next(); + convertedStyleSettings.set(setting.getKey(), setting.getValue()); + } + _mapPresentationEnvironment.setSettings(convertedStyleSettings); + } + + // Update all dependencies + if (_mapPrimitiviser != null) + updateMapPrimitiviser(); + } + + /** + * Reference to map primitiviser (if used) + */ + private MapPrimitiviser _mapPrimitiviser; + + /** + * Update map primitiviser and everything that depends on it + */ + private void updateMapPrimitiviser() { + // Create new map primitiviser + _mapPrimitiviser = new MapPrimitiviser(_mapPresentationEnvironment); + + // Update all dependencies + if (_mapPrimitivesProvider != null) + updateMapPrimitivesProvider(); + } + + /** + * Reference to OBF map objects provider (if used) + */ + private ObfMapObjectsProvider _obfMapObjectsProvider; + + /** + * Update OBF map objects provider and everything that depends on it + */ + private void updateObfMapObjectsProvider() { + _obfMapObjectsProvider = new ObfMapObjectsProvider( + _obfsCollection); + + // Update all dependencies + if (_mapPrimitivesProvider != null) + updateMapPrimitivesProvider(); + } + + /** + * Reference to map primitives provider (if used) + */ + private MapPrimitivesProvider _mapPrimitivesProvider; + + /** + * Update map primitives provider and everything that depends on it + */ + private void updateMapPrimitivesProvider() { + // Create new map primitives provider + _mapPrimitivesProvider = new MapPrimitivesProvider( + _obfMapObjectsProvider, + _mapPrimitiviser, + _rasterTileSize); + + // Update all dependencies + if (_obfMapRasterLayerProvider != null) + updateObfMapRasterLayerProvider(); + if (_obfMapSymbolsProvider != null) + updateObfMapSymbolsProvider(); + } + + /** + * Reference to OBF map raster layer provider (if used) + */ + private IRasterMapLayerProvider _obfMapRasterLayerProvider; + + /** + * Index of OBF map raster layer in bound map renderer view (if set) + */ + private Integer _obfMapRasterLayer; + + /** + * Update OBF map raster layer provider and everything that depends on it + */ + private void updateObfMapRasterLayerProvider() { + // Create new OBF map raster layer provider + _obfMapRasterLayerProvider = new MapRasterLayerProvider_Software( + _mapPrimitivesProvider); + + // In case there's bound view and configured layer, perform setup + if(_mapRendererView != null && _obfMapRasterLayer != null) + _mapRendererView.setMapLayerProvider(_obfMapRasterLayer, _obfMapRasterLayerProvider); + } + + /** + * Reference to OBF map symbols provider (if used) + */ + private IMapTiledSymbolsProvider _obfMapSymbolsProvider; + + /** + * Update OBF map symbols provider and everything that depends on it + */ + private void updateObfMapSymbolsProvider() { + // If there's current provider and bound view, remove it + if (_obfMapSymbolsProvider != null && _mapRendererView != null) + _mapRendererView.removeSymbolsProvider(_obfMapSymbolsProvider); + + // Create new OBF map symbols provider + _obfMapSymbolsProvider = new MapObjectsSymbolsProvider( + _mapPrimitivesProvider, + _referenceTileSize); + + // If there's bound view, add new provider + if (_mapRendererView != null) + _mapRendererView.addSymbolsProvider(_obfMapSymbolsProvider); + } + + /** + * Apply current context to view + */ + private void apply() { + if (_mapRendererView instanceof AtlasMapRendererView) + ((AtlasMapRendererView)_mapRendererView).setReferenceTileSizeOnScreenInPixels(_referenceTileSize); + + // Layers + if (_obfMapRasterLayer != null && _obfMapRasterLayerProvider != null) + _mapRendererView.setMapLayerProvider(_obfMapRasterLayer, _obfMapRasterLayerProvider); + + // Symbols + if (_obfMapSymbolsProvider != null) + _mapRendererView.addSymbolsProvider(_obfMapSymbolsProvider); + } + + /** + * Setup OBF map on layer 0 with symbols + * @param obfsCollection OBFs collection + */ + public void setupObfMap(ResolvedMapStyle mapStyle, IObfsCollection obfsCollection) { + setupObfMap(mapStyle, obfsCollection, 0, true); + } + + /** + * Setup OBF map on specified layer with optional symbols + * @param obfsCollection OBFs collection + * @param layer Layer index + * @param withSymbols True if with symbols, false otherwise + */ + public void setupObfMap(ResolvedMapStyle mapStyle, + IObfsCollection obfsCollection, + int layer, + boolean withSymbols) { + synchronized (_syncObject) { + boolean update = false; + + if (_mapStyle != mapStyle) { + _mapStyle = mapStyle; + update = true; + } + + if (_obfsCollection != obfsCollection) { + _obfsCollection = obfsCollection; + update = true; + } + + if (_obfMapRasterLayer == null || _obfMapRasterLayer != layer) { + _obfMapRasterLayer = layer; + update = true; + } + + if (withSymbols != (_obfMapSymbolsProvider != null)) { + update = true; + } + + if (!update) + return; + + updateMapPresentationEnvironment(); + updateMapPrimitiviser(); + updateMapPrimitivesProvider(); + updateObfMapObjectsProvider(); + updateObfMapRasterLayerProvider(); + updateObfMapSymbolsProvider(); + } + } +} diff --git a/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java b/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java index beff07b766..80a10c6224 100644 --- a/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java +++ b/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java @@ -42,35 +42,32 @@ public class CurrentPositionHelper { ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, app.getResourceManager().getRoutingMapFiles()); } - public synchronized RouteDataObject runUpdateInThread(double lat , double lon) { + public synchronized RouteDataObject runUpdateInThread(double lat, double lon) throws IOException { RoutePlannerFrontEnd rp = new RoutePlannerFrontEnd(false); - try { - if(ctx == null || am != app.getSettings().getApplicationMode()) { - initCtx(app); - if(ctx == null) { - return null; - } - } - RouteSegment sg = rp.findRouteSegment(lat, lon, ctx); - if(sg == null) { + if (ctx == null || am != app.getSettings().getApplicationMode()) { + initCtx(app); + if (ctx == null) { return null; } - return sg.getRoad(); - } catch (IOException e) { + } + RouteSegment sg = rp.findRouteSegment(lat, lon, ctx); + if (sg == null) { return null; } + return sg.getRoad(); + } private void scheduleRouteSegmentFind(final Location loc){ if(calculatingThread == Thread.currentThread()) { - lastFound = runUpdateInThread(loc.getLatitude(), loc.getLongitude()); + lastFound = runUpdateInThreadCatch(loc.getLatitude(), loc.getLongitude()); } else if(calculatingThread == null && loc != null) { Runnable run = new Runnable() { @Override public void run() { try { - lastFound = runUpdateInThread(loc.getLatitude(), loc.getLongitude()); + lastFound = runUpdateInThreadCatch(loc.getLatitude(), loc.getLongitude()); if (lastAskedLocation != loc) { // refresh and run new task if needed getLastKnownRouteSegment(lastAskedLocation); @@ -85,6 +82,15 @@ public class CurrentPositionHelper { } + protected RouteDataObject runUpdateInThreadCatch(double latitude, double longitude) { + try { + return runUpdateInThread(latitude, longitude); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + private static double getOrthogonalDistance(RouteDataObject r, Location loc){ double d = 1000; if (r.getPointsLength() > 0) { diff --git a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java index 8ff1290ba1..ba6e818e4b 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java @@ -21,7 +21,6 @@ import net.osmand.plus.helpers.WaypointHelper; import net.osmand.plus.routing.RouteCalculationResult; import net.osmand.plus.views.OsmandMapTileView; import android.app.Activity; -import android.view.Window; public class OsmAndAppCustomization { diff --git a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java index d4f4afbfd7..0310bde0a6 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java @@ -216,7 +216,7 @@ public class OsmAndLocationProvider implements SensorEventListener { } public RouteDataObject findRoute(double lat , double lon) { - return currentPositionHelper.runUpdateInThread(lat, lon); + return currentPositionHelper.runUpdateInThreadCatch(lat, lon); } public void resumeAllUpdates() { diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index a7e63613f8..57e9d9c572 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -33,7 +33,7 @@ import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.sherpafy.SherpafyCustomization; -import net.osmand.plus.views.corenative.NativeQtLibrary; +import net.osmand.plus.views.corenative.NativeCoreContext; import net.osmand.plus.voice.CommandPlayer; import net.osmand.plus.voice.CommandPlayerException; import net.osmand.plus.voice.CommandPlayerFactory; @@ -121,6 +121,8 @@ public class OsmandApplication extends Application { MapActivity mapActivity; DownloadActivity downloadActivity; + // Typeface + @Override public void onCreate() { long timeToStart = System.currentTimeMillis(); @@ -558,7 +560,7 @@ public class OsmandApplication extends Application { if (osmandSettings.USE_NATIVE_RENDER.get()) { if (!osmandSettings.CPP_RENDER_FAILED.get()) { osmandSettings.CPP_RENDER_FAILED.set(true); - boolean success = NativeQtLibrary.tryCatchInit(this); + boolean success = NativeCoreContext.tryCatchInit(this); if (success) { osmandSettings.CPP_RENDER_FAILED.set(false); } diff --git a/OsmAnd/src/net/osmand/plus/activities/DashboardActivity.java b/OsmAnd/src/net/osmand/plus/activities/DashboardActivity.java index e3fe3a9c59..37c7982f0d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/DashboardActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/DashboardActivity.java @@ -9,7 +9,6 @@ import java.util.Date; import java.util.List; import java.util.Random; -import android.support.v4.app.Fragment; import net.osmand.access.AccessibleAlertBuilder; import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmandApplication; @@ -42,6 +41,7 @@ import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.text.SpannableString; import android.text.Spanned; import android.text.format.DateFormat; @@ -57,7 +57,6 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; /** - * Created by Denis on 05.11.2014. */ public class DashboardActivity extends BaseDownloadActivity { public static final boolean TIPS_AND_TRICKS = false; @@ -71,10 +70,10 @@ public class DashboardActivity extends BaseDownloadActivity { private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$ private static final String CONTRIBUTION_VERSION_FLAG = "CONTRIBUTION_VERSION_FLAG"; + private static final int HELP_ID = 0; + private static final int SETTINGS_ID = 1; + private static final int EXIT_ID = 2; private ProgressDialog startProgressDialog; - - - @Override protected void onCreate(Bundle savedInstanceState) { @@ -156,25 +155,22 @@ public class DashboardActivity extends BaseDownloadActivity { android.support.v4.app.FragmentTransaction fragmentTransaction = manager.beginTransaction(); //after rotation list of fragments in fragment transaction is not cleared //so we need to check whether some fragments are already existing - if (manager.findFragmentByTag(DashSearchFragment.TAG) == null){ - DashSearchFragment searchFragment = new DashSearchFragment(); - fragmentTransaction.add(R.id.content, searchFragment, DashSearchFragment.TAG); - } if (manager.findFragmentByTag(DashMapFragment.TAG) == null){ DashMapFragment mapFragment = new DashMapFragment(); fragmentTransaction.add(R.id.content, mapFragment, DashMapFragment.TAG); } - + if (manager.findFragmentByTag(DashSearchFragment.TAG) == null){ + DashSearchFragment searchFragment = new DashSearchFragment(); + fragmentTransaction.add(R.id.content, searchFragment, DashSearchFragment.TAG); + } if (manager.findFragmentByTag(DashFavoritesFragment.TAG) == null){ DashFavoritesFragment favoritesFragment = new DashFavoritesFragment(); fragmentTransaction.add(R.id.content, favoritesFragment, DashFavoritesFragment.TAG); } - if (manager.findFragmentByTag(DashUpdatesFragment.TAG) == null){ DashUpdatesFragment updatesFragment = new DashUpdatesFragment(); fragmentTransaction.add(R.id.content, updatesFragment, DashUpdatesFragment.TAG); } - if (manager.findFragmentByTag(DashPluginsFragment.TAG) == null){ DashPluginsFragment pluginsFragment = new DashPluginsFragment(); fragmentTransaction.add(R.id.content, pluginsFragment, DashPluginsFragment.TAG).commit(); @@ -282,6 +278,10 @@ public class DashboardActivity extends BaseDownloadActivity { @Override public void onDismiss(DialogInterface dialog) { checkVectorIndexesDownloaded(); + // Do some action on close + // FIXME uncomment + // app.getResourceManager().getRenderer().clearCache(); + // mapView.refreshMap(true); } }); } else { @@ -382,12 +382,12 @@ public class DashboardActivity extends BaseDownloadActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, 0, 0, R.string.tips_and_tricks).setIcon(R.drawable.ic_ac_help) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - menu.add(0, 1, 0, R.string.settings).setIcon(R.drawable.ic_ac_settings) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - menu.add(0, 2, 0, R.string.exit_Button).setIcon(R.drawable.ic_ac_close) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); + menu.add(0, HELP_ID, 0, R.string.tips_and_tricks).setIcon(R.drawable.ic_ac_help) + .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + menu.add(0, SETTINGS_ID, 0, R.string.settings).setIcon(R.drawable.ic_ac_settings) + .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + menu.add(0, EXIT_ID, 0, R.string.exit_Button).setIcon(R.drawable.ic_ac_close) + .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } @@ -400,7 +400,7 @@ public class DashboardActivity extends BaseDownloadActivity { @Override public boolean onOptionsItemSelected(MenuItem item) { OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization(); - if (item.getItemId() == 0) { + if (item.getItemId() == HELP_ID) { if(TIPS_AND_TRICKS) { TipsAndTricksActivity activity = new TipsAndTricksActivity(this); Dialog dlg = activity.getDialogToShowTips(false, true); @@ -409,10 +409,10 @@ public class DashboardActivity extends BaseDownloadActivity { final Intent helpIntent = new Intent(this, HelpActivity.class); startActivity(helpIntent); } - } else if (item.getItemId() == 1){ + } else if (item.getItemId() == SETTINGS_ID){ final Intent settings = new Intent(this, appCustomization.getSettingsActivity()); startActivity(settings); - } else if (item.getItemId() == 2){ + } else if (item.getItemId() == EXIT_ID){ getMyApplication().closeApplication(this); } return true; diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 2ddd1d581a..6e790a50f9 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -15,6 +15,7 @@ import net.osmand.access.AccessibilityPlugin; import net.osmand.access.AccessibleActivity; import net.osmand.access.AccessibleToast; import net.osmand.access.MapAccessibilityActions; +import net.osmand.core.android.AtlasMapRendererView; import net.osmand.data.LatLon; import net.osmand.data.QuadPoint; import net.osmand.data.RotatedTileBox; @@ -46,7 +47,7 @@ import net.osmand.plus.views.OsmAndMapLayersView; import net.osmand.plus.views.OsmAndMapSurfaceView; import net.osmand.plus.views.OsmandMapLayer; import net.osmand.plus.views.OsmandMapTileView; -import net.osmand.plus.views.corenative.NativeQtLibrary; +import net.osmand.plus.views.corenative.NativeCoreContext; import net.osmand.render.RenderingRulesStorage; import net.osmand.util.Algorithms; import android.app.Dialog; @@ -91,7 +92,7 @@ public class MapActivity extends AccessibleActivity implements /** Called when the activity is first created. */ private OsmandMapTileView mapView; - private GLSurfaceView glSurfaceView; + private AtlasMapRendererView atlasMapRendererView; private MapActivityActions mapActions; private MapActivityLayers mapLayers; @@ -151,14 +152,16 @@ public class MapActivity extends AccessibleActivity implements app.checkApplicationIsBeingInitialized(this, startProgressDialog); parseLaunchIntentLocation(); - if(settings.USE_NATIVE_RENDER.get() && NativeQtLibrary.isInit()) { - ViewStub stub = (ViewStub) findViewById(R.id.glSurfaceStub); - glSurfaceView = (GLSurfaceView) stub.inflate(); + if(settings.USE_NATIVE_RENDER.get() && NativeCoreContext.isInit()) { + ViewStub stub = (ViewStub) findViewById(R.id.atlasMapRendererViewStub); + atlasMapRendererView = (AtlasMapRendererView) stub.inflate(); OsmAndMapLayersView ml = (OsmAndMapLayersView) findViewById(R.id.MapLayersView); ml.setVisibility(View.VISIBLE); - NativeQtLibrary.initView(glSurfaceView); + atlasMapRendererView.setAzimuth(0); + atlasMapRendererView.setElevationAngle(90); + NativeCoreContext.getMapRendererContext().setMapRendererView(atlasMapRendererView); mapView = ml.getMapView(); - mapView.setMapRender(NativeQtLibrary.getMapRenderer()); + mapView.setMapRender(atlasMapRendererView); } else { OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) findViewById(R.id.MapView); surf.setVisibility(View.VISIBLE); @@ -442,8 +445,8 @@ public class MapActivity extends AccessibleActivity implements OsmandPlugin.onMapActivityResume(this); mapView.refreshMap(true); - if(glSurfaceView != null) { - glSurfaceView.onResume(); + if(atlasMapRendererView != null) { + atlasMapRendererView.handleOnResume(); } } @@ -611,6 +614,9 @@ public class MapActivity extends AccessibleActivity implements mapViewTrackingUtilities.setMapView(null); cancelNotification(); app.getResourceManager().getMapTileDownloader().removeDownloaderCallback(mapView); + if(atlasMapRendererView != null) { + atlasMapRendererView.handleOnDestroy(); + } } private void cancelNotification() { @@ -657,8 +663,8 @@ public class MapActivity extends AccessibleActivity implements app.getResourceManager().interruptRendering(); app.getResourceManager().setBusyIndicator(null); OsmandPlugin.onMapActivityPause(this); - if(glSurfaceView != null) { - glSurfaceView.onPause(); + if(atlasMapRendererView != null) { + atlasMapRendererView.handleOnPause(); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index ffc787aaf1..8b1e712e3d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -247,7 +247,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity { getString(R.string.lang_hu), getString(R.string.lang_id) + incompleteSuffix, getString(R.string.lang_it), - getString(R.string.lang_ja) + incompleteSuffix, + getString(R.string.lang_ja), getString(R.string.lang_ko), getString(R.string.lang_lv), getString(R.string.lang_lt), @@ -258,7 +258,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity { getString(R.string.lang_pt), getString(R.string.lang_ro), getString(R.string.lang_ru), - getString(R.string.lang_sc) + incompleteSuffix, + getString(R.string.lang_sc), getString(R.string.lang_sr) + incompleteSuffix, getString(R.string.lang_zh_CN) + incompleteSuffix, getString(R.string.lang_sk), diff --git a/OsmAnd/src/net/osmand/plus/api/render/Paint.java b/OsmAnd/src/net/osmand/plus/api/render/Paint.java deleted file mode 100644 index 018ac9ab3e..0000000000 --- a/OsmAnd/src/net/osmand/plus/api/render/Paint.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.osmand.plus.api.render; - - -public interface Paint { - public enum Style { - FILL (0), - STROKE (1), - FILL_AND_STROKE (2); - Style(int nativeInt) { - this.nativeInt = nativeInt; - } - final int nativeInt; - } - - public enum Cap { - BUTT (0), - ROUND (1), - SQUARE (2); - private Cap(int nativeInt) { - this.nativeInt = nativeInt; - } - final int nativeInt; - } - - public enum Join { - MITER (0), - ROUND (1), - BEVEL (2); - private Join(int nativeInt) { - this.nativeInt = nativeInt; - } - final int nativeInt; - } - - public enum Align { - LEFT (0), - CENTER (1), - RIGHT (2); - private Align(int nativeInt) { - this.nativeInt = nativeInt; - } - final int nativeInt; - } - - void setColor(int color); - - int getColor(); - - void setTextAlign(Align align); - - void setStrokeWidth(float width); - - void setAntiAlias(boolean flag); - - void setStyle(Style style); -} diff --git a/OsmAnd/src/net/osmand/plus/api/render/Path.java b/OsmAnd/src/net/osmand/plus/api/render/Path.java deleted file mode 100644 index 0a384baf05..0000000000 --- a/OsmAnd/src/net/osmand/plus/api/render/Path.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.osmand.plus.api.render; - -public interface Path { - -} diff --git a/OsmAnd/src/net/osmand/plus/api/render/Typeface.java b/OsmAnd/src/net/osmand/plus/api/render/Typeface.java deleted file mode 100644 index a234efd27b..0000000000 --- a/OsmAnd/src/net/osmand/plus/api/render/Typeface.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.osmand.plus.api.render; - -public class Typeface { - -} diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java index 136b5bfbae..d84f1b3d83 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java @@ -21,6 +21,7 @@ import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.FavoriteImageDrawable; +import net.osmand.plus.helpers.FontCache; import net.osmand.util.MapUtils; import java.util.ArrayList; @@ -36,7 +37,7 @@ public class DashFavoritesFragment extends DashBaseFragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = getActivity().getLayoutInflater().inflate(R.layout.dash_favorites_fragment, container, false); - Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf"); + Typeface typeface = FontCache.getRobotoMedium(getActivity()); ((TextView) view.findViewById(R.id.fav_text)).setTypeface(typeface); ((Button) view.findViewById(R.id.show_all)).setTypeface(typeface); diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java index cc738a85c4..a8812bea36 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java @@ -15,6 +15,9 @@ import net.osmand.map.MapTileDownloader.DownloadRequest; import net.osmand.map.MapTileDownloader.IMapDownloaderCallback; import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.MapActivityActions; +import net.osmand.plus.helpers.FontCache; import net.osmand.plus.render.MapVectorLayer; import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.views.MapTextLayer; @@ -41,22 +44,25 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader getMyApplication().getResourceManager().getMapTileDownloader().addDownloaderCallback(this); } + protected void startMapActivity() { + MapActivity.launchMapActivityMoveToTop(getActivity()); + } + @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = getActivity().getLayoutInflater().inflate(R.layout.dash_map_fragment, container, false); setupMapView(view); - Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf"); + Typeface typeface = FontCache.getRobotoMedium(getActivity()); ((TextView) view.findViewById(R.id.map_text)).setTypeface(typeface); ((Button) view.findViewById(R.id.show_map)).setTypeface(typeface); (view.findViewById(R.id.show_map)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Activity activity = getActivity(); - OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization(); - final Intent mapIndent = new Intent(activity, appCustomization.getMapActivity()); - activity.startActivityForResult(mapIndent, 0); + startMapActivity(); } + + }); return view; @@ -64,6 +70,13 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader private void setupMapView(View view){ OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) view.findViewById(R.id.MapView); + surf.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + startMapActivity(); + } + }); osmandMapTileView = surf.getMapView(); osmandMapTileView.getView().setVisibility(View.VISIBLE); osmandMapTileView.removeAllLayers(); @@ -75,10 +88,16 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader osmandMapTileView.addLayer(mapVectorLayer, 0.5f); osmandMapTileView.setMainLayer(mapVectorLayer); mapVectorLayer.setVisible(true); + osmandMapTileView.setShowMapPosition(false); + } + + @Override + public void onResume() { + super.onResume(); LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation(); int zm = getMyApplication().getSettings().getLastKnownMapZoom(); osmandMapTileView.setLatLon(lm.getLatitude(), lm.getLongitude()); - osmandMapTileView.setIntZoom(zm); + osmandMapTileView.setComplexZoom(zm, osmandMapTileView.getSettingsZoomScale()); osmandMapTileView.refreshMap(true); } diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java index cb2d801a3c..87997852db 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java @@ -14,6 +14,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; +import net.osmand.plus.helpers.FontCache; import java.util.List; @@ -27,7 +28,7 @@ public class DashPluginsFragment extends DashBaseFragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = getActivity().getLayoutInflater().inflate(R.layout.dash_plugins_fragment, container, false); - Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf"); + Typeface typeface = FontCache.getRobotoMedium(getActivity()); ((TextView) view.findViewById(R.id.plugin_text)).setTypeface(typeface); ((Button) view.findViewById(R.id.show_all)).setTypeface(typeface); view.findViewById(R.id.show_all).setOnClickListener(new View.OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashSearchFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashSearchFragment.java index 8de9cfefe7..77906528af 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashSearchFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashSearchFragment.java @@ -1,18 +1,22 @@ package net.osmand.plus.dashboard; +import net.osmand.plus.OsmAndAppCustomization; +import net.osmand.plus.R; +import net.osmand.plus.activities.search.SearchActivity; +import net.osmand.plus.helpers.FontCache; import android.app.Activity; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.support.annotation.Nullable; +import android.text.Editable; +import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.AutoCompleteTextView; +import android.widget.EditText; import android.widget.TextView; -import net.osmand.plus.OsmAndAppCustomization; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.R; -import net.osmand.plus.activities.search.SearchActivity; /** * Created by Denis on 24.11.2014. @@ -25,7 +29,7 @@ public class DashSearchFragment extends DashBaseFragment { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = getActivity().getLayoutInflater().inflate(R.layout.dash_search_fragment, container, false); setupButtons(view); - Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf"); + Typeface typeface = FontCache.getRobotoMedium(getActivity()); ((TextView) view.findViewById(R.id.search_for)).setTypeface(typeface); return view; } @@ -39,6 +43,8 @@ public class DashSearchFragment extends DashBaseFragment { private void setupButtons(View view){ final Activity activity = getActivity(); final OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization(); +// EditText searchText = (EditText) view.findViewById(R.id.search_text); +// searchText.addTextChangedListener(textWatcher); (view.findViewById(R.id.poi)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java index b80aadabaa..038ee7feaf 100644 --- a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java @@ -6,7 +6,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import net.osmand.core.android.GLActivity; import net.osmand.plus.ApplicationMode; import net.osmand.plus.R; import net.osmand.plus.activities.SettingsBaseActivity; @@ -45,19 +44,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity { cat.addPreference(createCheckBoxPreference(settings.USE_NATIVE_RENDER, R.string.use_native_render,R.string.use_native_render_descr)); Preference pref = new Preference(this); - pref.setTitle(R.string.test_native_render); - pref.setSummary(R.string.test_native_render_msg); - pref.setKey("test_native_render"); - pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - startActivity(new Intent(SettingsDevelopmentActivity.this, GLActivity.class)); - return true; - } - }); - cat.addPreference(pref); - - pref = new Preference(this); pref.setTitle(R.string.test_voice_prompts); pref.setSummary(R.string.play_commands_of_currently_selected_voice); pref.setKey("test_voice_commands"); diff --git a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java index 04beefd12c..ef9f2bdef5 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java +++ b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java @@ -27,6 +27,7 @@ import android.widget.ArrayAdapter; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; public class AvoidSpecificRoads { private List missingRoads; @@ -143,14 +144,23 @@ public class AvoidSpecificRoads { } private void findRoad(final MapActivity activity, final LatLon loc) { new AsyncTask() { + Exception e = null; @Override protected RouteDataObject doInBackground(LatLon... params) { - return app.getLocationProvider().findRoute(loc.getLatitude(), loc.getLongitude()); + try { + return app.getLocationProvider().findRoute(loc.getLatitude(), loc.getLongitude()); + } catch (Exception e) { + this.e = e; + e.printStackTrace(); + return null; + } } protected void onPostExecute(RouteDataObject result) { - if(result != null) { + if(e != null) { + Toast.makeText(activity, R.string.error_avoid_specific_road, Toast.LENGTH_LONG).show(); + } else if(result != null) { getBuilder().addImpassableRoad(result); RoutingHelper rh = app.getRoutingHelper(); if(rh.isRouteCalculated() || rh.isRouteBeingCalculated()) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/FontCache.java b/OsmAnd/src/net/osmand/plus/helpers/FontCache.java new file mode 100644 index 0000000000..989a21676f --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/helpers/FontCache.java @@ -0,0 +1,27 @@ +package net.osmand.plus.helpers; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import android.content.Context; +import android.graphics.Typeface; + +public class FontCache { + private static Map fontMap = new ConcurrentHashMap(); + public static final String ROBOTO_MEDIUM = "fonts/Roboto-Medium.ttf"; + public static final String ROBOTO_REGULAR = "fonts/Roboto-Regular.ttf"; + + public static Typeface getRobotoMedium(Context context) { + return getFont(context, ROBOTO_MEDIUM); + } + + public static Typeface getFont(Context context, String fontName) { + if (fontMap.containsKey(fontName)) { + return fontMap.get(fontName); + } else { + Typeface tf = Typeface.createFromAsset(context.getAssets(), fontName); + fontMap.put(fontName, tf); + return tf; + } + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 4c54604e49..915dd55d99 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -614,15 +614,15 @@ public class MapRenderRepositories { // calculate data box QuadRect dataBox = requestedBox.getLatLonBounds(); long now = System.currentTimeMillis(); - if (cObjectsBox.left > dataBox.left || cObjectsBox.top > dataBox.top || cObjectsBox.right < dataBox.right - || cObjectsBox.bottom < dataBox.bottom || (nativeLib != null) == (cNativeObjects == null)) { + if (cObjectsBox.left > dataBox.left || cObjectsBox.top < dataBox.top || cObjectsBox.right < dataBox.right + || cObjectsBox.bottom > dataBox.bottom || (nativeLib != null) == (cNativeObjects == null)) { // increase data box in order for rotate if ((dataBox.right - dataBox.left) > (dataBox.top - dataBox.bottom)) { - double wi = (dataBox.right - dataBox.left) * .2; + double wi = (dataBox.right - dataBox.left) * .05; dataBox.left -= wi; dataBox.right += wi; } else { - double hi = (dataBox.top - dataBox.bottom) * .2; + double hi = (dataBox.top - dataBox.bottom) * .05; dataBox.top += hi; dataBox.bottom -= hi; } diff --git a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java index 187251e86e..4a195a6b9f 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java +++ b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java @@ -1,5 +1,6 @@ package net.osmand.plus.render; +import net.osmand.core.android.MapRendererView; import net.osmand.core.jni.IMapRenderer; import net.osmand.core.jni.PointI; import net.osmand.data.QuadPointDouble; @@ -89,7 +90,7 @@ public class MapVectorLayer extends BaseMapLayer { tileLayer.drawTileMap(canvas, tilesRect); resourceManager.getRenderer().interruptLoadingMap(); } else { - final IMapRenderer mapRenderer = view.getMapRenderer(); + final MapRendererView mapRenderer = view.getMapRenderer(); if (mapRenderer != null) { // opengl renderer mapRenderer.setTarget(new PointI(tilesRect.getCenter31X(), tilesRect.getCenter31Y())); diff --git a/OsmAnd/src/net/osmand/plus/views/OsmAndMapLayersView.java b/OsmAnd/src/net/osmand/plus/views/OsmAndMapLayersView.java index e50acfc5a9..ca3dd7e2e8 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmAndMapLayersView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmAndMapLayersView.java @@ -6,7 +6,6 @@ import android.graphics.Canvas; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; -import android.view.SurfaceHolder; import android.view.View; public class OsmAndMapLayersView extends View { diff --git a/OsmAnd/src/net/osmand/plus/views/OsmAndMapSurfaceView.java b/OsmAnd/src/net/osmand/plus/views/OsmAndMapSurfaceView.java index fdcf093d02..845f5096f3 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmAndMapSurfaceView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmAndMapSurfaceView.java @@ -11,6 +11,7 @@ import android.view.SurfaceView; public class OsmAndMapSurfaceView extends SurfaceView implements Callback { private OsmandMapTileView mapView; + private OnClickListener onClickListener; public OsmAndMapSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); @@ -52,6 +53,11 @@ public class OsmAndMapSurfaceView extends SurfaceView implements Callback { return r; } + @Override + public void setOnClickListener(OnClickListener l) { + super.setOnClickListener(l); + this.onClickListener = l; + } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Boolean r = mapView.onKeyDown(keyCode, event); @@ -63,6 +69,9 @@ public class OsmAndMapSurfaceView extends SurfaceView implements Callback { @Override public boolean onTouchEvent(MotionEvent event) { + if(onClickListener != null) { + return super.onTouchEvent(event); + } return mapView.onTouchEvent(event); } diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 1198067212..00967d98dc 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -10,7 +10,7 @@ import net.osmand.PlatformUtil; import net.osmand.access.AccessibilityActionsProvider; import net.osmand.access.AccessibleToast; import net.osmand.access.MapExplorer; -import net.osmand.core.jni.IMapRenderer; +import net.osmand.core.android.MapRendererView; import net.osmand.data.LatLon; import net.osmand.data.QuadPoint; import net.osmand.data.QuadPointDouble; @@ -30,6 +30,7 @@ import net.osmand.util.MapUtils; import org.apache.commons.logging.Log; +import android.annotation.SuppressLint; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; @@ -146,7 +147,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback { private DisplayMetrics dm; - private IMapRenderer mapRenderer; + private MapRendererView mapRenderer; private OsmandApplication application; @@ -514,6 +515,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback { return additional.fps; } + @SuppressLint("WrongCall") public void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings) { if(mapRenderer == null) { fillCanvas(canvas, drawSettings); @@ -736,11 +738,11 @@ public class OsmandMapTileView implements IMapDownloaderCallback { return true; } - public void setMapRender(IMapRenderer mapRenderer) { + public void setMapRender(MapRendererView mapRenderer) { this.mapRenderer = mapRenderer; } - public IMapRenderer getMapRenderer() { + public MapRendererView getMapRenderer() { return mapRenderer; } diff --git a/OsmAnd/src/net/osmand/plus/views/corenative/NativeCoreContext.java b/OsmAnd/src/net/osmand/plus/views/corenative/NativeCoreContext.java new file mode 100644 index 0000000000..775ec8fad1 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/views/corenative/NativeCoreContext.java @@ -0,0 +1,93 @@ +package net.osmand.plus.views.corenative; + +import java.io.File; + +import android.content.Context; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.WindowManager; +import net.osmand.core.android.CoreResourcesFromAndroidAssetsCustom; +import net.osmand.core.android.MapRendererContext; +import net.osmand.core.android.NativeCore; +import net.osmand.core.jni.Logger; +import net.osmand.core.jni.MapStylesCollection; +import net.osmand.core.jni.ObfsCollection; +import net.osmand.core.jni.QIODeviceLogSink; +import net.osmand.plus.OsmandApplication; + +/** + * Created by Denis on 01.10.2014. + */ +public class NativeCoreContext { + private static final String TAG = "NativeCoreContext"; + + private static boolean init; + + public static boolean isInit() { + return init; + } + + public static boolean tryCatchInit(OsmandApplication app) { + try { + init(app); + return true; + } catch(Throwable t) { + t.printStackTrace(); + Log.e(TAG, "Failed to initialize", t); + return false; + } + + } + + public static void init(OsmandApplication app) { + if (!init && NativeCore.isAvailable()) { + if (!NativeCore.isLoaded()) + NativeCore.load(CoreResourcesFromAndroidAssetsCustom.loadFromCurrentApplication(app)); + if (NativeCore.isLoaded()) { + + File directory = app.getAppPath(""); + Logger.get().addLogSink(QIODeviceLogSink.createFileLogSink( + directory.getAbsolutePath() + "osmandcore.log")); + + WindowManager mgr = (WindowManager)app.getSystemService(Context.WINDOW_SERVICE); + DisplayMetrics dm = new DisplayMetrics(); + mgr.getDefaultDisplay().getMetrics(dm); + + // Get device display density factor +// DisplayMetrics displayMetrics = new DisplayMetrics(); +// act.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + DisplayMetrics displayMetrics = app.getResources().getDisplayMetrics(); + // TODO getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1)) + float scaleCoefficient = displayMetrics.density; + if (Math.min(dm.widthPixels / (dm.density * 160), dm.heightPixels / (dm.density * 160)) > 2.5f) { + // large screen + scaleCoefficient *= 1.5f; + } + float displayDensityFactor = scaleCoefficient; + + _obfsCollection = new ObfsCollection(); + _obfsCollection.addDirectory(directory.getAbsolutePath(), false); + + _mapStylesCollection = new MapStylesCollection(); + + _mapRendererContext = new MapRendererContext(); + _mapRendererContext.setDisplayDensityFactor(displayDensityFactor); + _mapRendererContext.setupObfMap( + _mapStylesCollection.getResolvedStyleByName("default"), + _obfsCollection); + + init = true; + } + } + } + + private static MapStylesCollection _mapStylesCollection; + + private static ObfsCollection _obfsCollection; + + private static MapRendererContext _mapRendererContext; + + public static MapRendererContext getMapRendererContext() { + return _mapRendererContext; + } +} diff --git a/OsmAnd/src/net/osmand/plus/views/corenative/NativeQtLibrary.java b/OsmAnd/src/net/osmand/plus/views/corenative/NativeQtLibrary.java deleted file mode 100644 index 384e83d55b..0000000000 --- a/OsmAnd/src/net/osmand/plus/views/corenative/NativeQtLibrary.java +++ /dev/null @@ -1,329 +0,0 @@ -package net.osmand.plus.views.corenative; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.egl.EGLDisplay; -import javax.microedition.khronos.egl.EGLSurface; - -import net.osmand.core.android.CoreResourcesFromAndroidAssetsCustom; -import net.osmand.core.jni.AtlasMapRendererConfiguration; -import net.osmand.core.jni.ObfMapObjectsProvider; -import net.osmand.core.jni.MapPrimitivesProvider; -import net.osmand.core.jni.MapRasterLayerProvider_Software; -import net.osmand.core.jni.MapObjectsSymbolsProvider; -import net.osmand.core.jni.IMapRenderer; -import net.osmand.core.jni.Logger; -import net.osmand.core.jni.MapPresentationEnvironment; -import net.osmand.core.jni.MapRendererClass; -import net.osmand.core.jni.MapRendererSetupOptions; -import net.osmand.core.jni.MapStylesCollection; -import net.osmand.core.jni.ObfsCollection; -import net.osmand.core.jni.OnlineRasterMapLayerProvider; -import net.osmand.core.jni.OnlineTileSources; -import net.osmand.core.jni.OsmAndCore; -import net.osmand.core.jni.MapPrimitiviser; -import net.osmand.core.jni.QIODeviceLogSink; -import net.osmand.core.jni.ResolvedMapStyle; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.render.NativeCppLibrary; -import android.content.Context; -import android.opengl.EGL14; -import android.opengl.GLSurfaceView; -import android.util.DisplayMetrics; -import android.util.Log; -import android.view.WindowManager; - -/** - * Created by Denis on 01.10.2014. - */ -public class NativeQtLibrary { - - private static boolean OFFLINE_MAP = true; - private static IMapRenderer mapRenderer; - public static final String NATIVE_TAG = "NativeRender"; - - private static List doNotGc = new ArrayList(); - private static boolean init; - - - private static T notGc(T obj){ - doNotGc.add(obj); - return obj; - } - - private static T notGcFor1Egl(T obj){ - doNotGc.add(obj); - return obj; - } - - public static void initView(GLSurfaceView glSurfaceView) { - System.out.println("Init GL View"); - //TODO:_glSurfaceView.setPreserveEGLContextOnPause(true); - glSurfaceView.setEGLContextClientVersion(2); - glSurfaceView.setEGLContextFactory(new EGLContextFactory(glSurfaceView)); - glSurfaceView.setRenderer(new NativeRenderer(mapRenderer)); - glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); - mapRenderer.setAzimuth(0.0f); - mapRenderer.setElevationAngle(90); - } - - public static IMapRenderer getMapRenderer() { - return mapRenderer; - } - - public static boolean isInit() { - return init; - } - - public static boolean tryCatchInit(OsmandApplication app) { - try { - init(app); - return true; - } catch(Throwable t) { - t.printStackTrace(); - Log.e(NATIVE_TAG, "Failed to initialize"); - return false; - } - - } - - public static void init(OsmandApplication app) { - if (!init) { - loadLibraries(); - initRenderer(app); - init = true; - } - } - - private static void loadLibraries() { - NativeCppLibrary.loadLibrary("gnustl_shared"); - NativeCppLibrary.loadLibrary("Qt5Core"); - NativeCppLibrary.loadLibrary("Qt5Network"); - NativeCppLibrary.loadLibrary("Qt5Sql"); - NativeCppLibrary.loadLibrary("OsmAndCoreWithJNI"); - } - - private static void initRenderer(OsmandApplication app) { - WindowManager mgr = (WindowManager)app.getSystemService(Context.WINDOW_SERVICE); - DisplayMetrics dm = new DisplayMetrics(); - mgr.getDefaultDisplay().getMetrics(dm); - - // Get device display density factor -// DisplayMetrics displayMetrics = new DisplayMetrics(); -// act.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - DisplayMetrics displayMetrics = app.getResources().getDisplayMetrics(); - // TODO getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1)) - float scaleCoefficient = displayMetrics.density; - if (Math.min(dm.widthPixels / (dm.density * 160), dm.heightPixels / (dm.density * 160)) > 2.5f) { - // large screen - scaleCoefficient *= 1.5f; - } - float displayDensityFactor = scaleCoefficient; - int referenceTileSize = (int)(256 * displayDensityFactor); - int rasterTileSize = Integer.highestOneBit(referenceTileSize - 1) * 2; - Log.i(NATIVE_TAG, "displayDensityFactor = " + displayDensityFactor + - " referenceTileSize = " + referenceTileSize + " rasterTileSize = " + rasterTileSize); - Log.i(NATIVE_TAG, "Initializing core..."); - CoreResourcesFromAndroidAssetsCustom coreResources = notGc(CoreResourcesFromAndroidAssetsCustom.loadFromCurrentApplication(app)); - OsmAndCore.InitializeCore(coreResources.instantiateProxy()); - - // initialize log - File directory = app.getAppPath(""); - QIODeviceLogSink fileLogSink = - notGc(QIODeviceLogSink.createFileLogSink(directory.getAbsolutePath() + "osmandcore.log")); - Logger.get().addLogSink(fileLogSink); - - Log.i(NATIVE_TAG, "Going to resolve default embedded style..."); - MapStylesCollection mapStylesCollection = notGc(new MapStylesCollection()); - ResolvedMapStyle mapStyle = mapStylesCollection.getResolvedStyleByName("default"); - if (mapStyle == null) { - throw new IllegalStateException("Failed to resolve style 'default'"); - - } - Log.i(NATIVE_TAG, "Will load OBFs from " + directory.getAbsolutePath()); - ObfsCollection obfsCollection = notGc(new ObfsCollection()); - obfsCollection.addDirectory(directory.getAbsolutePath(), false); - - Log.i(NATIVE_TAG, "Going to prepare all resources for renderer"); - Log.i(NATIVE_TAG, "Going to create renderer"); - mapRenderer = OsmAndCore.createMapRenderer(MapRendererClass.AtlasMapRenderer_OpenGLES2); - if (mapRenderer == null) { - throw new IllegalArgumentException("Failed to create map renderer 'AtlasMapRenderer_OpenGLES2'"); - } - - AtlasMapRendererConfiguration atlasRendererConfiguration = AtlasMapRendererConfiguration.Casts.upcastFrom(mapRenderer.getConfiguration()); - atlasRendererConfiguration.setReferenceTileSizeOnScreenInPixels(referenceTileSize); - mapRenderer.setConfiguration(AtlasMapRendererConfiguration.Casts.downcastTo_MapRendererConfiguration(atlasRendererConfiguration)); - - if (OFFLINE_MAP){ - MapPresentationEnvironment presentation = notGc(new MapPresentationEnvironment(mapStyle, displayDensityFactor, "en")); - //TODO: here should be current locale - //mapPresentationEnvironment->setSettings(configuration.styleSettings); - MapPrimitivesProvider mapPrimitivesProvider = notGc(new MapPrimitivesProvider( - notGc(new ObfMapObjectsProvider(obfsCollection)), - notGc(new MapPrimitiviser(presentation)), rasterTileSize)); - MapRasterLayerProvider_Software mapRasterLayerProvider = notGc(new MapRasterLayerProvider_Software( - mapPrimitivesProvider)); - mapRenderer.setMapLayerProvider(0, mapRasterLayerProvider); - MapObjectsSymbolsProvider mapObjectsSymbolsProvider = notGc(new MapObjectsSymbolsProvider( - mapPrimitivesProvider, rasterTileSize)); - mapRenderer.addSymbolsProvider(mapObjectsSymbolsProvider); - } else { - OnlineRasterMapLayerProvider onlineMapRasterLayerProvider = notGc(OnlineTileSources.getBuiltIn() - .createProviderFor("Mapnik (OsmAnd)")); - mapRenderer.setMapLayerProvider(0, onlineMapRasterLayerProvider); - } - - } - - - - private static class EGLContextFactory implements GLSurfaceView.EGLContextFactory { - private EGLContext gpuWorkerContext; - private EGLSurface gpuWorkerFakeSurface; - private GLSurfaceView glSurfaceView; - - public EGLContextFactory(GLSurfaceView glSurfaceView) { - this.glSurfaceView = glSurfaceView; - } - - public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { - final String eglExtensions = egl.eglQueryString(display, EGL10.EGL_EXTENSIONS); - Log.i(NATIVE_TAG, "EGL extensions: " + eglExtensions); - final String eglVersion = egl.eglQueryString(display, EGL10.EGL_VERSION); - Log.i(NATIVE_TAG, "EGL version: " + eglVersion); - - Log.i(NATIVE_TAG, "Creating main context..."); - final int[] contextAttribList = { EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; - - EGLContext mainContext = null; - try { - mainContext = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, contextAttribList); - } catch (Exception e) { - Log.e(NATIVE_TAG, "Failed to create main context", e); - } - if (mainContext == null || mainContext == EGL10.EGL_NO_CONTEXT) { - Log.e(NATIVE_TAG, "Failed to create main context: " + egl.eglGetError()); - mainContext = null; - System.exit(0); - } - - Log.i(NATIVE_TAG, "Creating GPU worker context..."); - try { - gpuWorkerContext = egl.eglCreateContext(display, eglConfig, mainContext, contextAttribList); - } catch (Exception e) { - Log.e(NATIVE_TAG, "Failed to create GPU worker context", e); - } - if (gpuWorkerContext == null || gpuWorkerContext == EGL10.EGL_NO_CONTEXT) { - Log.e(NATIVE_TAG, "Failed to create GPU worker context: " + egl.eglGetError()); - gpuWorkerContext = null; - } - - if (gpuWorkerContext != null) { - Log.i(NATIVE_TAG, "Creating GPU worker fake surface..."); - try { - final int[] surfaceAttribList = { EGL10.EGL_WIDTH, 1, EGL10.EGL_HEIGHT, 1, EGL10.EGL_NONE }; - gpuWorkerFakeSurface = egl.eglCreatePbufferSurface(display, eglConfig, surfaceAttribList); - } catch (Exception e) { - Log.e(NATIVE_TAG, "Failed to create GPU worker fake surface", e); - } - if (gpuWorkerFakeSurface == null || gpuWorkerFakeSurface == EGL10.EGL_NO_SURFACE) { - Log.e(NATIVE_TAG, "Failed to create GPU worker fake surface: " + egl.eglGetError()); - gpuWorkerFakeSurface = null; - } - } - - MapRendererSetupOptions rendererSetupOptions = notGcFor1Egl(new MapRendererSetupOptions()); - if (gpuWorkerContext != null && gpuWorkerFakeSurface != null) { - rendererSetupOptions.setGpuWorkerThreadEnabled(true); - GpuWorkerThreadPrologue gpuWorkerThreadPrologue = notGcFor1Egl(new GpuWorkerThreadPrologue(egl, - display, gpuWorkerContext, gpuWorkerFakeSurface)); - rendererSetupOptions.setGpuWorkerThreadPrologue(gpuWorkerThreadPrologue.getBinding()); - GpuWorkerThreadEpilogue gpuWorkerThreadEpilogue = notGcFor1Egl(new GpuWorkerThreadEpilogue(egl)); - rendererSetupOptions.setGpuWorkerThreadEpilogue(gpuWorkerThreadEpilogue.getBinding()); - } else { - rendererSetupOptions.setGpuWorkerThreadEnabled(false); - } - RenderRequestCallback renderRequestCallback = notGcFor1Egl(new RenderRequestCallback(glSurfaceView)); - rendererSetupOptions.setFrameUpdateRequestCallback(renderRequestCallback.getBinding()); - mapRenderer.setup(rendererSetupOptions); - - return mainContext; - } - - public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) { - egl.eglDestroyContext(display, context); - - if (gpuWorkerContext != null) { - egl.eglDestroyContext(display, gpuWorkerContext); - gpuWorkerContext = null; - } - - if (gpuWorkerFakeSurface != null) { - egl.eglDestroySurface(display, gpuWorkerFakeSurface); - gpuWorkerFakeSurface = null; - } - } - } - - private static class GpuWorkerThreadEpilogue extends MapRendererSetupOptions.IGpuWorkerThreadEpilogue { - public GpuWorkerThreadEpilogue(EGL10 egl) { - _egl = egl; - } - - private final EGL10 _egl; - - @Override - public void method(IMapRenderer mapRenderer) { - try { - if (!_egl.eglWaitGL()) - Log.e(NATIVE_TAG, "Failed to wait for GPU worker context: " + _egl.eglGetError()); - } catch (Exception e) { - Log.e(NATIVE_TAG, "Failed to wait for GPU worker context", e); - } - } - } - - private static class GpuWorkerThreadPrologue extends MapRendererSetupOptions.IGpuWorkerThreadPrologue { - public GpuWorkerThreadPrologue(EGL10 egl, EGLDisplay eglDisplay, EGLContext context, EGLSurface surface) { - _egl = egl; - _eglDisplay = eglDisplay; - _context = context; - _eglSurface = surface; - } - - private final EGL10 _egl; - private final EGLDisplay _eglDisplay; - private final EGLContext _context; - private final EGLSurface _eglSurface; - - @Override - public void method(IMapRenderer mapRenderer) { - try { - if (!_egl.eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _context)) - Log.e(NATIVE_TAG, "Failed to set GPU worker context active: " + _egl.eglGetError()); - } catch (Exception e) { - Log.e(NATIVE_TAG, "Failed to set GPU worker context active", e); - } - } - } - - private static class RenderRequestCallback extends MapRendererSetupOptions.IFrameUpdateRequestCallback { - private GLSurfaceView glSurfaceView; - - public RenderRequestCallback(GLSurfaceView glSurfaceView) { - this.glSurfaceView = glSurfaceView; - } - - @Override - public void method(IMapRenderer mapRenderer) { - glSurfaceView.requestRender(); - } - } - -} diff --git a/OsmAnd/src/net/osmand/plus/views/corenative/NativeRenderer.java b/OsmAnd/src/net/osmand/plus/views/corenative/NativeRenderer.java deleted file mode 100644 index 82d887a021..0000000000 --- a/OsmAnd/src/net/osmand/plus/views/corenative/NativeRenderer.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.osmand.plus.views.corenative; - -import android.opengl.GLSurfaceView; -import android.util.Log; -import net.osmand.core.jni.AreaI; -import net.osmand.core.jni.IMapRenderer; -import net.osmand.core.jni.PointI; - -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -/** - * Created by Denis on 01.10.2014. - */ -public class NativeRenderer implements GLSurfaceView.Renderer { - private IMapRenderer mapRenderer; - - - public NativeRenderer(IMapRenderer mapRenderer){ - this.mapRenderer = mapRenderer; - } - - public void onSurfaceCreated(GL10 gl, EGLConfig config) { - Log.i(NativeQtLibrary.NATIVE_TAG, "onSurfaceCreated"); - if (mapRenderer.isRenderingInitialized()) - mapRenderer.releaseRendering(); - } - - public void onSurfaceChanged(GL10 gl, int width, int height) { - Log.i(NativeQtLibrary.NATIVE_TAG, "onSurfaceChanged"); - mapRenderer.setViewport(new AreaI(0, 0, height, width)); - mapRenderer.setWindowSize(new PointI(width, height)); - - if (!mapRenderer.isRenderingInitialized()) - { - if (!mapRenderer.initializeRendering()) - Log.e(NativeQtLibrary.NATIVE_TAG, "Failed to initialize rendering"); - } - } - - public void onDrawFrame(GL10 gl) { - mapRenderer.update(); - if (mapRenderer.prepareFrame()) - mapRenderer.renderFrame(); - gl.glFlush(); - } -} -