Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compileSDKVersion to 29, android:requestLegacyExternalStorage for Android 10, change file path for copying odk constraints #174

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions MapboxAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ repositories {
}

dependencies {
compile 'com.vividsolutions:jts:1.13'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'commons-codec:commons-codec:1.10'
compile 'commons-io:commons-io:2.4'
implementation 'com.vividsolutions:jts:1.13'
implementation "com.android.support:appcompat-v7:28.0.0"
implementation 'com.squareup.okhttp:okhttp:2.4.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'commons-codec:commons-codec:1.10'
implementation 'commons-io:commons-io:2.4'
}

android {
Expand Down Expand Up @@ -85,7 +85,7 @@ android.libraryVariants.all { variant ->
destinationDir = new File(destinationDir, variant.baseName)
source = files(variant.javaCompile.source)
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
doFirst { classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) }
options.links("http://docs.oracle.com/javase/7/docs/api/")
options.links("http://d.android.com/reference/")
exclude '**/R.html', '**/R.*.html'
Expand Down
6 changes: 3 additions & 3 deletions MapboxAndroidSDK/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ POM_DEVELOPER_ID=mapbox
POM_DEVELOPER_NAME=Mapbox

ANDROID_MIN_SDK=9
ANDROID_BUILD_TARGET_SDK_VERSION=22
ANDROID_BUILD_TOOLS_VERSION=22.0.1
ANDROID_BUILD_SDK_VERSION=22
ANDROID_BUILD_TARGET_SDK_VERSION=29
ANDROID_BUILD_TOOLS_VERSION=28.0.3
ANDROID_BUILD_SDK_VERSION=29

POM_NAME=Mapbox SDK
POM_ARTIFACT_ID=mapbox-android-sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public float getCurrentSpan() {
if (mCurrLen == -1) {
final float cvx = mCurrFingerDiffX;
final float cvy = mCurrFingerDiffY;
mCurrLen = FloatMath.sqrt(cvx * cvx + cvy * cvy);
mCurrLen = (float) Math.sqrt(cvx * cvx + cvy * cvy);
}
return mCurrLen;
}
Expand All @@ -107,7 +107,7 @@ public float getPreviousSpan() {
if (mPrevLen == -1) {
final float pvx = mPrevFingerDiffX;
final float pvy = mPrevFingerDiffY;
mPrevLen = FloatMath.sqrt(pvx * pvx + pvy * pvy);
mPrevLen = (float) Math.sqrt(pvx * pvx + pvy * pvy);
}
return mPrevLen;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ public boolean getNetworkAvailable() {
final NetworkInfo networkInfo = mConnectionManager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isAvailable();
}

public boolean getWiFiNetworkAvailable() {
final NetworkInfo wifi = mConnectionManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
return wifi != null && wifi.isAvailable();
}

public boolean getCellularDataNetworkAvailable() {
final NetworkInfo mobile =
mConnectionManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
return mobile != null && mobile.isAvailable();
}

public boolean getRouteToPathExists(final int hostAddress) {
return (mConnectionManager.requestRouteToHost(ConnectivityManager.TYPE_WIFI, hostAddress)
|| mConnectionManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE,
hostAddress));
}
//
// public boolean getWiFiNetworkAvailable() {
// final NetworkInfo wifi = mConnectionManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
// return wifi != null && wifi.isAvailable();
// }
//
// public boolean getCellularDataNetworkAvailable() {
// final NetworkInfo mobile =
// mConnectionManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
// return mobile != null && mobile.isAvailable();
// }
//
// public boolean getRouteToPathExists(final int hostAddress) {
// return (mConnectionManager.requestRouteToHost(ConnectivityManager.TYPE_WIFI, hostAddress)
// || mConnectionManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE,
// hostAddress));
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ public boolean clipRect(final Rect rect) {
@Override
public boolean clipRegion(final Region region, final Op op) {
region.translate(xOffset, yOffset);
return getWrappedCanvas().clipRegion(region, op);
return true;
}

@Override
public boolean clipRegion(final Region region) {
region.translate(xOffset, yOffset);
return getWrappedCanvas().clipRegion(region);
return true;
}

@Override
Expand Down Expand Up @@ -478,7 +478,7 @@ public int save() {
@Override
public int save(int saveFlags) {

return getWrappedCanvas().save(saveFlags);
return getWrappedCanvas().save();
}

@Override
Expand Down
38 changes: 19 additions & 19 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apply plugin: 'com.android.application'

ext {
supportLibVersion = '23.1.1'
supportLibVersion = '28.0.0'
}

android {
compileSdkVersion 26
compileSdkVersion 29
buildToolsVersion '28.0.3'

defaultConfig {
applicationId "org.redcross.openmapkit"
minSdkVersion 16
targetSdkVersion 26
targetSdkVersion 29
versionCode 23
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -22,7 +22,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
Expand All @@ -35,19 +38,16 @@ repositories {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.google.guava', name: 'guava', version: '18.0'
compile 'org.apache.commons:commons-lang3:3.0'
compile 'commons-io:commons-io:2.4'
compile 'com.nanohttpd:nanohttpd-webserver:2.1.1'
compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
compile 'com.google.zxing:core:3.2.1'
compile project(':MapboxAndroidSDK')
compile "com.android.support:support-annotations:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
androidTestCompile 'com.android.support.test:runner:0.5'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation group: 'com.google.guava', name: 'guava', version: '18.0'
implementation 'org.apache.commons:commons-lang3:3.0'
implementation 'commons-io:commons-io:2.6'
implementation 'com.nanohttpd:nanohttpd-webserver:2.1.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
implementation 'com.google.zxing:core:3.3.0'
implementation project(':MapboxAndroidSDK')
implementation "com.android.support:support-annotations:${supportLibVersion}"
implementation "com.android.support:design:${supportLibVersion}"
//noinspection GradleCompatible
implementation "com.android.support:appcompat-v7:28.0.0"
}
18 changes: 18 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "org.redcross.openmapkit",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 23,
"versionName": "1.2",
"outputFile": "app-release.apk"
}
]
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:icon="@mipmap/ic_omk_nobg_green"
android:label="@string/app_name"
android:largeHeap="true"
android:requestLegacyExternalStorage="true"
android:theme="@style/AppTheme">
<activity
android:name=".MapActivity"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/constraints/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
"source": {
"implicit": "survey"
}
}
}
9 changes: 4 additions & 5 deletions app/src/main/java/org/redcross/openmapkit/Constraints.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.json.JSONObject;
import org.redcross.openmapkit.odkcollect.ODKCollectHandler;
import org.redcross.openmapkit.odkcollect.tag.ODKTag;
import org.redcross.openmapkit.tagswipe.TagEdit;

import java.io.File;
import java.util.Collection;
Expand All @@ -27,7 +26,7 @@ public class Constraints {
/**
* Contains a map of constraint keys with the key value pairs of the
* OSM Element conditions in which a tag view should be hidden.
*
* <p>
* The key of the outer map is to the tag in question
*/
private Map<String, Map<String, String>> hideMap = new HashMap<>();
Expand All @@ -41,7 +40,7 @@ public class Constraints {
/**
* Contains a map of constraint keys with the key value pairs of the
* OSM Element conditions in which a tag view should be shown.
*
* <p>
* The key of the outer map is to the tag in question.
*/
private Map<String, Map<String, String>> showMap = new HashMap<>();
Expand Down Expand Up @@ -99,7 +98,7 @@ public Set<String> requiredTagsNotMet(OSMElement osmElement) {

if (ODKCollectHandler.isODKCollectMode()) {
Map<String, String> tags = osmElement.getTags();
Collection<ODKTag> odkTags = ODKCollectHandler.getODKCollectData().getRequiredTags();
Collection<ODKTag> odkTags = ODKCollectHandler.getODKCollectData().getRequiredTags();
for (ODKTag odkTag : odkTags) {
String odkTagKey = odkTag.getKey();
if (cascadeBooleanTagConstraint(odkTagKey, "required", false)) {
Expand Down Expand Up @@ -174,7 +173,7 @@ public boolean tagShouldBeShown(String tagKey, OSMElement osmElement) {
/**
* If the tag has an implicit value, it returns it.
* Otherwise, it returns null.
*
* <p>
* This is how to test if the tag should be considered implicit.
*
* @param tagKey
Expand Down
Loading