summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-01-17 15:54:49 +0100
committerTobrun <tobrun@mapbox.com>2018-01-23 12:09:48 +0100
commit6e5ddfae9505b03885933edc19cad6a9009f17f6 (patch)
treead0839bf2edbef7a32e04ffac0cc9288fbdb85e7
parentc3068ec3975c0c13486c5a456cc9ae26baf4f755 (diff)
downloadqtlocation-mapboxgl-6e5ddfae9505b03885933edc19cad6a9009f17f6.tar.gz
[android] - allow setting an OkHttpClient
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUtil.java13
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java4
4 files changed, 19 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
index 945fb0ba47..da27ee7bb8 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
@@ -234,4 +234,8 @@ class HTTPRequest implements Callback {
static void enablePrintRequestUrlOnFailure(boolean enabled) {
logRequestUrl = enabled;
}
+
+ static void setOKHttpClient(OkHttpClient client) {
+ mClient = client;
+ }
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUtil.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUtil.java
index 5afe3b6572..872032867a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUtil.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUtil.java
@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.http;
+import okhttp3.OkHttpClient;
+
/**
* Utility class for setting HttpRequest configurations
*/
@@ -28,8 +30,17 @@ public class HttpRequestUtil {
*
* @param enabled True will print urls, false will disable
*/
- public static void setPrintRequestUrlOnFaillure(boolean enabled) {
+ public static void setPrintRequestUrlOnFailure(boolean enabled) {
HTTPRequest.enablePrintRequestUrlOnFailure(enabled);
}
+ /**
+ * Set the OkHttpClient used for requesting map resources.
+ *
+ * @param client the OkHttpClient
+ */
+ public static void setOkHttpClient(OkHttpClient client) {
+ HTTPRequest.setOKHttpClient(client);
+ }
+
} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
index 7fa85ae550..84a601039f 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
@@ -261,7 +261,7 @@ final class Transform implements MapView.OnMapChangedListener {
setZoom(zoom, focalPoint, 0, false);
}
- void setZoom(double zoom, @NonNull PointF focalPoint, long duration, boolean isAnimator) {
+ void setZoom(double zoom, @NonNull PointF focalPoint, long duration, final boolean isAnimator) {
if (mapView != null) {
mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
index 3fb91f90e9..f597f67555 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
@@ -57,7 +57,7 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- HttpRequestUtil.setPrintRequestUrlOnFaillure(true);
+ HttpRequestUtil.setPrintRequestUrlOnFailure(true);
setContentView(R.layout.activity_debug_mode);
setupToolbar();
setupMapView(savedInstanceState);
@@ -231,7 +231,7 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
- HttpRequestUtil.setPrintRequestUrlOnFaillure(false);
+ HttpRequestUtil.setPrintRequestUrlOnFailure(false);
}
@Override