diff --git a/CHANGELOG.md b/CHANGELOG.md index d1567ccfb9..c2d04ffddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ Mapbox welcomes participation and contributions from everyone. # 11.6.0-rc.1 ## Features ✨ and improvements 🏁 * Support negative values for `CircleLayer.circleBlur` to render inner glow effect. +* Add new `Style.STANDARD_SATELLITE` style that combines updated satellite imagery and vector layers. +* Introduce new import configuration properties for `Style.STANDARD`: `theme`, `show3dObjects` which could be set with `Style.setStyleImportConfigProperty`. +* [compose] Extend `StandardStyleConfigurationState` with `theme: ThemeValue` and `show3dObjects: BooleanValue` properties. +* [compose] Introduce composable function `MapboxStandardSatelliteStyle` with dedicated `StandardSatelliteStyleConfigurationState`. ## Bug fixes 🐞 * Fix elevated line occlusion issue in 2D mode. @@ -13,6 +17,7 @@ Mapbox welcomes participation and contributions from everyone. ## Dependencies * Update gl-native to v11.6.0-rc.1 and common to v24.6.0-rc.1. + ## Known issues * `ClipLayer` property `clipLayerTypes` is not updated in runtime. The fix is expected to land in stable 11.6.0. diff --git a/app/src/main/assets/fragment-realestate-NY.json b/app/src/main/assets/fragment-realestate-NY.json index e9c61a8208..d0241658c0 100644 --- a/app/src/main/assets/fragment-realestate-NY.json +++ b/app/src/main/assets/fragment-realestate-NY.json @@ -9,7 +9,9 @@ "showPointOfInterestLabels": true, "showTransitLabels": false, "showPlaceLabels": true, - "showRoadLabels": false + "showRoadLabels": false, + "theme": "monochrome", + "show3dObjects": true } } ], diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/StandardStyleActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/StandardStyleActivity.kt index 8a61235ed4..b7443b4c20 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/StandardStyleActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/StandardStyleActivity.kt @@ -1,6 +1,8 @@ package com.mapbox.maps.testapp.examples import android.os.Bundle +import android.view.View +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import com.mapbox.bindgen.Value import com.mapbox.geojson.LineString @@ -17,16 +19,18 @@ import com.mapbox.maps.testapp.databinding.ActivityStandardStyleBinding * Example of working with style imports and the Standard style. */ class StandardStyleActivity : AppCompatActivity() { + private lateinit var mapboxMap: MapboxMap private val line = LineString.fromLngLats(LINE_COORDINATES) private var lightSetting: LightPresets = LightPresets.DUSK + private var themeSetting: Theme = Theme.DEFAULT private var labelsSetting = true + private var show3dObjectsSetting = true private lateinit var binding: ActivityStandardStyleBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityStandardStyleBinding.inflate(layoutInflater) - setContentView(binding.root) mapboxMap = binding.mapView.mapboxMap setContentView(binding.root) @@ -60,6 +64,22 @@ class StandardStyleActivity : AppCompatActivity() { } private fun addOnClickListeners() { + binding.fabThemeSetting.setOnClickListener { + mapboxMap.getStyle { style -> + themeSetting = when (themeSetting) { + Theme.DEFAULT -> Theme.FADED + Theme.FADED -> Theme.MONOCHROME + Theme.MONOCHROME -> Theme.DEFAULT + } + style.setStyleImportConfigProperty( + IMPORT_ID_FOR_STANDARD_STYLE, + "theme", + themeSetting.value + ) + showAction(it, themeSetting.value.toString()) + } + } + // When a user clicks the light setting button change the `lightPreset` config property on the Standard style import binding.fabLightSetting.setOnClickListener { mapboxMap.getStyle { style -> @@ -74,6 +94,7 @@ class StandardStyleActivity : AppCompatActivity() { "lightPreset", lightSetting.value ) + showAction(it, lightSetting.value.toString()) } } @@ -82,14 +103,50 @@ class StandardStyleActivity : AppCompatActivity() { binding.fabLabelsSetting.setOnClickListener { mapboxMap.getStyle { style -> labelsSetting = !labelsSetting - style.setStyleImportConfigProperty(IMPORT_ID_FOR_STANDARD_STYLE, "showPlaceLabels", Value.valueOf(labelsSetting)) - style.setStyleImportConfigProperty(IMPORT_ID_FOR_STANDARD_STYLE, "showRoadLabels", Value.valueOf(labelsSetting)) - style.setStyleImportConfigProperty(IMPORT_ID_FOR_STANDARD_STYLE, "showPointInterestLabels", Value.valueOf(labelsSetting)) - style.setStyleImportConfigProperty(IMPORT_ID_FOR_STANDARD_STYLE, "showTransitLabels", Value.valueOf(labelsSetting)) + style.setStyleImportConfigProperty( + IMPORT_ID_FOR_STANDARD_STYLE, + "showPlaceLabels", + Value.valueOf(labelsSetting) + ) + style.setStyleImportConfigProperty( + IMPORT_ID_FOR_STANDARD_STYLE, + "showRoadLabels", + Value.valueOf(labelsSetting) + ) + style.setStyleImportConfigProperty( + IMPORT_ID_FOR_STANDARD_STYLE, + "showPointInterestLabels", + Value.valueOf(labelsSetting) + ) + style.setStyleImportConfigProperty( + IMPORT_ID_FOR_STANDARD_STYLE, + "showTransitLabels", + Value.valueOf(labelsSetting) + ) + showAction(it, labelsSetting.toString()) + } + } + binding.fab3dObjectsSetting.setOnClickListener { + mapboxMap.getStyle { style -> + show3dObjectsSetting = !show3dObjectsSetting + style.setStyleImportConfigProperty( + IMPORT_ID_FOR_STANDARD_STYLE, + "show3dObjects", + Value.valueOf(show3dObjectsSetting) + ) + showAction(it, show3dObjectsSetting.toString()) } } } + private fun showAction(it: View, value: String) { + Toast.makeText( + this@StandardStyleActivity, + it.contentDescription.toString() + value, + Toast.LENGTH_SHORT + ).show() + } + private enum class LightPresets(val value: Value) { DAY(Value.valueOf("day")), DAWN(Value.valueOf("dawn")), @@ -97,6 +154,12 @@ class StandardStyleActivity : AppCompatActivity() { NIGHT(Value.valueOf("night")) } + private enum class Theme(val value: Value) { + FADED(Value.valueOf("faded")), + MONOCHROME(Value.valueOf("monochrome")), + DEFAULT(Value.valueOf("default")) + } + companion object { /** * The ID used in [STYLE_URL] that references the `standard` style. diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/StyleSwitchActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/StyleSwitchActivity.kt index ccd6e82130..a018691864 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/StyleSwitchActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/StyleSwitchActivity.kt @@ -42,5 +42,11 @@ class StyleSwitchActivity : AppCompatActivity() { binding.outdoorsButton.setOnClickListener { mapboxMap.loadStyle(Style.OUTDOORS) } + binding.standardButton.setOnClickListener { + mapboxMap.loadStyle(Style.STANDARD) + } + binding.standardSatelliteButton.setOnClickListener { + mapboxMap.loadStyle(Style.STANDARD_SATELLITE) + } } } \ No newline at end of file diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/ViewPagerActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/ViewPagerActivity.kt index 409620b638..28b7b9f6d0 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/ViewPagerActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/ViewPagerActivity.kt @@ -57,7 +57,7 @@ class ViewPagerActivity : AppCompatActivity() { } companion object { - private const val NUM_ITEMS = 5 + private const val NUM_ITEMS = 6 } } } @@ -75,6 +75,7 @@ fun getStyleFromIndex(index: Int): String { 2 -> Style.SATELLITE 3 -> Style.LIGHT 4 -> Style.TRAFFIC_NIGHT + 5 -> Style.STANDARD_SATELLITE else -> Style.STANDARD } } \ No newline at end of file diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/annotation/AnnotationUtils.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/annotation/AnnotationUtils.kt index 1fba72ae39..ca2f9f2105 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/annotation/AnnotationUtils.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/annotation/AnnotationUtils.kt @@ -19,8 +19,9 @@ import java.util.* */ object AnnotationUtils { private const val TAG = "AnnotationUtils" + val STYLES = - arrayOf(Style.STANDARD, Style.OUTDOORS, Style.LIGHT, Style.DARK, Style.SATELLITE_STREETS) + arrayOf(Style.STANDARD, Style.OUTDOORS, Style.LIGHT, Style.DARK, Style.SATELLITE_STREETS, Style.STANDARD_SATELLITE) val SLOTS = arrayOf("top", "middle", "bottom") /** diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/CircleAnnotationActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/CircleAnnotationActivity.kt index f6a414c0c1..b851787b43 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/CircleAnnotationActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/CircleAnnotationActivity.kt @@ -144,8 +144,8 @@ class CircleAnnotationActivity : AppCompatActivity() { private fun switchToNextStyle() { val style = nextStyle binding.mapView.mapboxMap.loadStyle(style) - // only standard supports slots - binding.changeSlot.isEnabled = style == Style.STANDARD + // only standard based styles support slots + binding.changeSlot.isEnabled = (style == Style.STANDARD || style == Style.STANDARD_SATELLITE) } companion object { diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/PointAnnotationClusterActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/PointAnnotationClusterActivity.kt index 071060b979..317f0c685c 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/PointAnnotationClusterActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/PointAnnotationClusterActivity.kt @@ -41,7 +41,7 @@ class PointAnnotationClusterActivity : AppCompatActivity(), CoroutineScope { private var slotIndex: Int = 0 // STANDARD style doesn't support ICON_FIRE_STATION image - private val styles = AnnotationUtils.STYLES.filterNot { it == Style.STANDARD } + private val styles = AnnotationUtils.STYLES.filterNot { it == Style.STANDARD || it == Style.STANDARD_SATELLITE } private val nextStyle: String get() = styles[styleIndex++ % styles.size] private val nextSlot: String diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationBasicAddActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationBasicAddActivity.kt index 16b2ed4ad2..b01d08b3ad 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationBasicAddActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationBasicAddActivity.kt @@ -43,7 +43,8 @@ class ViewAnnotationBasicAddActivity : AppCompatActivity(), OnMapClickListener { binding.fabStyleToggle.setOnClickListener { when (style?.styleURI) { Style.STANDARD -> loadStyle(Style.SATELLITE_STREETS) - Style.SATELLITE_STREETS -> loadStyle(Style.STANDARD) + Style.SATELLITE_STREETS -> loadStyle(Style.STANDARD_SATELLITE) + Style.STANDARD_SATELLITE -> loadStyle(Style.STANDARD) } } Toast.makeText(this@ViewAnnotationBasicAddActivity, STARTUP_TEXT, Toast.LENGTH_LONG).show() diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationShowcaseActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationShowcaseActivity.kt index 0b8e13fcf0..b40e3406aa 100644 --- a/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationShowcaseActivity.kt +++ b/app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/ViewAnnotationShowcaseActivity.kt @@ -81,7 +81,8 @@ class ViewAnnotationShowcaseActivity : binding.fabStyleToggle.setOnClickListener { when (style?.styleURI) { Style.STANDARD -> loadStyle(prepareStyle(Style.SATELLITE_STREETS, bitmap)) - Style.SATELLITE_STREETS -> loadStyle(prepareStyle(Style.STANDARD, bitmap)) + Style.SATELLITE_STREETS -> loadStyle(prepareStyle(Style.STANDARD_SATELLITE, bitmap)) + Style.STANDARD_SATELLITE -> loadStyle(prepareStyle(Style.STANDARD, bitmap)) } } Toast.makeText(this@ViewAnnotationShowcaseActivity, STARTUP_TEXT, Toast.LENGTH_LONG).show() diff --git a/app/src/main/res/layout/activity_standard_style.xml b/app/src/main/res/layout/activity_standard_style.xml index 657e1149fe..abb577aa5b 100644 --- a/app/src/main/res/layout/activity_standard_style.xml +++ b/app/src/main/res/layout/activity_standard_style.xml @@ -9,6 +9,30 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> + + + + @@ -26,6 +51,7 @@ android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:layout_margin="16dp" + android:contentDescription="Label visibility: " android:src="@android:drawable/ic_dialog_info" app:backgroundTint="@color/primary" /> diff --git a/app/src/main/res/layout/activity_style_switch.xml b/app/src/main/res/layout/activity_style_switch.xml index 558450f313..1300f752af 100644 --- a/app/src/main/res/layout/activity_style_switch.xml +++ b/app/src/main/res/layout/activity_style_switch.xml @@ -24,34 +24,36 @@ android:layout_height="0dp" app:layout_constraintBottom_toTopOf="@+id/guideline" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" app:mapbox_attributionEnabled="true" app:mapbox_attributionGravity="top|right" app:mapbox_attributionMarginBottom="32dp" app:mapbox_attributionMarginLeft="32dp" app:mapbox_attributionMarginRight="32dp" app:mapbox_attributionMarginTop="32dp" - app:mapbox_compassImage="@drawable/custom_compass" app:mapbox_compassEnabled="true" app:mapbox_compassFadeWhenFacingNorth="false" app:mapbox_compassGravity="left|top" + app:mapbox_compassImage="@drawable/custom_compass" app:mapbox_compassMarginBottom="32dp" app:mapbox_compassMarginLeft="32dp" app:mapbox_compassMarginRight="32dp" app:mapbox_compassMarginTop="32dp" app:mapbox_gesturesDoubleTapToZoomInEnabled="false" + app:mapbox_gesturesPinchToZoomEnabled="false" + app:mapbox_gesturesPitchEnabled="false" + app:mapbox_gesturesQuickZoomEnabled="false" + app:mapbox_gesturesRotateEnabled="true" + app:mapbox_gesturesScrollEnabled="false" app:mapbox_logoEnabled="true" app:mapbox_logoGravity="bottom|right" app:mapbox_logoMarginBottom="32dp" app:mapbox_logoMarginLeft="32dp" app:mapbox_logoMarginRight="32dp" - app:mapbox_logoMarginTop="32dp" - app:mapbox_gesturesQuickZoomEnabled="false" - app:mapbox_gesturesRotateEnabled="true" - app:mapbox_gesturesScrollEnabled="false" - app:mapbox_gesturesPitchEnabled="false" - app:mapbox_gesturesPinchToZoomEnabled="false" /> + app:mapbox_logoMarginTop="32dp" />