diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionMeasure.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionMeasure.java | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionMeasure.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionMeasure.java index b40a7be24c..c2408ca718 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionMeasure.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionMeasure.java @@ -2,8 +2,6 @@ package com.mapbox.mapboxsdk.attribution; import android.graphics.Bitmap; import android.graphics.PointF; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.widget.TextView; import java.util.Arrays; @@ -29,7 +27,6 @@ public class AttributionMeasure { this.margin = margin; } - @Nullable public AttributionLayout measure() { Chain chain = new Chain( new FullLogoLongTextCommand(), @@ -48,8 +45,7 @@ public class AttributionMeasure { private static class FullLogoLongTextCommand implements Command { - @Nullable - public AttributionLayout execute(@NonNull AttributionMeasure measure) { + public AttributionLayout execute(AttributionMeasure measure) { float width = measure.getLogoContainerWidth() + measure.getTextViewContainerWidth(); boolean fitBounds = width <= measure.getMaxSize(); if (fitBounds) { @@ -61,9 +57,8 @@ public class AttributionMeasure { } private static class FullLogoShortTextCommand implements Command { - @Nullable @Override - public AttributionLayout execute(@NonNull AttributionMeasure measure) { + public AttributionLayout execute(AttributionMeasure measure) { float width = measure.getLogoContainerWidth() + measure.getTextViewShortContainerWidth(); boolean fitBounds = width <= measure.getMaxSizeShort(); if (fitBounds) { @@ -75,9 +70,8 @@ public class AttributionMeasure { } private static class SmallLogoLongTextCommand implements Command { - @Nullable @Override - public AttributionLayout execute(@NonNull AttributionMeasure measure) { + public AttributionLayout execute(AttributionMeasure measure) { float width = measure.getLogoSmallContainerWidth() + measure.getTextViewContainerWidth(); boolean fitBounds = width <= measure.getMaxSize(); if (fitBounds) { @@ -89,9 +83,8 @@ public class AttributionMeasure { } private static class SmallLogoShortTextCommand implements Command { - @Nullable @Override - public AttributionLayout execute(@NonNull AttributionMeasure measure) { + public AttributionLayout execute(AttributionMeasure measure) { float width = measure.getLogoContainerWidth() + measure.getTextViewShortContainerWidth(); boolean fitBounds = width <= measure.getMaxSizeShort(); if (fitBounds) { @@ -103,9 +96,8 @@ public class AttributionMeasure { } private static class LongTextCommand implements Command { - @Nullable @Override - public AttributionLayout execute(@NonNull AttributionMeasure measure) { + public AttributionLayout execute(AttributionMeasure measure) { float width = measure.getTextViewContainerWidth() + measure.margin; boolean fitBounds = width <= measure.getMaxSize(); if (fitBounds) { @@ -116,9 +108,8 @@ public class AttributionMeasure { } private static class ShortTextCommand implements Command { - @Nullable @Override - public AttributionLayout execute(@NonNull AttributionMeasure measure) { + public AttributionLayout execute(AttributionMeasure measure) { float width = measure.getTextViewShortContainerWidth() + measure.margin; boolean fitBounds = width <= measure.getMaxSizeShort(); if (fitBounds) { @@ -130,7 +121,6 @@ public class AttributionMeasure { } private static class NoTextCommand implements Command { - @NonNull @Override public AttributionLayout execute(AttributionMeasure measure) { return new AttributionLayout(null, null, false); @@ -155,7 +145,6 @@ public class AttributionMeasure { this.commands = Arrays.asList(commands); } - @Nullable public AttributionLayout start(AttributionMeasure measure) { AttributionLayout attributionLayout = null; for (Command command : commands) { @@ -169,7 +158,6 @@ public class AttributionMeasure { } public interface Command { - @Nullable AttributionLayout execute(AttributionMeasure measure); } @@ -205,43 +193,36 @@ public class AttributionMeasure { private TextView textViewShort; private float marginPadding; - @NonNull public Builder setSnapshot(Bitmap snapshot) { this.snapshot = snapshot; return this; } - @NonNull public Builder setLogo(Bitmap logo) { this.logo = logo; return this; } - @NonNull public Builder setLogoSmall(Bitmap logoSmall) { this.logoSmall = logoSmall; return this; } - @NonNull public Builder setTextView(TextView textView) { this.textView = textView; return this; } - @NonNull public Builder setTextViewShort(TextView textViewShort) { this.textViewShort = textViewShort; return this; } - @NonNull public Builder setMarginPadding(float marginPadding) { this.marginPadding = marginPadding; return this; } - @NonNull public AttributionMeasure build() { return new AttributionMeasure(snapshot, logo, logoSmall, textView, textViewShort, marginPadding); } |