diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-03-07 12:20:46 +0100 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-03-07 18:47:10 +0100 |
commit | a0fd38eb2978b507b69f48c3c1ba32dcbe91065a (patch) | |
tree | bf15d0321ac797e87205a1a56b3b89b8ebc73586 /platform/android/MapboxGLAndroidSDKTestApp | |
parent | b4e315ee28539efe0497ea53fe45e485b8eb31e0 (diff) | |
download | qtlocation-mapboxgl-a0fd38eb2978b507b69f48c3c1ba32dcbe91065a.tar.gz |
[android] get vector drawables using AppCompatResources and set vector drawables programmatically
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp')
2 files changed, 5 insertions, 5 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt index da06ba7173..01d8761cf3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt @@ -13,7 +13,6 @@ import android.support.test.espresso.assertion.ViewAssertions.matches import android.support.test.espresso.matcher.ViewMatchers.* import android.support.test.rule.GrantPermissionRule import android.support.test.runner.AndroidJUnit4 -import android.support.v4.content.ContextCompat import com.mapbox.geojson.Point import com.mapbox.mapboxsdk.camera.CameraUpdateFactory import com.mapbox.mapboxsdk.geometry.LatLng @@ -28,6 +27,7 @@ import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.activity.EspressoTest import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils +import com.mapbox.mapboxsdk.utils.BitmapUtils import com.mapbox.mapboxsdk.utils.ColorUtils import org.hamcrest.CoreMatchers.* import org.junit.* @@ -277,7 +277,7 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = true - val foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.ic_media_play) + val foregroundDrawable = BitmapUtils.getDrawableFromRes(context, R.drawable.ic_media_play) foregroundDrawable?.let { mapboxMap.addImageFromDrawable("custom-foreground-bitmap", it) mapboxMap.addImageFromDrawable("custom-background-bitmap", it) @@ -324,7 +324,7 @@ class LocationComponentTest : EspressoTest() { component.renderMode = RenderMode.GPS component.forceLocationUpdate(location) - val foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.ic_media_play) + val foregroundDrawable = BitmapUtils.getDrawableFromRes(context, R.drawable.ic_media_play) foregroundDrawable?.let { mapboxMap.addImageFromDrawable("custom-foreground-bitmap", it) mapboxMap.addImageFromDrawable("custom-gps-bitmap", it) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java index 96e329d3c0..e474c46038 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java @@ -7,7 +7,6 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import com.mapbox.mapboxsdk.Mapbox; @@ -20,6 +19,7 @@ import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.style.layers.RasterLayer; import com.mapbox.mapboxsdk.style.sources.ImageSource; import com.mapbox.mapboxsdk.testapp.R; +import com.mapbox.mapboxsdk.utils.BitmapUtils; /** * Test activity showing how to use a series of images to create an animation @@ -112,7 +112,7 @@ public class AnimatedImageSourceActivity extends AppCompatActivity implements On Bitmap getBitmap(int resourceId) { Context context = Mapbox.getApplicationContext(); - Drawable drawable = ContextCompat.getDrawable(context, resourceId); + Drawable drawable = BitmapUtils.getDrawableFromRes(context, resourceId); if (drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; return bitmapDrawable.getBitmap(); |