From 8ff9bcb22a94567a555cd2c75b051d0979101ff7 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 4 May 2016 13:04:35 +0200 Subject: [PATCH] [android] #4930 - added invalidate to change tint colors --- .../maps/widgets/MyLocationView.java | 4 + .../src/main/AndroidManifest.xml | 4 +- ...y.java => MyLocationDrawableActivity.java} | 2 +- ...Color.java => MyLocationTintActivity.java} | 73 ++++++++++--------- .../layout/activity_my_location_dot_color.xml | 4 +- .../src/main/res/values/strings.xml | 4 +- 6 files changed, 49 insertions(+), 42 deletions(-) rename platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/{MyLocationCustomizationActivity.java => MyLocationDrawableActivity.java} (97%) rename platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/{MyLocationDotColor.java => MyLocationTintActivity.java} (66%) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java index 19d214461..23c46bfd3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java @@ -135,6 +135,7 @@ public class MyLocationView extends View { foregroundBearingDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN); } } + invalidate(); } public final void setShadowDrawable(Drawable drawable) { @@ -164,16 +165,19 @@ public class MyLocationView extends View { } backgroundDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN); } + invalidate(); } public final void setAccuracyTint(@ColorInt int color) { int alpha = accuracyPaint.getAlpha(); accuracyPaint.setColor(color); accuracyPaint.setAlpha(alpha); + invalidate(); } public final void setAccuracyAlpha(@IntRange(from = 0, to = 255) int alpha) { accuracyPaint.setAlpha(alpha); + invalidate(); } private void invalidateBounds() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 75356e6e2..ff3e7a5a1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -140,7 +140,7 @@ android:value="@string/category_userlocation" /> @@ -16,8 +15,7 @@ android:id="@id/mapView" android:layout_below="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="match_parent" - app:style_url="@string/style_mapbox_streets" /> + android:layout_height="match_parent"/> Snapshot Activity User tracking mode User location customization - User location dot color + User location tint color User location toggle Custom Layer Map Padding @@ -48,7 +48,7 @@ Tracks the location of the user Customize the location of the user - Customize the user dot color + Customize the user location color Toggle location of the user on and off Overlay a custom native layer on the map Learn how to create a custom InfoWindow