[android] - introduce MapboxMapOptins facility creation method.
This commit is contained in:
@@ -91,7 +91,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
@UiThread
|
||||
public MapView(@NonNull Context context) {
|
||||
super(context);
|
||||
initialize(context, MapboxMapOptions.createFromAttributes(context, null));
|
||||
initialize(context, MapboxMapOptions.createFromAttributes(context));
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@@ -109,7 +109,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
@UiThread
|
||||
public MapView(@NonNull Context context, @Nullable MapboxMapOptions options) {
|
||||
super(context);
|
||||
initialize(context, options == null ? MapboxMapOptions.createFromAttributes(context, null) : options);
|
||||
initialize(context, options == null ? MapboxMapOptions.createFromAttributes(context) : options);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
|
||||
import com.mapbox.mapboxsdk.R;
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
@@ -136,7 +137,18 @@ public class MapboxMapOptions implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MapboxMapsOptions from the attribute set.s
|
||||
* Creates a default MapboxMapsOptions from a given context.
|
||||
*
|
||||
* @param context Context related to a map view.
|
||||
* @return the MapboxMapOptions created from attributes
|
||||
*/
|
||||
@NonNull
|
||||
public static MapboxMapOptions createFromAttributes(@NonNull Context context) {
|
||||
return createFromAttributes(context, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MapboxMapsOptions from the attribute set.
|
||||
*
|
||||
* @param context Context related to a map view.
|
||||
* @param attrs Attributeset containing configuration
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MapFragmentUtils {
|
||||
options = args.getParcelable(MapboxConstants.FRAG_ARG_MAPBOXMAPOPTIONS);
|
||||
} else {
|
||||
// load default options
|
||||
options = MapboxMapOptions.createFromAttributes(context, null);
|
||||
options = MapboxMapOptions.createFromAttributes(context);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user