From 6a97768209f800a0327bd9a2d86d404e85e08cb3 Mon Sep 17 00:00:00 2001 From: tobrun Date: Mon, 1 Apr 2019 11:46:49 +0200 Subject: [android] - add pixel dimension annotation to public UiSettings methods --- .../java/com/mapbox/mapboxsdk/maps/UiSettings.java | 49 ++++++++++++++-------- 1 file changed, 31 insertions(+), 18 deletions(-) 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 034dc63c35..c671146876 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 @@ -10,6 +10,7 @@ import android.os.Bundle; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.Px; import android.support.annotation.UiThread; import android.support.v4.content.ContextCompat; import android.support.v4.content.res.ResourcesCompat; @@ -344,7 +345,7 @@ public final class UiSettings { } /** - * Sets the margins of the compass view. Use this to change the distance of the compass from the + * Sets the margins of the compass view in pixels. Use this to change the distance of the compass from the * map view edge. * * @param left The left margin in pixels. @@ -353,42 +354,46 @@ public final class UiSettings { * @param bottom The bottom margin in pixels. */ @UiThread - public void setCompassMargins(int left, int top, int right, int bottom) { + public void setCompassMargins(@Px int left, @Px int top, @Px int right, @Px int bottom) { setWidgetMargins(compassView, compassMargins, left, top, right, bottom); } /** - * Returns the left side margin of CompassView + * Returns the left side margin of CompassView in pixels. * * @return The left margin in pixels */ + @Px public int getCompassMarginLeft() { return compassMargins[0]; } /** - * Returns the top side margin of CompassView + * Returns the top side margin of CompassView in pixels. * * @return The top margin in pixels */ + @Px public int getCompassMarginTop() { return compassMargins[1]; } /** - * Returns the right side margin of CompassView + * Returns the right side margin of CompassView in pixels. * * @return The right margin in pixels */ + @Px public int getCompassMarginRight() { return compassMargins[2]; } /** - * Returns the bottom side margin of CompassView + * Returns the bottom side margin of CompassView in pixels. * * @return The bottom margin in pixels */ + @Px public int getCompassMarginBottom() { return compassMargins[3]; } @@ -456,7 +461,7 @@ public final class UiSettings { } /** - * Sets the margins of the logo view. Use this to change the distance of the Mapbox logo from the + * Sets the margins of the logo view in pixels. Use this to change the distance of the Mapbox logo from the * map view edge. * * @param left The left margin in pixels. @@ -464,42 +469,46 @@ public final class UiSettings { * @param right The right margin in pixels. * @param bottom The bottom margin in pixels. */ - public void setLogoMargins(int left, int top, int right, int bottom) { + public void setLogoMargins(@Px int left, @Px int top, @Px int right, @Px int bottom) { setWidgetMargins(logoView, logoMargins, left, top, right, bottom); } /** - * Returns the left side margin of the logo + * Returns the left side margin of the logo in pixels. * * @return The left margin in pixels */ + @Px public int getLogoMarginLeft() { return logoMargins[0]; } /** - * Returns the top side margin of the logo + * Returns the top side margin of the logo in pixels. * * @return The top margin in pixels */ + @Px public int getLogoMarginTop() { return logoMargins[1]; } /** - * Returns the right side margin of the logo + * Returns the right side margin of the logo in pixels. * * @return The right margin in pixels */ + @Px public int getLogoMarginRight() { return logoMargins[2]; } /** - * Returns the bottom side margin of the logo + * Returns the bottom side margin of the logo in pixels. * * @return The bottom margin in pixels */ + @Px public int getLogoMarginBottom() { return logoMargins[3]; } @@ -570,14 +579,14 @@ public final class UiSettings { } /** - * Sets the margins of the attribution view. + * Sets the margins of the attribution view in pixels. * * @param left The left margin in pixels. * @param top The top margin in pixels. * @param right The right margin in pixels. * @param bottom The bottom margin in pixels. */ - public void setAttributionMargins(int left, int top, int right, int bottom) { + public void setAttributionMargins(@Px int left, @Px int top, @Px int right, @Px int bottom) { setWidgetMargins(attributionsView, attributionsMargins, left, top, right, bottom); } @@ -599,37 +608,41 @@ public final class UiSettings { } /** - * Returns the left side margin of the attribution view. + * Returns the left side margin of the attribution view in pixels. * * @return The left margin in pixels */ + @Px public int getAttributionMarginLeft() { return attributionsMargins[0]; } /** - * Returns the top side margin of the attribution view. + * Returns the top side margin of the attribution view in pixels. * * @return The top margin in pixels */ + @Px public int getAttributionMarginTop() { return attributionsMargins[1]; } /** - * Returns the right side margin of the attribution view. + * Returns the right side margin of the attribution view in pixels. * * @return The right margin in pixels */ + @Px public int getAttributionMarginRight() { return attributionsMargins[2]; } /** - * Returns the bottom side margin of the logo + * Returns the bottom side margin of the logo in pixels. * * @return The bottom margin in pixels */ + @Px public int getAttributionMarginBottom() { return attributionsMargins[3]; } -- cgit v1.2.1