JavaDoc error fixes (#596)

Co-authored-by: Artak Kalantarian <artak@amazon.com>
This commit is contained in:
Artak Kalantarian
2022-12-15 00:34:27 -08:00
committed by GitHub
parent ff2745b9ce
commit 3321a026e0
7 changed files with 34 additions and 23 deletions

View File

@@ -13,6 +13,7 @@ dependencies {
implementation dependenciesList.supportFragmentV4
implementation dependenciesList.okhttp3
implementation dependenciesList.gmsLocation
implementation dependenciesList.timber
testImplementation dependenciesList.junit
testImplementation dependenciesList.mockito

View File

@@ -1,6 +1,6 @@
package com.mapbox.mapboxsdk;
class MapStrictModeException extends RuntimeException {
public class MapStrictModeException extends RuntimeException {
MapStrictModeException(String message) {
super(String.format("Map detected an error that would fail silently otherwise: %s", message));
}

View File

@@ -8,6 +8,7 @@ import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import timber.log.Timber;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException;
@@ -92,6 +93,7 @@ public final class Mapbox {
ThreadUtils.init(context);
ThreadUtils.checkThread(TAG);
if (INSTANCE == null) {
Timber.plant(new Timber.DebugTree());
Context appContext = context.getApplicationContext();
FileSource.initializeFileDirsPaths(appContext);
INSTANCE = new Mapbox(appContext, apiKey);

View File

@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.exceptions;
import com.mapbox.mapboxsdk.WellKnownTileServer;
import android.content.Context;
import androidx.annotation.NonNull;
@@ -8,10 +10,10 @@ import androidx.annotation.NonNull;
* A MapboxConfigurationException is thrown by MapboxMap when the SDK hasn't been properly initialised.
* <p>
* This occurs either when {@link com.mapbox.mapboxsdk.Mapbox} is not correctly initialised or the provided apiKey
* through {@link com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String)} isn't valid.
* through {@link com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String, WellKnownTileServer)} isn't valid.
* </p>
*
* @see com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String)
* @see com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String, WellKnownTileServer)
*/
public class MapboxConfigurationException extends RuntimeException {
@@ -19,8 +21,8 @@ public class MapboxConfigurationException extends RuntimeException {
* Creates a Mapbox configuration exception thrown by MapboxMap when the SDK hasn't been properly initialised.
*/
public MapboxConfigurationException() {
super("\nUsing MapView requires calling Mapbox.getInstance(Context context, String apiKey) before "
+ "inflating or creating the view.");
super("\nUsing MapView requires calling Mapbox.getInstance(Context context, String apiKey, "
+ "WellKnownTileServer wellKnownTileServer) before inflating or creating the view.");
}
/**

View File

@@ -18,11 +18,13 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.collection.LongSparseArray;
import timber.log.Timber;
import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.mapboxsdk.MapStrictMode;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.R;
import com.mapbox.mapboxsdk.WellKnownTileServer;
import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException;
@@ -99,24 +101,28 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
@UiThread
public MapView(@NonNull Context context) {
super(context);
Timber.d("MapView constructed with context");
initialize(context, MapboxMapOptions.createFromAttributes(context));
}
@UiThread
public MapView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Timber.d("MapView constructed with context and attribute set");
initialize(context, MapboxMapOptions.createFromAttributes(context, attrs));
}
@UiThread
public MapView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Timber.d( "MapView constructed with context, attributeSet and defStyleAttr");
initialize(context, MapboxMapOptions.createFromAttributes(context, attrs));
}
@UiThread
public MapView(@NonNull Context context, @Nullable MapboxMapOptions options) {
super(context);
Timber.d("MapView constructed with context and MapboxMapOptions");
initialize(context, options == null ? MapboxMapOptions.createFromAttributes(context) : options);
}
@@ -160,18 +166,18 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
Polylines polylines = new PolylineContainer(nativeMapView, annotationsArray);
ShapeAnnotations shapeAnnotations = new ShapeAnnotationContainer(nativeMapView, annotationsArray);
AnnotationManager annotationManager = new AnnotationManager(this, annotationsArray, iconManager,
annotations, markers, polygons, polylines, shapeAnnotations);
annotations, markers, polygons, polylines, shapeAnnotations);
Transform transform = new Transform(this, nativeMapView, cameraDispatcher);
// MapboxMap
List<MapboxMap.OnDeveloperAnimationListener> developerAnimationListeners = new ArrayList<>();
mapboxMap = new MapboxMap(nativeMapView, transform, uiSettings, proj, registerTouchListener, cameraDispatcher,
developerAnimationListeners);
developerAnimationListeners);
mapboxMap.injectAnnotationManager(annotationManager);
// user input
mapGestureDetector = new MapGestureDetector(context, transform, proj, uiSettings,
annotationManager, cameraDispatcher);
annotationManager, cameraDispatcher);
mapKeyListener = new MapKeyListener(transform, uiSettings, mapGestureDetector);
// LocationComponent
@@ -245,7 +251,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
}
private MapboxMap.OnCompassAnimationListener createCompassAnimationListener(@NonNull final CameraChangeDispatcher
cameraChangeDispatcher) {
cameraChangeDispatcher) {
return new MapboxMap.OnCompassAnimationListener() {
@Override
public void onCompassAnimation() {
@@ -289,11 +295,12 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
* You must call this method from the parent's Activity#onCreate(Bundle)} or
* Fragment#onViewCreated(View, Bundle).
* </p>
* You must set a valid access token with {@link com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String)}
* You must set a valid access token with
* {@link com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String, WellKnownTileServer)}
* before you call this method or an exception will be thrown.
*
* @param savedInstanceState Pass in the parent's savedInstanceState.
* @see com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String)
* @see com.mapbox.mapboxsdk.Mapbox#getInstance(Context, String, WellKnownTileServer)
*/
@UiThread
public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -308,7 +315,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
TextureView textureView = new TextureView(getContext());
boolean translucentSurface = options.getTranslucentTextureSurface();
mapRenderer = new TextureViewMapRenderer(getContext(),
textureView, localFontFamily, translucentSurface) {
textureView, localFontFamily, translucentSurface) {
@Override
protected void onSurfaceCreated(GL10 gl, EGLConfig config) {
MapView.this.onSurfaceCreated();
@@ -335,7 +342,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
boolean crossSourceCollisions = mapboxMapOptions.getCrossSourceCollisions();
nativeMapView = new NativeMapView(
getContext(), getPixelRatio(), crossSourceCollisions, this, mapChangeReceiver, mapRenderer
getContext(), getPixelRatio(), crossSourceCollisions, this, mapChangeReceiver, mapRenderer
);
}
@@ -1272,7 +1279,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
public void setGesturesManager(AndroidGesturesManager gesturesManager, boolean attachDefaultListeners,
boolean setDefaultMutuallyExclusives) {
mapGestureDetector.setGesturesManager(
getContext(), gesturesManager, attachDefaultListeners, setDefaultMutuallyExclusives);
getContext(), gesturesManager, attachDefaultListeners, setDefaultMutuallyExclusives);
}
@Override
@@ -1282,8 +1289,8 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
}
private class MapCallback implements OnDidFinishLoadingStyleListener,
OnDidFinishRenderingFrameListener, OnDidFinishLoadingMapListener,
OnCameraIsChangingListener, OnCameraDidChangeListener, OnDidFailLoadingMapListener {
OnDidFinishRenderingFrameListener, OnDidFinishLoadingMapListener,
OnCameraIsChangingListener, OnCameraDidChangeListener, OnDidFailLoadingMapListener {
private final List<OnMapReadyCallback> onMapReadyCallbackList = new ArrayList<>();

View File

@@ -85,8 +85,8 @@ public class MapboxTest {
expectedException.expect(MapboxConfigurationException.class);
expectedException.expectMessage(
"\nUsing MapView requires calling Mapbox.getInstance(Context context, String apiKey) before "
+ "inflating or creating the view."
"\nUsing MapView requires calling Mapbox.getInstance(Context context, String apiKey,"
+ " WellKnownTileServer wellKnownTileServer) before inflating or creating the view."
);
new MapView(context);
}

View File

@@ -15,7 +15,6 @@ import com.mapbox.mapboxsdk.style.layers.Layer
import com.mapbox.mapboxsdk.style.layers.Property
import com.mapbox.mapboxsdk.style.layers.PropertyFactory
import com.mapbox.mapboxsdk.testapp.R
import com.mapbox.mapboxsdk.testapp.activity.maplayout.DebugModeActivity.LayerListAdapter
import timber.log.Timber
import java.util.*
@@ -216,7 +215,7 @@ open class DebugModeActivity : AppCompatActivity(), OnMapReadyCallback, OnFpsCha
mapView!!.onLowMemory()
}
private class LayerListAdapter internal constructor(context: Context?, layers: List<Layer>) :
private class LayerListAdapter(context: Context?, layers: List<Layer>) :
BaseAdapter() {
private val layoutInflater: LayoutInflater
private val layers: List<Layer>
@@ -232,7 +231,7 @@ open class DebugModeActivity : AppCompatActivity(), OnMapReadyCallback, OnFpsCha
return position.toLong()
}
override fun getView(position: Int, convertView: View, parent: ViewGroup): View {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val layer = layers[position]
var view = convertView
if (view == null) {
@@ -243,13 +242,13 @@ open class DebugModeActivity : AppCompatActivity(), OnMapReadyCallback, OnFpsCha
)
view.tag = holder
}
val holder = view.tag as ViewHolder
val holder = view!!.tag as ViewHolder
holder.text.text = layer.javaClass.simpleName
holder.subText.text = layer.id
return view
}
private class ViewHolder internal constructor(val text: TextView, val subText: TextView)
private class ViewHolder(val text: TextView, val subText: TextView)
init {
layoutInflater = LayoutInflater.from(context)