Skip to content

Commit

Permalink
[deps] update gl-native to beta.15 and common to beta.11, adopt break… (
Browse files Browse the repository at this point in the history
#120)

* [deps] update gl-native to beta.15 and common to beta.11, adopt breaking changes

* Fix breaking changes related to text-field and GeoJsonSource data property.

Co-authored-by: Peng Liu <peng.liu@mapbox.com>
  • Loading branch information
tobrun and pengdev authored Feb 24, 2021
1 parent 1750bee commit 1397c3f
Show file tree
Hide file tree
Showing 17 changed files with 188 additions and 183 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.MenuItem
import android.view.View
import android.widget.FrameLayout
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.geojson.FeatureCollection
import com.mapbox.geojson.Point
import com.mapbox.geojson.Polygon
import com.mapbox.maps.BoundOptions
Expand Down Expand Up @@ -37,7 +38,7 @@ class RestrictBoundsActivity : AppCompatActivity() {
mapboxMap.loadStyle(
style(Style.SATELLITE_STREETS) {
+geoJsonSource(BOUNDS_ID) {
data("")
featureCollection(FeatureCollection.fromFeatures(listOf()))
}
+fillLayer(BOUNDS_ID, BOUNDS_ID) {
fillColor(Color.RED)
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ object Versions {
const val mapboxGestures = "0.7.0"
const val mapboxJavaServices = "5.4.1"
const val mapboxBase = "0.5.0"
const val mapboxGlNative = "10.0.0-beta.14"
const val mapboxCommon = "10.0.0-beta.9.1"
const val mapboxGlNative = "10.0.0-beta.15"
const val mapboxCommon = "10.0.0-beta.11"
const val mapboxAndroidCore = "3.1.1"
const val mapboxAndroidTelemetry = "6.2.2"
const val androidxCore = "1.3.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract class BaseStyleTest {

mapboxMap = mapView.getMapboxMap()
mapboxMap.loadStyleUri(
Style.DARK
"mapbox://styles/mapbox/empty-v9"
) {
this@BaseStyleTest.style = it
latch.countDown()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,49 @@ class Formatted : ArrayList<FormattedSection>() {
* Static variables and methods.
*/
companion object {

/**
* Construct a [Formatted] object from a HashMap (Returned from the Core SDK).
* Construct a [Formatted] object from a Formatted List (Returned from the Core).
*/
fun fromProperty(map: HashMap<*, *>): Formatted {
fun fromProperty(list: ArrayList<*>): Formatted {
val formatted = Formatted()
val property = map["sections"] as List<*>

property.forEach { section ->
val sectionMap = section as HashMap<*, *>
val text = sectionMap["text"] as String
val formattedSection = FormattedSection(text)
sectionMap.keys.forEach { key ->
when (key) {
"textColor" -> {
val colorMap = sectionMap[key] as HashMap<String, Double>
formattedSection.textColor = ColorUtils.rgbaExpressionToColorString(
rgba {
literal(colorMap["r"]!! * 255)
literal(colorMap["g"]!! * 255)
literal(colorMap["b"]!! * 255)
literal(colorMap["a"]!!)
if (list.removeFirst() == "format") {
list.forEachIndexed { index, element ->
when (element) {
is String -> {
val formattedSection = FormattedSection(element)
val optionsMap = list[index + 1] as HashMap<*, *>
optionsMap.keys.forEach { key ->
when (key) {
"text-color" -> {
val colorExpressionList = optionsMap[key] as ArrayList<*>
if (colorExpressionList.removeFirst() == "rgba") {
formattedSection.textColor = ColorUtils.rgbaExpressionToColorString(
rgba {
literal(colorExpressionList[0] as Double)
literal(colorExpressionList[1] as Double)
literal(colorExpressionList[2] as Double)
literal(colorExpressionList[3] as Double)
}
)
}
}
"font-scale" -> formattedSection.fontScale = optionsMap[key] as Double
"text-font" -> {
val textFontExpressionList = optionsMap[key] as ArrayList<*>
if (textFontExpressionList.removeFirst() == "literal") {
formattedSection.fontStack =
textFontExpressionList.last() as ArrayList<String>
}
}
}
)
}
formatted.add(formattedSection)
}
"scale" -> formattedSection.fontScale = sectionMap[key] as Double
"fontStack" -> formattedSection.fontStack = (sectionMap[key] as String).split(',')
else -> Unit
}
}
formatted.add(formattedSection)
}
return formatted
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1397c3f

Please sign in to comment.