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

Commit

Permalink
[android] - add nullability annotations to public api for kotlin lang…
Browse files Browse the repository at this point in the history
…uage integration
  • Loading branch information
tobrun committed May 17, 2018
1 parent 7d1e52a commit fbad62d
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ZoomButtonsController;

import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.android.telemetry.AppUserTurnstile;
import com.mapbox.android.telemetry.Event;
Expand All @@ -43,6 +42,8 @@
import com.mapbox.mapboxsdk.storage.FileSource;
import com.mapbox.mapboxsdk.utils.BitmapUtils;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
Expand All @@ -51,9 +52,6 @@
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION;
import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_WAIT_IDLE;

Expand Down Expand Up @@ -598,10 +596,8 @@ public Bitmap getViewContent() {
* @param listener The callback that's invoked on every frame rendered to the map view.
* @see MapView#removeOnMapChangedListener(OnMapChangedListener)
*/
public void addOnMapChangedListener(@Nullable OnMapChangedListener listener) {
if (listener != null) {
onMapChangedListeners.add(listener);
}
public void addOnMapChangedListener(@NonNull OnMapChangedListener listener) {
onMapChangedListeners.add(listener);
}

/**
Expand All @@ -610,8 +606,8 @@ public void addOnMapChangedListener(@Nullable OnMapChangedListener listener) {
* @param listener The previously added callback to remove.
* @see MapView#addOnMapChangedListener(OnMapChangedListener)
*/
public void removeOnMapChangedListener(@Nullable OnMapChangedListener listener) {
if (listener != null && onMapChangedListeners.contains(listener)) {
public void removeOnMapChangedListener(@NonNull OnMapChangedListener listener) {
if (onMapChangedListeners.contains(listener)) {
onMapChangedListeners.remove(listener);
}
}
Expand All @@ -622,13 +618,11 @@ public void removeOnMapChangedListener(@Nullable OnMapChangedListener listener)
* @param callback The callback object that will be triggered when the map is ready to be used.
*/
@UiThread
public void getMapAsync(final OnMapReadyCallback callback) {
if (!mapCallback.isInitialLoad() && callback != null) {
public void getMapAsync(final @NonNull OnMapReadyCallback callback) {
if (!mapCallback.isInitialLoad()) {
callback.onMapReady(mapboxMap);
} else {
if (callback != null) {
mapCallback.addOnMapReadyCallback(callback);
}
mapCallback.addOnMapReadyCallback(callback);
}
}

Expand Down
Loading

0 comments on commit fbad62d

Please sign in to comment.