From c7b417e24747dbe9a0dbdf698dbba9776f66bcdb Mon Sep 17 00:00:00 2001 From: tobrun Date: Mon, 29 Oct 2018 11:30:15 +0100 Subject: [android] - move CameraPositionActivity to use FragmetnActivity above AppCompatActivity --- .../java/com/mapbox/mapboxsdk/maps/UiSettings.java | 1 - .../com/mapbox/mapboxsdk/utils/ColorUtils.java | 12 +++---- .../src/main/AndroidManifest.xml | 1 + .../activity/camera/CameraPositionActivity.java | 12 ++++--- .../src/main/res/drawable/ic_ab_back.xml | 12 +++++++ .../main/res/layout/activity_camera_position.xml | 41 +++++++++++++--------- 6 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_ab_back.xml (limited to 'platform') diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java index 16f42c9b0f..600402db03 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java @@ -595,7 +595,6 @@ public final class UiSettings { *

* Sets the tint of the attribution view. Use this to change the color of the attribution. *

- * By default, the logo is tinted with the primary color of your theme. * * @param tintColor Color to tint the attribution. */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java index 3a53794e50..f180eda809 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java @@ -4,14 +4,12 @@ import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Color; -import android.graphics.drawable.Drawable; import android.os.Build; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; -import android.support.v4.graphics.drawable.DrawableCompat; +import android.support.v4.widget.ImageViewCompat; import android.util.TypedValue; import android.widget.ImageView; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.exceptions.ConversionException; @@ -109,12 +107,10 @@ public class ColorUtils { * @param tintColor The color to tint. */ public static void setTintList(@NonNull ImageView imageView, @ColorInt int tintColor) { - Drawable originalDrawable = imageView.getDrawable(); - Drawable wrappedDrawable = DrawableCompat.wrap(originalDrawable); - DrawableCompat.setTintList(wrappedDrawable, getSelector(tintColor)); + ImageViewCompat.setImageTintList(imageView, getSelector(tintColor)); } - static int normalizeColorComponent(String value) { + private static int normalizeColorComponent(String value) { return (int) (Float.parseFloat(value) * 255); } @@ -151,7 +147,7 @@ public class ColorUtils { * @return String rgba color */ public static String colorToRgbaString(@ColorInt int color) { - String alpha = new DecimalFormat("#.###").format(((float)((color >> 24) & 0xFF)) / 255.0f); + String alpha = new DecimalFormat("#.###").format(((float) ((color >> 24) & 0xFF)) / 255.0f); return String.format(Locale.US, "rgba(%d, %d, %d, %s)", (color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, alpha); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 5fcbcb9630..14066123d3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -126,6 +126,7 @@ finish()); + mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_ab_back.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_ab_back.xml new file mode 100644 index 0000000000..a972876485 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_ab_back.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml index 341218c406..bafafb9546 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml @@ -1,24 +1,33 @@ + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/coordinator_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + + android:id="@id/mapView" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="?android:attr/actionBarSize" + app:mapbox_uiAttributionTintColor="@color/redAccent" + app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + android:id="@+id/fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end|bottom" + android:layout_margin="@dimen/fab_margin" + app:srcCompat="@drawable/ic_input" + app:backgroundTint="@android:color/white"/> -- cgit v1.2.1