[android] - allow setting an OkHttpClient

This commit is contained in:
Tobrun
2018-01-17 15:54:49 +01:00
committed by Tobrun
parent c3068ec397
commit 6e5ddfae95
4 changed files with 19 additions and 4 deletions

View File

@@ -234,4 +234,8 @@ class HTTPRequest implements Callback {
static void enablePrintRequestUrlOnFailure(boolean enabled) {
logRequestUrl = enabled;
}
static void setOKHttpClient(OkHttpClient client) {
mClient = client;
}
}

View File

@@ -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);
}
}

View File

@@ -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