Skip to content

Commit 14f7f84

Browse files
kediarovgithub-actions[bot]
authored andcommitted
Add an API to toggle the visibility of Landmark icons (#3889)
GitOrigin-RevId: addc012cd9e4c62064a6c9578edbff101121426b
1 parent 1a87584 commit 14f7f84

File tree

8 files changed

+51
-1
lines changed

8 files changed

+51
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Mapbox welcomes participation and contributions from everyone.
1313
* Add common `MapInteraction` APIs to `StandardStyleInteractionsState`: `.onFeaturesetClicked`, `.onLayerClicked`, `.onFeaturesetLongClicked`, `.onLayerLongClicked`, `.onMapClicked`, `.onMapLongClicked`.
1414
* Add `StyleInteractionsState` to `MapboxStandardSatelliteStyle` so interactions can be used with the satellite style.
1515
* [compose] Rename experimental `ExperimentalStandardStyleState` to `StandardStyleState`, rename experimental `MapboxStandardStyleExperimental` to `MapboxStandardStyle(styleImportsContent, topSlot, middleSlot, bottomSlot, standardStyleState)`, and deprecate previous `MapboxStandardStyle` composable functions.
16+
* [compose] Add config option `showLandmarkIcons` to `MapboxStandardStyle`.
1617
* Expose new experimental camera event `MapboxMap.subscribeCameraChangedCoalesced`, `MapboxMap.cameraChangedCoalescedEvents`.
1718
* [compose] Expose new camera event `MapState.cameraChangedCoalescedEvents`
1819

app/src/main/assets/fragment-realestate-NY.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"config": {
77
"font": "Montserrat",
88
"lightPreset": "dusk",
9+
"showLandmarkIcons": true,
910
"showPointOfInterestLabels": true,
1011
"showTransitLabels": false,
1112
"showPlaceLabels": true,

compose-app/src/main/assets/fragment-realestate-NY.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"config": {
77
"font": "Montserrat",
88
"lightPreset": "dusk",
9+
"showLandmarkIcons": true,
910
"showPointOfInterestLabels": true,
1011
"showTransitLabels": false,
1112
"showPlaceLabels": true,

compose-app/src/main/java/com/mapbox/maps/compose/testapp/examples/style/StandardStyleActivity.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public class StandardStyleActivity : ComponentActivity() {
4747
var isStandardSatellite by remember {
4848
mutableStateOf(false)
4949
}
50+
var enableLandmarkIcons by remember {
51+
mutableStateOf(false)
52+
}
5053
var enablePlaceLabels by remember {
5154
mutableStateOf(true)
5255
}
@@ -84,6 +87,30 @@ public class StandardStyleActivity : ComponentActivity() {
8487
Column(
8588
modifier = Modifier.width(IntrinsicSize.Max)
8689
) {
90+
Row(
91+
modifier = Modifier.fillMaxWidth()
92+
) {
93+
FloatingActionButton(
94+
modifier = Modifier
95+
.defaultMinSize(
96+
minWidth = ButtonDefaults.MinWidth,
97+
minHeight = ButtonDefaults.MinHeight
98+
)
99+
.padding(end = 4.dp),
100+
onClick = {
101+
if (!isStandardSatellite) {
102+
enableLandmarkIcons = !enableLandmarkIcons
103+
}
104+
},
105+
shape = RoundedCornerShape(16.dp),
106+
backgroundColor = if (isStandardSatellite) Color.Gray else MaterialTheme.colors.secondary,
107+
) {
108+
Text(
109+
modifier = Modifier.padding(6.dp),
110+
text = "showLandmarkIcons: $enableLandmarkIcons"
111+
)
112+
}
113+
}
87114
Row(
88115
modifier = Modifier.fillMaxWidth()
89116
) {
@@ -364,6 +391,7 @@ public class StandardStyleActivity : ComponentActivity() {
364391
enablePlacementTransitions(true)
365392
}
366393
configurationsState.apply {
394+
showLandmarkIcons = BooleanValue(enableLandmarkIcons)
367395
showPlaceLabels = BooleanValue(enablePlaceLabels)
368396
showRoadLabels = BooleanValue(enableRoadLabels)
369397
showPointOfInterestLabels = BooleanValue(enablePointOfInterestLabels)

extension-compose/api/Release/metalava.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5092,10 +5092,13 @@ package com.mapbox.maps.extension.compose.style.standard {
50925092
@androidx.compose.runtime.Stable public final class StandardStyleConfigurationState extends com.mapbox.maps.extension.compose.style.standard.BaseStyleConfigurationState {
50935093
ctor public StandardStyleConfigurationState();
50945094
method public com.mapbox.maps.extension.compose.style.BooleanValue getShow3dObjects();
5095+
method public com.mapbox.maps.extension.compose.style.BooleanValue getShowLandmarkIcons();
50955096
method public com.mapbox.maps.extension.compose.style.standard.ThemeValue getTheme();
50965097
method public void setShow3dObjects(com.mapbox.maps.extension.compose.style.BooleanValue);
5098+
method public void setShowLandmarkIcons(com.mapbox.maps.extension.compose.style.BooleanValue);
50975099
method public void setTheme(com.mapbox.maps.extension.compose.style.standard.ThemeValue);
50985100
property public final com.mapbox.maps.extension.compose.style.BooleanValue show3dObjects;
5101+
property public final com.mapbox.maps.extension.compose.style.BooleanValue showLandmarkIcons;
50995102
property public final com.mapbox.maps.extension.compose.style.standard.ThemeValue theme;
51005103
}
51015104

extension-compose/api/extension-compose.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4314,8 +4314,10 @@ public final class com/mapbox/maps/extension/compose/style/standard/StandardSate
43144314
public final class com/mapbox/maps/extension/compose/style/standard/StandardStyleConfigurationState : com/mapbox/maps/extension/compose/style/standard/BaseStyleConfigurationState {
43154315
public fun <init> ()V
43164316
public final fun getShow3dObjects ()Lcom/mapbox/maps/extension/compose/style/BooleanValue;
4317+
public final fun getShowLandmarkIcons ()Lcom/mapbox/maps/extension/compose/style/BooleanValue;
43174318
public final fun getTheme ()Lcom/mapbox/maps/extension/compose/style/standard/ThemeValue;
43184319
public final fun setShow3dObjects (Lcom/mapbox/maps/extension/compose/style/BooleanValue;)V
4320+
public final fun setShowLandmarkIcons (Lcom/mapbox/maps/extension/compose/style/BooleanValue;)V
43194321
public final fun setTheme (Lcom/mapbox/maps/extension/compose/style/standard/ThemeValue;)V
43204322
}
43214323

extension-compose/src/main/java/com/mapbox/maps/extension/compose/style/standard/MapboxStandardStyle.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public fun MapboxStandardStyle(
6565
styleImportsConfig = styleImportsConfig {
6666
importConfig(importId = "basemap") {
6767
with(standardStyleConfigurationState) {
68+
if (showLandmarkIcons.isNotInitial()) {
69+
config(StandardStyleConfigurationState.CONFIG_SHOW_LANDMARK_ICON, showLandmarkIcons.value)
70+
}
6871
if (showPlaceLabels.isNotInitial()) {
6972
config(BaseStyleConfigurationState.CONFIG_SHOW_PLACE_LABELS, showPlaceLabels.value)
7073
}
@@ -184,6 +187,9 @@ public fun MapboxStandardStyle(
184187
styleImportsConfig = styleImportsConfig {
185188
importConfig(importId = "basemap") {
186189
with(standardStyleState.configurationsState) {
190+
if (showLandmarkIcons.isNotInitial()) {
191+
config(StandardStyleConfigurationState.CONFIG_SHOW_LANDMARK_ICON, showLandmarkIcons.value)
192+
}
187193
if (showPlaceLabels.isNotInitial()) {
188194
config(BaseStyleConfigurationState.CONFIG_SHOW_PLACE_LABELS, showPlaceLabels.value)
189195
}

extension-compose/src/main/java/com/mapbox/maps/extension/compose/style/standard/StandardStyleConfigurationState.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public data class ThemeValue(public val value: Value) {
8181
@Stable
8282
public class StandardStyleConfigurationState private constructor(
8383
initialTheme: ThemeValue,
84-
initialShow3dObjects: BooleanValue
84+
initialShow3dObjects: BooleanValue,
85+
initialShowLandmarkIcons: BooleanValue,
8586
) : BaseStyleConfigurationState() {
8687

8788
/**
@@ -90,6 +91,7 @@ public class StandardStyleConfigurationState private constructor(
9091
public constructor() : this(
9192
initialTheme = ThemeValue.INITIAL,
9293
initialShow3dObjects = BooleanValue.INITIAL,
94+
initialShowLandmarkIcons = BooleanValue.INITIAL,
9395
)
9496

9597
/**
@@ -102,7 +104,13 @@ public class StandardStyleConfigurationState private constructor(
102104
*/
103105
public var show3dObjects: BooleanValue by mutableStateOf(initialShow3dObjects)
104106

107+
/**
108+
* Shows or hides Landmark Icons, default to false.
109+
*/
110+
public var showLandmarkIcons: BooleanValue by mutableStateOf(initialShowLandmarkIcons)
111+
105112
internal companion object {
113+
internal const val CONFIG_SHOW_LANDMARK_ICON = "showLandmarkIcons"
106114
internal const val CONFIG_THEME = "theme"
107115
internal const val CONFIG_SHOW_3D_OBJECTS = "show3dObjects"
108116
}

0 commit comments

Comments
 (0)