Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Revert "[android] - infer nullity"
Browse files Browse the repository at this point in the history
This reverts commit 6177427.
  • Loading branch information
tobrun committed Oct 23, 2018
1 parent 3ef5bc6 commit 83ac115
Show file tree
Hide file tree
Showing 131 changed files with 415 additions and 1,375 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public final class Mapbox {
private static Mapbox INSTANCE;

private Context context;
@Nullable
private String accessToken;
private Boolean connected;
@Nullable
private TelemetryDefinition telemetry;

/**
Expand All @@ -49,7 +47,6 @@ public final class Mapbox {
* @param accessToken Mapbox access token
* @return the single instance of Mapbox
*/
@NonNull
@UiThread
public static synchronized Mapbox getInstance(@NonNull Context context, @Nullable String accessToken) {
ThreadUtils.checkThread("Mapbox");
Expand Down Expand Up @@ -174,7 +171,7 @@ private static void validateMapbox() {
* @param accessToken the access token to validate
* @return true is valid, false otherwise
*/
static boolean isAccessTokenValid(@Nullable String accessToken) {
static boolean isAccessTokenValid(String accessToken) {
if (accessToken == null) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.support.annotation.NonNull;

import android.support.annotation.Nullable;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;

Expand Down Expand Up @@ -122,11 +121,11 @@ public int compareTo(@NonNull Annotation annotation) {
* @return returns true both id's match else returns false.
*/
@Override
public boolean equals(@Nullable Object object) {
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Annotation)) {
if (object == null || !(object instanceof Annotation)) {
return false;
}
Annotation that = (Annotation) object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.support.annotation.Keep;

import android.support.annotation.NonNull;
import com.mapbox.mapboxsdk.geometry.LatLng;

import java.util.ArrayList;
Expand All @@ -28,7 +27,6 @@ protected BasePointCollection() {
*
* @return A {@link List} of points.
*/
@NonNull
public List<LatLng> getPoints() {
return new ArrayList<>(points);
}
Expand All @@ -39,7 +37,7 @@ public List<LatLng> getPoints() {
*
* @param points A {@link List} of {@link LatLng} points making up the polyline.
*/
public void setPoints(@NonNull List<LatLng> points) {
public void setPoints(List<LatLng> points) {
this.points = new ArrayList<>(points);
update();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,22 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;

class Bubble extends Drawable {

@NonNull
private RectF rect;
private float arrowWidth;
private float arrowHeight;
private float arrowPosition;
private float cornersRadius;
@NonNull
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
private float strokeWidth;
private Paint strokePaint;
private Path strokePath;
@NonNull
private Path path = new Path();

Bubble(@NonNull RectF rect, @NonNull ArrowDirection arrowDirection, float arrowWidth, float arrowHeight,
float arrowPosition, float cornersRadius, int bubbleColor, float strokeWidth, int strokeColor) {
Bubble(RectF rect, ArrowDirection arrowDirection, float arrowWidth, float arrowHeight, float arrowPosition,
float cornersRadius, int bubbleColor, float strokeWidth, int strokeColor) {
this.rect = rect;
this.arrowWidth = arrowWidth;
this.arrowHeight = arrowHeight;
Expand All @@ -53,7 +49,7 @@ protected void onBoundsChange(Rect bounds) {
}

@Override
public void draw(@NonNull Canvas canvas) {
public void draw(Canvas canvas) {
if (strokeWidth > 0) {
canvas.drawPath(strokePath, strokePaint);
}
Expand Down Expand Up @@ -85,7 +81,7 @@ public int getIntrinsicHeight() {
return (int) rect.height();
}

private void initPath(@NonNull ArrowDirection arrowDirection, @NonNull Path path, float strokeWidth) {
private void initPath(ArrowDirection arrowDirection, Path path, float strokeWidth) {
switch (arrowDirection.getValue()) {
case ArrowDirection.LEFT:
if (cornersRadius <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.widget.LinearLayout;
Expand All @@ -18,7 +17,6 @@
public class BubbleLayout extends LinearLayout {

public static final float DEFAULT_STROKE_WIDTH = -1;
@NonNull
private ArrowDirection arrowDirection;
private float arrowWidth;
private float arrowHeight;
Expand All @@ -34,7 +32,7 @@ public class BubbleLayout extends LinearLayout {
*
* @param context The context used to inflate this bubble layout
*/
public BubbleLayout(@NonNull Context context) {
public BubbleLayout(Context context) {
this(context, null, 0);
}

Expand All @@ -44,7 +42,7 @@ public BubbleLayout(@NonNull Context context) {
* @param context The context used to inflate this bubble layout
* @param attrs The attribute set to initialise this bubble layout from
*/
public BubbleLayout(@NonNull Context context, AttributeSet attrs) {
public BubbleLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

Expand All @@ -55,7 +53,7 @@ public BubbleLayout(@NonNull Context context, AttributeSet attrs) {
* @param attrs The attribute set to initialise this bubble layout from
* @param defStyleAttr The default style to apply this bubble layout with
*/
public BubbleLayout(@NonNull Context context, AttributeSet attrs, int defStyleAttr) {
public BubbleLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);

TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.mapbox_BubbleLayout);
Expand Down Expand Up @@ -86,7 +84,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
}

@Override
protected void dispatchDraw(@NonNull Canvas canvas) {
protected void dispatchDraw(Canvas canvas) {
if (bubble != null) {
bubble.draw(canvas);
}
Expand All @@ -113,8 +111,7 @@ public ArrowDirection getArrowDirection() {
* @param arrowDirection The direction of the arrow
* @return this
*/
@NonNull
public BubbleLayout setArrowDirection(@NonNull ArrowDirection arrowDirection) {
public BubbleLayout setArrowDirection(ArrowDirection arrowDirection) {
resetPadding();
this.arrowDirection = arrowDirection;
initPadding();
Expand All @@ -136,7 +133,6 @@ public float getArrowWidth() {
* @param arrowWidth The width of the arrow
* @return this
*/
@NonNull
public BubbleLayout setArrowWidth(float arrowWidth) {
resetPadding();
this.arrowWidth = arrowWidth;
Expand All @@ -159,7 +155,6 @@ public float getArrowHeight() {
* @param arrowHeight The height of the arrow
* @return this
*/
@NonNull
public BubbleLayout setArrowHeight(float arrowHeight) {
resetPadding();
this.arrowHeight = arrowHeight;
Expand All @@ -182,7 +177,6 @@ public float getArrowPosition() {
* @param arrowPosition The arrow position
* @return this
*/
@NonNull
public BubbleLayout setArrowPosition(float arrowPosition) {
resetPadding();
this.arrowPosition = arrowPosition;
Expand All @@ -205,7 +199,6 @@ public float getCornersRadius() {
* @param cornersRadius The corner radius
* @return this
*/
@NonNull
public BubbleLayout setCornersRadius(float cornersRadius) {
this.cornersRadius = cornersRadius;
requestLayout();
Expand All @@ -227,7 +220,6 @@ public int getBubbleColor() {
* @param bubbleColor The buble color
* @return this
*/
@NonNull
public BubbleLayout setBubbleColor(int bubbleColor) {
this.bubbleColor = bubbleColor;
requestLayout();
Expand All @@ -249,7 +241,6 @@ public float getStrokeWidth() {
* @param strokeWidth The stroke width
* @return this
*/
@NonNull
public BubbleLayout setStrokeWidth(float strokeWidth) {
resetPadding();
this.strokeWidth = strokeWidth;
Expand All @@ -272,7 +263,6 @@ public int getStrokeColor() {
* @param strokeColor The stroke color
* @return this
*/
@NonNull
public BubbleLayout setStrokeColor(int strokeColor) {
this.strokeColor = strokeColor;
requestLayout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class BubblePopupHelper {

@NonNull
static PopupWindow create(@NonNull Context context, @NonNull BubbleLayout bubbleLayout) {
PopupWindow popupWindow = new PopupWindow(context);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.mapbox.mapboxsdk.annotations;

import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.DisplayMetrics;

import java.nio.ByteBuffer;
Expand Down Expand Up @@ -71,7 +69,6 @@ public float getScale() {
*
* @return the bytes of the bitmap
*/
@NonNull
public byte[] toBytes() {
if (mBitmap == null) {
throw new IllegalStateException("Required to set a Icon before calling toBytes");
Expand All @@ -88,7 +85,7 @@ public byte[] toBytes() {
* @return True if the icon being passed in matches this icon object. Else, false.
*/
@Override
public boolean equals(@Nullable Object object) {
public boolean equals(Object object) {
if (this == object) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import android.graphics.PointF;
import android.os.Build;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -49,17 +47,17 @@ public class InfoWindow {
@LayoutRes
private int layoutRes;

InfoWindow(@NonNull MapView mapView, int layoutResId, @NonNull MapboxMap mapboxMap) {
InfoWindow(MapView mapView, int layoutResId, MapboxMap mapboxMap) {
layoutRes = layoutResId;
View view = LayoutInflater.from(mapView.getContext()).inflate(layoutResId, mapView, false);
initialize(view, mapboxMap);
}

InfoWindow(@NonNull View view, @NonNull MapboxMap mapboxMap) {
InfoWindow(View view, MapboxMap mapboxMap) {
initialize(view, mapboxMap);
}

private void initialize(@NonNull View view, @NonNull MapboxMap mapboxMap) {
private void initialize(View view, MapboxMap mapboxMap) {
this.mapboxMap = new WeakReference<>(mapboxMap);
isVisible = false;
this.view = new WeakReference<>(view);
Expand Down Expand Up @@ -118,8 +116,7 @@ private void closeInfoWindow() {
* the view from the object position.
* @return this {@link InfoWindow}.
*/
@NonNull
InfoWindow open(@NonNull MapView mapView, Marker boundMarker, @NonNull LatLng position, int offsetX, int offsetY) {
InfoWindow open(MapView mapView, Marker boundMarker, LatLng position, int offsetX, int offsetY) {
setBoundMarker(boundMarker);

MapView.LayoutParams lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT,
Expand Down Expand Up @@ -216,7 +213,6 @@ InfoWindow open(@NonNull MapView mapView, Marker boundMarker, @NonNull LatLng po
*
* @return This {@link InfoWindow}
*/
@NonNull
InfoWindow close() {
MapboxMap mapboxMap = this.mapboxMap.get();
if (isVisible && mapboxMap != null) {
Expand All @@ -243,7 +239,7 @@ InfoWindow close() {
*
* @param overlayItem the tapped overlay item
*/
void adaptDefaultMarker(@NonNull Marker overlayItem, MapboxMap mapboxMap, @NonNull MapView mapView) {
void adaptDefaultMarker(Marker overlayItem, MapboxMap mapboxMap, MapView mapView) {
View view = this.view.get();
if (view == null) {
view = LayoutInflater.from(mapView.getContext()).inflate(layoutRes, mapView, false);
Expand All @@ -269,13 +265,11 @@ void adaptDefaultMarker(@NonNull Marker overlayItem, MapboxMap mapboxMap, @NonNu
}
}

@NonNull
InfoWindow setBoundMarker(Marker boundMarker) {
this.boundMarker = new WeakReference<>(boundMarker);
return this;
}

@Nullable
Marker getBoundMarker() {
if (boundMarker == null) {
return null;
Expand Down Expand Up @@ -313,7 +307,6 @@ void onContentUpdate() {
}
}

@Nullable
private final ViewTreeObserver.OnGlobalLayoutListener contentUpdateListener =
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
Expand All @@ -336,7 +329,6 @@ public void onGlobalLayout() {
*
* @return This {@link InfoWindow}'s current View.
*/
@Nullable
public View getView() {
return view != null ? view.get() : null;
}
Expand Down
Loading

0 comments on commit 83ac115

Please sign in to comment.