From 6fbada4b1962b979132c9724be66b939b96f9381 Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Tue, 23 Feb 2021 15:30:33 +0200 Subject: [PATCH] [style-extension] Rename reference to style plugin and converting them to style extension. (#123) --- .../testapp/examples/DSLStylingActivity.kt | 2 +- .../examples/RuntimeStylingActivity.kt | 6 ++-- .../extension/style/StyleExtensionImpl.kt | 6 ++-- .../style/image/ImageExtensionImpl.kt | 2 +- .../maps/extension/style/layers/Layer.kt | 10 +++---- .../extension/style/light/generated/Light.kt | 6 ++-- .../maps/extension/style/sources/Source.kt | 4 +-- .../style/terrain/generated/Terrain.kt | 4 +-- .../maps/extension/style/StyleContract.kt | 2 +- .../main/java/com/mapbox/maps/MapboxMap.kt | 12 ++++---- .../java/com/mapbox/maps/MapboxMapTest.kt | 28 +++++++++---------- .../maps/plugin/MapDelegateProviderTest.kt | 2 +- 12 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/DSLStylingActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/DSLStylingActivity.kt index a2045eb2c0..e0e418700f 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/DSLStylingActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/DSLStylingActivity.kt @@ -22,7 +22,7 @@ import java.text.DateFormat.getDateTimeInstance import java.util.* /** - * Example showcasing usage of style-plugin. + * Example showcasing usage of style extension. */ class DSLStylingActivity : AppCompatActivity(), OnMapClickListener { diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/RuntimeStylingActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/RuntimeStylingActivity.kt index bb8e2f0cd0..35413fd612 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/RuntimeStylingActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/RuntimeStylingActivity.kt @@ -26,7 +26,7 @@ import kotlinx.android.synthetic.main.activity_simple_map.* import java.nio.ByteBuffer /** - * Example showcasing usage of style-plugin. + * Example showcasing usage of style extension. */ class RuntimeStylingActivity : AppCompatActivity() { @@ -55,7 +55,7 @@ class RuntimeStylingActivity : AppCompatActivity() { addImageSource(style) addRasterLayer(style) - addLayerWithoutStylePlugin(style) + addLayerWithoutStyleExtension(style) val source = style.getSource("composite") as VectorSource Logger.e(TAG, "getSource: $source") @@ -333,7 +333,7 @@ class RuntimeStylingActivity : AppCompatActivity() { style.addLayer(raster) } - private fun addLayerWithoutStylePlugin(style: Style) { + private fun addLayerWithoutStyleExtension(style: Style) { val bitmap = ContextCompat.getDrawable(this, R.drawable.android_symbol)?.toBitmap(64, 64) val byteBuffer = ByteBuffer.allocate(bitmap!!.byteCount) bitmap.copyPixelsToBuffer(byteBuffer) diff --git a/extension-style/src/main/java/com/mapbox/maps/extension/style/StyleExtensionImpl.kt b/extension-style/src/main/java/com/mapbox/maps/extension/style/StyleExtensionImpl.kt index d1effe56d0..f5b3f84835 100644 --- a/extension-style/src/main/java/com/mapbox/maps/extension/style/StyleExtensionImpl.kt +++ b/extension-style/src/main/java/com/mapbox/maps/extension/style/StyleExtensionImpl.kt @@ -9,7 +9,7 @@ import com.mapbox.maps.extension.style.sources.* import com.mapbox.maps.extension.style.terrain.generated.Terrain /** - * The concrete implementation of style plugin. + * The concrete implementation of style extension. */ class StyleExtensionImpl private constructor(builder: Builder) : StyleContract.StyleExtension { @@ -44,7 +44,7 @@ class StyleExtensionImpl private constructor(builder: Builder) : StyleContract.S override val terrain: Terrain? = builder.terrain /** - * The builder for style plugin. + * The builder for style extension. */ class Builder( /** @@ -138,7 +138,7 @@ class StyleExtensionImpl private constructor(builder: Builder) : StyleContract.S } /** - * DSL function to construct a style plugin. + * DSL function to construct a style extension. */ fun style(styleUri: String, block: Builder.() -> Unit) = Builder(styleUri).apply(block).build() \ No newline at end of file diff --git a/extension-style/src/main/java/com/mapbox/maps/extension/style/image/ImageExtensionImpl.kt b/extension-style/src/main/java/com/mapbox/maps/extension/style/image/ImageExtensionImpl.kt index d19c0596a7..fb5fd7a443 100644 --- a/extension-style/src/main/java/com/mapbox/maps/extension/style/image/ImageExtensionImpl.kt +++ b/extension-style/src/main/java/com/mapbox/maps/extension/style/image/ImageExtensionImpl.kt @@ -159,7 +159,7 @@ fun image(imageId: String, block: ImageExtensionImpl.Builder.() -> Unit): ImageE ImageExtensionImpl.Builder(imageId).apply(block).build() /** - * Extension function to add an image provided by the Style Plugin to the Style. + * Extension function to add an image provided by the Style Extension to the Style. * * @param image The image to be added */ diff --git a/extension-style/src/main/java/com/mapbox/maps/extension/style/layers/Layer.kt b/extension-style/src/main/java/com/mapbox/maps/extension/style/layers/Layer.kt index 65a0e865fc..922672ae4d 100644 --- a/extension-style/src/main/java/com/mapbox/maps/extension/style/layers/Layer.kt +++ b/extension-style/src/main/java/com/mapbox/maps/extension/style/layers/Layer.kt @@ -174,7 +174,7 @@ abstract class Layer : StyleContract.StyleLayerExtension { } /** - * Extension function to get a Layer provided by the Style Plugin by layer id. + * Extension function to get a Layer provided by the Style Extension by layer id. * * @param layerId the layer id * @return StyleLayerPlugin @@ -223,7 +223,7 @@ fun StyleManagerInterface.getLayerAs(layerId: String): T { } /** - * Extension function to add a Layer provided by the Style Plugin to the Style. + * Extension function to add a Layer provided by the Style Extension to the Style. * * @param layer The layer to be added * @param below the layer id that the current layer is added below @@ -233,7 +233,7 @@ fun StyleManagerInterface.addLayerBelow(layer: StyleContract.StyleLayerExtension } /** - * Extension function to add a Layer provided by the Style Plugin to the Style. + * Extension function to add a Layer provided by the Style Extension to the Style. * * @param layer The layer to be added * @param above the layer id that the current layer is added above @@ -243,7 +243,7 @@ fun StyleManagerInterface.addLayerAbove(layer: StyleContract.StyleLayerExtension } /** - * Extension function to add a Layer provided by the Style Plugin to the Style. + * Extension function to add a Layer provided by the Style Extension to the Style. * * @param layer The layer to be added * @param index the index that the current layer is added on @@ -253,7 +253,7 @@ fun StyleManagerInterface.addLayerAt(layer: StyleContract.StyleLayerExtension, i } /** - * Extension function to add a Layer provided by the Style Plugin to the Style. + * Extension function to add a Layer provided by the Style Extension to the Style. * * @param layer The layer to be added */ diff --git a/extension-style/src/main/java/com/mapbox/maps/extension/style/light/generated/Light.kt b/extension-style/src/main/java/com/mapbox/maps/extension/style/light/generated/Light.kt index 465df5f13b..3d079b4eb9 100644 --- a/extension-style/src/main/java/com/mapbox/maps/extension/style/light/generated/Light.kt +++ b/extension-style/src/main/java/com/mapbox/maps/extension/style/light/generated/Light.kt @@ -24,7 +24,7 @@ import kotlin.collections.HashMap /** * The global light source. * - * @see The online documentation + * Check the [online documentation](https://www.mapbox.com/mapbox-gl-style-spec/#light). */ @UiThread class Light : LightDslReceiver, StyleContract.StyleLightExtension { @@ -560,7 +560,7 @@ interface LightDslReceiver { fun light(block: LightDslReceiver.() -> Unit): Light = Light().apply(block) /** - * Extension function to get the light provided by the Style Plugin. + * Extension function to get the light provided by the Style Extension. * * @return Light */ @@ -569,7 +569,7 @@ fun StyleManagerInterface.getLight(): Light { } /** - * Extension function to add a Light provided by the Style Plugin to the Style. + * Extension function to add a Light provided by the Style Extension to the Style. * * @param light The light to be added */ diff --git a/extension-style/src/main/java/com/mapbox/maps/extension/style/sources/Source.kt b/extension-style/src/main/java/com/mapbox/maps/extension/style/sources/Source.kt index b3524833e0..fa51ca3339 100644 --- a/extension-style/src/main/java/com/mapbox/maps/extension/style/sources/Source.kt +++ b/extension-style/src/main/java/com/mapbox/maps/extension/style/sources/Source.kt @@ -132,7 +132,7 @@ abstract class Source( } /** - * Extension function to get a Source provided by the Style Plugin by source id. + * Extension function to get a Source provided by the Style Extension by source id. * * @param sourceId the source id * @return StyleSourcePlugin @@ -177,7 +177,7 @@ inline fun StyleManagerInterface.getSourceAs(sourceId: Stri } /** - * Extension function to add a Source provided by the Style Plugin to the Style. + * Extension function to add a Source provided by the Style Extension to the Style. * * @param source The light to be added */ diff --git a/extension-style/src/main/java/com/mapbox/maps/extension/style/terrain/generated/Terrain.kt b/extension-style/src/main/java/com/mapbox/maps/extension/style/terrain/generated/Terrain.kt index 34f7b670af..526bfbc9c1 100644 --- a/extension-style/src/main/java/com/mapbox/maps/extension/style/terrain/generated/Terrain.kt +++ b/extension-style/src/main/java/com/mapbox/maps/extension/style/terrain/generated/Terrain.kt @@ -168,7 +168,7 @@ fun terrain(sourceId: String, block: (TerrainDslReceiver.() -> Unit)? = null): T } /** - * Extension function to get the terrain provided by the Style Plugin. + * Extension function to get the terrain provided by the Style Extension. * * @return Terrain */ @@ -177,7 +177,7 @@ fun StyleManagerInterface.getTerrain(sourceId: String): Terrain { } /** - * Extension function to add a Terrain provided by the Style Plugin to the Style. + * Extension function to add a Terrain provided by the Style Extension to the Style. * * @param terrain The terrain to be added */ diff --git a/sdk-base/src/main/java/com/mapbox/maps/extension/style/StyleContract.kt b/sdk-base/src/main/java/com/mapbox/maps/extension/style/StyleContract.kt index b49653ebc8..26e3321b70 100644 --- a/sdk-base/src/main/java/com/mapbox/maps/extension/style/StyleContract.kt +++ b/sdk-base/src/main/java/com/mapbox/maps/extension/style/StyleContract.kt @@ -13,7 +13,7 @@ import java.nio.ByteBuffer */ interface StyleContract { /** - * Define the interfaces for the Style plugin. + * Define the interfaces for the Style Extension. */ interface StyleExtension { /** diff --git a/sdk/src/main/java/com/mapbox/maps/MapboxMap.kt b/sdk/src/main/java/com/mapbox/maps/MapboxMap.kt index 09926aee35..8733d11eb9 100644 --- a/sdk/src/main/java/com/mapbox/maps/MapboxMap.kt +++ b/sdk/src/main/java/com/mapbox/maps/MapboxMap.kt @@ -112,7 +112,7 @@ class MapboxMap internal constructor( } /** - * Load style JSON + * Load style JSON. */ fun loadStyleJSON( json: String, @@ -120,7 +120,7 @@ class MapboxMap internal constructor( ) = loadStyleJSON(json, onStyleLoaded, null) /** - * Load the style from Style plugin. + * Load the style from Style Extension. */ fun loadStyle( styleExtension: StyleContract.StyleExtension, @@ -130,13 +130,13 @@ class MapboxMap internal constructor( terrainEnabled = false this.loadStyleUri( styleExtension.styleUri, - { style -> onFinishLoadingStylePlugin(style, styleExtension, onStyleLoaded) }, + { style -> onFinishLoadingStyleExtension(style, styleExtension, onStyleLoaded) }, onMapLoadErrorListener ) } /** - * Load the style from Style plugin. + * Load the style from Style Extension. */ fun loadStyle( styleExtension: StyleContract.StyleExtension, @@ -144,9 +144,9 @@ class MapboxMap internal constructor( ) = loadStyle(styleExtension, onStyleLoaded, null) /** - * Handle the style loading from Style plugin. + * Handle the style loading from Style Extension. */ - internal fun onFinishLoadingStylePlugin( + internal fun onFinishLoadingStyleExtension( style: Style, styleExtension: StyleContract.StyleExtension, onStyleLoaded: Style.OnStyleLoaded? = null diff --git a/sdk/src/test/java/com/mapbox/maps/MapboxMapTest.kt b/sdk/src/test/java/com/mapbox/maps/MapboxMapTest.kt index f190137b35..d7184e3300 100644 --- a/sdk/src/test/java/com/mapbox/maps/MapboxMapTest.kt +++ b/sdk/src/test/java/com/mapbox/maps/MapboxMapTest.kt @@ -58,19 +58,19 @@ class MapboxMapTest { @Test fun loadStyle() { - val stylePlugin = mockk() - every { stylePlugin.styleUri } returns "foobar" + val styleExtension = mockk() + every { styleExtension.styleUri } returns "foobar" val onMapLoadError = mockk() val onStyleLoadError = mockk() - mapboxMap.loadStyle(stylePlugin, onStyleLoadError, onMapLoadError) + mapboxMap.loadStyle(styleExtension, onStyleLoadError, onMapLoadError) verify { nativeMap.styleURI = "foobar" } } @Test fun loadStyleLambda() { - val stylePlugin = mockk() - every { stylePlugin.styleUri } returns "foobar" - mapboxMap.loadStyle(stylePlugin) {} + val styleExtension = mockk() + every { styleExtension.styleUri } returns "foobar" + mapboxMap.loadStyle(styleExtension) {} verify { nativeMap.styleURI = "foobar" } } @@ -84,30 +84,30 @@ class MapboxMapTest { } @Test - fun finishLoadingStylePlugin() { + fun finishLoadingStyleExtension() { val style = mockk