[android] Removed previously deprecated colorToRgbaString and colorToRgbaArray (#13337)
from PropertyFactory
This commit is contained in:
@@ -51,9 +51,9 @@ import static com.mapbox.mapboxsdk.style.expressions.Expression.stop;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.zoom;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.NONE;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.colorToRgbaString;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconSize;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility;
|
||||
import static com.mapbox.mapboxsdk.utils.ColorUtils.colorToRgbaString;
|
||||
|
||||
final class LocationLayerController implements MapboxAnimator.OnLayerAnimationsValuesChangeListener {
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.mapbox.mapboxsdk.utils.ColorUtils.colorToRgbaArray;
|
||||
|
||||
/**
|
||||
* The value for any layout property, paint property, or filter may be specified as an expression.
|
||||
* An expression defines a formula for computing the value of the property using the operators described below.
|
||||
@@ -220,7 +222,7 @@ public class Expression {
|
||||
* @return the color expression
|
||||
*/
|
||||
public static Expression color(@ColorInt int color) {
|
||||
float[] rgba = PropertyFactory.colorToRgbaArray(color);
|
||||
float[] rgba = colorToRgbaArray(color);
|
||||
return rgba(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mapbox.mapboxsdk.style.layers;
|
||||
import android.support.annotation.ColorInt;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.utils.ColorUtils;
|
||||
import static com.mapbox.mapboxsdk.utils.ColorUtils.colorToRgbaString;
|
||||
|
||||
/**
|
||||
* Constructs paint/layout properties for Layers
|
||||
@@ -2444,33 +2444,4 @@ public class PropertyFactory {
|
||||
return new LayoutPropertyValue<>("text-optional", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Android color int to "rbga(r, g, b, a)" String equivalent.
|
||||
* <p>
|
||||
* Alpha value will be converted from 0-255 range to 0-1.
|
||||
* </p>
|
||||
*
|
||||
* @param color Android color int
|
||||
* @return String rgba color
|
||||
* @deprecated use {@link com.mapbox.mapboxsdk.utils.ColorUtils#colorToRgbaString(int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static String colorToRgbaString(@ColorInt int color) {
|
||||
return ColorUtils.colorToRgbaString(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Android color int to rgba float array.
|
||||
* <p>
|
||||
* Alpha value will be converted from 0-255 range to 0-1.
|
||||
* </p>
|
||||
*
|
||||
* @param color Android color int
|
||||
* @return int rgba array
|
||||
* @deprecated use {@link com.mapbox.mapboxsdk.utils.ColorUtils#colorToRgbaArray(int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static float[] colorToRgbaArray(@ColorInt int color) {
|
||||
return ColorUtils.colorToRgbaArray(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package com.mapbox.mapboxsdk.style.layers;
|
||||
import android.support.annotation.ColorInt;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.utils.ColorUtils;
|
||||
import static com.mapbox.mapboxsdk.utils.ColorUtils.colorToRgbaString;
|
||||
|
||||
/**
|
||||
* Constructs paint/layout properties for Layers
|
||||
@@ -84,33 +84,4 @@ public class PropertyFactory {
|
||||
}
|
||||
|
||||
<% } -%>
|
||||
/**
|
||||
* Converts Android color int to "rbga(r, g, b, a)" String equivalent.
|
||||
* <p>
|
||||
* Alpha value will be converted from 0-255 range to 0-1.
|
||||
* </p>
|
||||
*
|
||||
* @param color Android color int
|
||||
* @return String rgba color
|
||||
* @deprecated use {@link com.mapbox.mapboxsdk.utils.ColorUtils#colorToRgbaString(int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static String colorToRgbaString(@ColorInt int color) {
|
||||
return ColorUtils.colorToRgbaString(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Android color int to rgba float array.
|
||||
* <p>
|
||||
* Alpha value will be converted from 0-255 range to 0-1.
|
||||
* </p>
|
||||
*
|
||||
* @param color Android color int
|
||||
* @return int rgba array
|
||||
* @deprecated use {@link com.mapbox.mapboxsdk.utils.ColorUtils#colorToRgbaArray(int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static float[] colorToRgbaArray(@ColorInt int color) {
|
||||
return ColorUtils.colorToRgbaArray(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.layers.Property;
|
||||
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
import com.mapbox.mapboxsdk.utils.ColorUtils;
|
||||
import com.mapbox.mapboxsdk.utils.ThreadUtils;
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ public class Light {
|
||||
*/
|
||||
public void setColor(@ColorInt int color) {
|
||||
checkThread();
|
||||
nativeSetColor(PropertyFactory.colorToRgbaString(color));
|
||||
nativeSetColor(ColorUtils.colorToRgbaString(color));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,8 +12,8 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.layers.Property;
|
||||
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
import com.mapbox.mapboxsdk.utils.ColorUtils;
|
||||
import com.mapbox.mapboxsdk.utils.ThreadUtils;
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ public class Light {
|
||||
*/
|
||||
public void set<%- camelize(property.name) %>(@ColorInt int <%- property.name %>) {
|
||||
checkThread();
|
||||
nativeSet<%- camelize(property.name) %>(PropertyFactory.colorToRgbaString(<%- property.name %>));
|
||||
nativeSet<%- camelize(property.name) %>(ColorUtils.colorToRgbaString(<%- property.name %>));
|
||||
}
|
||||
<% } -%>
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.mapbox.mapboxsdk.style.expressions;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
|
||||
import com.mapbox.mapboxsdk.style.layers.PropertyValue;
|
||||
import com.mapbox.mapboxsdk.utils.ColorUtils;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -147,7 +147,7 @@ public class ExpressionTest {
|
||||
@Test
|
||||
public void testToRgba() throws Exception {
|
||||
Object[] expected = new Object[] {"to-rgba", new Object[] {"to-color", "rgba(255, 0, 0, 1)"}};
|
||||
Object[] actual = toRgba(toColor(literal(PropertyFactory.colorToRgbaString(Color.RED)))).toArray();
|
||||
Object[] actual = toRgba(toColor(literal(ColorUtils.colorToRgbaString(Color.RED)))).toArray();
|
||||
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
|
||||
}
|
||||
|
||||
@@ -1282,7 +1282,7 @@ public class ExpressionTest {
|
||||
literal(5f), literal("rgba(0, 0, 0, 1)"),
|
||||
literal(10.5f), literal("rgb(255, 0, 0)"),
|
||||
literal(15), color(Color.GREEN),
|
||||
literal(20), literal(PropertyFactory.colorToRgbaString(Color.BLUE)));
|
||||
literal(20), literal(ColorUtils.colorToRgbaString(Color.BLUE)));
|
||||
assertEquals("expressions should match", expected, raw(expected.toString()));
|
||||
}
|
||||
|
||||
@@ -1312,7 +1312,7 @@ public class ExpressionTest {
|
||||
|
||||
@Test
|
||||
public void testAlphaValueInStringConversion() {
|
||||
String color = PropertyFactory.colorToRgbaString(Color.parseColor("#41FF0000")).split(" ")[3];
|
||||
String color = ColorUtils.colorToRgbaString(Color.parseColor("#41FF0000")).split(" ")[3];
|
||||
String alpha = color.substring(0, color.length() - 1);
|
||||
assertEquals("alpha value should match", 0.254f, Float.valueOf(alpha), 0.001f);
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.Property;
|
||||
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
|
||||
import com.mapbox.mapboxsdk.style.light.Light;
|
||||
import com.mapbox.mapboxsdk.style.light.Position;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.mapboxsdk.utils.ColorUtils;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.eq;
|
||||
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
|
||||
@@ -79,7 +79,7 @@ public class BuildingFillExtrusionActivity extends AppCompatActivity {
|
||||
|
||||
findViewById(R.id.fabLightColor).setOnClickListener(v -> {
|
||||
isRedColor = !isRedColor;
|
||||
light.setColor(PropertyFactory.colorToRgbaString(isRedColor ? Color.RED : Color.BLUE));
|
||||
light.setColor(ColorUtils.colorToRgbaString(isRedColor ? Color.RED : Color.BLUE));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user