diff --git a/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java b/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java
index 4af1596c2c..f7be034cbe 100644
--- a/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java
+++ b/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java
@@ -39,6 +39,11 @@ public class Amenity extends MapObject {
public static final String REF = "ref";
public static final String OSM_DELETE_VALUE = "delete";
public static final String OSM_DELETE_TAG = "osmand_change";
+ public static final String IMAGE_TITLE = "image_title";
+ public static final String IS_PART = "is_part";
+ public static final String IS_AGGR_PART = "is_aggr_part";
+ public static final String CONTENT_JSON = "content_json";
+
private String subType;
private PoiCategory type;
diff --git a/OsmAnd/build.gradle.lib b/OsmAnd/build.gradle.lib
index f29b9b2a10..419f7dd801 100644
--- a/OsmAnd/build.gradle.lib
+++ b/OsmAnd/build.gradle.lib
@@ -17,6 +17,7 @@ android {
}
lintOptions {
+ tasks.lint.enabled = false
abortOnError false
}
@@ -42,8 +43,6 @@ android {
res.srcDirs = ["res"]
assets.srcDirs = ["assets"]
}
- debug {
- }
legacy {
jniLibs.srcDirs = ["libc++"]
@@ -339,23 +338,74 @@ task appStart(type: Exec) {
// commandLine 'cmd', '/c', 'adb', 'shell', 'am', 'start', '-n', 'net.osmand.plus/net.osmand.plus.activities.MapActivity'
}
+artifacts {
+ archives(file("../OsmAnd-java/build/libs/OsmAnd-java-android-1.0.jar")) {
+ classifier "OsmAnd-java-android"
+ name 'OsmAnd'
+ type "jar"
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-x86-debug.aar")) {
+ classifier 'legacyX86Debug'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-x86-release.aar")) {
+ classifier 'legacyX86Release'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-arm64-debug.aar")) {
+ classifier 'legacyArm64Debug'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-arm64-release.aar")) {
+ classifier 'legacyArm64Release'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-armonly-debug.aar")) {
+ classifier 'legacyArmonlyDebug'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-armonly-release.aar")) {
+ classifier 'legacyArmonlyRelease'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-armv7-debug.aar")) {
+ classifier 'legacyArmv7Debug'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-armv7-release.aar")) {
+ classifier 'legacyArmv7Release'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-fat-debug.aar")) {
+ classifier 'legacyFatDebug'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+ archives(file("$buildDir/outputs/aar/OsmAnd-legacy-fat-release.aar")) {
+ classifier 'legacyFatRelease'
+ name 'OsmAnd'
+ extension 'aar'
+ }
+}
+
// Uploading artifacts to local path
-group = "net.osmand"
+group = 'net.osmand'
uploadArchives {
repositories.ivy {
// credentials {
// username ""
// password ""
// }
- url = System.getenv("OSMAND_BINARIES_IVY_ROOT") ?: "./"
- layout "pattern" , {
- artifact "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
- }
-// def gitInfo = "git describe --long".execute().text.trim()
-// def parsedGitInfo = Pattern.compile("v(\\d+\\.\\d+)-([\\d.]+)-(\\w+)").matcher(gitInfo)
-// assert parsedGitInfo.matches()
-// version = parsedGitInfo.group(1) + "-SNAPSHOT"
+ url = System.getenv("OSMAND_BINARIES_IVY_ROOT") ?: "./"
version = "1.0-SNAPSHOT"
}
}
diff --git a/OsmAnd/res/animator/appbar_always_elevated.xml b/OsmAnd/res/animator/appbar_always_elevated.xml
new file mode 100644
index 0000000000..c8378c1c29
--- /dev/null
+++ b/OsmAnd/res/animator/appbar_always_elevated.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml
index 34e329d8a3..65fc03610c 100644
--- a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml
+++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_checkbox_56dp.xml
@@ -33,7 +33,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
- android:maxLines="1"
+ android:maxLines="2"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Some title"/>
diff --git a/OsmAnd/res/layout/enough_space_warning_card.xml b/OsmAnd/res/layout/enough_space_warning_card.xml
index a39076eb99..d572d20366 100644
--- a/OsmAnd/res/layout/enough_space_warning_card.xml
+++ b/OsmAnd/res/layout/enough_space_warning_card.xml
@@ -36,6 +36,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="@dimen/text_button_letter_spacing"
+ android:paddingBottom="@dimen/measurement_tool_menu_title_padding_bottom"
android:text="@string/export_not_enough_space"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
diff --git a/OsmAnd/res/layout/follow_track_options.xml b/OsmAnd/res/layout/follow_track_options.xml
index 0877fcc307..4523599e6c 100644
--- a/OsmAnd/res/layout/follow_track_options.xml
+++ b/OsmAnd/res/layout/follow_track_options.xml
@@ -75,7 +75,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/route_info_bg"
- android:foreground="@drawable/bg_contextmenu_shadow"
android:foregroundGravity="top|fill_horizontal">
+
+
+ android:background="@android:color/transparent"
+ android:stateListAnimator="@animator/appbar_always_elevated">
diff --git a/OsmAnd/res/values-ar/phrases.xml b/OsmAnd/res/values-ar/phrases.xml
index a1560af76a..bc5277a310 100644
--- a/OsmAnd/res/values-ar/phrases.xml
+++ b/OsmAnd/res/values-ar/phrases.xml
@@ -117,7 +117,7 @@
شرطةنوع العمل الفني : نافورةنجار
- سباك
+ سباكةمعرض سياراتورشة تصليح السياراتخراطيش الطابعة
@@ -702,7 +702,7 @@
تجميل الاظافرصالون تدليكصالون وشم
- التنظيف الجاف
+ مغسلة ملابسغسيل الملابستأجير سياراتمشاركة السيارات
@@ -1369,7 +1369,7 @@
طب الأطفال الاجتماعيطب التوليد (القيصرية)طب الإدمان
- بصريات
+ نظارات/بصرياتعلاج النطقالطب الرياضيالوخز بالإبر
@@ -1739,7 +1739,7 @@
جصاصطبقة الباركيهدهان
- أخصائي بصريات
+ محل نظارات/بصرياتحرفة الصناعات المعدنيةناسخ مفاتيحصانع ومصلح المفاتيح
@@ -2116,7 +2116,7 @@
سهلمقياس RTSAمتضرره من الرياح
- فيضة/شجيرات ربيعية
+ فيضة/روضةبراحمستوى العبورمعبر خط القطار
diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml
index d6716c22f0..b85578312f 100644
--- a/OsmAnd/res/values-eo/strings.xml
+++ b/OsmAnd/res/values-eo/strings.xml
@@ -3955,12 +3955,12 @@
Ensaluti al OpenStreetMapEnsaluti al OpenStreetMap.orgEnsaluti per OpenStreetMap
- Ensalutu por alŝuti novajn aŭ modifitajn ŝanĝojn
+ Vi devas ensaluti por alŝuti novajn aŭ modifitajn ŝanĝojn.
\n
-\naŭ per la sekura metodo OAuth aŭ per enigi uzantnomon kaj pasvorton.
- Ensaluti per uzantnomo kaj pasvorto
+\nVi povas ensaluti per la sekura metodo OAuth aŭ per enigi salutnomon kaj pasvorton.
+ Ensaluti per salutnomo kaj pasvortoKonto
- Uzantnomo
+ SalutnomoHistorio de markojSendi GPX‑dosieron al OpenStreetMapEnigu etikedojn disigitajn per komo (,).
@@ -3970,11 +3970,11 @@
“Spurebla” signifas, ke la GPX‑spuro ne montriĝos en publikaj listoj, sed pritraktitaj punktoj kun tempindikoj el ĝi (kiuj ne povos esti senpere ligitaj al vi) estos elŝuteblaj per la publika API GPS.Fermi OSM-rimarkonKomenti OSM-rimarkon
- Ensalutii per la sekura metodo OAuth aŭ per uzi uzantnomon kaj pasvorton.
+ Vi povas ensalutii per la sekura metodo OAuth aŭ per uzi salutnomon kaj pasvorton.Aldoni fotonRegistri ĉe
\nOpenPlaceReviews.org
- Ensaluti en la paĝon de la malferm‑datuma projekto OpenPlaceReviews.org por alŝuti fotojn.
+ Fotoj estas liverataj de la malferm‑datuma projekto OpenPlaceReviews.org. Por alŝuti viajn fotojn, vi devas enlasaluti en la retejon.Krei novan kontonMi jam havas kontonSerĉi en historio
@@ -3996,4 +3996,6 @@
Elektu elementojn por enporti.Baskuli al dev.openstreetmap.org anstataŭ openstreetmap.org por testi alŝuti OSM‑rimarkojn, interesejojn, GPX‑spurojn.Uzi dev.openstreetmap.org
+ Ne povas alŝuti la bildon, reprovu poste
+ Elektu bildon
\ No newline at end of file
diff --git a/OsmAnd/res/values-es-rUS/phrases.xml b/OsmAnd/res/values-es-rUS/phrases.xml
index 1e57d33830..9980bdccd7 100644
--- a/OsmAnd/res/values-es-rUS/phrases.xml
+++ b/OsmAnd/res/values-es-rUS/phrases.xml
@@ -400,7 +400,7 @@
BuceoSubmarinismoCanódromo
- Equitación
+ Deportes ecuestresHockey sobre céspedGolfGimnasia
@@ -1234,7 +1234,7 @@
Paso a nivel peatonal;Cruce peatonal ferroviarioPaso a nivel;Cruce ferroviarioObservatorio de aves
- Equitación
+ Centro ecuestreJardínCéspedPastizal
diff --git a/OsmAnd/res/values-es-rUS/strings.xml b/OsmAnd/res/values-es-rUS/strings.xml
index 41d034e714..6e8220cde8 100644
--- a/OsmAnd/res/values-es-rUS/strings.xml
+++ b/OsmAnd/res/values-es-rUS/strings.xml
@@ -3948,17 +3948,17 @@
EmergenciaComodidadEl archivo ya fue importado en OsmAnd
- Nombre de usuario
- Ingresar nombre de usuario y contraseña
+ Ingresar
+ Ingresar con usuario y contraseñaHay un problema con la suscripción. Pulsa el botón para ir a los ajustes de la suscripción de Google Play y corregir el método de pago.La suscripción a OsmAnd Live se ha pausadoLa suscripción a OsmAnd Live está en esperaLa suscripción a OsmAnd Live ha caducadoIngresar con OpenStreetMapEnviar archivo GPX a OpenStreetMap
- Inicia sesión para subir los cambios nuevos o modificados,
+ Debes iniciar sesión para subir los cambios nuevos o modificados.
\n
-\nya sea con OAuth o usando el nombre de usuario y contraseña.
+\nPuedes ingresar usando el método seguro de OAuth o con nombre de usuario y contraseña.Debes añadir al menos dos puntosHistorial de marcadoresGestionar suscripción
@@ -3973,10 +3973,10 @@
Añadir fotoYa tengo cuentaCrear nueva cuenta
- Ingresa en el sitio web del proyecto de datos abiertos OpenPlaceReviews.org para subir más fotos.
+ Las fotos son provistas por el proyecto de datos abiertos OpenPlaceReviews.org. Para subir fotos debes registrarte en el sitio web.Registrarse en
\nOpenPlaceReviews.org
- Ingresa usando el método seguro de OAuth o usa el nombre de usuario y contraseña.
+ Puedes iniciar sesión con el método seguro de OAuth o usar el nombre de usuario y contraseña.Comentar nota de OSMCerrar nota de OSMHistorial de búsqueda
@@ -3994,4 +3994,11 @@
\nOpenPlaceReviews (fotos de PDI);
\nMapillary (imágenes a nivel de calle);
\nWeb / Wikimedia (fotos de PDI incluidas en los datos de OpenStreetMap).
+ Cambia a la versión para desarrolladores «dev.openstreetmap.org» en lugar de openstreetmap.org para probar la carga de PDI, notas de OSM y archivos GPX.
+ Usar dev.openstreetmap.org
+ Elegir imagen
+ Marca los elementos que serán importados.
+ Marca los grupos que serán importados.
+ No se puede subir la imagen, inténtalo más tarde
+ Separador
\ No newline at end of file
diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml
index 42a06769a4..3a3565a83b 100644
--- a/OsmAnd/res/values-eu/strings.xml
+++ b/OsmAnd/res/values-eu/strings.xml
@@ -3815,7 +3815,7 @@ Area honi dagokio: %1$s x %2$s
Zehaztu lorratz orokorreko grabazio erregistroaren tartea (mapan \'Bidaia grabaketa\' trepetaren bidez aktibatuta dago).Ireki gordetako lorratza\"Jarraigarria\" esan nahi du lorratza ez dela inolako zerrenda publikoetan agertzen, baina prozesatutako puntuak bere denbora markekin (zurekin zuzenean lotu ezin direnak) GPS API publikoaren deskargen bidez agertzen dira.
-
+ PrestazioaOpenStreetMap-eko saio hasieraOpenStreetMap.org-eko saio hasiera
@@ -3876,7 +3876,7 @@ Area honi dagokio: %1$s x %2$s
\nbai OAuth-ekin edo zure erabiltzaile izena eta pasahitza erabiliz.
Hasi saioa erabiltzaile izenarekin eta pasahitzarekinKontua
- Erabiltzaile-izena
+ Hasi saioaKudeatu harpidetzaArazo bat dago zure harpidetzarekin. Egin klik botoian Google Play harpidetzaren ezarpenetara joateko zure ordainketa-metodoa konpontzeko.OsmAnd Live harpidetza iraungi egin da
@@ -3998,4 +3998,6 @@ Area honi dagokio: %1$s x %2$s
Markatzaileen historiaBidali GPX fitxategia OpenStreetMap-eraEgin iruzkina OSM oharrean
+ Hautatu argazkia
+ Erabili dev.openstreetmap.org
\ No newline at end of file
diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml
index cd4664a6dd..d18f8ccd4a 100644
--- a/OsmAnd/res/values-pt/strings.xml
+++ b/OsmAnd/res/values-pt/strings.xml
@@ -3970,14 +3970,14 @@
Público significa que o rastreamento será mostrado publicamente nos Seus traços de GPS e em listas públicas de rastreamento de GPS. Os dados servidos através da API não fazem referência à sua página de rastreamento. As marcas temporais dos pontos de rastreamento não estão disponíveis através da API pública do GPS e os pontos não estão ordenados cronologicamente. No entanto, outros utilizadores ainda são capazes de descarregar o rastreamento bruto da lista pública de rastreamento e de quaisquer carimbos de tempo contidos nela.Privado significa que o rastreamento não aparecerá em nenhuma listagem pública, mas os pontos de rastreamento dele ainda estarão disponíveis através da API pública do GPS sem carimbos de tempo, mas não serão ordenados cronologicamente.Identificável significa que o rastreamento será mostrado publicamente nos Seus traços de GPS e em listas públicas de rastreamento de GPS, ou seja, outros utilizadores serão capazes de descarregar o rastreamento bruto e associá-lo ao seu nome de utilizador. Os dados servidos através da API dos pontos de rastreamento referenciarão à sua página de rastreamento original. As marcas de tempo dos pontos de rastreamento estão disponíveis através da API pública do GPS.
- Rastreável significa que o rastreamento não aparecerá em nenhuma lista pública, mas os pontos de rastreamento a partir dele ainda estarão disponíveis através da API pública do GPS com carimbos de tempo. Outros utilizadores só poderão descarregar pontos de rastreamento processados do seu rastreamento que não podem ser associados diretamente a si.
+ \"Rastreável\" significa que o rastreamento não aparece em nenhuma listagem pública, mas pontos de rastreamento processados com carimbos de tempo a partir dele (que não podem ser associados diretamente a si) fazem através de descarregadas da API pública do GPS.Fechar nota do OSMComentário de nota do OSM
- Faça login a usar o método seguro OAuth ou use o seu nome de utilizador e a palavra-passe.
+ Pode fazer login pelo método seguro OAuth ou use o seu nome de utilizador e a palavra-passe.Adicionar fotosCadastre-se em
\nOpenPlaceReviews.org
- Faça login no site do projeto de dados abertos OpenPlaceReviews.org para enviar ainda mais fotos.
+ As fotos são fornecidas pelo projeto de dados abertos OpenPlaceReviews.org. Para enviar as suas fotos precisa cadastrar-se no site.Criar uma contaJá tenho uma contaHistórico de pesquisa
@@ -3998,4 +3998,7 @@
Seleccionar os grupos que serão importados.Seleccionar os objectos que serão importados.Utilizar dev.openstreetmap.org
+ Não é possível enviar a imagem, por favor, tente novamente mais tarde
+ Selecione a imagem
+ Mude para usar dev.openstreetmap.org ao invés de openstreetmap.org para testar enviar uma OSM Nota / POI / GPX.
\ No newline at end of file
diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml
index 66cbcb543b..fb1dc5e65d 100644
--- a/OsmAnd/res/values-ru/phrases.xml
+++ b/OsmAnd/res/values-ru/phrases.xml
@@ -3838,4 +3838,30 @@
Радиолокационная вышкаПридорожная стоянкаНа крыше
+ Нет
+ Да
+ Нет
+ Да
+ Нет
+ Да
+ Представительство
+ Офис
+ Почетный консул
+ Генеральное консульство
+ Консульский офис
+ Во главе с консулом
+ Резиденция
+ Нунциатура
+ Миссия
+ Верховный комиссариат
+ Делегация
+ Филиал
+ Во главе с послом
+ Связь
+ Посольство
+ Гражданские услуги
+ Иммиграционные визы
+ Неиммиграционные визы
+ Связь
+ Посольство
\ No newline at end of file
diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index d7ac847575..1ae090253b 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -3991,4 +3991,5 @@
Фотографии предоставлены проектом открытых данных OpenPlaceReviews.org. Чтобы отправить свои фотографии, необходимо зарегистрироваться на сайте.Невозможно отправить изображение, попробуйте позжеВыбор изображения
+ Каяк
\ No newline at end of file
diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml
index c1addc1349..f91581adf6 100644
--- a/OsmAnd/res/values/sizes.xml
+++ b/OsmAnd/res/values/sizes.xml
@@ -397,6 +397,7 @@
42dp128dp164dp
+ 68dp6dp12dp
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 72fb10e393..9da2ac6d86 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -11,6 +11,7 @@
Thx - Hardy
-->
+ %1$s * %2$sOsmAnd shows photos from several sources:\nOpenPlaceReviews - POI photos;\nMapillary - street-level imagery;\nWeb / Wikimedia - POI photos specified in OpenStreetMap data.Use dev.openstreetmap.orgSwitch to use "dev.openstreetmap.org" instead of "openstreetmap.org" to testing uploading OSM Note / POI / GPX.
diff --git a/OsmAnd/src/net/osmand/plus/AnalyticsHelper.java b/OsmAnd/src/net/osmand/plus/AnalyticsHelper.java
index e906d7b9bb..2fd12a11ac 100644
--- a/OsmAnd/src/net/osmand/plus/AnalyticsHelper.java
+++ b/OsmAnd/src/net/osmand/plus/AnalyticsHelper.java
@@ -27,7 +27,7 @@ public class AnalyticsHelper extends SQLiteOpenHelper {
private final static Log LOG = PlatformUtil.getLog(AnalyticsHelper.class);
- private final static String ANALYTICS_UPLOAD_URL = "https://test.osmand.net/api/submit_analytics";
+ private final static String ANALYTICS_UPLOAD_URL = "https://osmand.net/api/submit_analytics";
private final static String ANALYTICS_FILE_NAME = "analytics.json";
private final static int DATA_PARCEL_SIZE = 500; // 500 events
diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java
index a862182014..8f13681d69 100644
--- a/OsmAnd/src/net/osmand/plus/AppInitializer.java
+++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java
@@ -66,6 +66,8 @@ import net.osmand.plus.voice.JSTTSCommandPlayerImpl;
import net.osmand.plus.voice.MediaCommandPlayerImpl;
import net.osmand.plus.voice.TTSCommandPlayerImpl;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelHelper;
+import net.osmand.plus.wikivoyage.data.TravelObfHelper;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.router.RoutingConfiguration;
import net.osmand.util.Algorithms;
@@ -85,7 +87,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Random;
-import btools.routingapp.BRouterServiceConnection;
import btools.routingapp.IBRouterService;
import static net.osmand.plus.AppVersionUpgradeOnInit.LAST_APP_VERSION;
@@ -457,11 +458,14 @@ public class AppInitializer implements IProgress {
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
app.mapViewTrackingUtilities = startupInit(new MapViewTrackingUtilities(app), MapViewTrackingUtilities.class);
- app.travelDbHelper = new TravelDbHelper(app);
+
+ //TODO cleanup after Travel migration complete
+ app.travelHelper = TravelObfHelper.checkIfObfFileExists(app) ? new TravelObfHelper(app) : new TravelDbHelper(app);
if (app.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
- app.travelDbHelper.initTravelBooks();
+ app.travelHelper.initTravelBooks();
}
- app.travelDbHelper = startupInit(app.travelDbHelper, TravelDbHelper.class);
+ app.travelHelper = startupInit(app.travelHelper, TravelHelper.class);
+
app.lockHelper = startupInit(new LockHelper(app), LockHelper.class);
app.settingsHelper = startupInit(new SettingsHelper(app), SettingsHelper.class);
app.quickActionRegistry = startupInit(new QuickActionRegistry(app.getSettings()), QuickActionRegistry.class);
diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
index 00bdd97e2d..bbe45aab51 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
@@ -79,7 +79,7 @@ import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.backup.SettingsHelper;
import net.osmand.plus.voice.CommandPlayer;
-import net.osmand.plus.wikivoyage.data.TravelDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelHelper;
import net.osmand.router.GeneralRouter;
import net.osmand.router.RoutingConfiguration;
import net.osmand.router.RoutingConfiguration.Builder;
@@ -148,7 +148,7 @@ public class OsmandApplication extends MultiDexApplication {
OsmandRegions regions;
GeocodingLookupService geocodingLookupService;
QuickSearchHelper searchUICore;
- TravelDbHelper travelDbHelper;
+ TravelHelper travelHelper;
InAppPurchaseHelper inAppPurchaseHelper;
MapViewTrackingUtilities mapViewTrackingUtilities;
LockHelper lockHelper;
@@ -481,8 +481,8 @@ public class OsmandApplication extends MultiDexApplication {
return searchUICore;
}
- public TravelDbHelper getTravelDbHelper() {
- return travelDbHelper;
+ public TravelHelper getTravelHelper() {
+ return travelHelper;
}
public InAppPurchaseHelper getInAppPurchaseHelper() {
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index 5a6a7560a5..00bd656b63 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -76,6 +76,7 @@ import net.osmand.plus.views.layers.MapControlsLayer;
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
import net.osmand.plus.wikivoyage.WikivoyageWelcomeDialogFragment;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelHelper;
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity;
import net.osmand.router.GeneralRouter;
import net.osmand.util.Algorithms;
@@ -924,9 +925,9 @@ public class MapActivityActions implements DialogProvider {
@Override
public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
MapActivity.clearPrevActivityIntent();
- TravelDbHelper travelDbHelper = getMyApplication().getTravelDbHelper();
- travelDbHelper.initTravelBooks();
- if (travelDbHelper.getSelectedTravelBook() == null) {
+ TravelHelper travelHelper = getMyApplication().getTravelHelper();
+ travelHelper.initTravelBooks();
+ if (travelHelper.getSelectedTravelBook() == null) {
WikivoyageWelcomeDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
} else {
Intent intent = new Intent(mapActivity, WikivoyageExploreActivity.class);
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
index e1317fb630..c42e4de8aa 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
@@ -930,11 +930,21 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
stopRecording(activity, false);
}
+ @Override
+ public void mapActivityResume(MapActivity activity) {
+ this.mapActivity = activity;
+ if (Build.VERSION.SDK_INT < 29) {
+ runAction(activity);
+ }
+ }
+
@Override
public void mapActivityResumeOnTop(MapActivity activity) {
this.mapActivity = activity;
-// ((AudioManager) activity.getSystemService(Context.AUDIO_SERVICE)).registerMediaButtonEventReceiver(
-// new ComponentName(activity, MediaRemoteControlReceiver.class));
+ runAction(activity);
+ }
+
+ private void runAction(MapActivity activity) {
if (runAction != -1) {
takeAction(activity, actionLon, actionLat, runAction);
runAction = -1;
diff --git a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java
index ccd166818a..22e0607c7f 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java
@@ -417,7 +417,9 @@ public class AvoidSpecificRoads {
AvoidRoadInfo other = (AvoidRoadInfo) obj;
return Math.abs(latitude - other.latitude) < 0.00001
&& Math.abs(longitude - other.longitude) < 0.00001
- && Algorithms.objectEquals(name, other.name);
+ && Algorithms.objectEquals(name, other.name)
+ && Algorithms.objectEquals(appModeKey, other.appModeKey)
+ && id == other.id;
}
}
}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
index 26dfdaefa7..503e52ecf0 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
@@ -14,6 +14,8 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.Looper;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
@@ -27,14 +29,12 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
-
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
-
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.data.Amenity;
@@ -42,11 +42,7 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect;
import net.osmand.osm.io.NetworkUtils;
-import net.osmand.plus.OsmAndFormatter;
-import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.OsmandPlugin;
-import net.osmand.plus.R;
-import net.osmand.plus.UiUtilities;
+import net.osmand.plus.*;
import net.osmand.plus.activities.ActivityResultListener;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.FontCache;
@@ -69,7 +65,6 @@ import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.widgets.tools.ClickableSpanTouchListener;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
-
import org.apache.commons.logging.Log;
import org.openplacereviews.opendb.util.exception.FailedVerificationException;
@@ -77,13 +72,7 @@ import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import static net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener;
@@ -119,6 +108,8 @@ public class MenuBuilder {
private String preferredMapLang;
private String preferredMapAppLang;
private boolean transliterateNames;
+ private View view;
+ private View photoButton;
private final OpenDBAPI openDBAPI = new OpenDBAPI();
private String[] placeId = new String[0];
@@ -131,6 +122,14 @@ public class MenuBuilder {
@Override
public void onPlaceIdAcquired(String[] placeId) {
MenuBuilder.this.placeId = placeId;
+ if (placeId.length < 2) {
+ app.runInUIThread(new Runnable() {
+ @Override
+ public void run() {
+ photoButton.setVisibility(View.GONE);
+ }
+ });
+ }
}
@Override
@@ -239,6 +238,7 @@ public class MenuBuilder {
}
public void build(View view) {
+ this.view = view;
firstRow = true;
hidden = false;
buildTopInternal(view);
@@ -412,7 +412,10 @@ public class MenuBuilder {
}
});
//TODO This feature is under development
- view.setVisibility(View.VISIBLE);
+ if (!OsmandPlugin.isDevelopment()) {
+ view.setVisibility(View.GONE);
+ }
+ photoButton = view;
return view;
}
@@ -430,7 +433,9 @@ public class MenuBuilder {
OnActivityResultListener() {
@Override
public void onResult(int resultCode, Intent resultData) {
- handleSelectedImage(view, resultData.getData());
+ if (resultData != null) {
+ handleSelectedImage(view, resultData.getData());
+ }
}
}));
}
@@ -443,10 +448,12 @@ public class MenuBuilder {
try {
inputStream = app.getContentResolver().openInputStream(uri);
if (inputStream != null) {
- uploadImageToPlace(view, inputStream);
+ uploadImageToPlace(inputStream);
}
} catch (Exception e) {
LOG.error(e);
+ String str = app.getString(R.string.cannot_upload_image);
+ showToastMessage(str);
} finally {
Algorithms.closeStream(inputStream);
}
@@ -455,7 +462,7 @@ public class MenuBuilder {
t.start();
}
- private void uploadImageToPlace(View view, InputStream image) {
+ private void uploadImageToPlace(InputStream image) {
InputStream serverData = new ByteArrayInputStream(compressImage(image));
final String baseUrl = OPRWebviewActivity.getBaseUrl(app);
String url = baseUrl + "api/ipfs/image";
@@ -463,26 +470,60 @@ public class MenuBuilder {
if (response != null) {
int res = 0;
try {
+ StringBuilder error = new StringBuilder();
res = openDBAPI.uploadImage(
placeId,
baseUrl,
OPRWebviewActivity.getPrivateKeyFromCookie(app),
OPRWebviewActivity.getUsernameFromCookie(app),
- response);
+ response, error);
+ if (res != 200) {
+ showToastMessage(error.toString());
+ } else {
+ //ok, continue
+ }
} catch (FailedVerificationException e) {
LOG.error(e);
- app.showToastMessage(R.string.cannot_upload_image);
+ checkTokenAndShowScreen();
}
if (res != 200) {
//image was uploaded but not added to blockchain
- app.showToastMessage(R.string.cannot_upload_image);
+ checkTokenAndShowScreen();
} else {
- app.showToastMessage(R.string.successfully_uploaded_pattern, 1, 1);
+ String str = app.getString(R.string.successfully_uploaded_pattern, 1, 1);
+ showToastMessage(str);
//refresh the image
execute(new GetImageCardsTask(mapActivity, getLatLon(), getAdditionalCardParams(), imageCardListener));
}
} else {
- app.showToastMessage(R.string.cannot_upload_image);
+ checkTokenAndShowScreen();
+ }
+ }
+
+ private void showToastMessage(final String str) {
+ new Handler(Looper.getMainLooper()).post(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(mapActivity.getBaseContext(), str, Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ //This method runs on non main thread
+ private void checkTokenAndShowScreen() {
+ final String baseUrl = OPRWebviewActivity.getBaseUrl(app);
+ final String name = OPRWebviewActivity.getUsernameFromCookie(app);
+ final String privateKey = OPRWebviewActivity.getPrivateKeyFromCookie(app);
+ if (openDBAPI.checkPrivateKeyValid(baseUrl, name, privateKey)) {
+ String str = app.getString(R.string.cannot_upload_image);
+ showToastMessage(str);
+ } else {
+ app.runInUIThread(new Runnable() {
+ @Override
+ public void run() {
+ OprStartFragment.showInstance(mapActivity.getSupportFragmentManager());
+ }
+ });
}
}
@@ -1186,4 +1227,4 @@ public class MenuBuilder {
public static
void execute(AsyncTask
task, P... requests) {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests);
}
-}
\ No newline at end of file
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
index 29fb2e578d..12b1b0d497 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
@@ -48,7 +48,9 @@ import net.osmand.util.OpeningHoursParser;
import org.apache.commons.logging.Log;
+import java.io.UnsupportedEncodingException;
import java.math.RoundingMode;
+import java.net.URLDecoder;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
@@ -784,20 +786,29 @@ public class AmenityMenuBuilder extends MenuBuilder {
String wikidataValue = amenity.getAdditionalInfo(Amenity.WIKIDATA);
String wikimediaValue = amenity.getAdditionalInfo(Amenity.WIKIMEDIA_COMMONS);
if (!Algorithms.isEmpty(imageValue)) {
- params.put("osm_image", imageValue);
+ params.put("osm_image", getDecodedAdditionalInfo(imageValue));
}
if (!Algorithms.isEmpty(mapillaryValue)) {
- params.put("osm_mapillary_key", mapillaryValue);
+ params.put("osm_mapillary_key", getDecodedAdditionalInfo(mapillaryValue));
}
if (!Algorithms.isEmpty(wikidataValue)) {
- params.put(Amenity.WIKIDATA, wikidataValue);
+ params.put(Amenity.WIKIDATA, getDecodedAdditionalInfo(wikidataValue));
}
if (!Algorithms.isEmpty(wikimediaValue)) {
- params.put(Amenity.WIKIMEDIA_COMMONS, wikimediaValue);
+ params.put(Amenity.WIKIMEDIA_COMMONS, getDecodedAdditionalInfo(wikimediaValue));
}
return params;
}
+ private String getDecodedAdditionalInfo(String additionalInfo) {
+ try {
+ return URLDecoder.decode(additionalInfo, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ LOG.error(e);
+ }
+ return additionalInfo;
+ }
+
private CollapsableView getPoiTypeCollapsableView(final Context context, boolean collapsed,
@NonNull final List categoryTypes,
final boolean poiAdditional, AmenityInfoRow textRow) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/IPFSImageCard.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/IPFSImageCard.java
index 0d58add034..63f02d10fe 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/IPFSImageCard.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/IPFSImageCard.java
@@ -1,8 +1,8 @@
package net.osmand.plus.mapcontextmenu.builders.cards;
+
import android.view.View;
import androidx.core.content.ContextCompat;
-import net.osmand.AndroidNetworkUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
@@ -12,7 +12,6 @@ import org.json.JSONException;
import org.json.JSONObject;
public class IPFSImageCard extends ImageCard {
- private static final String BASE_URL = "https://test.openplacereviews.org/api/ipfs/image-ipfs?cid=";
private static final Log LOG = PlatformUtil.getLog(IPFSImageCard.class);
public IPFSImageCard(MapActivity mapActivity, JSONObject imageObject) {
@@ -23,6 +22,7 @@ public class IPFSImageCard extends ImageCard {
} catch (JSONException e) {
LOG.error(e);
}
+ String BASE_URL = mapActivity.getString(R.string.opr_base_url) + "api/ipfs/image-ipfs?cid=";
url = BASE_URL + cid;
imageHiresUrl = BASE_URL + cid;
imageUrl = BASE_URL + cid;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java
index 3650f6d820..74797620f9 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java
@@ -27,6 +27,7 @@ import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.wikivoyage.data.TravelArticle;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelHelper;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
@@ -567,11 +568,11 @@ public class MapMarkersHelper {
@NonNull
public List getGroupsForSavedArticlesTravelBook() {
List res = new ArrayList<>();
- TravelDbHelper travelDbHelper = ctx.getTravelDbHelper();
- if (travelDbHelper.getSelectedTravelBook() != null) {
- List savedArticles = travelDbHelper.getLocalDataHelper().getSavedArticles();
+ TravelHelper travelHelper = ctx.getTravelHelper();
+ if (travelHelper.getSelectedTravelBook() != null) {
+ List savedArticles = travelHelper.getLocalDataHelper().getSavedArticles();
for (TravelArticle art : savedArticles) {
- String gpxName = travelDbHelper.getGPXName(art);
+ String gpxName = travelHelper.getGPXName(art);
File path = ctx.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
LOG.debug("Article group " + path.getAbsolutePath() + " " + path.exists());
MapMarkersGroup search = getMapMarkerGroupById(getMarkerGroupId(path), MapMarkersGroup.GPX_TYPE);
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java
index 30639c768b..4cb0b9f690 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java
@@ -37,6 +37,7 @@ import net.osmand.plus.mapmarkers.SelectWptCategoriesBottomSheetDialogFragment;
import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment;
import net.osmand.plus.wikivoyage.data.TravelArticle;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelHelper;
import java.io.File;
import java.text.SimpleDateFormat;
@@ -163,11 +164,11 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter savedArticles = travelDbHelper.getLocalDataHelper().getSavedArticles();
+ TravelHelper travelHelper = mapActivity.getMyApplication().getTravelHelper();
+ if (travelHelper.getSelectedTravelBook() != null) {
+ List savedArticles = travelHelper.getLocalDataHelper().getSavedArticles();
for (TravelArticle art : savedArticles) {
- String gpxName = travelDbHelper.getGPXName(art);
+ String gpxName = travelHelper.getGPXName(art);
File path = mapActivity.getMyApplication().getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
if (path.getAbsolutePath().equals(group.getGpxPath())) {
group.setWikivoyageArticle(art);
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java
index 7612583067..d27ceba057 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java
@@ -486,7 +486,7 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
String title = metadata.getArticleTitle();
String lang = metadata.getArticleLang();
if (!TextUtils.isEmpty(title) && !TextUtils.isEmpty(lang)) {
- return app.getTravelDbHelper().getArticle(title, lang);
+ return app.getTravelHelper().getArticle(title, lang);
}
return null;
}
diff --git a/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java b/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java
index 14fd181f54..62e030ecca 100644
--- a/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java
+++ b/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java
@@ -11,19 +11,21 @@ import android.webkit.CookieManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
-
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
-
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.settings.backend.OsmandSettings;
+import java.util.ArrayList;
+import java.util.List;
+
public class OPRWebviewActivity extends OsmandActionBarActivity {
public static final String KEY_LOGIN = "LOGIN_KEY";
- public static String KEY_TITLE = "TITLE_KEY";
+ public static final String KEY_TITLE = "TITLE_KEY";
+ private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko)";
private WebView webView;
private boolean isLogin = false;
@@ -43,8 +45,13 @@ public class OPRWebviewActivity extends OsmandActionBarActivity {
return getBaseUrl(ctx) + "signup";
}
- public static String getFinishUrl(Context ctx) {
- return getCookieUrl(ctx);
+ public static List getFinishUrls(Context ctx) {
+ String googleOAuthFinishUrl = getBaseUrl(ctx) + "auth?code=4";
+ String profileUrl = getCookieUrl(ctx);
+ List urls = new ArrayList<>();
+ urls.add(googleOAuthFinishUrl);
+ urls.add(profileUrl);
+ return urls;
}
public void onCreate(Bundle savedInstanceState) {
@@ -76,6 +83,7 @@ public class OPRWebviewActivity extends OsmandActionBarActivity {
}
});
webView = findViewById(R.id.printDialogWebview);
+ webView.getSettings().setUserAgentString(USER_AGENT);
webView.setWebViewClient(new CloseOnSuccessWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
WebView.setWebContentsDebuggingEnabled(true);
@@ -124,8 +132,10 @@ public class OPRWebviewActivity extends OsmandActionBarActivity {
public class CloseOnSuccessWebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
- if (url.contains(getFinishUrl(OPRWebviewActivity.this)) && isLogin) {
- finish();
+ for (String furl : getFinishUrls(OPRWebviewActivity.this)) {
+ if (url.contains(furl) && isLogin) {
+ finish();
+ }
}
super.onPageFinished(view, url);
}
diff --git a/OsmAnd/src/net/osmand/plus/openplacereviews/OprStartFragment.java b/OsmAnd/src/net/osmand/plus/openplacereviews/OprStartFragment.java
index 00aba01997..d91164ff18 100644
--- a/OsmAnd/src/net/osmand/plus/openplacereviews/OprStartFragment.java
+++ b/OsmAnd/src/net/osmand/plus/openplacereviews/OprStartFragment.java
@@ -18,6 +18,7 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.PlatformUtil;
+import net.osmand.plus.BuildConfig;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndFragment;
@@ -74,7 +75,7 @@ public class OprStartFragment extends BaseOsmAndFragment {
private void setURLSpan(View v) {
String desc = requireContext().getString(R.string.register_on_openplacereviews_desc);
SpannableString ss = new SpannableString(desc);
- ss.setSpan(new URLSpanNoUnderline("https://" + openPlaceReviewsUrl), desc.indexOf(openPlaceReviewsUrl),
+ ss.setSpan(new URLSpanNoUnderline(getActivity().getString(R.string.opr_base_url)), desc.indexOf(openPlaceReviewsUrl),
desc.indexOf(openPlaceReviewsUrl) + openPlaceReviewsUrl.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
v.findViewById(R.id.start_opr_description).setText(ss);
v.findViewById(R.id.start_opr_description).setMovementMethod(LinkMovementMethod.getInstance());
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/opr/OpenDBAPI.java b/OsmAnd/src/net/osmand/plus/osmedit/opr/OpenDBAPI.java
index 7c891c25c9..36d6e82b11 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/opr/OpenDBAPI.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/opr/OpenDBAPI.java
@@ -68,7 +68,7 @@ public class OpenDBAPI {
response.toString().contains(LOGIN_SUCCESS_MESSAGE);
}
- public int uploadImage(String[] placeId, String baseUrl, String privateKey, String username, String image) throws FailedVerificationException {
+ public int uploadImage(String[] placeId, String baseUrl, String privateKey, String username, String image, StringBuilder sb) throws FailedVerificationException {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
Security.removeProvider("BC");
Security.addProvider(new BouncyCastleProvider());
@@ -92,11 +92,9 @@ public class OpenDBAPI {
List ids = new ArrayList<>(Arrays.asList(placeId));
Map change = new TreeMap<>();
Map images = new TreeMap<>();
- Map outdoor = new TreeMap<>();
- outdoor.put("outdoor", imageResponseList);
- images.put("append", outdoor);
+ images.put("append", imageMap);
change.put("version", "increment");
- change.put("images", images);
+ change.put("images.review", images);
edit.put("id", ids);
edit.put("change", change);
edit.put("current", new Object());
@@ -134,6 +132,7 @@ public class OpenDBAPI {
String strCurrentLine;
while ((strCurrentLine = br.readLine()) != null) {
log.error(strCurrentLine);
+ sb.append(strCurrentLine);
}
}
return rc;
@@ -149,4 +148,4 @@ public class OpenDBAPI {
public String cid;
public String extension;
}
-}
\ No newline at end of file
+}
diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java
index d805cde0df..7730010808 100644
--- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java
+++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java
@@ -156,6 +156,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
if (view != null) {
ImageButton closeButton = view.findViewById(R.id.close_button);
buttonsShadow = view.findViewById(R.id.buttons_shadow);
+ sortButton = view.findViewById(R.id.sort_button);
closeButton.setImageDrawable(getContentIcon(AndroidUtils.getNavigationIconResId(app)));
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -219,6 +220,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
if (Algorithms.isEmpty(fileName)) {
fileName = app.getString(R.string.shared_string_gpx_track);
}
+ sortButton.setVisibility(View.GONE);
GPXInfo gpxInfo = new GPXInfo(fileName, file != null ? file.lastModified() : 0, file != null ? file.length() : 0);
TrackEditCard importTrackCard = new TrackEditCard(mapActivity, gpxInfo);
importTrackCard.setListener(this);
@@ -268,6 +270,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
tracksCard = new TracksToFollowCard(mapActivity, list, defaultCategory);
tracksCard.setListener(FollowTrackFragment.this);
getCardsContainer().addView(tracksCard.build(mapActivity));
+ sortButton.setVisibility(View.VISIBLE);
}
}
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java
index bf86c42ee6..13135c0821 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java
@@ -10,7 +10,6 @@ public enum ExportSettingsType {
GLOBAL(R.string.general_settings_2, R.drawable.ic_action_settings),
QUICK_ACTIONS(R.string.configure_screen_quick_action, R.drawable.ic_quick_action),
POI_TYPES(R.string.poi_dialog_poi_type, R.drawable.ic_action_info_dark),
- SEARCH_HISTORY(R.string.shared_string_search_history, R.drawable.ic_action_history),
AVOID_ROADS(R.string.avoid_road, R.drawable.ic_action_alert),
FAVORITES(R.string.shared_string_favorites, R.drawable.ic_action_favorite),
TRACKS(R.string.shared_string_tracks, R.drawable.ic_action_route_distance),
@@ -19,6 +18,7 @@ public enum ExportSettingsType {
MULTIMEDIA_NOTES(R.string.audionotes_plugin_name, R.drawable.ic_grouped_by_type),
ACTIVE_MARKERS(R.string.map_markers, R.drawable.ic_action_flag),
HISTORY_MARKERS(R.string.markers_history, R.drawable.ic_action_flag),
+ SEARCH_HISTORY(R.string.shared_string_search_history, R.drawable.ic_action_history),
CUSTOM_RENDER_STYLE(R.string.shared_string_rendering_style, R.drawable.ic_action_map_style),
CUSTOM_ROUTING(R.string.shared_string_routing, R.drawable.ic_action_route_distance),
MAP_SOURCES(R.string.quick_action_map_source_title, R.drawable.ic_map),
@@ -48,12 +48,13 @@ public enum ExportSettingsType {
public boolean isSettingsCategory() {
return this == PROFILE || this == GLOBAL || this == QUICK_ACTIONS || this == POI_TYPES
- || this == SEARCH_HISTORY || this == AVOID_ROADS;
+ || this == AVOID_ROADS;
}
public boolean isMyPlacesCategory() {
return this == FAVORITES || this == TRACKS || this == OSM_EDITS || this == OSM_NOTES
- || this == MULTIMEDIA_NOTES || this == ACTIVE_MARKERS || this == HISTORY_MARKERS;
+ || this == MULTIMEDIA_NOTES || this == ACTIVE_MARKERS || this == HISTORY_MARKERS
+ || this == SEARCH_HISTORY;
}
public boolean isResourcesCategory() {
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java
index 61b5f28541..6507ab874e 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java
@@ -68,13 +68,9 @@ public class AvoidRoadsSettingsItem extends CollectionSettingsItem(newItems);
for (AvoidSpecificRoads.AvoidRoadInfo duplicate : duplicateItems) {
- if (shouldReplace) {
- LatLon latLon = new LatLon(duplicate.latitude, duplicate.longitude);
- if (settings.removeImpassableRoad(latLon)) {
- settings.addImpassableRoad(duplicate);
- }
- } else {
- settings.addImpassableRoad(renameItem(duplicate));
+ LatLon latLon = new LatLon(duplicate.latitude, duplicate.longitude);
+ if (settings.removeImpassableRoad(latLon)) {
+ settings.addImpassableRoad(duplicate);
}
}
for (AvoidSpecificRoads.AvoidRoadInfo avoidRoad : appliedItems) {
@@ -87,7 +83,12 @@ public class AvoidRoadsSettingsItem extends CollectionSettingsItem historyEntries = SearchHistoryHelper.getInstance(app).getHistoryEntries(false);
- if (!historyEntries.isEmpty()) {
- settingsItems.put(ExportSettingsType.SEARCH_HISTORY, historyEntries);
- }
Map impassableRoads = app.getAvoidSpecificRoads().getImpassableRoads();
if (!impassableRoads.isEmpty()) {
settingsItems.put(ExportSettingsType.AVOID_ROADS, new ArrayList<>(impassableRoads.values()));
@@ -611,6 +607,10 @@ public class SettingsHelper {
markersGroup.setMarkers(markersHistory);
myPlacesItems.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup));
}
+ List historyEntries = SearchHistoryHelper.getInstance(app).getHistoryEntries(false);
+ if (!historyEntries.isEmpty()) {
+ myPlacesItems.put(ExportSettingsType.SEARCH_HISTORY, historyEntries);
+ }
return myPlacesItems;
}
@@ -829,10 +829,10 @@ public class SettingsHelper {
List routingFilesList = new ArrayList<>();
List renderFilesList = new ArrayList<>();
List multimediaFilesList = new ArrayList<>();
- List tracksFilesList = new ArrayList<>();
List ttsVoiceFilesList = new ArrayList<>();
List voiceFilesList = new ArrayList<>();
List mapFilesList = new ArrayList<>();
+ List tracksFilesList = new ArrayList<>();
List avoidRoads = new ArrayList<>();
List globalSettingsItems = new ArrayList<>();
List notesPointList = new ArrayList<>();
@@ -856,7 +856,7 @@ public class SettingsHelper {
} else if (fileItem.getSubtype() == FileSubtype.MULTIMEDIA_NOTES) {
multimediaFilesList.add(fileItem.getFile());
} else if (fileItem.getSubtype() == FileSubtype.GPX) {
- tracksFilesList.add(fileItem.getFile());
+ tracksFilesList.add(fileItem);
} else if (fileItem.getSubtype().isMap()) {
mapFilesList.add(fileItem);
} else if (fileItem.getSubtype() == FileSubtype.TTS_VOICE) {
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java
index 7f72761066..66c40d03cc 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsImporter.java
@@ -60,7 +60,7 @@ class SettingsImporter {
try {
SettingsItemsFactory itemsFactory = new SettingsItemsFactory(app, itemsJson);
List settingsItemList = itemsFactory.getItems();
- getFilesSize(file, settingsItemList);
+ updateFilesInfo(file, settingsItemList);
items.addAll(settingsItemList);
} catch (IllegalArgumentException e) {
SettingsHelper.LOG.error("Error parsing items: " + itemsJson, e);
@@ -81,7 +81,7 @@ class SettingsImporter {
return items;
}
- private void getFilesSize(@NonNull File file, List settingsItemList) throws IOException {
+ private void updateFilesInfo(@NonNull File file, List settingsItemList) throws IOException {
ZipFile zipfile = new ZipFile(file.getPath());
Enumeration extends ZipEntry> zipEnum = zipfile.entries();
while (zipEnum.hasMoreElements()) {
@@ -90,7 +90,9 @@ class SettingsImporter {
for (SettingsItem settingsItem : settingsItemList) {
if (settingsItem instanceof FileSettingsItem
&& zipEntry.getName().equals(settingsItem.getFileName())) {
- ((FileSettingsItem) settingsItem).setSize(size);
+ FileSettingsItem fileSettingsItem = (FileSettingsItem) settingsItem;
+ fileSettingsItem.setSize(size);
+ fileSettingsItem.setLastModified(zipEntry.getTime());
break;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java
index 090767a493..65863f0e90 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemWriter.java
@@ -22,9 +22,13 @@ public abstract class SettingsItemWriter {
public abstract boolean writeToStream(@NonNull OutputStream outputStream) throws IOException;
public void writeEntry(String fileName, @NonNull ZipOutputStream zos) throws IOException {
- ZipEntry entry = new ZipEntry(fileName);
+ ZipEntry entry = createNewEntry(fileName);
zos.putNextEntry(entry);
writeToStream(zos);
zos.closeEntry();
}
+
+ public ZipEntry createNewEntry(String fileName) {
+ return new ZipEntry(fileName);
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java
index d95b6cffea..86b7389f6e 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java
@@ -2,15 +2,14 @@ package net.osmand.plus.settings.fragments;
import android.content.Context;
import android.content.DialogInterface;
-import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
import android.widget.ExpandableListView;
import android.widget.LinearLayout;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
@@ -31,6 +30,7 @@ import net.osmand.plus.settings.backend.ExportSettingsCategory;
import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.fragments.ExportSettingsAdapter.OnItemSelectedListener;
import net.osmand.plus.widgets.TextViewEx;
+import net.osmand.util.Algorithms;
import java.io.File;
import java.util.ArrayList;
@@ -60,6 +60,7 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
protected ExpandableListView expandableList;
protected ExportSettingsAdapter adapter;
+ protected boolean exportMode;
protected boolean nightMode;
private boolean wasDrawerDisabled;
@@ -73,6 +74,17 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
super.onCreate(savedInstanceState);
app = requireMyApplication();
nightMode = !app.getSettings().isLightContent();
+
+ requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ @Override
+ public void handleOnBackPressed() {
+ if (hasSelectedData()) {
+ showExitDialog();
+ } else {
+ dismissFragment();
+ }
+ }
+ });
}
@Nullable
@@ -101,26 +113,15 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
continueBtn = root.findViewById(R.id.continue_button);
UiUtilities.setupDialogButton(nightMode, continueBtn, DialogButtonType.PRIMARY, getString(R.string.shared_string_continue));
- continueBtn.setOnClickListener(new View.OnClickListener() {
+ root.findViewById(R.id.continue_button_container).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- onContinueButtonClickAction();
- }
- });
-
- ViewTreeObserver treeObserver = buttonsContainer.getViewTreeObserver();
- treeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- if (buttonsContainer != null) {
- ViewTreeObserver vts = buttonsContainer.getViewTreeObserver();
- int height = buttonsContainer.getMeasuredHeight();
- expandableList.setPadding(0, 0, 0, height);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- vts.removeOnGlobalLayoutListener(this);
- } else {
- vts.removeGlobalOnLayoutListener(this);
+ if (expandableList.getHeaderViewsCount() <= 1) {
+ if (hasSelectedData()) {
+ onContinueButtonClickAction();
}
+ } else {
+ expandableList.smoothScrollToPosition(0);
}
}
});
@@ -185,7 +186,11 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- showExitDialog();
+ if (hasSelectedData()) {
+ showExitDialog();
+ } else {
+ dismissFragment();
+ }
}
});
}
@@ -204,16 +209,25 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
continueBtn.setEnabled(false);
} else {
updateWarningHeaderVisibility(false);
- continueBtn.setEnabled(adapter.hasSelectedData());
+ continueBtn.setEnabled(hasSelectedData());
}
itemsSizeContainer.setVisibility(View.VISIBLE);
} else {
updateWarningHeaderVisibility(false);
itemsSizeContainer.setVisibility(View.INVISIBLE);
- continueBtn.setEnabled(adapter.hasSelectedData());
+ continueBtn.setEnabled(hasSelectedData());
}
}
+ public boolean hasSelectedData() {
+ for (List> items : selectedItemsMap.values()) {
+ if (!Algorithms.isEmpty(items)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private void updateWarningHeaderVisibility(boolean visible) {
if (visible) {
if (expandableList.getHeaderViewsCount() < 2) {
@@ -255,13 +269,24 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
updateAvailableSpace();
}
+ protected List