diff options
author | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-05-24 17:35:21 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-05-28 14:58:51 +0200 |
commit | 22741a0ce1171562c9f8e495a2a419cb6c39b869 (patch) | |
tree | 63701b6209ab43f494a7a83b41d4ab6132059de7 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java | |
parent | f2d2f2d6a9c960c7fdafe7005cd400fb9da4e5d3 (diff) | |
download | qtlocation-mapboxgl-22741a0ce1171562c9f8e495a2a419cb6c39b869.tar.gz |
[android] - raw expression support
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java index 1dd8eddab9..57638920be 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java @@ -2375,9 +2375,24 @@ public class PropertyFactory { return new LayoutPropertyValue<>("text-optional", value); } - public static String colorToRgbaString(@ColorInt int value) { - return String.format(Locale.US,"rgba(%d, %d, %d, %d)", - (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, (value >> 24) & 0xFF); + /** + * Converts Android color int to "rbga(r, g, b, a)" String equivalent. + * + * @param color Android color int + * @return String rgba color + */ + public static String colorToRgbaString(@ColorInt int color) { + return String.format(Locale.US, "rgba(%d, %d, %d, %d)", + (color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, (color >> 24) & 0xFF); } + /** + * Converts Android color int to rgba int array. + * + * @param color Android color int + * @return int rgba array + */ + public static int[] colorToRgbaArray(@ColorInt int color) { + return new int[] {(color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, (color >> 24) & 0xFF}; + } } |