diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e96eeece..01744eff0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,27 +14,35 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 + - name: Create local.properties file + run: touch local.properties && echo "mapbox.repo.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties - name: Print Java version run: java -version - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Git show commit count + run: git fetch origin master && git rev-list --first-parent --count origin/master + - name: Download Robolectric deps + run: chmod +x download-robolectric-deps.sh && ./download-robolectric-deps.sh - name: Clean project run: ./gradlew clean --stacktrace - name: Build project skipping tests run: ./gradlew build -x test --stacktrace - - name: Run jacocoTestReport for each module + - name: Run Instrumented Tests manually uses: reactivecircus/android-emulator-runner@v2 with: api-level: 22 - script: ./gradlew jacocoTestReport --stacktrace + script: ./gradlew connectedDebug --stacktrace + - name: Run jacocoTestReport for each module + run: ./gradlew jacocoTestReport --stacktrace --info - name: Merge jacoco reports from all modules run: ./gradlew jacocoFullReport --stacktrace - name: Upload coverage to Coveralls with Gradle diff --git a/.gitignore b/.gitignore index c366966d4..d77d39503 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ **/jacoco.exec **/*-journal + +# Robolectric dependencies +robolectric-deps/ +**/robolectric-deps.properties \ No newline at end of file diff --git a/README.md b/README.md index c92478a29..c63881c83 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,12 @@ The library offers a view `KujakuMapView` that provides more functionality than - For Mapbox related functionality, [go here](https://docs.mapbox.com/android/maps/overview/) - For extra features provided by this library [go here](./SPECIFICATION.md) +## `Unable to resolve artifact: Missing` while running tests + +This is encountered when Robolectric has problems downloading the jars it needs for different Android SDK levels. If you keep running into this you can download the JARs locally and point Robolectric to them by doing: + +``` +./download-robolectric-deps.sh ## License diff --git a/build.gradle b/build.gradle index 5542d945e..9000cc0b5 100644 --- a/build.gradle +++ b/build.gradle @@ -4,30 +4,36 @@ buildscript { repositories { google() jcenter() + mavenCentral() maven{ url "https://plugins.gradle.org/m2/" } - maven { url 'https://maven.fabric.io/public' } } + dependencies { - classpath 'com.android.tools.build:gradle:3.2.0' + classpath 'com.android.tools.build:gradle:7.1.3' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' - classpath 'io.fabric.tools:gradle:1.25.4' - classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.10.2' - classpath 'com.palantir:jacoco-coverage:0.4.0' + classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1' + //classpath 'com.palantir:jacoco-coverage:0.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } -apply plugin: 'com.palantir.jacoco-full-report' apply plugin: 'com.github.kt3k.coveralls' +apply from: 'configs.gradle' allprojects { repositories { google() jcenter() - /*maven { + mavenLocal() + maven { url "https://jitpack.io" } + maven { + url "https://dl.cloudsmith.io/public/terraframe/geoprism-registry/maven/" + } + maven { url 'https://api.mapbox.com/downloads/v2/releases/maven' authentication { basic(BasicAuthentication) @@ -37,26 +43,19 @@ allprojects { // This should always be `mapbox` (not your username). username = "mapbox" // Use the secret token you stored in gradle.properties as the password - password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: "" + password = localProperties['mapbox.repo.token'] ?: "" } - }*/ + } } -} +} +/* task clean(type: Delete) { delete rootProject.buildDir } + */ -ext { - supportVersion = '28.0.0' - buildToolsVersion = "28.0.3" - compileSdkVersion = 28 - volleyVersion = "1.1.0" - targetSdkVersion = 27 - jacocoVersion = "0.7.9" - mapboxSdkVersion = "8.3.3" - mapboxAnnotationPluginVersion = "0.6.0" -} +apply plugin: 'java' coveralls { jacocoReportPath = "${buildDir}/reports/jacoco/jacocoFullReport/jacocoFullReport.xml" @@ -66,12 +65,51 @@ coveralls { , "wrapper/src/main/java"] } -subprojects { - project.configurations.all { - resolutionStrategy.eachDependency { details -> - if (details.requested.group == 'com.getkeepsafe.relinker') { - details.useVersion "1.2.2" +task jacocoFullReport(type: JacocoReport, group: 'Coverage reports') { + description = 'Generates an aggregate report from all subprojects' + + additionalSourceDirs.from = files(subprojects.sourceSets.main.allSource.srcDirs) + sourceDirectories.from = files(subprojects.sourceSets.main.allSource.srcDirs) + classDirectories.from = files(subprojects.sourceSets.main.output) + + + List executionDataPaths = new ArrayList<>() + List classPaths = new ArrayList<>() + List sourcePaths = new ArrayList<>() + List jacocoClasspathPaths = new ArrayList<>() + + for (subModule in subprojects) { + def jacocoTestReportTask = subModule.getTasksByName("jacocoTestReport", false) + jacocoTestReportTask.forEach({task -> + if (task instanceof JacocoReport) { + executionDataPaths.addAll((task as JacocoReport).executionData.getFiles()) + classPaths.addAll((task as JacocoReport).classDirectories) + sourcePaths.addAll((task as JacocoReport).sourceDirectories) + jacocoClasspathPaths.addAll((task as JacocoReport).jacocoClasspath) } - } + }) } + + executionData.from = executionDataPaths + sourceDirectories.from = sourcePaths + classDirectories.from = classPaths + + getReports().getXml().setDestination(file("${buildDir}/reports/jacoco/jacocoFullReport/jacocoFullReport.xml")) + getReports().getHtml().setDestination(file("${buildDir}/reports/jacoco/jacocoFullReport/html")) + + reports { + html.enabled true + xml.enabled true + } + + jacocoClasspath = files(jacocoClasspathPaths) +} + + +task printClasspath { + doLast { + this.printClasspath + } + + //def task = org.gradle.testing.jacoco.tasks.JacocoReport() } diff --git a/configs.gradle b/configs.gradle new file mode 100644 index 000000000..d76b42003 --- /dev/null +++ b/configs.gradle @@ -0,0 +1,150 @@ + +ant.condition(property: 'os', value: 'windows') { + os(family: 'windows') +} +ant.condition(property: 'os', value: 'unix') { + os(family: 'unix') +} + +// Based on http://stackoverflow.com/questions/17097263#24121734 +def getMasterCommitCount = { -> + try { + def stdout = new ByteArrayOutputStream() + exec { + switch (ant.properties.os) { + case 'windows': + commandLine 'cmd', '/c', 'git', 'rev-list', '--first-parent', '--count', 'master' + break + case 'unix': + commandLine 'git', 'rev-list', '--first-parent', '--count', 'origin/master' + break + } + standardOutput = stdout + } + return Integer.parseInt(stdout.toString().trim()) + } catch (ignored) { + return -1 + } +} + +def getVersionName = { -> + try { + def stdout = new ByteArrayOutputStream() + exec { + switch (ant.properties.os) { + case 'windows': + commandLine 'cmd', '/c', 'git', 'describe', '--tags', '--dirty', '--always' + break + case 'unix': + commandLine 'git', 'describe', '--tags', '--dirty', '--always' + break + } + standardOutput = stdout + } + return stdout.toString().trim() + } catch (ignored) { + return null + } +} + +ext.getMasterCommitCount = getMasterCommitCount +ext.getVersionName = getVersionName + + +// LOAD PROPERTIES FILE +Properties properties = new Properties() +String[] propertyKeys = ["cgr.username", "cgr.password", "cgr.url", "mapbox.sdk.token", "mapbox.repo.token"] + + +if (project.rootProject.file("local.properties").exists()) { + properties.load(project.rootProject.file("local.properties").newDataInputStream()) + + if (properties != null) { + boolean containsAllKeys = true + ArrayList missingKeys = new ArrayList<>() + + for (String propertyKey: propertyKeys) { + if (!properties.containsKey(propertyKey)) { + missingKeys.add(propertyKey) + containsAllKeys = false + } + } + + if (!containsAllKeys) { + println(("One of the required config variables is not set in your local.properties. Make sure you have " + missingKeys.join(", "))) + } + } else { + println("Properties was null!! The file does not exist or contains nothing") + } +} else { + println("local.properties does not exist") +} + +if (properties == null) { + properties = new Properties() +} + +for (String propertyKey: propertyKeys) { + if (!properties.containsKey(propertyKey)) { + properties.put(propertyKey, "\"\"") + } +} + +ext.localProperties = properties + + +/** + + Dependencies + + + */ + +ext { + + // Dependency and other versions + androidxTestCoreVersion = "1.4.0" + buildToolsVersion = "30.0.3" + compileSdkVersion = 28 + jacocoVersion = "0.8.8" + junitVersion = "4.12" + mapboxAnnotationPluginVersion = "0.9.0" + mapboxSdkVersion = "9.7.1" + robolectricShadowsMultidexVersion = "4.3.1" + robolectricVersion = "4.3.1" + supportVersion = "1.0.0" + volleyVersion = "1.2.0" + targetSdkVersion = 27 + + // Dependency names + androidxTestCore = "androidx.test:core:$androidxTestCoreVersion" + junit = "junit:junit:$junitVersion" + mapboxSDK = "com.mapbox.mapboxsdk:mapbox-android-sdk:$mapboxSdkVersion" + mapboxSDKTurf = "com.mapbox.mapboxsdk:mapbox-sdk-turf:4.8.0" + mapboxAnnotationPlugin = "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:$mapboxAnnotationPluginVersion" + robolectric = "org.robolectric:robolectric:$robolectricVersion" + robolectricShadowsMultidex = "org.robolectric:shadows-multidex:$robolectricShadowsMultidexVersion" +} + + +//ext.mapboxSDK = "com.mapbox.maps:android:10.7.0" + +ext.mapboxDependencies = { instance, configuration -> + + configuration.implementation("com.mapbox.maps:android:$mapboxSdkVersion") { + transitive = true; + exclude group: 'com.android.support', module: 'support-v4' + exclude group: 'com.android.support', module: 'support-annotations' + exclude group: 'com.android.support', module: 'support-fragment' + } + + + // The local build has an issue fetching this library for some reason which + // is a dependency of the mapbox-android-sdk. The mapbox-sdk-turf is declared as + // a runtime dependency + configuration.implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:4.8.0' + configuration.implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:${instance.mapboxAnnotationPluginVersion}" + +} + +//ext.mapboxDependencies = mapboxDependencies diff --git a/download-robolectric-deps.sh b/download-robolectric-deps.sh new file mode 100755 index 000000000..e5dcd5394 --- /dev/null +++ b/download-robolectric-deps.sh @@ -0,0 +1,16 @@ +#!/bin/sh +mkdir robolectric-deps +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.jar -P robolectric-deps +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/8.1.0-robolectric-4611349/android-all-8.1.0-robolectric-4611349.jar -P robolectric-deps +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/8.0.0_r4-robolectric-r1/android-all-8.0.0_r4-robolectric-r1.jar -P robolectric-deps + +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/6.0.1_r3-robolectric-r1/android-all-6.0.1_r3-robolectric-r1.jar -P robolectric-deps +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/7.0.0_r1-robolectric-r1/android-all-7.0.0_r1-robolectric-r1.jar -P robolectric-deps +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/7.1.0_r7-robolectric-r1/android-all-7.1.0_r7-robolectric-r1.jar -P robolectric-deps +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/9-robolectric-4913185-2/android-all-9-robolectric-4913185-2.jar -P robolectric-deps +wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/11-robolectric-6757853/android-all-11-robolectric-6757853.jar -P robolectric-deps + +cp robolectric-deps.properties library/src/test/resources +cp robolectric-deps.properties utils/src/test/resources +cp robolectric-deps.properties sample/src/test/resources +cp robolectric-deps.properties wrapper/src/test/resources \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ce38ef8fd..cc3f99f3d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,6 +29,11 @@ POM_SETTING_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_SETTING_LICENCE_DIST=repo POM_SETTING_DEVELOPER_ID=opensrp POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev +android.useAndroidX=true +android.enableJetifier=true + +android.jetifier.ignorelist=shadows,bcprov-jdk15on +#android.jetifier.blacklist=shadows,bcprov-jdk15on # android.debug.obsoleteApi=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 61cd8a994..28c8d73df 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Feb 28 14:26:07 CET 2019 +#Sun Aug 21 19:58:31 EAT 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/library/build.gradle b/library/build.gradle index 4fc00d0c1..34f31ee33 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -10,18 +10,11 @@ buildscript { } } -allprojects { - repositories { - maven { url "https://dl.google.com/dl/android/maven2/" } - mavenLocal() - } -} - apply plugin: 'realm-android' apply plugin: 'com.jfrog.bintray' apply plugin: 'maven-publish' -version '0.9.0' +version '0.10.0' project.version = this.version @@ -44,7 +37,7 @@ android { targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName this.version - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' multiDexEnabled true } @@ -58,7 +51,7 @@ android { properties.load(project.rootProject.file("local.properties").newDataInputStream()) if (properties != null && properties.containsKey("mapbox.sdk.token")) { - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", properties["mapbox.sdk.token"] + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] } else { println("One of the required config variables is not set in your local.properties"); buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\"" @@ -70,14 +63,15 @@ android { } debug { - testCoverageEnabled true + // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 + testCoverageEnabled false if (project.rootProject.file("local.properties").exists()) { Properties properties = new Properties() properties.load(project.rootProject.file("local.properties").newDataInputStream()) if (properties != null && properties.containsKey("mapbox.sdk.token")) { - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", properties["mapbox.sdk.token"] + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] } else { println("One of the required config variables is not set in your local.properties"); buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\"" @@ -99,59 +93,73 @@ android { unitTests { includeAndroidResources = true } + /*unitTests.all { + systemProperty 'robolectric.dependency.repo.id', 'roboMaven' + systemProperty 'robolectric.dependency.repo.url', "https://repo1.maven.org/maven2" + }*/ } } dependencies { configuration -> - implementation "com.android.support:support-v4:${supportVersion}" - implementation ("com.mapbox.mapboxsdk:mapbox-android-sdk:${mapboxSdkVersion}") { + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation (mapboxSDK) { transitive = true; exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-fragment' } - implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:${mapboxAnnotationPluginVersion}" + // The local build has an issue fetching this library for some reason which + // is a dependency of the mapbox-android-sdk. The mapbox-sdk-turf is declared as + // a runtime dependency + implementation mapboxSDKTurf + implementation mapboxAnnotationPlugin // Comment the line below when creating releases - The line is for development of the library & utils - //implementation (project(":utils")) { + implementation (project(":utils")) { // Uncomment the line below when creating releases - implementation('io.ona.kujaku:utils:0.8.0') { + //implementation('io.ona.kujaku:utils:0.9.0') { transitive = true; exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-sdk' exclude group: 'com.android.support', module: 'support-v4' - exclude group: 'com.android.support', module: 'appcompat-v7' } - implementation "com.android.support:appcompat-v7:${supportVersion}" - implementation "com.android.support:design:${supportVersion}" + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'com.google.android.material:material:1.0.0' implementation 'org.simpleframework:simple-xml:2.7.1' implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1' - implementation 'com.jakewharton.timber:timber:4.7.1' + implementation 'com.jakewharton.timber:timber:5.0.1' + + implementation 'androidx.multidex:multidex:2.0.0' customDependencies(this, configuration) appPermissionsDependencies(configuration) infoWindowDependencies(this, configuration) locationDependencies(configuration) - testDependencies(configuration) + testDependencies(this, configuration) } -private static void testDependencies(configuration) { - configuration.testImplementation 'junit:junit:4.12' - configuration.testImplementation 'org.robolectric:robolectric:3.8' - configuration.testImplementation 'org.robolectric:shadows-support-v4:3.4-rc2' +private static void testDependencies(instance, configuration) { + configuration.testImplementation instance.junit + + configuration.testImplementation instance.robolectric + configuration.testImplementation instance.robolectricShadowsMultidex configuration.testImplementation 'org.mockito:mockito-inline:2.25.0' + configuration.testImplementation instance.androidxTestCore + configuration.androidTestImplementation instance.junit configuration.androidTestImplementation 'org.mockito:mockito-android:2.7.22' - configuration.androidTestImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', { + configuration.androidTestImplementation 'org.mockito:mockito-core:2.7.22' + configuration.androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' + exclude group: 'net.sf.kxml', module: 'kxml2' }) } private static void infoWindowDependencies(instance, configuration) { - configuration.implementation "com.android.support:cardview-v7:${instance.supportVersion}" - configuration.implementation "com.android.support:recyclerview-v7:${instance.supportVersion}" + configuration.implementation "androidx.cardview:cardview:${instance.supportVersion}" + configuration.implementation "androidx.recyclerview:recyclerview:${instance.supportVersion}" } private static void customDependencies(instance, configuration) { @@ -161,18 +169,20 @@ private static void customDependencies(instance, configuration) { } private static void appPermissionsDependencies(configuration) { - configuration.implementation 'com.karumi:dexter:5.0.0' + configuration.implementation 'com.karumi:dexter:6.2.3' } private static void locationDependencies(configuration) { - configuration.implementation 'com.google.android.gms:play-services-location:16.0.0' + configuration.implementation 'com.google.android.gms:play-services-location:19.0.1' } tasks.withType(Test) { jacoco.includeNoLocationClasses = true + jacoco.excludes = ['jdk.internal.*'] } -task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { +// createDebugCoverageReport is not available when android.buildTypes.debug.testCoverageEnabled is false +task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { //, 'createDebugCoverageReport']) { reports { xml.enabled = true @@ -184,14 +194,14 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'crea def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*' , 'android/**/*.*', "io/realm/*.*"] - def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter) + def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/classes", excludes: fileFilter) def mainSrc = "${project.projectDir}/src/main/java" - sourceDirectories = files([mainSrc]) - classDirectories = files([debugTree]) - executionData = fileTree(dir: project.buildDir, includes: [ + sourceDirectories.setFrom([mainSrc]) + classDirectories.setFrom(files([debugTree])) + executionData.setFrom(fileTree(dir: project.buildDir, includes: [ 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' - ]) + ])) } // Add github packages, maven-central and sonatype publishing diff --git a/library/src/androidTest/java/io/ona/kujaku/ExampleInstrumentedTest.java b/library/src/androidTest/java/io/ona/kujaku/ExampleInstrumentedTest.java index 24a4384a4..4a1c6d798 100644 --- a/library/src/androidTest/java/io/ona/kujaku/ExampleInstrumentedTest.java +++ b/library/src/androidTest/java/io/ona/kujaku/ExampleInstrumentedTest.java @@ -1,14 +1,15 @@ package io.ona.kujaku; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + /** * Instrumentation test, which will execute on an Android device. * diff --git a/library/src/androidTest/java/io/ona/kujaku/data/realm/RealmRelatedInstrumentedTest.java b/library/src/androidTest/java/io/ona/kujaku/data/realm/RealmRelatedInstrumentedTest.java index e9deaaa61..98e1e4e23 100644 --- a/library/src/androidTest/java/io/ona/kujaku/data/realm/RealmRelatedInstrumentedTest.java +++ b/library/src/androidTest/java/io/ona/kujaku/data/realm/RealmRelatedInstrumentedTest.java @@ -1,8 +1,9 @@ package io.ona.kujaku.data.realm; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; + +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Before; diff --git a/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java b/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java index 94e8d9d5c..33d92f611 100644 --- a/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java +++ b/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java @@ -1,9 +1,6 @@ package io.ona.kujaku.downloaders; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.rule.UiThreadTestRule; -import android.support.test.runner.AndroidJUnit4; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.geometry.LatLng; @@ -31,7 +28,6 @@ import java.util.concurrent.CountDownLatch; import io.ona.kujaku.BaseTest; -import io.ona.kujaku.BuildConfig; import io.ona.kujaku.data.MapBoxDownloadTask; import io.ona.kujaku.listeners.IncompleteMapDownloadCallback; import io.ona.kujaku.listeners.OnDownloadMapListener; @@ -40,6 +36,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + /** * Created by Ephraim Kigamba - ekigamba@ona.io on 07/12/2017. */ @@ -57,9 +56,6 @@ public class MapBoxOfflineResourcesDownloaderTest extends BaseTest { private ArrayList offlineRegionsList = new ArrayList<>(); private long lastId = 0; - @Rule - public UiThreadTestRule uiThreadTestRule = new UiThreadTestRule(); - @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -68,7 +64,7 @@ public void setup() throws Throwable { context = InstrumentationRegistry.getTargetContext(); MapBoxOfflineResourcesDownloader.instance = null; - uiThreadTestRule.runOnUiThread(() -> Mapbox.getInstance(context, "sample-token")); + InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> Mapbox.getInstance(context, "sample-token")); } @Test @@ -78,7 +74,7 @@ public void downloadMapShouldThrowExceptionWhenGivenNullContext() throws Throwab MapBoxDownloadTask invalidDownloadTask = createSampleDownloadTask(); - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mapBoxOfflineResourcesDownloader = MapBoxOfflineResourcesDownloader.getInstance(null, Mapbox.getInstance(context, Mapbox.getAccessToken())); @@ -205,7 +201,7 @@ public void downloadMapShouldThrowExceptionWhenGivenInvalidMinMaxZoom5() throws } private void createMapboxOfflineResourcesDownloaderInstanceOnUIThread() throws Throwable { - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mapBoxOfflineResourcesDownloader = MapBoxOfflineResourcesDownloader.getInstance(context, Mapbox.getAccessToken()); @@ -326,7 +322,7 @@ public void onError(String error) { } }; - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mapBoxOfflineResourcesDownloader = MapBoxOfflineResourcesDownloader.getInstance(null, Mapbox.getInstance(context, Mapbox.getAccessToken())); @@ -344,7 +340,7 @@ public void deleteMapShouldCallErrorMethodWhenGiveNonExistentMapName() throws Th downLatch = new CountDownLatch(1); resetTestVariables(); - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mapBoxOfflineResourcesDownloader = MapBoxOfflineResourcesDownloader.getInstance(context, Mapbox.getInstance(context, Mapbox.getAccessToken())); @@ -489,7 +485,7 @@ public void onError(String error) { MapBoxDownloadTask invalidDownloadTask = createSampleDownloadTask(); - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mapBoxOfflineResourcesDownloader = MapBoxOfflineResourcesDownloader.getInstance(null, Mapbox.getInstance(context, Mapbox.getAccessToken())); @@ -522,7 +518,7 @@ public void onError(String errorReason) { } }; - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mapBoxOfflineResourcesDownloader = MapBoxOfflineResourcesDownloader.getInstance(null, Mapbox.getInstance(context, Mapbox.getAccessToken())); diff --git a/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapTestView.java b/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapTestView.java index be13e9dde..b3fada301 100644 --- a/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapTestView.java +++ b/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapTestView.java @@ -1,8 +1,8 @@ package io.ona.kujaku.views; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapViewTest.java b/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapViewTest.java index 74055c9cb..7ab1c71bf 100644 --- a/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapViewTest.java +++ b/library/src/androidTest/java/io/ona/kujaku/views/KujakuMapViewTest.java @@ -3,9 +3,6 @@ import android.content.Context; import android.graphics.Color; import android.location.Location; -import android.support.test.InstrumentationRegistry; -import android.support.test.rule.UiThreadTestRule; -import android.support.test.runner.AndroidJUnit4; import android.view.View; import android.widget.Button; import android.widget.ImageButton; @@ -51,6 +48,9 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + /** * Created by Ephraim Kigamba - ekigamba@ona.io on 05/11/2018 */ @@ -59,14 +59,13 @@ public class KujakuMapViewTest extends BaseTest { private KujakuMapTestView kujakuMapView; - @Rule - public UiThreadTestRule uiThreadTestRule = new UiThreadTestRule(); + @Before public void setUp() throws Throwable { Context context = InstrumentationRegistry.getTargetContext(); - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { Mapbox.getInstance(context, "sample_token"); @@ -156,7 +155,7 @@ public void onLocationChanged(Location location) { LatLng latLng = new LatLng(14d, 23d); insertValueInPrivateField(KujakuMapView.class, kujakuMapView, "latestLocationCoordinates", latLng); - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { kujakuMapView.enableAddPoint(true, onLocationChanged); @@ -184,7 +183,7 @@ public void addPointShouldMakeAddViewVisible() { assertEquals(View.GONE, addBtn.getVisibility()); kujakuMapView.addPoint(false, new AddPointCallback() { @Override - public void onPointAdd(JSONObject jsonObject) { + public void onPointAdd(JSONObject featureGeoJSON) { // Do nothing } @@ -211,7 +210,7 @@ public void addPointShouldPerformActionsOnClick() { kujakuMapView.addPoint(false, new AddPointCallback() { @Override - public void onPointAdd(JSONObject jsonObject) { + public void onPointAdd(JSONObject featureGeoJSON) { states.put(isPointAddCalled, true); } @@ -402,7 +401,7 @@ public void addLayer() throws Throwable { FeatureCollection featureCollection = FeatureCollection.fromFeatures(new ArrayList()); - uiThreadTestRule.runOnUiThread(new Runnable() { + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { accessedFromInnerClassObjects.add(new BoundaryLayer.Builder(featureCollection) diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index ccf481f5f..022be0261 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1,5 +1,7 @@ - diff --git a/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedLayoutPropertyValue.java b/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedLayoutPropertyValue.java index 30d677da1..aea17465e 100644 --- a/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedLayoutPropertyValue.java +++ b/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedLayoutPropertyValue.java @@ -1,6 +1,6 @@ package com.mapbox.mapboxsdk.style.layers; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.style.layers.LayoutPropertyValue; diff --git a/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedPaintPropertyValue.java b/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedPaintPropertyValue.java index 29fb02c4e..53584d43d 100644 --- a/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedPaintPropertyValue.java +++ b/library/src/main/java/com/mapbox/mapboxsdk/style/layers/ExposedPaintPropertyValue.java @@ -1,6 +1,6 @@ package com.mapbox.mapboxsdk.style.layers; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; /** * Created by Ephraim Kigamba - ekigamba@ona.io on 2019-05-20 diff --git a/library/src/main/java/io/ona/kujaku/KujakuLibrary.java b/library/src/main/java/io/ona/kujaku/KujakuLibrary.java index 126fc7b17..573a58583 100644 --- a/library/src/main/java/io/ona/kujaku/KujakuLibrary.java +++ b/library/src/main/java/io/ona/kujaku/KujakuLibrary.java @@ -6,8 +6,8 @@ import android.content.Context; import android.content.Intent; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.widget.Toast; import com.jakewharton.threetenabp.AndroidThreeTen; @@ -24,6 +24,7 @@ import timber.log.Timber; import static android.content.Context.ALARM_SERVICE; +import static timber.log.Timber.DebugTree; /** * @author Vincent Karuri @@ -62,7 +63,7 @@ public static void init(Context context) { AndroidThreeTen.init(context); if (Timber.treeCount() < 1) { - Timber.plant(new Timber.DebugTree()); + Timber.plant(new DebugTree()); } } diff --git a/library/src/main/java/io/ona/kujaku/activities/MapActivity.java b/library/src/main/java/io/ona/kujaku/activities/MapActivity.java index 295c1cee3..5712d9e0c 100644 --- a/library/src/main/java/io/ona/kujaku/activities/MapActivity.java +++ b/library/src/main/java/io/ona/kujaku/activities/MapActivity.java @@ -6,12 +6,13 @@ import android.content.Intent; import android.graphics.PointF; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; diff --git a/library/src/main/java/io/ona/kujaku/activities/MapViewLifecycleActivity.java b/library/src/main/java/io/ona/kujaku/activities/MapViewLifecycleActivity.java index ade62eb39..6959074a5 100644 --- a/library/src/main/java/io/ona/kujaku/activities/MapViewLifecycleActivity.java +++ b/library/src/main/java/io/ona/kujaku/activities/MapViewLifecycleActivity.java @@ -1,7 +1,8 @@ package io.ona.kujaku.activities; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; import io.ona.kujaku.views.KujakuMapView; diff --git a/library/src/main/java/io/ona/kujaku/adapters/InfoWindowAdapter.java b/library/src/main/java/io/ona/kujaku/adapters/InfoWindowAdapter.java index 717851f20..37203bf2b 100644 --- a/library/src/main/java/io/ona/kujaku/adapters/InfoWindowAdapter.java +++ b/library/src/main/java/io/ona/kujaku/adapters/InfoWindowAdapter.java @@ -3,9 +3,10 @@ import android.app.Activity; import android.content.Context; import android.content.DialogInterface; -import android.support.annotation.NonNull; -import android.support.v7.widget.CardView; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; + import android.util.Log; import android.view.LayoutInflater; import android.view.ViewGroup; diff --git a/library/src/main/java/io/ona/kujaku/adapters/holders/InfoWindowViewHolder.java b/library/src/main/java/io/ona/kujaku/adapters/holders/InfoWindowViewHolder.java index cedcf952d..6058621b1 100644 --- a/library/src/main/java/io/ona/kujaku/adapters/holders/InfoWindowViewHolder.java +++ b/library/src/main/java/io/ona/kujaku/adapters/holders/InfoWindowViewHolder.java @@ -2,9 +2,10 @@ import android.animation.Animator; import android.animation.ValueAnimator; -import android.support.annotation.NonNull; -import android.support.v7.widget.CardView; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; + import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; diff --git a/library/src/main/java/io/ona/kujaku/callbacks/AddPointCallback.java b/library/src/main/java/io/ona/kujaku/callbacks/AddPointCallback.java index 2bad3c3b6..090313866 100644 --- a/library/src/main/java/io/ona/kujaku/callbacks/AddPointCallback.java +++ b/library/src/main/java/io/ona/kujaku/callbacks/AddPointCallback.java @@ -9,11 +9,12 @@ public interface AddPointCallback { /** - * Called when the user selects a specific point on the UI. + * Called when the user selects a specific point on the UI. A JSONObject of the Feature + * is returned to the application * - * @param jsonObject + * @param featureGeoJSON */ - void onPointAdd(JSONObject jsonObject); + void onPointAdd(JSONObject featureGeoJSON); /** * This method is called if & when the user cancels the Add Point operation. diff --git a/library/src/main/java/io/ona/kujaku/comparators/ArrowLineSortConfigComparator.java b/library/src/main/java/io/ona/kujaku/comparators/ArrowLineSortConfigComparator.java index 9f781dcaf..bdec5024f 100644 --- a/library/src/main/java/io/ona/kujaku/comparators/ArrowLineSortConfigComparator.java +++ b/library/src/main/java/io/ona/kujaku/comparators/ArrowLineSortConfigComparator.java @@ -1,6 +1,6 @@ package io.ona.kujaku.comparators; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.geojson.Feature; diff --git a/library/src/main/java/io/ona/kujaku/data/MapBoxDeleteTask.java b/library/src/main/java/io/ona/kujaku/data/MapBoxDeleteTask.java index 8b2284c98..9945e0edf 100644 --- a/library/src/main/java/io/ona/kujaku/data/MapBoxDeleteTask.java +++ b/library/src/main/java/io/ona/kujaku/data/MapBoxDeleteTask.java @@ -1,6 +1,6 @@ package io.ona.kujaku.data; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import org.json.JSONException; diff --git a/library/src/main/java/io/ona/kujaku/data/MapBoxDownloadTask.java b/library/src/main/java/io/ona/kujaku/data/MapBoxDownloadTask.java index 6b2ca82d7..34360fbb7 100644 --- a/library/src/main/java/io/ona/kujaku/data/MapBoxDownloadTask.java +++ b/library/src/main/java/io/ona/kujaku/data/MapBoxDownloadTask.java @@ -1,6 +1,6 @@ package io.ona.kujaku.data; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/library/src/main/java/io/ona/kujaku/data/realm/RealmDatabase.java b/library/src/main/java/io/ona/kujaku/data/realm/RealmDatabase.java index ca9c6e105..3d4ac08bb 100644 --- a/library/src/main/java/io/ona/kujaku/data/realm/RealmDatabase.java +++ b/library/src/main/java/io/ona/kujaku/data/realm/RealmDatabase.java @@ -1,8 +1,8 @@ package io.ona.kujaku.data.realm; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.mapboxsdk.offline.OfflineRegion; diff --git a/library/src/main/java/io/ona/kujaku/data/realm/objects/MapBoxOfflineQueueTask.java b/library/src/main/java/io/ona/kujaku/data/realm/objects/MapBoxOfflineQueueTask.java index 96131a112..5ca040d51 100644 --- a/library/src/main/java/io/ona/kujaku/data/realm/objects/MapBoxOfflineQueueTask.java +++ b/library/src/main/java/io/ona/kujaku/data/realm/objects/MapBoxOfflineQueueTask.java @@ -1,6 +1,6 @@ package io.ona.kujaku.data.realm.objects; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONException; import org.json.JSONObject; diff --git a/library/src/main/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloader.java b/library/src/main/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloader.java index caea84667..5e7b0dda9 100644 --- a/library/src/main/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloader.java +++ b/library/src/main/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloader.java @@ -1,7 +1,7 @@ package io.ona.kujaku.downloaders; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.util.Log; diff --git a/library/src/main/java/io/ona/kujaku/helpers/ActivityLauncherHelper.java b/library/src/main/java/io/ona/kujaku/helpers/ActivityLauncherHelper.java index b91a25064..b5866fa80 100644 --- a/library/src/main/java/io/ona/kujaku/helpers/ActivityLauncherHelper.java +++ b/library/src/main/java/io/ona/kujaku/helpers/ActivityLauncherHelper.java @@ -5,8 +5,8 @@ import android.content.Intent; import android.os.AsyncTask; import android.os.Parcelable; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.Log; import org.json.JSONObject; diff --git a/library/src/main/java/io/ona/kujaku/helpers/MapBoxWebServiceApi.java b/library/src/main/java/io/ona/kujaku/helpers/MapBoxWebServiceApi.java index 72da3c77b..97b7d7c62 100644 --- a/library/src/main/java/io/ona/kujaku/helpers/MapBoxWebServiceApi.java +++ b/library/src/main/java/io/ona/kujaku/helpers/MapBoxWebServiceApi.java @@ -1,7 +1,7 @@ package io.ona.kujaku.helpers; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import com.android.volley.NetworkError; diff --git a/library/src/main/java/io/ona/kujaku/helpers/MapboxLocationComponentWrapper.java b/library/src/main/java/io/ona/kujaku/helpers/MapboxLocationComponentWrapper.java index b84723ed1..0ec960e96 100644 --- a/library/src/main/java/io/ona/kujaku/helpers/MapboxLocationComponentWrapper.java +++ b/library/src/main/java/io/ona/kujaku/helpers/MapboxLocationComponentWrapper.java @@ -2,8 +2,8 @@ import android.content.Context; import android.content.pm.PackageManager; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.mapboxsdk.location.LocationComponent; import com.mapbox.mapboxsdk.location.modes.CameraMode; diff --git a/library/src/main/java/io/ona/kujaku/helpers/OfflineServiceHelper.java b/library/src/main/java/io/ona/kujaku/helpers/OfflineServiceHelper.java index 3b6da9a30..731d08579 100644 --- a/library/src/main/java/io/ona/kujaku/helpers/OfflineServiceHelper.java +++ b/library/src/main/java/io/ona/kujaku/helpers/OfflineServiceHelper.java @@ -2,7 +2,7 @@ import android.content.Context; import android.content.Intent; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/library/src/main/java/io/ona/kujaku/helpers/storage/MapBoxStyleStorage.java b/library/src/main/java/io/ona/kujaku/helpers/storage/MapBoxStyleStorage.java index 2f8be21cd..7bd266c94 100644 --- a/library/src/main/java/io/ona/kujaku/helpers/storage/MapBoxStyleStorage.java +++ b/library/src/main/java/io/ona/kujaku/helpers/storage/MapBoxStyleStorage.java @@ -1,6 +1,6 @@ package io.ona.kujaku.helpers.storage; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import java.io.File; diff --git a/library/src/main/java/io/ona/kujaku/helpers/wmts/WmtsHelper.java b/library/src/main/java/io/ona/kujaku/helpers/wmts/WmtsHelper.java index 520fdb936..8c087ad71 100644 --- a/library/src/main/java/io/ona/kujaku/helpers/wmts/WmtsHelper.java +++ b/library/src/main/java/io/ona/kujaku/helpers/wmts/WmtsHelper.java @@ -1,7 +1,7 @@ package io.ona.kujaku.helpers.wmts; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.style.layers.RasterLayer; diff --git a/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapView.java b/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapView.java index b0f47ff3b..7a5545412 100644 --- a/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapView.java +++ b/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapView.java @@ -5,9 +5,9 @@ */ import android.content.Context; -import android.support.annotation.DrawableRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.annotations.MarkerOptions; diff --git a/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapViewLowLevel.java b/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapViewLowLevel.java index 477620972..fc33e668d 100644 --- a/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapViewLowLevel.java +++ b/library/src/main/java/io/ona/kujaku/interfaces/IKujakuMapViewLowLevel.java @@ -1,8 +1,8 @@ package io.ona.kujaku.interfaces; -import android.support.annotation.DrawableRes; -import android.support.annotation.IntegerRes; -import android.support.annotation.Nullable; +import androidx.annotation.DrawableRes; +import androidx.annotation.IntegerRes; +import androidx.annotation.Nullable; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/library/src/main/java/io/ona/kujaku/interfaces/ILocationClient.java b/library/src/main/java/io/ona/kujaku/interfaces/ILocationClient.java index 7cbe52061..0876be304 100644 --- a/library/src/main/java/io/ona/kujaku/interfaces/ILocationClient.java +++ b/library/src/main/java/io/ona/kujaku/interfaces/ILocationClient.java @@ -2,8 +2,8 @@ import android.location.Location; import android.location.LocationListener; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.util.ArrayList; diff --git a/library/src/main/java/io/ona/kujaku/layers/ArrowLineLayer.java b/library/src/main/java/io/ona/kujaku/layers/ArrowLineLayer.java index f5337e3e3..ce529d9d3 100644 --- a/library/src/main/java/io/ona/kujaku/layers/ArrowLineLayer.java +++ b/library/src/main/java/io/ona/kujaku/layers/ArrowLineLayer.java @@ -6,12 +6,12 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; -import android.support.annotation.ColorInt; -import android.support.annotation.ColorRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v7.content.res.AppCompatResources; +import androidx.annotation.ColorInt; +import androidx.annotation.ColorRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.core.graphics.drawable.DrawableCompat; import android.text.TextUtils; import android.util.Log; diff --git a/library/src/main/java/io/ona/kujaku/layers/BoundaryLayer.java b/library/src/main/java/io/ona/kujaku/layers/BoundaryLayer.java index 9d3256c64..feb1611fa 100644 --- a/library/src/main/java/io/ona/kujaku/layers/BoundaryLayer.java +++ b/library/src/main/java/io/ona/kujaku/layers/BoundaryLayer.java @@ -2,7 +2,7 @@ import android.os.AsyncTask; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import com.mapbox.geojson.Feature; diff --git a/library/src/main/java/io/ona/kujaku/layers/FillBoundaryLayer.java b/library/src/main/java/io/ona/kujaku/layers/FillBoundaryLayer.java index 115e95764..af500ffae 100644 --- a/library/src/main/java/io/ona/kujaku/layers/FillBoundaryLayer.java +++ b/library/src/main/java/io/ona/kujaku/layers/FillBoundaryLayer.java @@ -1,6 +1,6 @@ package io.ona.kujaku.layers; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.maps.MapboxMap; diff --git a/library/src/main/java/io/ona/kujaku/layers/KujakuLayer.java b/library/src/main/java/io/ona/kujaku/layers/KujakuLayer.java index 1e451fd53..46db32785 100644 --- a/library/src/main/java/io/ona/kujaku/layers/KujakuLayer.java +++ b/library/src/main/java/io/ona/kujaku/layers/KujakuLayer.java @@ -2,9 +2,9 @@ import android.graphics.Color; import android.graphics.PointF; -import android.support.annotation.ColorInt; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.maps.MapboxMap; diff --git a/library/src/main/java/io/ona/kujaku/listeners/LocationClientStartedCallback.java b/library/src/main/java/io/ona/kujaku/listeners/LocationClientStartedCallback.java index 307a622c0..a560287a2 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/LocationClientStartedCallback.java +++ b/library/src/main/java/io/ona/kujaku/listeners/LocationClientStartedCallback.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import io.ona.kujaku.interfaces.ILocationClient; /** diff --git a/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleClickListener.java b/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleClickListener.java index 87f967529..fb39679b8 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleClickListener.java +++ b/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleClickListener.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.annotation.Circle; diff --git a/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleLongClickListener.java b/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleLongClickListener.java index 5159811c1..45c06cefc 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleLongClickListener.java +++ b/library/src/main/java/io/ona/kujaku/listeners/OnDrawingCircleLongClickListener.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.annotation.Circle; diff --git a/library/src/main/java/io/ona/kujaku/listeners/OnFeatureLongClickListener.java b/library/src/main/java/io/ona/kujaku/listeners/OnFeatureLongClickListener.java index cbdc21430..05958b06f 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/OnFeatureLongClickListener.java +++ b/library/src/main/java/io/ona/kujaku/listeners/OnFeatureLongClickListener.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.geojson.Feature; diff --git a/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerClickListener.java b/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerClickListener.java index a58771fd8..b8ca742d2 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerClickListener.java +++ b/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerClickListener.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import io.ona.kujaku.layers.KujakuLayer; diff --git a/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerLongClickListener.java b/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerLongClickListener.java index 0034b5237..9e4c2328b 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerLongClickListener.java +++ b/library/src/main/java/io/ona/kujaku/listeners/OnKujakuLayerLongClickListener.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import io.ona.kujaku.layers.KujakuLayer; diff --git a/library/src/main/java/io/ona/kujaku/listeners/OnSplittingClickListener.java b/library/src/main/java/io/ona/kujaku/listeners/OnSplittingClickListener.java index ba2162ee9..4724c063c 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/OnSplittingClickListener.java +++ b/library/src/main/java/io/ona/kujaku/listeners/OnSplittingClickListener.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/library/src/main/java/io/ona/kujaku/listeners/OnSplittingLongClickListener.java b/library/src/main/java/io/ona/kujaku/listeners/OnSplittingLongClickListener.java index fae76b1f3..cd123af1d 100644 --- a/library/src/main/java/io/ona/kujaku/listeners/OnSplittingLongClickListener.java +++ b/library/src/main/java/io/ona/kujaku/listeners/OnSplittingLongClickListener.java @@ -1,6 +1,6 @@ package io.ona.kujaku.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/library/src/main/java/io/ona/kujaku/location/KujakuLocation.java b/library/src/main/java/io/ona/kujaku/location/KujakuLocation.java index 19cf079f3..c7a5bd569 100644 --- a/library/src/main/java/io/ona/kujaku/location/KujakuLocation.java +++ b/library/src/main/java/io/ona/kujaku/location/KujakuLocation.java @@ -1,7 +1,7 @@ package io.ona.kujaku.location; import android.location.Location; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; /** * KujakuLocation to extends the default Android Location by adding some attributes diff --git a/library/src/main/java/io/ona/kujaku/location/clients/AndroidGpsLocationClient.java b/library/src/main/java/io/ona/kujaku/location/clients/AndroidGpsLocationClient.java index afc0a28a3..20acb1780 100644 --- a/library/src/main/java/io/ona/kujaku/location/clients/AndroidGpsLocationClient.java +++ b/library/src/main/java/io/ona/kujaku/location/clients/AndroidGpsLocationClient.java @@ -9,9 +9,9 @@ import android.location.LocationListener; import android.location.LocationManager; import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import android.widget.Toast; import com.google.android.gms.common.api.ResultCallback; diff --git a/library/src/main/java/io/ona/kujaku/location/clients/BaseLocationClient.java b/library/src/main/java/io/ona/kujaku/location/clients/BaseLocationClient.java index 89d899fad..b416d1f0b 100644 --- a/library/src/main/java/io/ona/kujaku/location/clients/BaseLocationClient.java +++ b/library/src/main/java/io/ona/kujaku/location/clients/BaseLocationClient.java @@ -4,8 +4,8 @@ import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.util.ArrayList; diff --git a/library/src/main/java/io/ona/kujaku/location/clients/GoogleLocationClient.java b/library/src/main/java/io/ona/kujaku/location/clients/GoogleLocationClient.java index f57b0b13b..2c127a1ec 100644 --- a/library/src/main/java/io/ona/kujaku/location/clients/GoogleLocationClient.java +++ b/library/src/main/java/io/ona/kujaku/location/clients/GoogleLocationClient.java @@ -7,9 +7,9 @@ import android.location.Location; import android.location.LocationManager; import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import android.widget.Toast; import com.google.android.gms.common.api.ResultCallback; diff --git a/library/src/main/java/io/ona/kujaku/manager/AnnotationRepositoryManager.java b/library/src/main/java/io/ona/kujaku/manager/AnnotationRepositoryManager.java index f95c3e21b..c427d57fa 100644 --- a/library/src/main/java/io/ona/kujaku/manager/AnnotationRepositoryManager.java +++ b/library/src/main/java/io/ona/kujaku/manager/AnnotationRepositoryManager.java @@ -1,6 +1,6 @@ package io.ona.kujaku.manager; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.Style; diff --git a/library/src/main/java/io/ona/kujaku/manager/DrawingManager.java b/library/src/main/java/io/ona/kujaku/manager/DrawingManager.java index 1f1e23bba..bd6faf730 100644 --- a/library/src/main/java/io/ona/kujaku/manager/DrawingManager.java +++ b/library/src/main/java/io/ona/kujaku/manager/DrawingManager.java @@ -2,8 +2,8 @@ import android.graphics.Color; import android.graphics.PointF; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.geojson.Feature; import com.mapbox.geojson.FeatureCollection; @@ -79,7 +79,7 @@ public DrawingManager(@NonNull KujakuMapView mapView, @NonNull MapboxMap mapboxM circleManager.addClickListener(new OnCircleClickListener() { @Override - public void onAnnotationClick(Circle circle) { + public boolean onAnnotationClick(Circle circle) { if (drawingEnabled) { unsetCurrentCircleDraggable(); setDraggable(!circle.isDraggable(), circle); @@ -88,6 +88,8 @@ public void onAnnotationClick(Circle circle) { onDrawingCircleClickListener.onCircleClick(circle); } } + + return false; } }); @@ -114,7 +116,7 @@ public boolean onMapClick(@NonNull LatLng point) { if (!editBoundaryMode) { final PointF pixel = mapboxMap.getProjection().toScreenLocation(point); - List features = mapboxMap.queryRenderedFeatures(pixel, (Expression) null, CircleManager.ID_GEOJSON_LAYER); + List features = mapboxMap.queryRenderedFeatures(pixel, (Expression) null, circleManager.getLayerId()); if (features.size() == 0 && drawingEnabled) { if (getCurrentKujakuCircle() != null) { diff --git a/library/src/main/java/io/ona/kujaku/manager/KujakuCircle.java b/library/src/main/java/io/ona/kujaku/manager/KujakuCircle.java index e88117c35..753a71d53 100644 --- a/library/src/main/java/io/ona/kujaku/manager/KujakuCircle.java +++ b/library/src/main/java/io/ona/kujaku/manager/KujakuCircle.java @@ -1,6 +1,6 @@ package io.ona.kujaku.manager; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.plugins.annotation.Circle; diff --git a/library/src/main/java/io/ona/kujaku/manager/SplittingManager.java b/library/src/main/java/io/ona/kujaku/manager/SplittingManager.java index 2f597062d..a044d9f47 100644 --- a/library/src/main/java/io/ona/kujaku/manager/SplittingManager.java +++ b/library/src/main/java/io/ona/kujaku/manager/SplittingManager.java @@ -1,7 +1,7 @@ package io.ona.kujaku.manager; import android.graphics.Color; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.geojson.Feature; import com.mapbox.geojson.FeatureCollection; diff --git a/library/src/main/java/io/ona/kujaku/mbtiles/MBTilesHelper.java b/library/src/main/java/io/ona/kujaku/mbtiles/MBTilesHelper.java index 125ec495c..fe3c3f73b 100644 --- a/library/src/main/java/io/ona/kujaku/mbtiles/MBTilesHelper.java +++ b/library/src/main/java/io/ona/kujaku/mbtiles/MBTilesHelper.java @@ -3,7 +3,7 @@ import android.content.Context; import android.graphics.Color; import android.os.Environment; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.util.Pair; diff --git a/library/src/main/java/io/ona/kujaku/mbtiles/MbtilesFile.java b/library/src/main/java/io/ona/kujaku/mbtiles/MbtilesFile.java index 6d9dd26dc..f7f45fc73 100644 --- a/library/src/main/java/io/ona/kujaku/mbtiles/MbtilesFile.java +++ b/library/src/main/java/io/ona/kujaku/mbtiles/MbtilesFile.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONArray; import org.json.JSONException; diff --git a/library/src/main/java/io/ona/kujaku/notifications/CriticalDownloadErrorNotification.java b/library/src/main/java/io/ona/kujaku/notifications/CriticalDownloadErrorNotification.java index 0ad2c7cf3..f3b4e95e4 100644 --- a/library/src/main/java/io/ona/kujaku/notifications/CriticalDownloadErrorNotification.java +++ b/library/src/main/java/io/ona/kujaku/notifications/CriticalDownloadErrorNotification.java @@ -3,7 +3,7 @@ import android.app.NotificationManager; import android.content.Context; import android.graphics.Color; -import android.support.v4.app.NotificationCompat; +import androidx.core.app.NotificationCompat; import io.ona.kujaku.R; diff --git a/library/src/main/java/io/ona/kujaku/notifications/DownloadCompleteNotification.java b/library/src/main/java/io/ona/kujaku/notifications/DownloadCompleteNotification.java index e5c76d7e6..4d479b0f3 100644 --- a/library/src/main/java/io/ona/kujaku/notifications/DownloadCompleteNotification.java +++ b/library/src/main/java/io/ona/kujaku/notifications/DownloadCompleteNotification.java @@ -3,7 +3,7 @@ import android.app.NotificationManager; import android.content.Context; import android.graphics.Color; -import android.support.v4.app.NotificationCompat; +import androidx.core.app.NotificationCompat; import io.ona.kujaku.R; diff --git a/library/src/main/java/io/ona/kujaku/notifications/DownloadProgressNotification.java b/library/src/main/java/io/ona/kujaku/notifications/DownloadProgressNotification.java index c723208fb..eaf1e48d4 100644 --- a/library/src/main/java/io/ona/kujaku/notifications/DownloadProgressNotification.java +++ b/library/src/main/java/io/ona/kujaku/notifications/DownloadProgressNotification.java @@ -5,7 +5,7 @@ import android.app.Service; import android.content.Context; import android.content.Intent; -import android.support.v4.app.NotificationCompat; +import androidx.core.app.NotificationCompat; import java.text.DecimalFormat; diff --git a/library/src/main/java/io/ona/kujaku/notifications/KujakuNotification.java b/library/src/main/java/io/ona/kujaku/notifications/KujakuNotification.java index 5c8d46406..1d824bae4 100644 --- a/library/src/main/java/io/ona/kujaku/notifications/KujakuNotification.java +++ b/library/src/main/java/io/ona/kujaku/notifications/KujakuNotification.java @@ -4,10 +4,10 @@ import android.app.NotificationManager; import android.content.Context; import android.os.Build; -import android.support.annotation.ColorInt; -import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; -import android.support.v4.app.NotificationCompat; +import androidx.annotation.ColorInt; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; +import androidx.core.app.NotificationCompat; /** * Created by Ephraim Kigamba - ekigamba@ona.io on 11/01/2018. diff --git a/library/src/main/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPlugin.java b/library/src/main/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPlugin.java index f3a0b331f..7fcd90083 100644 --- a/library/src/main/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPlugin.java +++ b/library/src/main/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPlugin.java @@ -1,15 +1,16 @@ package io.ona.kujaku.plugin.switcher; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.widget.PopupMenu; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; +import androidx.appcompat.widget.PopupMenu; + import android.view.Gravity; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.mapbox.mapboxsdk.maps.Style; import java.util.ArrayList; diff --git a/library/src/main/java/io/ona/kujaku/plugin/switcher/ExpressionArrayLiteral.java b/library/src/main/java/io/ona/kujaku/plugin/switcher/ExpressionArrayLiteral.java index 3f6c0de70..844868c98 100644 --- a/library/src/main/java/io/ona/kujaku/plugin/switcher/ExpressionArrayLiteral.java +++ b/library/src/main/java/io/ona/kujaku/plugin/switcher/ExpressionArrayLiteral.java @@ -1,6 +1,6 @@ package io.ona.kujaku.plugin.switcher; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.style.expressions.Expression; diff --git a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/BaseLayer.java b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/BaseLayer.java index c7734c071..b62831021 100644 --- a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/BaseLayer.java +++ b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/BaseLayer.java @@ -1,6 +1,6 @@ package io.ona.kujaku.plugin.switcher.layer; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.maps.MapboxMap; diff --git a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/MBTilesLayer.java b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/MBTilesLayer.java index fe118671d..3630816e3 100644 --- a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/MBTilesLayer.java +++ b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/MBTilesLayer.java @@ -1,7 +1,7 @@ package io.ona.kujaku.plugin.switcher.layer; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Pair; import com.mapbox.mapboxsdk.style.layers.Layer; diff --git a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/SatelliteBaseLayer.java b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/SatelliteBaseLayer.java index 44d9ca491..80c2bb713 100644 --- a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/SatelliteBaseLayer.java +++ b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/SatelliteBaseLayer.java @@ -1,6 +1,6 @@ package io.ona.kujaku.plugin.switcher.layer; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.PropertyFactory; diff --git a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/StreetsBaseLayer.java b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/StreetsBaseLayer.java index 6595d9c7a..0362400c8 100644 --- a/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/StreetsBaseLayer.java +++ b/library/src/main/java/io/ona/kujaku/plugin/switcher/layer/StreetsBaseLayer.java @@ -1,7 +1,7 @@ package io.ona.kujaku.plugin.switcher.layer; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.style.expressions.Expression; import com.mapbox.mapboxsdk.style.layers.FillLayer; diff --git a/library/src/main/java/io/ona/kujaku/services/MapboxOfflineDownloaderService.java b/library/src/main/java/io/ona/kujaku/services/MapboxOfflineDownloaderService.java index 6ed330dfc..9a5372eaa 100644 --- a/library/src/main/java/io/ona/kujaku/services/MapboxOfflineDownloaderService.java +++ b/library/src/main/java/io/ona/kujaku/services/MapboxOfflineDownloaderService.java @@ -8,10 +8,11 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.RestrictTo; -import android.support.v4.content.LocalBroadcastManager; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + import android.text.TextUtils; import android.text.format.Formatter; import android.util.Log; @@ -25,7 +26,6 @@ import org.json.JSONException; -import io.ona.kujaku.BuildConfig; import io.ona.kujaku.R; import io.ona.kujaku.data.MapBoxDeleteTask; import io.ona.kujaku.data.MapBoxDownloadTask; diff --git a/library/src/main/java/io/ona/kujaku/services/TrackingService.java b/library/src/main/java/io/ona/kujaku/services/TrackingService.java index a58c38b97..5007f4496 100644 --- a/library/src/main/java/io/ona/kujaku/services/TrackingService.java +++ b/library/src/main/java/io/ona/kujaku/services/TrackingService.java @@ -23,9 +23,9 @@ import android.os.IBinder; import android.os.Looper; import android.os.PowerManager; -import android.support.annotation.NonNull; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.TaskStackBuilder; +import androidx.annotation.NonNull; +import androidx.core.app.NotificationCompat; +import androidx.core.app.TaskStackBuilder; import android.util.Log; import java.util.ArrayList; diff --git a/library/src/main/java/io/ona/kujaku/sorting/Sorter.java b/library/src/main/java/io/ona/kujaku/sorting/Sorter.java index f2da8da45..af024ce7d 100644 --- a/library/src/main/java/io/ona/kujaku/sorting/Sorter.java +++ b/library/src/main/java/io/ona/kujaku/sorting/Sorter.java @@ -1,6 +1,6 @@ package io.ona.kujaku.sorting; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONException; import org.json.JSONObject; diff --git a/library/src/main/java/io/ona/kujaku/tasks/GenericAsyncTask.java b/library/src/main/java/io/ona/kujaku/tasks/GenericAsyncTask.java index ca0ea4dab..42676ba4e 100644 --- a/library/src/main/java/io/ona/kujaku/tasks/GenericAsyncTask.java +++ b/library/src/main/java/io/ona/kujaku/tasks/GenericAsyncTask.java @@ -1,7 +1,7 @@ package io.ona.kujaku.tasks; import android.os.AsyncTask; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import io.ona.kujaku.callables.AsyncTaskCallable; import io.ona.kujaku.exceptions.AsyncTaskCancelledException; diff --git a/library/src/main/java/io/ona/kujaku/utils/FeatureFilter.java b/library/src/main/java/io/ona/kujaku/utils/FeatureFilter.java index 1ac3d30a8..d108ae583 100644 --- a/library/src/main/java/io/ona/kujaku/utils/FeatureFilter.java +++ b/library/src/main/java/io/ona/kujaku/utils/FeatureFilter.java @@ -1,7 +1,7 @@ package io.ona.kujaku.utils; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.geojson.Feature; import com.mapbox.geojson.FeatureCollection; diff --git a/library/src/main/java/io/ona/kujaku/utils/KujakuMultiplePermissionListener.java b/library/src/main/java/io/ona/kujaku/utils/KujakuMultiplePermissionListener.java index cc2e4bbe2..8947be608 100644 --- a/library/src/main/java/io/ona/kujaku/utils/KujakuMultiplePermissionListener.java +++ b/library/src/main/java/io/ona/kujaku/utils/KujakuMultiplePermissionListener.java @@ -4,7 +4,7 @@ import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.karumi.dexter.MultiplePermissionsReport; import com.karumi.dexter.listener.multi.BaseMultiplePermissionsListener; diff --git a/library/src/main/java/io/ona/kujaku/utils/LayerUtil.java b/library/src/main/java/io/ona/kujaku/utils/LayerUtil.java index a4d842877..22c14410a 100644 --- a/library/src/main/java/io/ona/kujaku/utils/LayerUtil.java +++ b/library/src/main/java/io/ona/kujaku/utils/LayerUtil.java @@ -1,8 +1,8 @@ package io.ona.kujaku.utils; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import android.text.TextUtils; import com.mapbox.mapboxsdk.style.expressions.Expression; diff --git a/library/src/main/java/io/ona/kujaku/utils/NumberFormatter.java b/library/src/main/java/io/ona/kujaku/utils/NumberFormatter.java index cdbb2627f..71203282d 100644 --- a/library/src/main/java/io/ona/kujaku/utils/NumberFormatter.java +++ b/library/src/main/java/io/ona/kujaku/utils/NumberFormatter.java @@ -1,7 +1,7 @@ package io.ona.kujaku.utils; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.format.Formatter; import java.text.DecimalFormat; diff --git a/library/src/main/java/io/ona/kujaku/utils/Permissions.java b/library/src/main/java/io/ona/kujaku/utils/Permissions.java index 267251f2d..68e4546b0 100644 --- a/library/src/main/java/io/ona/kujaku/utils/Permissions.java +++ b/library/src/main/java/io/ona/kujaku/utils/Permissions.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; import java.util.ArrayList; import java.util.List; diff --git a/library/src/main/java/io/ona/kujaku/utils/Views.java b/library/src/main/java/io/ona/kujaku/utils/Views.java index a558f5486..0c51fadb1 100644 --- a/library/src/main/java/io/ona/kujaku/utils/Views.java +++ b/library/src/main/java/io/ona/kujaku/utils/Views.java @@ -3,7 +3,7 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; diff --git a/library/src/main/java/io/ona/kujaku/views/Dialogs.java b/library/src/main/java/io/ona/kujaku/views/Dialogs.java index 0b68ec2ee..60821abf3 100644 --- a/library/src/main/java/io/ona/kujaku/views/Dialogs.java +++ b/library/src/main/java/io/ona/kujaku/views/Dialogs.java @@ -3,8 +3,8 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; diff --git a/library/src/main/java/io/ona/kujaku/views/InfoWindowLayoutManager.java b/library/src/main/java/io/ona/kujaku/views/InfoWindowLayoutManager.java index 51fc15bc4..84a297cd3 100644 --- a/library/src/main/java/io/ona/kujaku/views/InfoWindowLayoutManager.java +++ b/library/src/main/java/io/ona/kujaku/views/InfoWindowLayoutManager.java @@ -2,12 +2,13 @@ import android.content.Context; import android.graphics.PointF; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.LinearSmoothScroller; -import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearSmoothScroller; +import androidx.recyclerview.widget.RecyclerView; + /** * Created by Ephraim Kigamba - ekigamba@ona.io on 29/11/2017. */ diff --git a/library/src/main/java/io/ona/kujaku/views/KujakuMapView.java b/library/src/main/java/io/ona/kujaku/views/KujakuMapView.java index d2cd055f2..4f2bcca3b 100644 --- a/library/src/main/java/io/ona/kujaku/views/KujakuMapView.java +++ b/library/src/main/java/io/ona/kujaku/views/KujakuMapView.java @@ -11,12 +11,13 @@ import android.location.Location; import android.location.LocationListener; import android.os.IBinder; -import android.support.annotation.DrawableRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import android.util.AttributeSet; import android.util.Log; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewTreeObserver; import android.widget.Button; @@ -213,25 +214,29 @@ public class KujakuMapView extends MapView implements IKujakuMapView, MapboxMap. // private DrawingManager drawingManager = null ; public KujakuMapView(@NonNull Context context) { super(context); - init(null); + init(context, null); } public KujakuMapView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); - init(attrs); + init(context, attrs); } public KujakuMapView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - init(attrs); + init(context, attrs); } public KujakuMapView(@NonNull Context context, @Nullable MapboxMapOptions options) { super(context, options); - init(null); + init(context, null); } - private void init(@Nullable AttributeSet attributeSet) { + private void init(@NonNull Context context, @Nullable AttributeSet attributeSet) { + LayoutInflater inflater = (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + inflater.inflate(R.layout.mapbox_mapview_internal, this, true); + PermissionsHelper.checkPermissions(TAG, getContext()); markerLayout = findViewById(R.id.iv_mapview_locationSelectionMarker); diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsCapabilities.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsCapabilities.java index 5461d563f..fd74ecd6a 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsCapabilities.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsCapabilities.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsContents.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsContents.java index ab8fd2afc..9747df9ae 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsContents.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsContents.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.ElementList; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsLayer.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsLayer.java index 4e65136af..788a0536e 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsLayer.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsLayer.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsResourceUrl.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsResourceUrl.java index c7561bce7..ce0ee843e 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsResourceUrl.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsResourceUrl.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Attribute; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsServiceIdentification.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsServiceIdentification.java index f152cdcd3..12f89594d 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsServiceIdentification.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsServiceIdentification.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.ElementList; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsStyle.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsStyle.java index 3fa026b2c..97992756d 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsStyle.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsStyle.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSet.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSet.java index 1d96c6d82..0950bca4a 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSet.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSet.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSetLink.java b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSetLink.java index fc4fe3e21..fa186866f 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSetLink.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/WmtsTileMatrixSetLink.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Element; diff --git a/library/src/main/java/io/ona/kujaku/wmts/model/common/ows/LanguageStringType.java b/library/src/main/java/io/ona/kujaku/wmts/model/common/ows/LanguageStringType.java index 1ba447c3c..634ada15d 100644 --- a/library/src/main/java/io/ona/kujaku/wmts/model/common/ows/LanguageStringType.java +++ b/library/src/main/java/io/ona/kujaku/wmts/model/common/ows/LanguageStringType.java @@ -1,6 +1,6 @@ package io.ona.kujaku.wmts.model.common.ows; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Text; diff --git a/library/src/main/res/layout/activity_map.xml b/library/src/main/res/layout/activity_map.xml index ac364210c..b245e82d7 100644 --- a/library/src/main/res/layout/activity_map.xml +++ b/library/src/main/res/layout/activity_map.xml @@ -27,7 +27,7 @@ android:layout_alignParentLeft="true" android:visibility="gone"/> - - - - - @@ -104,7 +104,7 @@ android:textColor="@color/white" android:visibility="gone" android:layout_gravity="bottom|left"/> - - + - + - - \ No newline at end of file + \ No newline at end of file diff --git a/library/src/test/java/io/ona/kujaku/BaseTest.java b/library/src/test/java/io/ona/kujaku/BaseTest.java index f757a000c..1b3471a75 100644 --- a/library/src/test/java/io/ona/kujaku/BaseTest.java +++ b/library/src/test/java/io/ona/kujaku/BaseTest.java @@ -29,8 +29,7 @@ * */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, - manifest = Config.NONE) +@Config(manifest = Config.NONE) public abstract class BaseTest { protected Feature generateRandomFeatureWithProperties(GeoJSONFeature.Property... properties) { diff --git a/library/src/test/java/io/ona/kujaku/data/MapBoxDeleteTaskTest.java b/library/src/test/java/io/ona/kujaku/data/MapBoxDeleteTaskTest.java index 05b8e3b0a..48f70c024 100644 --- a/library/src/test/java/io/ona/kujaku/data/MapBoxDeleteTaskTest.java +++ b/library/src/test/java/io/ona/kujaku/data/MapBoxDeleteTaskTest.java @@ -16,7 +16,7 @@ * Created by Ephraim Kigamba - ekigamba@ona.io on 05/12/2017. */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class,manifest=Config.NONE) +@Config(manifest=Config.NONE) public class MapBoxDeleteTaskTest { @Test diff --git a/library/src/test/java/io/ona/kujaku/data/MapBoxDownloadTaskTest.java b/library/src/test/java/io/ona/kujaku/data/MapBoxDownloadTaskTest.java index 35168b86f..95baa66dc 100644 --- a/library/src/test/java/io/ona/kujaku/data/MapBoxDownloadTaskTest.java +++ b/library/src/test/java/io/ona/kujaku/data/MapBoxDownloadTaskTest.java @@ -18,7 +18,7 @@ * Created by Ephraim Kigamba - ekigamba@ona.io on 05/12/2017. */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class,manifest=Config.NONE) +@Config(manifest=Config.NONE) public class MapBoxDownloadTaskTest { @Test diff --git a/library/src/test/java/io/ona/kujaku/helpers/MapBoxStyleStorageTest.java b/library/src/test/java/io/ona/kujaku/helpers/MapBoxStyleStorageTest.java index 3374a345c..fff1370c3 100644 --- a/library/src/test/java/io/ona/kujaku/helpers/MapBoxStyleStorageTest.java +++ b/library/src/test/java/io/ona/kujaku/helpers/MapBoxStyleStorageTest.java @@ -19,7 +19,7 @@ */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, manifest = Config.NONE) +@Config(manifest = Config.NONE) public class MapBoxStyleStorageTest { @Test diff --git a/library/src/test/java/io/ona/kujaku/helpers/TrackingStorageTest.java b/library/src/test/java/io/ona/kujaku/helpers/TrackingStorageTest.java index 14254d510..2797090fd 100644 --- a/library/src/test/java/io/ona/kujaku/helpers/TrackingStorageTest.java +++ b/library/src/test/java/io/ona/kujaku/helpers/TrackingStorageTest.java @@ -19,7 +19,7 @@ */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, manifest = Config.NONE) +@Config(manifest = Config.NONE) public class TrackingStorageTest { @Test diff --git a/library/src/test/java/io/ona/kujaku/layers/ArrowLineLayerTest.java b/library/src/test/java/io/ona/kujaku/layers/ArrowLineLayerTest.java index 050876ef7..0db74f5aa 100644 --- a/library/src/test/java/io/ona/kujaku/layers/ArrowLineLayerTest.java +++ b/library/src/test/java/io/ona/kujaku/layers/ArrowLineLayerTest.java @@ -378,10 +378,10 @@ public void setLayerPropertiesFromBuilder() throws InvalidArrowLineConfigExcepti ArrowLineLayer.Builder builder = new ArrowLineLayer.Builder(context, featureConfig, sortConfig); - int colorRes = android.support.v7.appcompat.R.color.abc_btn_colored_text_material; + int colorRes = androidx.appcompat.R.color.abc_btn_colored_text_material; int colorInt = context .getResources() - .getColor(android.support.v7.appcompat.R.color.abc_btn_colored_text_material); + .getColor(androidx.appcompat.R.color.abc_btn_colored_text_material); float lineWidth = 67f; builder.setArrowLineColor(colorRes); diff --git a/library/src/test/java/io/ona/kujaku/layers/BaseKujakuLayerTest.java b/library/src/test/java/io/ona/kujaku/layers/BaseKujakuLayerTest.java index 4e9a8a714..faf27900b 100644 --- a/library/src/test/java/io/ona/kujaku/layers/BaseKujakuLayerTest.java +++ b/library/src/test/java/io/ona/kujaku/layers/BaseKujakuLayerTest.java @@ -2,7 +2,7 @@ import android.content.Context; import android.content.pm.ApplicationInfo; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.utils.ThreadUtils; diff --git a/library/src/test/java/io/ona/kujaku/library/KujakuLibraryTest.java b/library/src/test/java/io/ona/kujaku/library/KujakuLibraryTest.java index 9126f7fba..f8d62a88c 100644 --- a/library/src/test/java/io/ona/kujaku/library/KujakuLibraryTest.java +++ b/library/src/test/java/io/ona/kujaku/library/KujakuLibraryTest.java @@ -1,6 +1,7 @@ package io.ona.kujaku.library; import android.app.Activity; +import android.app.Application; import android.content.Intent; import com.mapbox.mapboxsdk.Mapbox; @@ -13,26 +14,24 @@ import org.mockito.junit.MockitoRule; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; -import org.robolectric.RuntimeEnvironment; +import org.robolectric.Shadows; import org.robolectric.annotation.Config; import java.util.ArrayList; -import io.ona.kujaku.BuildConfig; import io.ona.kujaku.TestApplication; import io.ona.kujaku.activities.MapActivity; import io.ona.kujaku.helpers.ActivityLauncherHelper; import io.ona.kujaku.test.shadows.ShadowConnectivityReceiver; import static junit.framework.Assert.assertEquals; -import static org.robolectric.Shadows.shadowOf; +import androidx.test.core.app.ApplicationProvider; /** * @author Vincent Karuri */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class - , manifest = Config.NONE +@Config(manifest = Config.NONE , application = TestApplication.class, shadows = {ShadowConnectivityReceiver.class}) public class KujakuLibraryTest { @@ -44,19 +43,20 @@ public class KujakuLibraryTest { @Before public void setupBeforeTest() { - Mapbox.getInstance(RuntimeEnvironment.application, "some-access-token"); + Mapbox.getInstance(ApplicationProvider.getApplicationContext(), "some-access-token"); activity = Robolectric.buildActivity(Activity.class).create().get(); } @Test public void testMethodLaunchMapActivityShouldSuccessfullyLaunchMapActivity() throws InterruptedException { ActivityLauncherHelper.launchMapActivity(activity, Mapbox.getAccessToken(), new ArrayList<>(), true); - Thread.sleep(5000l); + Thread.sleep(5000L); Robolectric.getForegroundThreadScheduler().runOneTask(); // flush foreground job to allow AsyncTask's onPostExecute to run Intent expectedIntent = new Intent(activity, MapActivity.class); - Intent actualIntent = shadowOf(RuntimeEnvironment.application).getNextStartedActivity(); + + Intent actualIntent = Shadows.shadowOf((Application) ApplicationProvider.getApplicationContext()).getNextStartedActivity(); assertEquals(expectedIntent.getComponent(), actualIntent.getComponent()); } } diff --git a/library/src/test/java/io/ona/kujaku/location/clients/BaseLocationClientTest.java b/library/src/test/java/io/ona/kujaku/location/clients/BaseLocationClientTest.java index 8757dc532..de96bcf80 100644 --- a/library/src/test/java/io/ona/kujaku/location/clients/BaseLocationClientTest.java +++ b/library/src/test/java/io/ona/kujaku/location/clients/BaseLocationClientTest.java @@ -2,8 +2,8 @@ import android.location.Location; import android.location.LocationListener; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.junit.Before; import org.junit.Test; diff --git a/library/src/test/java/io/ona/kujaku/notifications/BaseNotificationTest.java b/library/src/test/java/io/ona/kujaku/notifications/BaseNotificationTest.java index 6a4f1ba89..917729b8f 100644 --- a/library/src/test/java/io/ona/kujaku/notifications/BaseNotificationTest.java +++ b/library/src/test/java/io/ona/kujaku/notifications/BaseNotificationTest.java @@ -6,8 +6,8 @@ import android.content.Intent; import android.os.Build; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.NotificationCompat; +import androidx.annotation.Nullable; +import androidx.core.app.NotificationCompat; import org.junit.After; import org.junit.Before; @@ -31,7 +31,7 @@ * Created by Ephraim Kigamba - ekigamba@ona.io on 16/01/2018. */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, manifest = Config.NONE, sdk = Build.VERSION_CODES.O) +@Config(manifest = Config.NONE, sdk = Build.VERSION_CODES.O) public abstract class BaseNotificationTest extends BaseTest { protected Context context; diff --git a/library/src/test/java/io/ona/kujaku/notifications/DownloadCompleteNotificationTest.java b/library/src/test/java/io/ona/kujaku/notifications/DownloadCompleteNotificationTest.java index b2c9187c5..3e065d20d 100644 --- a/library/src/test/java/io/ona/kujaku/notifications/DownloadCompleteNotificationTest.java +++ b/library/src/test/java/io/ona/kujaku/notifications/DownloadCompleteNotificationTest.java @@ -4,7 +4,7 @@ import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; -import android.support.annotation.RequiresApi; +import androidx.annotation.RequiresApi; import org.junit.Test; import org.robolectric.Shadows; diff --git a/library/src/test/java/io/ona/kujaku/notifications/DownloadProgressNotificationTest.java b/library/src/test/java/io/ona/kujaku/notifications/DownloadProgressNotificationTest.java index 986a7fcc6..b97259448 100644 --- a/library/src/test/java/io/ona/kujaku/notifications/DownloadProgressNotificationTest.java +++ b/library/src/test/java/io/ona/kujaku/notifications/DownloadProgressNotificationTest.java @@ -4,8 +4,8 @@ import android.app.NotificationManager; import android.content.Context; import android.content.Intent; -import android.support.annotation.RequiresApi; -import android.support.v4.app.NotificationCompat; +import androidx.annotation.RequiresApi; +import androidx.core.app.NotificationCompat; import org.junit.Test; import org.robolectric.Robolectric; diff --git a/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationImplClass.java b/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationImplClass.java index 14f77ca2d..c8fcd7167 100644 --- a/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationImplClass.java +++ b/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationImplClass.java @@ -2,7 +2,7 @@ import android.app.NotificationManager; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import io.ona.kujaku.R; diff --git a/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationTest.java b/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationTest.java index b79b266de..6e78da659 100644 --- a/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationTest.java +++ b/library/src/test/java/io/ona/kujaku/notifications/KujakuNotificationTest.java @@ -5,8 +5,8 @@ import android.content.Context; import android.graphics.Color; import android.os.Build; -import android.support.annotation.RequiresApi; -import android.support.v4.app.NotificationCompat; +import androidx.annotation.RequiresApi; +import androidx.core.app.NotificationCompat; import org.junit.Test; import org.robolectric.annotation.Config; diff --git a/library/src/test/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPluginTest.java b/library/src/test/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPluginTest.java index dea504e21..a5e50e806 100644 --- a/library/src/test/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPluginTest.java +++ b/library/src/test/java/io/ona/kujaku/plugin/switcher/BaseLayerSwitcherPluginTest.java @@ -2,10 +2,10 @@ import android.content.Context; import android.content.pm.ApplicationInfo; -import android.support.design.widget.FloatingActionButton; import android.view.MenuItem; import android.view.View; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.utils.ThreadUtils; diff --git a/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java b/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java index dfbb23269..350602bc8 100644 --- a/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java +++ b/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java @@ -7,7 +7,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Handler; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.util.Log; import com.mapbox.mapboxsdk.Mapbox; @@ -72,8 +72,7 @@ * Created by Ephraim Kigamba - ekigamba@ona.io on 05/12/2017. */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, - manifest = Config.NONE, +@Config(manifest = Config.NONE, shadows = { ShadowMapBoxDeleteTask.class, ShadowMapBoxDownloadTask.class, diff --git a/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java b/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java index 71a87006a..10facdcec 100644 --- a/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java +++ b/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java @@ -46,8 +46,7 @@ * Created by Emmanuel Otin - eo@novel-t.ch 03/20/19. */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, - manifest = Config.NONE) +@Config(manifest = Config.NONE) public class TrackingServiceTest { private Context context; diff --git a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowKujakuMapView.java b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowKujakuMapView.java index f47194851..560ff3489 100644 --- a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowKujakuMapView.java +++ b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowKujakuMapView.java @@ -1,8 +1,8 @@ package io.ona.kujaku.test.shadows; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import org.robolectric.annotation.Implementation; diff --git a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowLayer.java b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowLayer.java index 7a771f0b5..f68bce385 100644 --- a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowLayer.java +++ b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowLayer.java @@ -1,6 +1,6 @@ package io.ona.kujaku.test.shadows; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.PropertyValue; diff --git a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDeleteTask.java b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDeleteTask.java index 26206a92e..d1c6c42b7 100644 --- a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDeleteTask.java +++ b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDeleteTask.java @@ -1,6 +1,6 @@ package io.ona.kujaku.test.shadows; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import org.json.JSONException; diff --git a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDownloadTask.java b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDownloadTask.java index e55092f45..78f177c50 100644 --- a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDownloadTask.java +++ b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapBoxDownloadTask.java @@ -1,6 +1,6 @@ package io.ona.kujaku.test.shadows; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import org.json.JSONException; diff --git a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapView.java b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapView.java index 1166458e7..7db6d01ae 100644 --- a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapView.java +++ b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowMapView.java @@ -1,8 +1,8 @@ package io.ona.kujaku.test.shadows; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import com.mapbox.mapboxsdk.maps.MapView; diff --git a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowSource.java b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowSource.java index fe62aeccc..2cfabe28b 100644 --- a/library/src/test/java/io/ona/kujaku/test/shadows/ShadowSource.java +++ b/library/src/test/java/io/ona/kujaku/test/shadows/ShadowSource.java @@ -1,6 +1,6 @@ package io.ona.kujaku.test.shadows; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.mapbox.mapboxsdk.style.sources.Source; diff --git a/library/src/test/java/io/ona/kujaku/test/shadows/implementations/KujakuMapTestView.java b/library/src/test/java/io/ona/kujaku/test/shadows/implementations/KujakuMapTestView.java index 97c9411a1..0be5ce97f 100644 --- a/library/src/test/java/io/ona/kujaku/test/shadows/implementations/KujakuMapTestView.java +++ b/library/src/test/java/io/ona/kujaku/test/shadows/implementations/KujakuMapTestView.java @@ -1,8 +1,8 @@ package io.ona.kujaku.test.shadows.implementations; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/library/src/test/java/io/ona/kujaku/wmts/WmtsCapabilitiesSerializerTest.java b/library/src/test/java/io/ona/kujaku/wmts/WmtsCapabilitiesSerializerTest.java index 6ab4cdada..8b457215d 100644 --- a/library/src/test/java/io/ona/kujaku/wmts/WmtsCapabilitiesSerializerTest.java +++ b/library/src/test/java/io/ona/kujaku/wmts/WmtsCapabilitiesSerializerTest.java @@ -20,7 +20,7 @@ * Created by Emmanuel Otin - eo@novel-t.ch 12/04/18. */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, manifest = Config.NONE) +@Config(manifest = Config.NONE) public class WmtsCapabilitiesSerializerTest { private WmtsCapabilities getCapabilities() throws Exception { diff --git a/library/src/test/resources/raster.mbtiles b/library/src/test/resources/raster.mbtiles index 3926bbdaa..ff08e9f63 100644 Binary files a/library/src/test/resources/raster.mbtiles and b/library/src/test/resources/raster.mbtiles differ diff --git a/library/src/test/resources/trails.mbtiles b/library/src/test/resources/trails.mbtiles index 13233d181..b4ad07e6a 100644 Binary files a/library/src/test/resources/trails.mbtiles and b/library/src/test/resources/trails.mbtiles differ diff --git a/publish.gradle b/publish.gradle index 7f8806582..24f7edb45 100644 --- a/publish.gradle +++ b/publish.gradle @@ -1,4 +1,4 @@ -apply plugin: 'maven' +apply plugin: 'maven-publish' apply plugin: 'signing' task sourceJar(type: Jar) { @@ -11,7 +11,7 @@ task javaDoc(type: Javadoc) { def mainSrc = "$project.projectDir/src/main/java" source = files([mainSrc]) classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - classpath += configurations.compile + //classpath += configurations.compile } task javadocJar(type: Jar, dependsOn: javaDoc) { diff --git a/robolectric-deps.properties b/robolectric-deps.properties new file mode 100644 index 000000000..43437be27 --- /dev/null +++ b/robolectric-deps.properties @@ -0,0 +1,8 @@ +org.robolectric\:android-all\:6.0.1_r3-robolectric-r1=../../../../../../robolectric-deps/android-all-6.0.1_r3-robolectric-r1.jar +org.robolectric\:android-all\:7.0.0_r1-robolectric-r1=../../../../../../robolectric-deps/android-all-7.0.0_r1-robolectric-r1.jar +org.robolectric\:android-all\:7.1.0_r7-robolectric-r1=../../../../../../robolectric-deps/android-all-7.1.0_r7-robolectric-r1.jar +org.robolectric\:android-all\:8.0.0_r4-robolectric-r1=../../../../../../robolectric-deps/android-all-8.0.0_r4-robolectric-r1.jar +org.robolectric\:android-all\:8.1.0-robolectric-4611349=../../../../../../robolectric-deps/android-all-8.1.0-robolectric-4611349.jar +org.robolectric\:android-all\:9-robolectric-4913185-2=../../../../../../robolectric-deps/android-all-9-robolectric-4913185-2.jar +org.robolectric\:android-all\:10-robolectric-5803371=../../../../../../robolectric-deps/android-all-10-robolectric-5803371.jar +org.robolectric\:android-all\:11-robolectric-6757853=../../../../../../robolectric-deps/android-all-11-robolectric-6757853.jar \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index bcf8254bb..30573d486 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,106 +1,6 @@ -allprojects { - repositories { - maven { url "https://dl.google.com/dl/android/maven2/" } - maven { url "https://jitpack.io" } - maven { url 'https://maven.fabric.io/public' } - maven { - url "https://dl.cloudsmith.io/public/terraframe/geoprism-registry/maven/" - } - mavenLocal() - //mavenCentral() - } -} - apply plugin: 'com.android.application' apply plugin: 'jacoco' -apply plugin: 'io.fabric' - - -ant.condition(property: 'os', value: 'windows') { - os(family: 'windows') -} -ant.condition(property: 'os', value: 'unix') { - os(family: 'unix') -} - -// Based on http://stackoverflow.com/questions/17097263#24121734 -def getMasterCommitCount = { -> - try { - def stdout = new ByteArrayOutputStream() - exec { - switch (ant.properties.os) { - case 'windows': - commandLine 'cmd', '/c', 'git', 'rev-list', '--first-parent', '--count', 'master' - break - case 'unix': - commandLine 'git', 'rev-list', '--first-parent', '--count', 'master' - break - } - standardOutput = stdout - } - return Integer.parseInt(stdout.toString().trim()) - } catch (ignored) { - return -1 - } -} - -def getVersionName = { -> - try { - def stdout = new ByteArrayOutputStream() - exec { - switch (ant.properties.os) { - case 'windows': - commandLine 'cmd', '/c', 'git', 'describe', '--tags', '--dirty', '--always' - break - case 'unix': - commandLine 'git', 'describe', '--tags', '--dirty', '--always' - break - } - standardOutput = stdout - } - return stdout.toString().trim() - } catch (ignored) { - return null - } -} - -// LOAD PROPERTIES FILE -Properties properties = new Properties() -String[] propertyKeys = ["cgr.username", "cgr.password", "cgr.url", "mapbox.sdk.token"] - -if (project.rootProject.file("local.properties").exists()) { - properties.load(project.rootProject.file("local.properties").newDataInputStream()) - - if (properties != null) { - boolean containsAllKeys = true - - for (String propertyKey: propertyKeys) { - if (!properties.containsKey(propertyKey)) { - containsAllKeys = false; - break - } - } - - if (!containsAllKeys) { - println(("One of the required config variables is not set in your local.properties. Make sure you have " + propertyKeys.join(", "))) - } - } else { - println("Properties was null!! The file does not exist or contains nothing") - } -} else { - println("local.properties does not exist") -} - -if (properties == null) { - properties = new Properties(); -} - -for (String propertyKey: propertyKeys) { - if (!properties.containsKey(propertyKey)) { - properties.put(propertyKey, "\"\"") - } -} - +apply plugin: 'com.google.firebase.crashlytics' jacoco { toolVersion = jacocoVersion @@ -124,7 +24,7 @@ android { versionName getVersionName() multiDexEnabled true - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildTypes { @@ -132,19 +32,20 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", properties["mapbox.sdk.token"] - buildConfigField "String", "CGR_USERNAME", properties["cgr.username"] - buildConfigField "String", "CGR_PASSWORD", properties["cgr.password"] - buildConfigField "String", "CGR_URL", properties["cgr.url"] + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] + buildConfigField "String", "CGR_USERNAME", localProperties["cgr.username"] + buildConfigField "String", "CGR_PASSWORD", localProperties["cgr.password"] + buildConfigField "String", "CGR_URL", localProperties["cgr.url"] buildConfigField "long", "MAPBOX_DOWNLOAD_TILE_LIMIT", "6001" } debug { - testCoverageEnabled true - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", properties["mapbox.sdk.token"] - buildConfigField "String", "CGR_USERNAME", properties["cgr.username"] - buildConfigField "String", "CGR_PASSWORD", properties["cgr.password"] - buildConfigField "String", "CGR_URL", properties["cgr.url"] + // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 + testCoverageEnabled false + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] + buildConfigField "String", "CGR_USERNAME", localProperties["cgr.username"] + buildConfigField "String", "CGR_PASSWORD", localProperties["cgr.password"] + buildConfigField "String", "CGR_URL", localProperties["cgr.url"] buildConfigField "long", "MAPBOX_DOWNLOAD_TILE_LIMIT", "6001" } } @@ -162,13 +63,13 @@ android { dependencies { configuration -> - //releaseTestKujakuImport(configuration) - developmentKujakuModulesImport(this, configuration) + //libraryModuleRelease(configuration) + libraryModuleDevelopment(this, configuration) implementation 'com.cocoahero.android:geojson:1.0.1@jar' implementation "com.android.volley:volley:${volleyVersion}" - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' }) @@ -177,12 +78,10 @@ dependencies { configuration -> implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0' - implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { - transitive = true; - } + firebaseCrashlytics(configuration) - implementation "com.android.support:appcompat-v7:${supportVersion}" - implementation "com.android.support:design:${supportVersion}" + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'com.google.android.material:material:1.0.0' implementation 'com.jakewharton.timber:timber:4.7.1' @@ -190,14 +89,14 @@ dependencies { configuration -> exclude group: "com.android.support", module: "appcompat-v7" } - implementation 'com.android.support:multidex:1.0.3' + implementation 'androidx.multidex:multidex:2.0.0' - testImplementation 'junit:junit:4.12' - testImplementation 'org.robolectric:robolectric:3.5.1' + testImplementation junit + testImplementation robolectric } // This is used for normal develoment of Kujaku -private static void developmentKujakuModulesImport(instance, configuration) { +private static void libraryModuleDevelopment(instance, configuration) { configuration.implementation(instance.project(":library")) { exclude group: 'com.google.code.findbugs', module: 'jsr305' exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-sdk' @@ -213,26 +112,40 @@ private static void developmentKujakuModulesImport(instance, configuration) { exclude group: 'org.jacoco' } - configuration.implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:${instance.mapboxSdkVersion}") { + configuration.implementation(instance.mapboxSDK) { transitive = true; exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-fragment' } - configuration.implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:${instance.mapboxAnnotationPluginVersion}" + configuration.implementation instance.mapboxSDKTurf + + configuration.implementation instance.mapboxAnnotationPlugin } // This is used when making a release and you need to test that the published artifacts work in host applications OK -private static void releaseTestKujakuImport(configuration) { +private static void libraryModuleRelease(configuration) { configuration.implementation 'io.ona.kujaku:library:0.9.0' } +private static void firebaseCrashlytics(configuration) { + // Import the BoM for the Firebase platform + configuration.implementation configuration.platform('com.google.firebase:firebase-bom:28.4.2') + + // Declare the dependencies for the Crashlytics and Analytics libraries + // When using the BoM, you don't specify versions in Firebase library dependencies + configuration.implementation 'com.google.firebase:firebase-crashlytics' + configuration.implementation 'com.google.firebase:firebase-analytics' +} + tasks.withType(Test) { jacoco.includeNoLocationClasses = true + jacoco.excludes = ['jdk.internal.*'] } -task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { +// createDebugCoverageReport is not available when android.buildTypes.debug.testCoverageEnabled is false +task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { //, 'createDebugCoverageReport']) { reports { xml.enabled = true @@ -244,12 +157,12 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'crea def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*' , 'android/**/*.*', "io/realm/*.*", "io/ona/kujaku/sample/activities/*.*"] - def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter) + def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/classes", excludes: fileFilter) def mainSrc = "${project.projectDir}/src/main/java" - sourceDirectories = files([mainSrc]) - classDirectories = files([debugTree]) - executionData = fileTree(dir: project.buildDir, includes: [ + sourceDirectories.setFrom(files([mainSrc])) + classDirectories.setFrom(files([debugTree])) + executionData.setFrom(fileTree(dir: project.buildDir, includes: [ 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' - ]) + ])) } diff --git a/sample/src/androidTest/java/io/ona/kujaku/sample/BaseRepositoryTest.java b/sample/src/androidTest/java/io/ona/kujaku/sample/BaseRepositoryTest.java index be75304cd..365a84589 100644 --- a/sample/src/androidTest/java/io/ona/kujaku/sample/BaseRepositoryTest.java +++ b/sample/src/androidTest/java/io/ona/kujaku/sample/BaseRepositoryTest.java @@ -1,7 +1,8 @@ package io.ona.kujaku.sample; import android.content.Context; -import android.support.test.runner.AndroidJUnit4; + +import androidx.test.runner.AndroidJUnit4; import org.junit.BeforeClass; import org.junit.runner.RunWith; diff --git a/sample/src/androidTest/java/io/ona/kujaku/sample/ExampleInstrumentedTest.java b/sample/src/androidTest/java/io/ona/kujaku/sample/ExampleInstrumentedTest.java index df5eae79c..cb26526c2 100644 --- a/sample/src/androidTest/java/io/ona/kujaku/sample/ExampleInstrumentedTest.java +++ b/sample/src/androidTest/java/io/ona/kujaku/sample/ExampleInstrumentedTest.java @@ -1,14 +1,15 @@ package io.ona.kujaku.sample; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + /** * Instrumentation test, which will execute on an Android device. * diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 912ea483e..49fc5d123 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -10,9 +10,6 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_base_layer_switcher.xml b/sample/src/main/res/layout/activity_base_layer_switcher.xml index 0ffd8c975..a1b1f7a5e 100644 --- a/sample/src/main/res/layout/activity_base_layer_switcher.xml +++ b/sample/src/main/res/layout/activity_base_layer_switcher.xml @@ -1,5 +1,5 @@ - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_bounding_box_listener_activity.xml b/sample/src/main/res/layout/activity_bounding_box_listener_activity.xml index 36c651b4a..b03f57e84 100644 --- a/sample/src/main/res/layout/activity_bounding_box_listener_activity.xml +++ b/sample/src/main/res/layout/activity_bounding_box_listener_activity.xml @@ -1,5 +1,5 @@ - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_bounds_aware.xml b/sample/src/main/res/layout/activity_bounds_aware.xml index f45a57477..beca8d6d2 100644 --- a/sample/src/main/res/layout/activity_bounds_aware.xml +++ b/sample/src/main/res/layout/activity_bounds_aware.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_card.xml b/sample/src/main/res/layout/activity_card.xml index b235afed5..d713d7b56 100644 --- a/sample/src/main/res/layout/activity_card.xml +++ b/sample/src/main/res/layout/activity_card.xml @@ -1,8 +1,8 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_case_relationship_activity.xml b/sample/src/main/res/layout/activity_case_relationship_activity.xml index d0a813f2d..390460558 100644 --- a/sample/src/main/res/layout/activity_case_relationship_activity.xml +++ b/sample/src/main/res/layout/activity_case_relationship_activity.xml @@ -1,5 +1,5 @@ - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_cgr_integration_activity.xml b/sample/src/main/res/layout/activity_cgr_integration_activity.xml index 7abf8e8e2..ffb8deabf 100644 --- a/sample/src/main/res/layout/activity_cgr_integration_activity.xml +++ b/sample/src/main/res/layout/activity_cgr_integration_activity.xml @@ -1,5 +1,5 @@ - - @@ -49,10 +49,10 @@ android:enabled="false" android:text="@string/restart_drill_down"/> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_configurable_location_circle.xml b/sample/src/main/res/layout/activity_configurable_location_circle.xml index ad91eb098..42c135b96 100644 --- a/sample/src/main/res/layout/activity_configurable_location_circle.xml +++ b/sample/src/main/res/layout/activity_configurable_location_circle.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_drawing_boundaries_map_view.xml b/sample/src/main/res/layout/activity_drawing_boundaries_map_view.xml index 99a626268..8c940588b 100644 --- a/sample/src/main/res/layout/activity_drawing_boundaries_map_view.xml +++ b/sample/src/main/res/layout/activity_drawing_boundaries_map_view.xml @@ -1,5 +1,5 @@ - - @@ -68,10 +68,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_feature_click_listener.xml b/sample/src/main/res/layout/activity_feature_click_listener.xml index a74e2b8d6..84a9dc30b 100644 --- a/sample/src/main/res/layout/activity_feature_click_listener.xml +++ b/sample/src/main/res/layout/activity_feature_click_listener.xml @@ -1,5 +1,5 @@ - - @@ -37,10 +37,10 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"/> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_feature_click_status.xml b/sample/src/main/res/layout/activity_feature_click_status.xml index dac6841e9..8f1545837 100644 --- a/sample/src/main/res/layout/activity_feature_click_status.xml +++ b/sample/src/main/res/layout/activity_feature_click_status.xml @@ -1,5 +1,5 @@ - - @@ -37,10 +37,10 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"/> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_foci_boundary.xml b/sample/src/main/res/layout/activity_foci_boundary.xml index f9aa00a52..e54a33e03 100644 --- a/sample/src/main/res/layout/activity_foci_boundary.xml +++ b/sample/src/main/res/layout/activity_foci_boundary.xml @@ -1,5 +1,5 @@ - - @@ -49,10 +49,10 @@ app:layout_constraintRight_toRightOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_high_level_location_add_point_map_view.xml b/sample/src/main/res/layout/activity_high_level_location_add_point_map_view.xml index 58d36ce01..0bdd6f055 100644 --- a/sample/src/main/res/layout/activity_high_level_location_add_point_map_view.xml +++ b/sample/src/main/res/layout/activity_high_level_location_add_point_map_view.xml @@ -1,5 +1,5 @@ - - @@ -39,10 +39,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_high_level_map_view.xml b/sample/src/main/res/layout/activity_high_level_map_view.xml index 1647f50e4..731408771 100644 --- a/sample/src/main/res/layout/activity_high_level_map_view.xml +++ b/sample/src/main/res/layout/activity_high_level_map_view.xml @@ -1,5 +1,5 @@ - - @@ -39,10 +39,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_low_level_location_add_point_map_view.xml b/sample/src/main/res/layout/activity_low_level_location_add_point_map_view.xml index aaa619125..007145a0f 100644 --- a/sample/src/main/res/layout/activity_low_level_location_add_point_map_view.xml +++ b/sample/src/main/res/layout/activity_low_level_location_add_point_map_view.xml @@ -1,5 +1,5 @@ - - @@ -67,10 +67,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_low_level_manual_add_point_map_view.xml b/sample/src/main/res/layout/activity_low_level_manual_add_point_map_view.xml index 0e601f36b..3261883f5 100644 --- a/sample/src/main/res/layout/activity_low_level_manual_add_point_map_view.xml +++ b/sample/src/main/res/layout/activity_low_level_manual_add_point_map_view.xml @@ -1,5 +1,5 @@ - - @@ -59,10 +59,10 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index cb31c780e..bd9f711e4 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - + diff --git a/sample/src/main/res/layout/activity_padded_bbox_activity.xml b/sample/src/main/res/layout/activity_padded_bbox_activity.xml index 660f040b5..6f259b83b 100644 --- a/sample/src/main/res/layout/activity_padded_bbox_activity.xml +++ b/sample/src/main/res/layout/activity_padded_bbox_activity.xml @@ -1,5 +1,5 @@ - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_passive_record_object_map_view.xml b/sample/src/main/res/layout/activity_passive_record_object_map_view.xml index a973a9c4f..27334ab49 100644 --- a/sample/src/main/res/layout/activity_passive_record_object_map_view.xml +++ b/sample/src/main/res/layout/activity_passive_record_object_map_view.xml @@ -1,5 +1,5 @@ - - @@ -67,10 +67,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_splitting_polygon_map_view.xml b/sample/src/main/res/layout/activity_splitting_polygon_map_view.xml index 67a8ee4b5..7ebf10b14 100644 --- a/sample/src/main/res/layout/activity_splitting_polygon_map_view.xml +++ b/sample/src/main/res/layout/activity_splitting_polygon_map_view.xml @@ -1,5 +1,5 @@ - - @@ -102,10 +102,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/app_bar.xml b/sample/src/main/res/layout/app_bar.xml index fa8e18d18..f5b766197 100644 --- a/sample/src/main/res/layout/app_bar.xml +++ b/sample/src/main/res/layout/app_bar.xml @@ -1,16 +1,16 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/content_add_update_properties.xml b/sample/src/main/res/layout/content_add_update_properties.xml index 90615f4d7..a639c21d9 100644 --- a/sample/src/main/res/layout/content_add_update_properties.xml +++ b/sample/src/main/res/layout/content_add_update_properties.xml @@ -1,5 +1,5 @@ - - @@ -55,9 +55,9 @@ app:mapbox_uiLogoMarginRight="30dp" app:mapbox_uiAttributionGravity="right|end|top" /> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/content_bounds_aware.xml b/sample/src/main/res/layout/content_bounds_aware.xml index 72c2650e1..16f34a800 100644 --- a/sample/src/main/res/layout/content_bounds_aware.xml +++ b/sample/src/main/res/layout/content_bounds_aware.xml @@ -1,5 +1,5 @@ - - @@ -45,10 +45,10 @@ app:mapbox_uiLogoMarginRight="30dp" app:mapbox_uiAttributionGravity="right|end|top" /> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/content_card.xml b/sample/src/main/res/layout/content_card.xml index 2d6ca997d..1318854f1 100644 --- a/sample/src/main/res/layout/content_card.xml +++ b/sample/src/main/res/layout/content_card.xml @@ -1,5 +1,5 @@ - - + + - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/content_configurable_location_circle.xml b/sample/src/main/res/layout/content_configurable_location_circle.xml index b792add0e..8d944bac1 100644 --- a/sample/src/main/res/layout/content_configurable_location_circle.xml +++ b/sample/src/main/res/layout/content_configurable_location_circle.xml @@ -1,4 +1,4 @@ - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/navigation_view.xml b/sample/src/main/res/layout/navigation_view.xml index 0f5ed7f90..bc7bf51ac 100644 --- a/sample/src/main/res/layout/navigation_view.xml +++ b/sample/src/main/res/layout/navigation_view.xml @@ -1,5 +1,5 @@ - - - + diff --git a/sample/src/main/res/layout/task_queue_activity.xml b/sample/src/main/res/layout/task_queue_activity.xml index be79128de..7cefc4c12 100644 --- a/sample/src/main/res/layout/task_queue_activity.xml +++ b/sample/src/main/res/layout/task_queue_activity.xml @@ -1,5 +1,5 @@ - - + diff --git a/sample/src/main/res/layout/wmts_map_view.xml b/sample/src/main/res/layout/wmts_map_view.xml index c5442f225..554e36245 100644 --- a/sample/src/main/res/layout/wmts_map_view.xml +++ b/sample/src/main/res/layout/wmts_map_view.xml @@ -1,5 +1,5 @@ - - @@ -39,10 +39,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/test/java/io/ona/kujaku/sample/activities/MainActivityTest.java b/sample/src/test/java/io/ona/kujaku/sample/activities/MainActivityTest.java index a992b5a51..cc4eb0c7d 100644 --- a/sample/src/test/java/io/ona/kujaku/sample/activities/MainActivityTest.java +++ b/sample/src/test/java/io/ona/kujaku/sample/activities/MainActivityTest.java @@ -25,8 +25,7 @@ * Created by Ephraim Kigamba - ekigamba@ona.io on 27/12/2017. */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class - , manifest = Config.NONE +@Config(manifest = Config.NONE , qualifiers = "en-port" , application = TestApplication.class) public class MainActivityTest { diff --git a/utils/build.gradle b/utils/build.gradle index 30b972dd3..2dce714df 100644 --- a/utils/build.gradle +++ b/utils/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.jfrog.bintray' apply plugin: 'maven-publish' apply plugin: 'jacoco' -version '0.8.0' +version '0.9.0' project.version = this.version @@ -26,7 +26,7 @@ android { targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName this.version - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildTypes { @@ -36,7 +36,8 @@ android { } debug { - testCoverageEnabled true + // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 + testCoverageEnabled false } } @@ -46,26 +47,34 @@ android { } dependencies { - androidTestImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', { + androidTestImplementation ('androidx.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' }) - implementation "com.android.support:appcompat-v7:${supportVersion}" + implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'com.cocoahero.android:geojson:1.0.1@jar' - implementation ("com.mapbox.mapboxsdk:mapbox-android-sdk:${mapboxSdkVersion}") { + implementation (mapboxSDK) { transitive = true exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-fragment' } - testImplementation 'junit:junit:4.12' - testImplementation 'org.robolectric:robolectric:3.5.1' + // The local build has an issue fetching this library for some reason which + // is a dependency of the mapbox-android-sdk. The mapbox-sdk-turf is declared as + // a runtime dependency + implementation mapboxSDKTurf + //implementation mapboxAnnotationPlugin + + testImplementation junit + testImplementation robolectric } tasks.withType(Test) { jacoco.includeNoLocationClasses = true + jacoco.excludes = ['jdk.internal.*'] } -task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { +// createDebugCoverageReport is not available when android.buildTypes.debug.testCoverageEnabled is false +task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { //, 'createDebugCoverageReport']) { reports { xml.enabled = true @@ -77,14 +86,18 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'crea def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*' , 'android/**/*.*', "io/realm/*.*"] - def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter) + def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/classes", excludes: fileFilter) def mainSrc = "${project.projectDir}/src/main/java" - sourceDirectories = files([mainSrc]) - classDirectories = files([debugTree]) - executionData = fileTree(dir: project.buildDir, includes: [ + sourceDirectories.setFrom(files([mainSrc])) + classDirectories.setFrom(files([debugTree])) + executionData.setFrom(fileTree(dir: project.buildDir, includes: [ 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' - ]) + ])) +} + +task printTasks { + System.out.println("Jacoco version ${jacoco.toolVersion}") } // Add github packages, maven-central and sonatype publishing diff --git a/utils/src/main/java/io/ona/kujaku/utils/CoordinateUtils.java b/utils/src/main/java/io/ona/kujaku/utils/CoordinateUtils.java index 29137b1b2..24d8fc4c6 100644 --- a/utils/src/main/java/io/ona/kujaku/utils/CoordinateUtils.java +++ b/utils/src/main/java/io/ona/kujaku/utils/CoordinateUtils.java @@ -1,7 +1,7 @@ package io.ona.kujaku.utils; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/utils/src/main/java/io/ona/kujaku/utils/config/DataSourceConfig.java b/utils/src/main/java/io/ona/kujaku/utils/config/DataSourceConfig.java index 99be1535b..b0f693e32 100644 --- a/utils/src/main/java/io/ona/kujaku/utils/config/DataSourceConfig.java +++ b/utils/src/main/java/io/ona/kujaku/utils/config/DataSourceConfig.java @@ -1,6 +1,6 @@ package io.ona.kujaku.utils.config; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.json.JSONException; diff --git a/utils/src/main/java/io/ona/kujaku/utils/config/InfoWindowConfig.java b/utils/src/main/java/io/ona/kujaku/utils/config/InfoWindowConfig.java index d662e7e10..dac503c8b 100644 --- a/utils/src/main/java/io/ona/kujaku/utils/config/InfoWindowConfig.java +++ b/utils/src/main/java/io/ona/kujaku/utils/config/InfoWindowConfig.java @@ -1,6 +1,6 @@ package io.ona.kujaku.utils.config; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.json.JSONArray; diff --git a/utils/src/main/java/io/ona/kujaku/utils/config/KujakuConfig.java b/utils/src/main/java/io/ona/kujaku/utils/config/KujakuConfig.java index c5dcea6f8..8eff03c2b 100644 --- a/utils/src/main/java/io/ona/kujaku/utils/config/KujakuConfig.java +++ b/utils/src/main/java/io/ona/kujaku/utils/config/KujakuConfig.java @@ -1,6 +1,6 @@ package io.ona.kujaku.utils.config; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONArray; import org.json.JSONException; diff --git a/utils/src/main/java/io/ona/kujaku/utils/config/SortFieldConfig.java b/utils/src/main/java/io/ona/kujaku/utils/config/SortFieldConfig.java index 3dfe686f0..033557081 100644 --- a/utils/src/main/java/io/ona/kujaku/utils/config/SortFieldConfig.java +++ b/utils/src/main/java/io/ona/kujaku/utils/config/SortFieldConfig.java @@ -1,6 +1,6 @@ package io.ona.kujaku.utils.config; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.json.JSONException; diff --git a/utils/src/main/java/io/ona/kujaku/utils/helpers/MapBoxStyleHelper.java b/utils/src/main/java/io/ona/kujaku/utils/helpers/MapBoxStyleHelper.java index 6b04c2e1f..a6fd2d5a6 100644 --- a/utils/src/main/java/io/ona/kujaku/utils/helpers/MapBoxStyleHelper.java +++ b/utils/src/main/java/io/ona/kujaku/utils/helpers/MapBoxStyleHelper.java @@ -1,7 +1,7 @@ package io.ona.kujaku.utils.helpers; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.mapbox.mapboxsdk.geometry.LatLng; diff --git a/utils/src/test/java/io/ona/kujaku/helpers/MapBoxStyleHelperTest.java b/utils/src/test/java/io/ona/kujaku/helpers/MapBoxStyleHelperTest.java index 26e4c9be6..7d13bea96 100644 --- a/utils/src/test/java/io/ona/kujaku/helpers/MapBoxStyleHelperTest.java +++ b/utils/src/test/java/io/ona/kujaku/helpers/MapBoxStyleHelperTest.java @@ -22,7 +22,6 @@ */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, manifest = Config.NONE) public class MapBoxStyleHelperTest { /** diff --git a/utils/src/test/java/io/ona/kujaku/helpers/converters/GeoJSONHelperTest.java b/utils/src/test/java/io/ona/kujaku/helpers/converters/GeoJSONHelperTest.java index fb2cb3c0b..3efbcb504 100644 --- a/utils/src/test/java/io/ona/kujaku/helpers/converters/GeoJSONHelperTest.java +++ b/utils/src/test/java/io/ona/kujaku/helpers/converters/GeoJSONHelperTest.java @@ -25,7 +25,7 @@ */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, manifest = Config.NONE) +@Config(manifest = Config.NONE) public class GeoJSONHelperTest { @Test diff --git a/utils/src/test/java/io/ona/kujaku/utils/config/DataSourceConfigTest.java b/utils/src/test/java/io/ona/kujaku/utils/config/DataSourceConfigTest.java index 2b418d631..d6218d223 100644 --- a/utils/src/test/java/io/ona/kujaku/utils/config/DataSourceConfigTest.java +++ b/utils/src/test/java/io/ona/kujaku/utils/config/DataSourceConfigTest.java @@ -18,7 +18,7 @@ */ @RunWith(RobolectricTestRunner.class) -@org.robolectric.annotation.Config(constants = BuildConfig.class, manifest = org.robolectric.annotation.Config.NONE) +@org.robolectric.annotation.Config(manifest = org.robolectric.annotation.Config.NONE) public class DataSourceConfigTest { @Test public void testConstructor() throws JSONException, InvalidMapBoxStyleException { diff --git a/utils/src/test/java/io/ona/kujaku/utils/config/InfoWindowConfigTest.java b/utils/src/test/java/io/ona/kujaku/utils/config/InfoWindowConfigTest.java index 5fc6119eb..1c7c4a4d3 100644 --- a/utils/src/test/java/io/ona/kujaku/utils/config/InfoWindowConfigTest.java +++ b/utils/src/test/java/io/ona/kujaku/utils/config/InfoWindowConfigTest.java @@ -17,7 +17,7 @@ */ @RunWith(RobolectricTestRunner.class) -@org.robolectric.annotation.Config(constants = BuildConfig.class, manifest = org.robolectric.annotation.Config.NONE) +@org.robolectric.annotation.Config(manifest = org.robolectric.annotation.Config.NONE) public class InfoWindowConfigTest { @Test diff --git a/utils/src/test/java/io/ona/kujaku/utils/config/KujakuConfigTest.java b/utils/src/test/java/io/ona/kujaku/utils/config/KujakuConfigTest.java index 7aa0223a2..b45781f99 100644 --- a/utils/src/test/java/io/ona/kujaku/utils/config/KujakuConfigTest.java +++ b/utils/src/test/java/io/ona/kujaku/utils/config/KujakuConfigTest.java @@ -18,7 +18,7 @@ */ @RunWith(RobolectricTestRunner.class) -@Config(constants = BuildConfig.class, manifest = Config.NONE) +@Config(manifest = Config.NONE) public class KujakuConfigTest { @Test diff --git a/utils/src/test/java/io/ona/kujaku/utils/config/SortFieldConfigTest.java b/utils/src/test/java/io/ona/kujaku/utils/config/SortFieldConfigTest.java index d5d1af9fd..fb9c94833 100644 --- a/utils/src/test/java/io/ona/kujaku/utils/config/SortFieldConfigTest.java +++ b/utils/src/test/java/io/ona/kujaku/utils/config/SortFieldConfigTest.java @@ -16,7 +16,7 @@ * Created by Jason Rogena - jrogena@ona.io on 1/3/18. */ @RunWith(RobolectricTestRunner.class) -@org.robolectric.annotation.Config(constants = BuildConfig.class, manifest = org.robolectric.annotation.Config.NONE) +@org.robolectric.annotation.Config(manifest = org.robolectric.annotation.Config.NONE) public class SortFieldConfigTest { @Test public void testConstructor() throws JSONException, InvalidMapBoxStyleException { diff --git a/wrapper/build.gradle b/wrapper/build.gradle index 187964fe8..3ca288ace 100644 --- a/wrapper/build.gradle +++ b/wrapper/build.gradle @@ -1,10 +1,3 @@ -allprojects { - repositories { - maven { url "https://dl.google.com/dl/android/maven2/" } - //maven { url "http://dl.bintray.com/ona/kujaku" } - } -} - apply plugin: 'com.android.application' apply plugin: 'jacoco' @@ -28,8 +21,8 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' + multiDexEnabled true } buildTypes { @@ -39,7 +32,8 @@ android { } debug { - testCoverageEnabled true + // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 + testCoverageEnabled false } } @@ -50,24 +44,27 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'android.arch.lifecycle:runtime:1.1.0' + implementation 'androidx.lifecycle:lifecycle-runtime:2.0.0' implementation (project(':library')) { exclude group: 'com.google.code.findbugs', module: 'jsr305' } - androidTestImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', { + androidTestImplementation ('androidx.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' }) - implementation "com.android.support:appcompat-v7:${supportVersion}" - testImplementation 'junit:junit:4.12' + implementation 'androidx.appcompat:appcompat:1.0.0' + testImplementation junit + implementation 'androidx.multidex:multidex:2.0.0' } tasks.withType(Test) { jacoco.includeNoLocationClasses = true + jacoco.excludes = ['jdk.internal.*'] } -task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { +// createDebugCoverageReport is not available when android.buildTypes.debug.testCoverageEnabled is false +task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { //, 'createDebugCoverageReport']) { reports { xml.enabled = true @@ -79,12 +76,12 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'crea def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*' , 'android/**/*.*', "io/realm/*.*"] - def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter) + def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/classes", excludes: fileFilter) def mainSrc = "${project.projectDir}/src/main/java" - sourceDirectories = files([mainSrc]) - classDirectories = files([debugTree]) - executionData = fileTree(dir: project.buildDir, includes: [ + sourceDirectories.setFrom(files([mainSrc])) + classDirectories.setFrom(files([debugTree])) + executionData.setFrom(fileTree(dir: project.buildDir, includes: [ 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' - ]) + ])) } \ No newline at end of file diff --git a/wrapper/src/main/java/io/ona/kujaku/wrapper/OfflineMapDownloderActivity.java b/wrapper/src/main/java/io/ona/kujaku/wrapper/OfflineMapDownloderActivity.java index ee4ad9b98..9684a11e8 100644 --- a/wrapper/src/main/java/io/ona/kujaku/wrapper/OfflineMapDownloderActivity.java +++ b/wrapper/src/main/java/io/ona/kujaku/wrapper/OfflineMapDownloderActivity.java @@ -1,8 +1,9 @@ package io.ona.kujaku.wrapper; -import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; + public class OfflineMapDownloderActivity extends AppCompatActivity { @Override