diff --git a/OsmAnd/AndroidManifest-free.xml b/OsmAnd/AndroidManifest-gplayFree.xml
similarity index 100%
rename from OsmAnd/AndroidManifest-free.xml
rename to OsmAnd/AndroidManifest-gplayFree.xml
diff --git a/OsmAnd/AndroidManifest-freehuawei.xml b/OsmAnd/AndroidManifest-huawei.xml
similarity index 100%
rename from OsmAnd/AndroidManifest-freehuawei.xml
rename to OsmAnd/AndroidManifest-huawei.xml
diff --git a/OsmAnd/AndroidManifest-freedev.xml b/OsmAnd/AndroidManifest-nightlyFree.xml
similarity index 93%
rename from OsmAnd/AndroidManifest-freedev.xml
rename to OsmAnd/AndroidManifest-nightlyFree.xml
index 09ecf8a880..6ec6d5a12e 100644
--- a/OsmAnd/AndroidManifest-freedev.xml
+++ b/OsmAnd/AndroidManifest-nightlyFree.xml
@@ -10,7 +10,7 @@
android:value="fb792288460976727"/>
[^<]*<", ">" + "" + "<")
- }
- return line;
-}
-
task updateNoTranslate(type: Copy) {
from('.') {
include 'no_translate.xml'
@@ -130,7 +127,7 @@ task validateTranslate {
line.contains("1\$ ") || line.contains("2\$ ") || line.contains("3\$ ") ||
line.contains("%1s") || line.contains(" 1\$s") ||
(line.contains("% \$") || line.contains("% 1") || line.contains("% 2") ||
- line.contains("% 3") || line.contains("% s"))) {
+ line.contains("% 3") || line.contains("% s"))) {
throw new GradleException("Incorrect translation " + it.getAbsolutePath() + " " + line);
}
}
@@ -151,7 +148,7 @@ task collectVoiceAssets(type: Sync) {
}
task cleanNoTranslate(type: Delete) {
- delete('res/values/no_translate.xml')
+ delete('res/values/no_translate.xml')
}
task collectFonts(type: Copy) {
@@ -180,7 +177,7 @@ task collectHelpContentsAssets(type: Copy) {
include "*.html"
}
from("../../help/website/blog_articles") {
- include "osmand-3-8-released.html"
+ include "osmand-3-9-released.html"
}
into "assets/feature_articles"
}
@@ -277,8 +274,6 @@ task collectExternalResources {
// Legacy core build
import org.apache.tools.ant.taskdefs.condition.Os
-import java.util.regex.Pattern
-
task buildOsmAndCore(type: Exec) {
Gradle gradle = getGradle()
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString().toLowerCase()
@@ -297,7 +292,7 @@ task buildOsmAndCore(type: Exec) {
flavour = flavour.length() == 0 ? "X86_ONLY" : ""
}
}
-
+
description "Build Legacy OsmAndCore"
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
@@ -325,38 +320,11 @@ task cleanupDuplicatesInCore() {
}
}
-afterEvaluate {
- android.libraryVariants.all { variant ->
- variant.javaCompiler.dependsOn(collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore)
- }
-}
-
task appStart(type: Exec) {
- // linux
+ // linux
commandLine 'adb', 'shell', 'am', 'start', '-n', 'net.osmand.plus/net.osmand.plus.activities.MapActivity'
// windows
- // commandLine 'cmd', '/c', 'adb', 'shell', 'am', 'start', '-n', 'net.osmand.plus/net.osmand.plus.activities.MapActivity'
-}
-
-project.afterEvaluate {
- publishing {
- repositories {
- ivy {
- url = System.getenv("OSMAND_BINARIES_IVY_ROOT") ?: "./"
- version = "0.1-SNAPSHOT"
- }
- }
- publications {
- aar(IvyPublication) {
- artifact bundleLegacyFatDebugAar {
- classifier 'debug'
- }
- artifact bundleLegacyFatReleaseAar {
- classifier 'release'
- }
- }
- }
- }
+ // commandLine 'cmd', '/c', 'adb', 'shell', 'am', 'start', '-n', 'net.osmand.plus/net.osmand.plus.activities.MapActivity'
}
dependencies {
@@ -369,7 +337,7 @@ dependencies {
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.preference:preference:1.1.0'
- implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
+ implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation 'commons-codec:commons-codec:1.11'
@@ -387,29 +355,21 @@ dependencies {
// JS core
implementation group: 'org.mozilla', name: 'rhino', version: '1.7.9'
// size restrictions
-// implementation 'com.ibm.icu:icu4j:50.1'
+// implementation 'com.ibm.icu:icu4j:50.1'
// implementation 'net.sf.trove4j:trove4j:3.0.3'
-// qtcoreImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
-// qtcoredebugImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
-
legacyImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
-// qtcoredebugImplementation "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
-// qtcoredebugImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
-// qtcoreImplementation "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
-// qtcoreImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
- implementation ("com.getkeepsafe.taptargetview:taptargetview:1.12.0"){
+
+ implementation("com.getkeepsafe.taptargetview:taptargetview:1.12.0") {
exclude group: 'com.android.support'
}
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
- implementation ("com.github.HITGIF:TextFieldBoxes:1.4.5"){
+ implementation("com.github.HITGIF:TextFieldBoxes:1.4.5") {
exclude group: 'com.android.support'
}
- implementation('com.github.scribejava:scribejava-apis:7.1.1'){
+ implementation('com.github.scribejava:scribejava-apis:7.1.1') {
exclude group: "com.fasterxml.jackson.core"
}
implementation 'com.jaredrummler:colorpicker:1.1.0'
implementation 'org.bouncycastle:bcpkix-jdk15on:1.56'
-
- implementation 'com.google.android.gms:play-services-location:17.1.0'
-}
+}
\ No newline at end of file
diff --git a/OsmAnd/build-library.gradle b/OsmAnd/build-library.gradle
new file mode 100644
index 0000000000..b8cf0a21a5
--- /dev/null
+++ b/OsmAnd/build-library.gradle
@@ -0,0 +1,64 @@
+apply plugin: 'com.android.library'
+apply plugin: 'ivy-publish'
+apply from: 'build-common.gradle'
+
+android {
+
+ defaultConfig {
+ minSdkVersion 15
+ }
+
+ lintOptions {
+ tasks.lint.enabled = false
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile "AndroidManifest-library.xml"
+ java.srcDirs = ["src", "src-gms", "src-google"]
+ }
+ }
+
+ productFlavors {
+ // CoreVersion
+ // Build that doesn't include 3D OpenGL
+ legacy {
+ dimension "coreversion"
+ }
+ }
+}
+
+def replaceNoTranslate(line) {
+ return line;
+}
+
+afterEvaluate {
+ android.libraryVariants.all { variant ->
+ variant.javaCompiler.dependsOn(collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore)
+ }
+}
+
+project.afterEvaluate {
+ publishing {
+ repositories {
+ ivy {
+ url = System.getenv("OSMAND_BINARIES_IVY_ROOT") ?: "./"
+ version = "0.1-SNAPSHOT"
+ }
+ }
+ publications {
+ aar(IvyPublication) {
+ artifact bundleLegacyFatDebugAar {
+ classifier 'debug'
+ }
+ artifact bundleLegacyFatReleaseAar {
+ classifier 'release'
+ }
+ }
+ }
+ }
+}
+
+dependencies {
+ implementation 'com.google.android.gms:play-services-location:17.1.0'
+}
diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle
index 24664da2a4..436aa652dc 100644
--- a/OsmAnd/build.gradle
+++ b/OsmAnd/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
+apply from: 'build-common.gradle'
// Global Parameters accepted
// TARGET_APP_NAME - app name
// APK_NUMBER_VERSION - version number of apk
// APK_VERSION_SUFFIX - build number like #99999Z, appended (for dev builds) to Manifest's versionName as X.X.X#99999Z
-// Z means flavor: M=-master, D=-main-default, B=-Blackberry, Des=-design, MQA=-main-qt-arm, MQDA=-main-qt-default-arm, S=-sherpafy
+// Z means flavor: M=-master, D=-main-default, Des=-design, MQA=-main-qt-arm, MQDA=-main-qt-default-arm, S=-sherpafy
// APP_EDITION - date stamp of builds
-// APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon
// 1. To be done Filter fonts
//
@@ -17,15 +17,7 @@ apply plugin: 'com.android.application'
//
// Less important
-task printc {
- configurations.each { if(it.isCanBeResolved()) println it.name }
-}
-
android {
- compileSdkVersion 29
- buildToolsVersion "29.0.3"
- // compileNdkVersion "android-ndk-r17b"
-
signingConfigs {
development {
storeFile file("../keystores/debug.keystore")
@@ -44,21 +36,15 @@ android {
defaultConfig {
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 15
- targetSdkVersion 29
versionCode 390
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
- multiDexEnabled true
versionName "3.9.0"
versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName
- // Stops the Gradle plugin’s automatic rasterization of vectors
- // vectorDrawables.generatedDensities = ['hdpi']
- vectorDrawables.useSupportLibrary = true
}
lintOptions {
lintConfig file("lint.xml")
- abortOnError false
warningsAsErrors false
}
@@ -79,55 +65,33 @@ android {
// exclude '/META-INF/NOTICE.md'
//}
- // This is from OsmAndCore_android.aar - for some reason it's not inherited
- aaptOptions {
- // Don't compress any embedded resources
- noCompress "qz"
- cruncherEnabled = false
- // Flag notifies aapt to keep the attribute IDs around
- // additionalParameters "--no-version-vectors"
- }
-
- dexOptions {
- javaMaxHeapSize "4g"
- }
-
sourceSets {
- main {
- manifest.srcFile "AndroidManifest.xml"
- jni.srcDirs = []
- jniLibs.srcDirs = ["libs"]
- aidl.srcDirs = ["src"]
- java.srcDirs = ["src"]
- resources.srcDirs = ["src"]
- renderscript.srcDirs = ["src"]
- res.srcDirs = ["res"]
- assets.srcDirs = ["assets"]
- }
debug {
manifest.srcFile "AndroidManifest-debug.xml"
}
- full {
+ androidFull {
java.srcDirs = ["src-nogms", "src-google"]
}
- fullGms {
+ gplayFull {
java.srcDirs = ["src-gms", "src-google"]
}
- free {
- java.srcDirs = ["src-nogms", "src-google"]
- manifest.srcFile "AndroidManifest-free.xml"
- }
- freeGms {
+ gplayFree {
java.srcDirs = ["src-gms", "src-google"]
- manifest.srcFile "AndroidManifest-free.xml"
+ manifest.srcFile "AndroidManifest-gplayFree.xml"
}
- freedev {
+ nightlyFree {
java.srcDirs = ["src-nogms", "src-google"]
- manifest.srcFile "AndroidManifest-freedev.xml"
+ manifest.srcFile "AndroidManifest-nightlyFree.xml"
}
- freehuawei {
+ amazonFree {
java.srcDirs = ["src-nogms", "src-google"]
- manifest.srcFile "AndroidManifest-freehuawei.xml"
+ }
+ amazonFull {
+ java.srcDirs = ["src-nogms", "src-google"]
+ }
+ huawei {
+ java.srcDirs = ["src-nogms", "src-google"]
+ manifest.srcFile "AndroidManifest-huawei.xml"
}
legacy {
@@ -137,75 +101,43 @@ android {
flavorDimensions "version", "coreversion", "abi"
productFlavors {
- // ABI
- armv7 {
- dimension "abi"
- ndk {
- abiFilter 'armeabi-v7a'
- }
- }
- arm64 {
- dimension "abi"
- ndk {
- abiFilter 'arm64-v8a'
- }
- }
- x86 {
- dimension "abi"
- ndk {
- abiFilters 'x86', 'x86_64'
- }
- }
- armonly {
- dimension "abi"
- ndk {
- abiFilters 'arm64-v8a', 'armeabi-v7a'
- }
- }
- fat {
- dimension "abi"
- ndk {
- abiFilters 'arm64-v8a', 'x86', 'x86_64', 'armeabi-v7a'
- }
- }
-
// Version
- freedev {
+ nightlyFree {
dimension "version"
applicationId "net.osmand.dev"
// resConfig "en"
}
- free {
- dimension "version"
- applicationId "net.osmand"
- }
- freeGms {
- dimension "version"
- applicationId "net.osmand"
- }
- full {
+ androidFull {
dimension "version"
applicationId "net.osmand.plus"
}
- fullGms {
+ gplayFree {
+ dimension "version"
+ applicationId "net.osmand"
+ }
+ gplayFull {
dimension "version"
applicationId "net.osmand.plus"
}
- freehuawei {
+ amazonFree {
+ dimension "version"
+ applicationId "net.osmand"
+ }
+ amazonFull {
+ dimension "version"
+ applicationId "net.osmand.plus"
+ }
+ huawei {
dimension "version"
applicationId "net.osmand.huawei"
}
- // CoreVersion
- // Build that doesn't include 3D OpenGL
- legacy {
- dimension "coreversion"
- }
+
// Build that includes 3D OpenGL release
- qtcore {
+ opengl {
dimension "coreversion"
}
// Build that includes 3D OpenGL debug
- qtcoredebug {
+ opengldebug {
dimension "coreversion"
}
}
@@ -231,226 +163,9 @@ def replaceNoTranslate(line) {
if (line.contains("\"app_edition\"") && System.getenv("APP_EDITION")) {
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_EDITION") + "<")
}
- if (line.contains("\"versionFeatures\"") && System.getenv("APP_FEATURES")) {
- return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_FEATURES") + "<")
- }
return line;
}
-task updateNoTranslate(type: Copy) {
- from('.') {
- include 'no_translate.xml'
- filter {
- line -> replaceNoTranslate(line);
- }
- }
- into 'res/values/'
-}
-
-task validateTranslate {
- println "Validating translations"
-
- file("res").eachFileRecurse groovy.io.FileType.FILES, {
- if (it.name == "strings.xml" || it.name == "phrases.xml") {
- it.eachLine { line ->
- if (line.contains("\$ s") || line.contains("\$ d") || line.contains("\$ f") ||
- line.contains(" \$s") || line.contains(" \$d") || line.contains(" \$f") ||
- line.contains("1\$ ") || line.contains("2\$ ") || line.contains("3\$ ") ||
- line.contains("%1s") || line.contains(" 1\$s") ||
- (line.contains("% \$") || line.contains("% 1") || line.contains("% 2") ||
- line.contains("% 3") || line.contains("% s"))) {
- throw new GradleException("Incorrect translation " + it.getAbsolutePath() + " " + line);
- }
- }
- }
- }
-}
-
-task downloadWorldMiniBasemap {
- doLast {
- ant.get(src: 'http://builder.osmand.net/basemap/World_basemap_mini_2.obf', dest: 'assets/World_basemap_mini.obf', skipexisting: 'true')
- }
-}
-
-task collectVoiceAssets(type: Sync) {
- from "../../resources/voice"
- into "assets/voice"
- include "**/*.js"
-}
-
-task cleanNoTranslate(type: Delete) {
- delete('res/values/no_translate.xml')
-}
-
-task collectFonts(type: Copy) {
- from "../../resources/fonts"
- from "../../resources/rendering_styles/fonts"
-// from "../../resources/rendering_styles/fonts/OpenSans"
- into "assets/fonts"
- include "*.ttf"
-}
-
-task collectHelpContentsStyle(type: Copy) {
- from("../../help/website/help/") {
- include "style.css"
- }
- into "assets"
-}
-
-task collectHelpContentsAssets(type: Copy) {
- from("../../help/website/help") {
- include "about.html"
- include "changes.html"
- include "faq.html"
- include "map-legend.html"
- }
- from("../../help/website/feature_articles") {
- include "*.html"
- }
- from("../../help/website/blog_articles") {
- include "osmand-3-9-released.html"
- }
- into "assets/feature_articles"
-}
-
-task copyPoiCategories(type: Copy) {
- from("../../resources/poi") {
- include "poi_categories.json"
- }
- into "assets"
-}
-
-task copyMapShaderIcons(type: Sync) {
- // from "../../resources/rendering_styles/style-icons/map-shaders-png"
- // into "res/"
- from "../../resources/rendering_styles/style-icons/map-shaders-vector"
- into "res/drawable"
- include "**/*.png", "**/*.xml"
- preserve {
- include '**/*'
- exclude "**/h_*"
- }
-}
-
-task copyMapPOIIcons(type: Sync) {
- from "../../resources/rendering_styles/style-icons/map-icons-vector"
- into "res/drawable/"
- // from "../../resources/rendering_styles/style-icons/map-icons-png"
- // into "res/"
-
- include "**/*.png", "**/*.xml"
- preserve {
- include '**/*'
- exclude "**/mm_*"
- }
-}
-
-task copyLargePOIIcons(type: Sync) {
- from "../../resources/rendering_styles/style-icons/poi-icons-vector"
- into "res/drawable/"
- include "**/*.png", "**/*.xml"
- preserve {
- include '**/*'
- exclude "**/mx_*"
- }
-}
-
-task copyWidgetIconsXhdpi(type: Sync) {
- from "res/drawable-xxhdpi/"
- into "res/drawable-large-xhdpi/"
- include "**/widget_*.png", "**/widget_*.xml", "**/map_*.xml", "**/map_*.png"
- preserve {
- include '*'
- exclude "**/widget_*.png", "**/widget_*.xml", "**/map_*.xml", "**/map_*.png"
- }
-}
-
-task copyWidgetIconsHdpi(type: Sync) {
- from "res/drawable-xhdpi/"
- into "res/drawable-large-hdpi/"
- include "**/widget_*.png", "**/widget_*.xml", "**/map_*.xml", "**/map_*.png"
- preserve {
- include '*'
- exclude "**/widget_*.png", "**/widget_*.xml", "**/map_*.xml", "**/map_*.png"
- }
-}
-
-task copyWidgetIcons(type: Sync) {
- from "res/drawable-hdpi/"
- into "res/drawable-large/"
- include "**/widget_*.png", "**/widget_*.xml", "**/map_*.xml", "**/map_*.png"
- preserve {
- include '*'
- exclude "**/widget_*.png", "**/widget_*.xml", "**/map_*.xml", "**/map_*.png"
- }
-}
-
-task collectExternalResources {
- dependsOn collectVoiceAssets,
- collectFonts,
- collectHelpContentsAssets,
- collectHelpContentsStyle,
- copyMapShaderIcons,
- copyMapPOIIcons,
- copyLargePOIIcons,
- updateNoTranslate,
- validateTranslate,
- copyWidgetIcons,
- copyWidgetIconsHdpi,
- copyWidgetIconsXhdpi,
- copyPoiCategories,
- downloadWorldMiniBasemap
-}
-
-// Legacy core build
-import org.apache.tools.ant.taskdefs.condition.Os
-
-task buildOsmAndCore(type: Exec) {
- Gradle gradle = getGradle()
- String tskReqStr = gradle.getStartParameter().getTaskRequests().toString().toLowerCase()
- String flavour = "";
- if(!tskReqStr.contains("fat")) {
- if(tskReqStr.contains("arm64")) {
- flavour = flavour.length() == 0 ? "ARM64_ONLY" : ""
- }
- if(tskReqStr.contains("armv7")) {
- flavour = flavour.length() == 0 ? "ARMV7_ONLY" : ""
- }
- if(tskReqStr.contains("armonly")) {
- flavour = flavour.length() == 0 ? "ARM_ONLY" : ""
- }
- if(tskReqStr.contains("x86")) {
- flavour = flavour.length() == 0 ? "X86_ONLY" : ""
- }
- }
-
- description "Build Legacy OsmAndCore"
-
- if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
- if(flavour.length() > 0) {
- environment "$flavour", "1"
- }
- commandLine "bash", file("./old-ndk-build.sh").getAbsolutePath()
- } else {
- commandLine "cmd", "/c", "echo", "Not supported"
- }
-}
-
-task cleanupDuplicatesInCore() {
- dependsOn buildOsmAndCore
- // doesn't work for legacy debug builds
- doLast {
- file("libc++/armeabi-v7a").mkdirs()
- file("libs/armeabi-v7a/libc++_shared.so").renameTo(file("libc++/armeabi-v7a/libc++_shared.so"))
- file("libc++/arm64-v8a").mkdirs()
- file("libs/arm64-v8a/libc++_shared.so").renameTo(file("libc++/arm64-v8a/libc++_shared.so"))
- file("libc++/x86").mkdirs()
- file("libs/x86/libc++_shared.so").renameTo(file("libc++/x86/libc++_shared.so"))
- file("libc++/x86_64").mkdirs()
- file("libs/x86_64/libc++_shared.so").renameTo(file("libc++/x86_64/libc++_shared.so"))
- }
-}
-
afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompiler.dependsOn(collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore)
@@ -462,52 +177,14 @@ afterEvaluate {
}
}
-task appStart(type: Exec) {
- // linux
- commandLine 'adb', 'shell', 'am', 'start', '-n', 'net.osmand.plus/net.osmand.plus.activities.MapActivity'
- // windows
- // commandLine 'cmd', '/c', 'adb', 'shell', 'am', 'start', '-n', 'net.osmand.plus/net.osmand.plus.activities.MapActivity'
-}
-
dependencies {
- implementation project(path: ':OsmAnd-java', configuration: 'android')
- implementation project(':OsmAnd-api')
- implementation 'androidx.multidex:multidex:2.0.1'
- implementation 'androidx.gridlayout:gridlayout:1.0.0'
- implementation 'androidx.cardview:cardview:1.0.0'
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'com.google.android.material:material:1.2.1'
- implementation 'androidx.browser:browser:1.0.0'
- implementation 'androidx.preference:preference:1.1.0'
- implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
+ openglImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
+ opengldebugImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
- implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
- implementation 'commons-codec:commons-codec:1.11'
- implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
- implementation 'org.apache.commons:commons-compress:1.17'
- implementation 'com.moparisthebest:junidecode:0.1.1'
- implementation 'org.immutables:gson:2.5.0'
- implementation 'com.vividsolutions:jts-core:1.14.0'
- implementation 'com.google.openlocationcode:openlocationcode:1.0.4'
- implementation 'com.android.billingclient:billing:2.0.3'
- // turn off for now
- //implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
- implementation 'com.squareup.picasso:picasso:2.71828'
- implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
- // JS core
- implementation group: 'org.mozilla', name: 'rhino', version: '1.7.9'
-// size restrictions
-// implementation 'com.ibm.icu:icu4j:50.1'
-// implementation 'net.sf.trove4j:trove4j:3.0.3'
-
- qtcoreImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
- qtcoredebugImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
-
- legacyImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
- qtcoredebugImplementation "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
- qtcoredebugImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
- qtcoreImplementation "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
- qtcoreImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
+ opengldebugImplementation "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
+ opengldebugImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
+ openglImplementation "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
+ openglImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
implementation ("com.getkeepsafe.taptargetview:taptargetview:1.12.0"){
exclude group: 'com.android.support'
}
@@ -521,8 +198,8 @@ dependencies {
implementation 'com.jaredrummler:colorpicker:1.1.0'
implementation "org.bouncycastle:bcpkix-jdk15on:1.56"
- freehuaweiImplementation 'com.huawei.hms:iap:5.0.2.300'
+ huaweiImplementation 'com.huawei.hms:iap:5.0.2.300'
- freeGmsImplementation 'com.google.android.gms:play-services-location:17.1.0'
- fullGmsImplementation 'com.google.android.gms:play-services-location:17.1.0'
+ gplayFreeImplementation 'com.google.android.gms:play-services-location:17.1.0'
+ gplayFullImplementation 'com.google.android.gms:play-services-location:17.1.0'
}
diff --git a/OsmAnd/no_translate.xml b/OsmAnd/no_translate.xml
index 20d7a424ca..d8e4108d4a 100644
--- a/OsmAnd/no_translate.xml
+++ b/OsmAnd/no_translate.xml
@@ -12,7 +12,6 @@
UA-28342846-2
10
true
- +play_market -amazon -blackberry
© OpenStreetMap
support@osmand.net
diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml
index 5945485c19..a7cbb98fda 100644
--- a/OsmAnd/res/values/styles.xml
+++ b/OsmAnd/res/values/styles.xml
@@ -54,7 +54,7 @@
- @drawable/first_splash_screen_free
-
diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
index af1570ecaa..e04f055b35 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
@@ -388,7 +388,7 @@ public abstract class OsmandPlugin {
}
private static boolean updateMarketPlugin(@NonNull OsmandApplication app, @NonNull Set enabledPlugins, @NonNull OsmandPlugin plugin) {
- boolean marketEnabled = Version.isMarketEnabled(app);
+ boolean marketEnabled = Version.isMarketEnabled();
boolean pckg = plugin.pluginAvailable(app);
boolean paid = plugin.isPaid();
if ((Version.isDeveloperVersion(app) || !Version.isProductionVersion(app)) && !paid) {
diff --git a/OsmAnd/src/net/osmand/plus/Version.java b/OsmAnd/src/net/osmand/plus/Version.java
index 48dd9b1feb..b1962564e3 100644
--- a/OsmAnd/src/net/osmand/plus/Version.java
+++ b/OsmAnd/src/net/osmand/plus/Version.java
@@ -1,9 +1,10 @@
package net.osmand.plus;
-
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import androidx.annotation.NonNull;
+
import net.osmand.plus.inapp.InAppPurchaseHelper;
import java.io.File;
@@ -16,26 +17,29 @@ public class Version {
private final String appName;
private final static String FREE_VERSION_NAME = "net.osmand";
private final static String FREE_DEV_VERSION_NAME = "net.osmand.dev";
- private final static String FREE_CUSTOM_VERSION_NAME = "net.osmand.freecustom";
private final static String UTM_REF = "&referrer=utm_source%3Dosmand";
-
- public static boolean isGpsStatusEnabled(OsmandApplication ctx) {
- return isGooglePlayEnabled(ctx) && !isBlackberry(ctx);
- }
-
- public static boolean isBlackberry(OsmandApplication ctx) {
- return ctx.getString(R.string.versionFeatures).contains("+blackberry");
- }
-
- public static boolean isHuawei(OsmandApplication ctx) {
- return ctx.getPackageName().endsWith(".huawei");
- }
-
- public static boolean isMarketEnabled(OsmandApplication ctx) {
- return isGooglePlayEnabled(ctx) || isAmazonEnabled(ctx);
+
+ public static boolean isHuawei() {
+ return "huawei".contains(getBuildFlavor());
}
- public static boolean isGooglePlayInstalled(OsmandApplication ctx) {
+ private static boolean isAmazon() {
+ return "amazon".contains(getBuildFlavor());
+ }
+
+ private static String getBuildFlavor() {
+ return net.osmand.plus.BuildConfig.FLAVOR;
+ }
+
+ public static boolean isGooglePlayEnabled() {
+ return !isHuawei() && !isAmazon();
+ }
+
+ public static boolean isMarketEnabled() {
+ return isGooglePlayEnabled() || isAmazon();
+ }
+
+ public static boolean isGooglePlayInstalled(@NonNull OsmandApplication ctx) {
try {
ctx.getPackageManager().getPackageInfo("com.android.vending", 0);
} catch (PackageManager.NameNotFoundException e) {
@@ -44,10 +48,10 @@ public class Version {
return true;
}
- public static String marketPrefix(OsmandApplication ctx) {
- if (isAmazonEnabled(ctx)) {
+ public static String marketPrefix(@NonNull OsmandApplication ctx) {
+ if (isAmazon()) {
return "amzn://apps/android?p=";
- } else if (isGooglePlayEnabled(ctx) && isGooglePlayInstalled(ctx)) {
+ } else if (isGooglePlayEnabled() && isGooglePlayInstalled(ctx)) {
return "market://details?id=";
}
return "https://osmand.net/apps?id=";
@@ -57,22 +61,11 @@ public class Version {
return marketPrefix(ctx) + appName + UTM_REF;
}
- private static boolean isAmazonEnabled(OsmandApplication ctx) {
- return ctx.getString(R.string.versionFeatures).contains("+amazon");
- }
-
- public static boolean isGooglePlayEnabled(OsmandApplication ctx) {
- return ctx.getString(R.string.versionFeatures).contains("+play_market");
- }
-
-
private Version(OsmandApplication ctx) {
String appVersion = "";
- int versionCode = -1;
try {
PackageInfo packageInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
appVersion = packageInfo.versionName; //Version suffix ctx.getString(R.string.app_version_suffix) already appended in build.gradle
- versionCode = packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
@@ -123,8 +116,7 @@ public class Version {
public static boolean isFreeVersion(OsmandApplication ctx){
return ctx.getPackageName().equals(FREE_VERSION_NAME) ||
ctx.getPackageName().equals(FREE_DEV_VERSION_NAME) ||
- ctx.getPackageName().equals(FREE_CUSTOM_VERSION_NAME) ||
- isHuawei(ctx);
+ isHuawei();
}
public static boolean isPaidVersion(OsmandApplication ctx) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index c526ddec2a..b5dd0dc3ea 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -903,7 +903,7 @@ public class MapActivityActions implements DialogProvider {
}
}).createItem());
- if (Version.isGooglePlayEnabled(app) || Version.isHuawei(app) || Version.isDeveloperVersion(app)) {
+ if (Version.isGooglePlayEnabled() || Version.isHuawei() || Version.isDeveloperVersion(app)) {
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.osm_live, mapActivity)
.setId(DRAWER_OSMAND_LIVE_ID)
.setIcon(R.drawable.ic_action_osm_live)
diff --git a/OsmAnd/src/net/osmand/plus/activities/OsmandInAppPurchaseActivity.java b/OsmAnd/src/net/osmand/plus/activities/OsmandInAppPurchaseActivity.java
index 47f7a17444..6cc1b222bb 100644
--- a/OsmAnd/src/net/osmand/plus/activities/OsmandInAppPurchaseActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/OsmandInAppPurchaseActivity.java
@@ -5,7 +5,6 @@ import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
-import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -16,16 +15,12 @@ import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.OsmandPlugin;
-import net.osmand.plus.R;
import net.osmand.plus.Version;
-import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseInitCallback;
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseListener;
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType;
import net.osmand.plus.liveupdates.OsmLiveRestartBottomSheetDialogFragment;
-import net.osmand.plus.srtmplugin.SRTMPlugin;
import org.apache.commons.logging.Log;
@@ -59,7 +54,7 @@ public class OsmandInAppPurchaseActivity extends AppCompatActivity implements In
InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper();
if (app.getSettings().isInternetConnectionAvailable()
&& isInAppPurchaseAllowed()
- && isInAppPurchaseSupported(purchaseHelper)) {
+ && isInAppPurchaseSupported()) {
this.purchaseHelper = purchaseHelper;
}
}
@@ -160,9 +155,8 @@ public class OsmandInAppPurchaseActivity extends AppCompatActivity implements In
return false;
}
- public boolean isInAppPurchaseSupported(InAppPurchaseHelper purchaseHelper) {
- OsmandApplication app = getMyApplication();
- return Version.isGooglePlayEnabled(app) || Version.isHuawei(app);
+ public boolean isInAppPurchaseSupported() {
+ return Version.isGooglePlayEnabled() || Version.isHuawei();
}
@Override
diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java
index 4858e3ccfe..f033e59bef 100644
--- a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java
+++ b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java
@@ -193,7 +193,7 @@ public class ShareDialog {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
} else {
- if (Version.isMarketEnabled((OsmandApplication) activity.getApplication())) {
+ if (Version.isMarketEnabled()) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setMessage(activity.getString(R.string.zxing_barcode_scanner_not_found));
builder.setPositiveButton(activity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java b/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java
index 79abd4190a..c8c9a70785 100644
--- a/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java
+++ b/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java
@@ -180,7 +180,7 @@ public class StartGPSStatus extends OsmAndAction {
intent.addCategory(Intent.CATEGORY_LAUNCHER);
mapActivity.startActivity(intent);
} else {
- if (Version.isMarketEnabled(getMyApplication())) {
+ if (Version.isMarketEnabled()) {
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
builder.setMessage(mapActivity. getString(R.string.gps_status_app_not_found));
builder.setPositiveButton(mapActivity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
diff --git a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java
index 9a7215867f..6547ae01db 100644
--- a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java
@@ -5,8 +5,6 @@ import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.Intent;
-import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
@@ -216,7 +214,7 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
infoDescription.setText(getInfoDescription());
}
TextViewEx planInfoDescription = (TextViewEx) view.findViewById(R.id.plan_info_description);
- planInfoDescription.setText(Version.isHuawei(app)
+ planInfoDescription.setText(Version.isHuawei()
? R.string.osm_live_payment_subscription_management_hw : R.string.osm_live_payment_subscription_management);
ViewGroup osmLiveCard = buildOsmLiveCard(ctx, cardsContainer);
if (osmLiveCard != null) {
diff --git a/OsmAnd/src/net/osmand/plus/development/DevelopmentSettingsFragment.java b/OsmAnd/src/net/osmand/plus/development/DevelopmentSettingsFragment.java
index 8cee128154..d34a306b79 100644
--- a/OsmAnd/src/net/osmand/plus/development/DevelopmentSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/development/DevelopmentSettingsFragment.java
@@ -71,16 +71,12 @@ public class DevelopmentSettingsFragment extends BaseSettingsFragment {
private void setupSafeModePref() {
SwitchPreferenceEx safeMode = findPreference(settings.SAFE_MODE.getId());
- if (!Version.isBlackberry(app)) {
- safeMode.setDescription(getString(R.string.safe_mode_description));
- safeMode.setIconSpaceReserved(false);
- // disable the switch if the library cannot be used
- if ((NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) || settings.NATIVE_RENDERING_FAILED.get()) {
- safeMode.setEnabled(false);
- safeMode.setChecked(true);
- }
- } else {
- safeMode.setVisible(false);
+ safeMode.setDescription(getString(R.string.safe_mode_description));
+ safeMode.setIconSpaceReserved(false);
+ // disable the switch if the library cannot be used
+ if ((NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) || settings.NATIVE_RENDERING_FAILED.get()) {
+ safeMode.setEnabled(false);
+ safeMode.setChecked(true);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/RateUsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/dialogs/RateUsBottomSheetDialogFragment.java
index 2dcd62c6bd..188031ea1d 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/RateUsBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/RateUsBottomSheetDialogFragment.java
@@ -108,7 +108,7 @@ public class RateUsBottomSheetDialogFragment extends MenuBottomSheetDialogFragme
public static boolean shouldShow(OsmandApplication app) {
long firstInstalledDays = app.getAppInitializer().getFirstInstalledDays();
//Do not show dialog if not google play version or more than 350 days left from the first start
- if (!Version.isGooglePlayEnabled(app) || firstInstalledDays > 350) {
+ if (!Version.isGooglePlayEnabled() || firstInstalledDays > 350) {
return false;
}
OsmandSettings settings = app.getSettings();
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java b/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java
index 92fa82079f..8e03b2c1e5 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadValidationManager.java
@@ -217,7 +217,7 @@ public class DownloadValidationManager {
AlertDialog.Builder msg = new AlertDialog.Builder(getActivity());
msg.setTitle(R.string.free_version_title);
msg.setMessage(msgTx);
- if (Version.isMarketEnabled(getMyApplication())) {
+ if (Version.isMarketEnabled()) {
msg.setPositiveButton(R.string.install_paid, new DialogInterface.OnClickListener() {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java
index c7464c6b1f..ec13eba2bd 100644
--- a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java
+++ b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java
@@ -212,7 +212,7 @@ public abstract class InAppPurchaseHelper {
}
protected void exec(final @NonNull InAppPurchaseTaskType taskType, final @NonNull InAppCommand command) {
- if (isDeveloperVersion || (!Version.isGooglePlayEnabled(ctx) && !Version.isHuawei(ctx))) {
+ if (isDeveloperVersion || (!Version.isGooglePlayEnabled() && !Version.isHuawei())) {
notifyDismissProgress(taskType);
stop(true);
return;
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java
index 430432981e..8bb3cfb333 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java
@@ -298,12 +298,9 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
mapEmptyStateAllowedPref.setTitle(getString(R.string.use_trackball));
mapEmptyStateAllowedPref.setDescription(getString(R.string.use_trackball_descr));
- boolean visible = false;
- if (!Version.isBlackberry(app)) {
- int nav = getResources().getConfiguration().navigation;
- visible = nav == Configuration.NAVIGATION_DPAD || nav == Configuration.NAVIGATION_TRACKBALL ||
- nav == Configuration.NAVIGATION_WHEEL || nav == Configuration.NAVIGATION_UNDEFINED;
- }
+ int nav = getResources().getConfiguration().navigation;
+ boolean visible = nav == Configuration.NAVIGATION_DPAD || nav == Configuration.NAVIGATION_TRACKBALL ||
+ nav == Configuration.NAVIGATION_WHEEL || nav == Configuration.NAVIGATION_UNDEFINED;
mapEmptyStateAllowedPref.setVisible(visible);
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java
index d3d9ef2d93..123c49b316 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java
@@ -171,15 +171,13 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
}
private void setupNativePublicTransport() {
- if (!Version.isBlackberry(app)) {
- SwitchPreferenceEx setupNativePublicTransport = createSwitchPreferenceEx(settings.PT_SAFE_MODE.getId(),
- R.string.use_native_pt, R.layout.preference_with_descr_dialog_and_switch);
- setupNativePublicTransport.setDescription(getString(R.string.use_native_pt_desc));
- setupNativePublicTransport.setSummaryOn(R.string.shared_string_enabled);
- setupNativePublicTransport.setSummaryOff(R.string.shared_string_disabled);
- setupNativePublicTransport.setIconSpaceReserved(true);
- getPreferenceScreen().addPreference(setupNativePublicTransport);
- }
+ SwitchPreferenceEx setupNativePublicTransport = createSwitchPreferenceEx(settings.PT_SAFE_MODE.getId(),
+ R.string.use_native_pt, R.layout.preference_with_descr_dialog_and_switch);
+ setupNativePublicTransport.setDescription(getString(R.string.use_native_pt_desc));
+ setupNativePublicTransport.setSummaryOn(R.string.shared_string_enabled);
+ setupNativePublicTransport.setSummaryOff(R.string.shared_string_disabled);
+ setupNativePublicTransport.setIconSpaceReserved(true);
+ getPreferenceScreen().addPreference(setupNativePublicTransport);
}
private void setupOsmLiveForRoutingPref() {
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceAnnouncesFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceAnnouncesFragment.java
index 9697acd599..fb617ab01f 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceAnnouncesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/VoiceAnnouncesFragment.java
@@ -97,10 +97,9 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
setupArrivalAnnouncementPref();
setupVoiceProviderPref();
- if (!Version.isBlackberry(app)) {
- setupAudioStreamGuidancePref();
- setupInterruptMusicPref();
- }
+ setupAudioStreamGuidancePref();
+ setupInterruptMusicPref();
+
enableDisablePreferences(!settings.VOICE_MUTE.getModeValue(getSelectedAppMode()));
setupSpeakCamerasPref();
setupSpeedCamerasAlert();