Skip to content

Commit 21344ee

Browse files
pjleonard37Release SDK bot for Maps SDK teamactions-user
authored andcommitted
Automate testing new Standard style versions (#3782)
This PR automates the Maps SDK process for Standard and Standard-Satellite testing for new versions of these styles. It has two parts: ### Add Standard/Standard-Satellite styles to our SLA metrics Specific changes: - Update the `mapbox-maps-internal` pin to include new tests for these four styles (`standard`, `standard-rc`, `standard-satellite`, `standard-satellite-rc`). They were added in this [pr](mapbox/mapbox-maps-internal#1430). - Update the SLA runners for iOS and Android to run these new tests whenever our existing benchmarks are run. Once these changes land, I will add charts for these new tests to the Mode Engineering Dashboards for iOS and Android. Example chart from a trial run: ![Screenshot 2025-05-16 at 4 44 00 PM](https://github.com/user-attachments/assets/8e11cb98-6b36-41ec-89c2-4b24f83e9444) ### Enable Mobot testing of RC versions of these styles Specific changes: - Add an example to iOS and update an example for Android to allow pasting a style URL at runtime Once this is merged I will update the Mobot test script to include test specific features in `standard`, `standard-rc`, `standard-satellite`, and `standard-satellite-rc`. We can easily add new test cases for new Standard features in the RC versions of these styles. <img src="https://github.com/user-attachments/assets/742eaca8-14f5-4deb-825f-396a6fdad5c7" width="300"> <img src="https://github.com/user-attachments/assets/65a133af-eae3-464f-93d3-6d4b38bd4d95" width="300"> cc @mapbox/sdk-ci cc @mapbox/maps-ios cc @mapbox/gl-native cc @mapbox/maps-android --------- Co-authored-by: Release SDK bot for Maps SDK team <[email protected]> Co-authored-by: Changelog autocreator bot <[email protected]> GitOrigin-RevId: 19690b797f4bb2cb4aeccddd3684b0e99e0ea3ec
1 parent dcf8b4c commit 21344ee

File tree

3 files changed

+57
-13
lines changed

3 files changed

+57
-13
lines changed

app/src/main/java/com/mapbox/maps/testapp/examples/StyleSwitchActivity.kt

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
package com.mapbox.maps.testapp.examples
22

33
import android.os.Bundle
4+
import android.webkit.URLUtil
5+
import android.widget.EditText
6+
import android.widget.Toast
7+
import androidx.appcompat.app.AlertDialog
48
import androidx.appcompat.app.AppCompatActivity
9+
import com.mapbox.geojson.Point
10+
import com.mapbox.maps.CameraOptions
511
import com.mapbox.maps.MapboxMap
612
import com.mapbox.maps.Style
713
import com.mapbox.maps.testapp.databinding.ActivityStyleSwitchBinding
@@ -20,9 +26,17 @@ class StyleSwitchActivity : AppCompatActivity() {
2026
setContentView(binding.root)
2127

2228
mapboxMap = binding.mapView.mapboxMap
29+
mapboxMap.setCamera(
30+
CameraOptions.Builder()
31+
.center(Point.fromLngLat(-0.1213, 51.5015))
32+
.zoom(15.0)
33+
.bearing(57.0)
34+
.pitch(60.0)
35+
.build()
36+
)
2337

2438
// Instead of this you can add your default style to the map layout with xml attribute `app:mapbox_styleUri="mapbox://styles/streets-v12"`
25-
mapboxMap.loadStyle(Style.MAPBOX_STREETS)
39+
mapboxMap.loadStyle(Style.STANDARD)
2640

2741
binding.streetsButton.setOnClickListener {
2842
mapboxMap.loadStyle(Style.MAPBOX_STREETS)
@@ -33,8 +47,8 @@ class StyleSwitchActivity : AppCompatActivity() {
3347
binding.darkButton.setOnClickListener {
3448
mapboxMap.loadStyle(Style.DARK)
3549
}
36-
binding.satelliteStreetsButton.setOnClickListener {
37-
mapboxMap.loadStyle(Style.SATELLITE_STREETS)
50+
binding.customStyleButton.setOnClickListener {
51+
showStyleInputDialog()
3852
}
3953
binding.satelliteButton.setOnClickListener {
4054
mapboxMap.loadStyle(Style.SATELLITE)
@@ -49,4 +63,34 @@ class StyleSwitchActivity : AppCompatActivity() {
4963
mapboxMap.loadStyle(Style.STANDARD_SATELLITE)
5064
}
5165
}
66+
67+
private fun showStyleInputDialog() {
68+
val editText = EditText(this)
69+
val dialog = AlertDialog.Builder(this)
70+
.setTitle("Mapbox Style URL")
71+
.setMessage("Paste the “Share URL” for your public Mapbox style")
72+
.setView(editText)
73+
.setPositiveButton("Save") { _, _ ->
74+
val input = editText.text.toString()
75+
saveStyleURLInput(input)
76+
}
77+
.setNegativeButton("Cancel", null)
78+
.create()
79+
dialog.show()
80+
}
81+
82+
private fun saveStyleURLInput(input: String) {
83+
if (input.isValidUri()) {
84+
mapboxMap.loadStyle(input)
85+
} else {
86+
Toast.makeText(this, "Invalid URL. Please check your Mapbox Studio Style URL.", Toast.LENGTH_SHORT).show()
87+
}
88+
}
89+
90+
private fun String.isValidUri(): Boolean {
91+
val isMapboxStyleUri = startsWith("mapbox://", ignoreCase = true)
92+
val isMapboxAssetUri = startsWith("asset://", ignoreCase = true)
93+
val isMapboxFileUri = startsWith("file://", ignoreCase = true)
94+
return isMapboxStyleUri || isMapboxAssetUri || isMapboxFileUri || URLUtil.isValidUrl(this)
95+
}
5296
}

app/src/main/res/layout/activity_style_switch.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
app:mapbox_compassMarginLeft="32dp"
4343
app:mapbox_compassMarginRight="32dp"
4444
app:mapbox_compassMarginTop="32dp"
45-
app:mapbox_gesturesDoubleTapToZoomInEnabled="false"
46-
app:mapbox_gesturesPinchToZoomEnabled="false"
47-
app:mapbox_gesturesPitchEnabled="false"
48-
app:mapbox_gesturesQuickZoomEnabled="false"
45+
app:mapbox_gesturesDoubleTapToZoomInEnabled="true"
46+
app:mapbox_gesturesPinchToZoomEnabled="true"
47+
app:mapbox_gesturesPitchEnabled="true"
48+
app:mapbox_gesturesQuickZoomEnabled="true"
4949
app:mapbox_gesturesRotateEnabled="true"
50-
app:mapbox_gesturesScrollEnabled="false"
50+
app:mapbox_gesturesScrollEnabled="true"
5151
app:mapbox_logoEnabled="true"
5252
app:mapbox_logoGravity="bottom|right"
5353
app:mapbox_logoMarginBottom="32dp"
@@ -56,11 +56,11 @@
5656
app:mapbox_logoMarginTop="32dp" />
5757

5858
<Button
59-
android:id="@+id/satellite_streets_button"
59+
android:id="@+id/custom_style_button"
6060
android:layout_width="wrap_content"
6161
android:layout_height="wrap_content"
6262
android:layout_marginTop="8dp"
63-
android:text="@string/menu_map_style_satellite_streets"
63+
android:text="@string/menu_map_style_custom_style"
6464
android:textAllCaps="false"
6565
app:layout_constraintEnd_toEndOf="@+id/streets_button"
6666
app:layout_constraintStart_toStartOf="@+id/streets_button"
@@ -73,8 +73,8 @@
7373
android:text="@string/menu_map_style_satellite"
7474
android:textAllCaps="false"
7575
app:layout_constraintBottom_toBottomOf="parent"
76-
app:layout_constraintEnd_toEndOf="@+id/satellite_streets_button"
77-
app:layout_constraintStart_toStartOf="@+id/satellite_streets_button"
76+
app:layout_constraintEnd_toEndOf="@+id/custom_style_button"
77+
app:layout_constraintStart_toStartOf="@+id/custom_style_button"
7878
app:layout_constraintTop_toTopOf="@+id/outdoors_button"
7979
app:layout_constraintVertical_bias="0.0" />
8080

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<string name="menu_map_style_standard">Standard</string>
1010
<string name="menu_map_style_satellite">Satellite</string>
1111
<string name="menu_map_style_standard_satellite">Standard Satellite</string>
12-
<string name="menu_map_style_satellite_streets">Satellite Streets</string>
12+
<string name="menu_map_style_custom_style">Custom</string>
1313
<string name="toggle_focus_on_a_point">Toggle focus on a point</string>
1414
<string name="toggle_velocity_animations">Toggle deceleration animations</string>
1515
<string name="toggle_rotate_enabled">Toggle rotate enabled</string>

0 commit comments

Comments
 (0)