summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2019-07-08 11:29:34 +0200
committerTobrun <tobrun.van.nuland@gmail.com>2019-07-08 16:33:26 +0200
commitee0d831a2f004d9ec82c498eecc03676b54e73ea (patch)
tree79829b92de721c2147d9af544211da35165865a0
parent532e9dc6ae1f62c7c46f24b1277240440ecfe9ea (diff)
downloadqtlocation-mapboxgl-ee0d831a2f004d9ec82c498eecc03676b54e73ea.tar.gz
[android] - introduce MapboxMapOptins facility creation method.
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java14
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java2
7 files changed, 21 insertions, 9 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index 81cd1830e6..1367de8729 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -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
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
index cc2124c6c7..09bb5012d1 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
@@ -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
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java
index f3c8fd32cf..884e0a42be 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MapFragmentUtils.java
@@ -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;
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt
index 67e0d678d7..de7f0bb5ac 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt
@@ -105,7 +105,7 @@ class NestedViewPagerActivity : AppCompatActivity() {
class MapPagerAdapter(private val context: Context, fm: FragmentManager?) : FragmentStatePagerAdapter(fm) {
override fun getItem(position: Int): Fragment {
- val options = MapboxMapOptions.createFromAttributes(context, null)
+ val options = MapboxMapOptions.createFromAttributes(context)
options.textureMode(true)
options.doubleTapGesturesEnabled(false)
options.rotateGesturesEnabled(false)
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt
index b6fba01d81..d1cb9acab6 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt
@@ -45,7 +45,7 @@ class ViewPagerActivity : AppCompatActivity() {
}
override fun getItem(position: Int): Fragment? {
- val options = MapboxMapOptions.createFromAttributes(context, null)
+ val options = MapboxMapOptions.createFromAttributes(context)
options.textureMode(true)
options.camera(
CameraPosition.Builder()
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java
index 4af6777995..9db7cb2c9d 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java
@@ -133,7 +133,7 @@ public class BottomSheetActivity extends AppCompatActivity {
Bundle bundle = new Bundle();
bundle.putInt("mapcounter", mapCounter);
mapFragment.setArguments(bundle);
- MapboxMapOptions mapboxMapOptions = MapboxMapOptions.createFromAttributes(context, null);
+ MapboxMapOptions mapboxMapOptions = MapboxMapOptions.createFromAttributes(context);
mapFragment.setArguments(MapFragmentUtils.createFragmentArgs(mapboxMapOptions));
return mapFragment;
}
@@ -211,7 +211,7 @@ public class BottomSheetActivity extends AppCompatActivity {
public static BottomSheetFragment newInstance(Context context) {
BottomSheetFragment mapFragment = new BottomSheetFragment();
- MapboxMapOptions mapboxMapOptions = MapboxMapOptions.createFromAttributes(context, null);
+ MapboxMapOptions mapboxMapOptions = MapboxMapOptions.createFromAttributes(context);
mapboxMapOptions.renderSurfaceOnTop(true);
mapFragment.setArguments(MapFragmentUtils.createFragmentArgs(mapboxMapOptions));
return mapFragment;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java
index 689ce1f0a7..3d65a92f72 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java
@@ -117,7 +117,7 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap.
setContentView(R.layout.activity_symbollayer);
// Create map configuration
- MapboxMapOptions mapboxMapOptions = MapboxMapOptions.createFromAttributes(this, null);
+ MapboxMapOptions mapboxMapOptions = MapboxMapOptions.createFromAttributes(this);
mapboxMapOptions.camera(new CameraPosition.Builder().target(
new LatLng(52.35273, 4.91638))
.zoom(13)