[android] - allow setting an OkHttpClient
This commit is contained in:
@@ -234,4 +234,8 @@ class HTTPRequest implements Callback {
|
||||
static void enablePrintRequestUrlOnFailure(boolean enabled) {
|
||||
logRequestUrl = enabled;
|
||||
}
|
||||
|
||||
static void setOKHttpClient(OkHttpClient client) {
|
||||
mClient = client;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user