[android] #5978 - fix number property filters [ci skip]
This commit is contained in:
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Utility to build filter expressions more easily:
|
||||
@@ -36,7 +37,7 @@ public class Filter {
|
||||
ArrayList<Object> array = new ArrayList<>(2 + values.length);
|
||||
array.add(operator);
|
||||
array.add(key);
|
||||
array.addAll(Arrays.asList(values));
|
||||
Collections.addAll(array, values);
|
||||
return array.toArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@ public class Function<T> {
|
||||
Object[] toValueObject() {
|
||||
return new Object[]{in, out};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("[%s, %s]", in, out);
|
||||
}
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
|
||||
@@ -26,11 +26,12 @@ public abstract class Layer {
|
||||
|
||||
boolean updateClasses = false;
|
||||
for (Property<?> property : properties) {
|
||||
Object converted = convertValue(property.value);
|
||||
if (property instanceof PaintProperty) {
|
||||
updateClasses = true;
|
||||
nativeSetPaintProperty(property.name, convertValue(property.value));
|
||||
nativeSetPaintProperty(property.name, converted);
|
||||
} else {
|
||||
nativeSetLayoutProperty(property.name, convertValue(property.value));
|
||||
nativeSetLayoutProperty(property.name, converted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -307,8 +307,15 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
|
||||
PropertyValue<String> fillColor = layer.getFillColor();
|
||||
Function<String> function = fillColor.getFunction();
|
||||
Log.d(TAG, "Fill color base: " + function.getBase());
|
||||
Log.d(TAG, "Fill color #stops: " + function.getStops().length);
|
||||
if (function != null) {
|
||||
Log.d(TAG, "Fill color base: " + function.getBase());
|
||||
Log.d(TAG, "Fill color #stops: " + function.getStops().length);
|
||||
if (function.getStops() != null) {
|
||||
for (Stop stop : function.getStops()) {
|
||||
Log.d(TAG, "Fill color #stops: " + stop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String readRawResource(@RawRes int rawResource) throws IOException {
|
||||
|
||||
@@ -80,7 +80,8 @@ inline optional<Value> toValue(const mbgl::android::Value& value) {
|
||||
} else if (value.isString()) {
|
||||
return { value.toString() };
|
||||
} else if (value.isNumber()) {
|
||||
return { value.toNumber() };
|
||||
//Need to cast to a double here as the float is otherwise considered a bool...
|
||||
return { (double) value.toNumber() };
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user