[android] #5880 - javadoc cleanup part one

This commit is contained in:
Tobrun
2016-08-08 21:51:52 -04:00
parent 82f19b94f7
commit 63efa9bf7d
15 changed files with 670 additions and 48 deletions

View File

@@ -60,7 +60,7 @@ public class MapboxAccountManager {
}
/**
* Access Token for this application
* Access Token for this application.
*
* @return Mapbox Access Token
*/
@@ -69,10 +69,10 @@ public class MapboxAccountManager {
}
/**
* Runtime validation of Access Token
* Runtime validation of Access Token.
*
* @param accessToken Access Token to check
* @throws InvalidAccessTokenException
* @throws InvalidAccessTokenException the exception thrown
*/
public static void validateAccessToken(String accessToken) throws InvalidAccessTokenException {
if (TextUtils.isEmpty(accessToken) || (!accessToken.toLowerCase(MapboxConstants.MAPBOX_LOCALE).startsWith("pk.") && !accessToken.toLowerCase(MapboxConstants.MAPBOX_LOCALE).startsWith("sk."))) {

View File

@@ -34,6 +34,8 @@ public abstract class Annotation implements Comparable<Annotation> {
* </p>
* This ID is unique for a MapView instance and is suitable for associating your own extra
* data with.
*
* @return the assigned id
*/
public long getId() {
return id;
@@ -48,6 +50,8 @@ public abstract class Annotation implements Comparable<Annotation> {
/**
* Do not use this method. Used internally by the SDK.
*
* @param id the assigned id
*/
public void setId(long id) {
this.id = id;
@@ -55,15 +59,17 @@ public abstract class Annotation implements Comparable<Annotation> {
/**
* Do not use this method. Used internally by the SDK.
*
* @param mapboxMap the hosting mapbox map
*/
public void setMapboxMap(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
}
/**
* Gets the associated MapboxMap
* Gets the hosting mapbox map.
*
* @return The MapboxMap
* @return the MapboxMap
*/
protected MapboxMap getMapboxMap() {
return mapboxMap;
@@ -71,13 +77,15 @@ public abstract class Annotation implements Comparable<Annotation> {
/**
* Don not use this method. Used internally by the SDK.
*
* @param mapView the hosting map view
*/
public void setMapView(MapView mapView) {
this.mapView = mapView;
}
/**
* Gets the associated MapView
* Gets the hosting map view.
*
* @return The MapView
*/

View File

@@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.annotations;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import com.mapbox.mapboxsdk.R;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
@@ -41,7 +42,7 @@ public class Marker extends Annotation {
title = baseMarkerOptions.title;
}
Marker(BaseMarkerViewOptions baseMarkerViewOptions){
Marker(BaseMarkerViewOptions baseMarkerViewOptions) {
position = baseMarkerViewOptions.position;
snippet = baseMarkerViewOptions.snippet;
icon = baseMarkerViewOptions.icon;
@@ -72,6 +73,8 @@ public class Marker extends Annotation {
/**
* Do not use this method. Used internally by the SDK.
*
* @return true if the infoWindow is shown
*/
public boolean isInfoWindowShown() {
return infoWindowShown;
@@ -126,7 +129,7 @@ public class Marker extends Annotation {
* Update only for default Marker's InfoWindow content for Title and Snippet
*/
private void refreshInfoWindowContent() {
if (isInfoWindowShown() && mapView != null && mapboxMap != null && mapboxMap.getInfoWindowAdapter() == null) {
if (isInfoWindowShown() && mapView != null && mapboxMap != null && mapboxMap.getInfoWindowAdapter() == null) {
InfoWindow infoWindow = getInfoWindow(mapView);
if (mapView.getContext() != null) {
infoWindow.adaptDefaultMarker(this, mapboxMap, mapView);
@@ -140,6 +143,10 @@ public class Marker extends Annotation {
/**
* Do not use this method. Used internally by the SDK.
*
* @param mapboxMap the hosting mapbox map
* @param mapView the hosting map view
* @return the info window that was shown
*/
public InfoWindow showInfoWindow(@NonNull MapboxMap mapboxMap, @NonNull MapView mapView) {
setMapboxMap(mapboxMap);
@@ -177,6 +184,8 @@ public class Marker extends Annotation {
/**
* Do not use this method. Used internally by the SDK.
*
* @param topOffsetPixels the top offset pixels.
*/
public void setTopOffsetPixels(int topOffsetPixels) {
this.topOffsetPixels = topOffsetPixels;
@@ -184,6 +193,8 @@ public class Marker extends Annotation {
/**
* Do not use this method. Used internally by the SDK.
*
* @param rightOffsetPixels the right offset pixels.
*/
public void setRightOffsetPixels(int rightOffsetPixels) {
this.rightOffsetPixels = rightOffsetPixels;

View File

@@ -156,7 +156,9 @@ public class MarkerViewManager {
}
/**
* Update and invalidate the MarkerView icon.
*
* @param markerView the marker view to updates
*/
public void updateIcon(@NonNull MarkerView markerView) {
View convertView = markerViewMap.get(markerView);

View File

@@ -137,7 +137,7 @@ public final class CameraPosition implements Parcelable {
/**
* Creates a builder for building CameraPosition objects using radiants.
*
* @param isRadiant
* @param isRadiant true if heading is in radiants
*/
public Builder(boolean isRadiant) {
this.isRadiant = isRadiant;

View File

@@ -27,10 +27,10 @@ public class ProjectedMeters implements IProjectedMeters, Parcelable {
private double easting;
/**
* Creates a ProjectedMeters based on projected meters in north and east direction
* Creates a ProjectedMeters based on projected meters in north and east direction.
*
* @param northing
* @param easting
* @param northing the northing in meters
* @param easting the easting in meters
*/
public ProjectedMeters(double northing, double easting) {
this.northing = northing;

View File

@@ -881,8 +881,8 @@ public class MapView extends FrameLayout {
* DEPRECATED @see MapboxAccountManager#start(String)
* </p>
* <p>
* <p>
* Sets the current Mapbox access token used to load map styles and tiles.
* </p>
* <p>
* You must set a valid access token before you call {@link MapView#onCreate(Bundle)}
* or an exception will be thrown.

View File

@@ -1908,7 +1908,6 @@ public class MapboxMap {
/**
* Called when an MarkerView is removed from the MapView or the View object is going to be reused.
* <p>
* <p>
* This method should be used to reset an animated view back to it's original state for view reuse.
* </p>
* <p>
@@ -1990,8 +1989,9 @@ public class MapboxMap {
/**
* Interface definition for a callback to be invoked when the user clicks on a MarkerView.
*
* @see MarkerViewManager#setOnMarkerViewClickListener(OnMarkerViewClickListener)
* </p>
* {@link MarkerViewManager#setOnMarkerViewClickListener(OnMarkerViewClickListener)}
* </p>
*/
public interface OnMarkerViewClickListener {

View File

@@ -124,11 +124,11 @@ public class MapboxMapOptions implements Parcelable {
}
/**
* Creates a GoogleMapsOptions from the attribute set
* Creates a MapboxMapsOptions from the attribute set.s
*
* @param context Context related to a map view.
* @param attrs Attributeset containing configuration
* @return
* @return the MapboxMapOptions created from attributes
*/
public static MapboxMapOptions createFromAttributes(@NonNull Context context, @Nullable AttributeSet attrs) {
MapboxMapOptions mapboxMapOptions = new MapboxMapOptions();

View File

@@ -8,8 +8,6 @@ import android.support.annotation.UiThread;
import android.view.Gravity;
import android.view.View;
import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings;
/**
* Settings for the user interface of a MapboxMap. To obtain this interface, call getUiSettings().
*/
@@ -492,7 +490,7 @@ public class UiSettings {
/**
* Gets whether the markers are automatically deselected (and therefore, their infowindows
* closed) when a map tap is detected.
*
* @return If true, markers are deselected on a map tap.
*/
public boolean isDeselectMarkersOnTap() {
@@ -503,7 +501,7 @@ public class UiSettings {
* Sets whether the markers are automatically deselected (and therefore, their infowindows
* closed) when a map tap is detected.
*
* @param deselectMarkersOnTap
* @param deselectMarkersOnTap determines if markers should be deslected on tap
*/
public void setDeselectMarkersOnTap(boolean deselectMarkersOnTap) {
this.deselectMarkersOnTap = deselectMarkersOnTap;
@@ -580,7 +578,7 @@ public class UiSettings {
/**
* Returns the gesture focal point
*
* @return The focal point
* @return The focal point
*/
public PointF getFocalPoint() {
return focalPoint;

View File

@@ -55,16 +55,16 @@ public class OfflineManager {
*/
public interface ListOfflineRegionsCallback {
/**
* Receives the list of offline regions
* Receives the list of offline regions.
*
* @param offlineRegions
* @param offlineRegions the offline region array
*/
void onList(OfflineRegion[] offlineRegions);
/**
* Receives the error message
* Receives the error message.
*
* @param error
* @param error the error message
*/
void onError(String error);
}
@@ -75,16 +75,16 @@ public class OfflineManager {
*/
public interface CreateOfflineRegionCallback {
/**
* Receives the newly created offline region
* Receives the newly created offline region.
*
* @param offlineRegion
* @param offlineRegion the offline region to create
*/
void onCreate(OfflineRegion offlineRegion);
/**
* Receives the error message
* Receives the error message.
*
* @param error
* @param error the error message to be shown
*/
void onError(String error);
}
@@ -149,6 +149,8 @@ public class OfflineManager {
* <p>
* Code from https://developer.android.com/guide/topics/data/data-storage.html#filesExternal
* </p>
*
* @return true if external storage is readable
*/
public static boolean isExternalStorageReadable() {
String state = Environment.getExternalStorageState();
@@ -193,7 +195,7 @@ public class OfflineManager {
/**
* Access token getter/setter
*
* @param accessToken
* @param accessToken the accessToken to be used by the offline manager.
* @deprecated As of release 4.1.0, replaced by {@link MapboxAccountManager#start(Context, String)} ()}
*/
@Deprecated
@@ -226,6 +228,8 @@ public class OfflineManager {
* The query will be executed asynchronously and the results passed to the given
* callback on the main thread.
* </p>
*
* @param callback the callback to be invoked
*/
public void listOfflineRegions(@NonNull final ListOfflineRegionsCallback callback) {
listOfflineRegions(mDefaultFileSourcePtr, new ListOfflineRegionsCallback() {
@@ -262,6 +266,10 @@ public class OfflineManager {
* downloading resources, call `OfflineRegion.setDownloadState(DownloadState.STATE_ACTIVE)`,
* optionally registering an `OfflineRegionObserver` beforehand.
* </p>
*
* @param definition the offline region definition
* @param metadata the metadata in bytes
* @param callback the callback to be invoked
*/
public void createOfflineRegion(
@NonNull OfflineRegionDefinition definition,

View File

@@ -55,8 +55,11 @@ public class OfflineRegion {
* Implement this method to be notified of a change in the status of an
* offline region. Status changes include any change in state of the members
* of OfflineRegionStatus.
*
* <p>
* This method will be executed on the main thread.
* </p>
*
* @param status the changed status
*/
void onStatusChanged(OfflineRegionStatus status);
@@ -65,8 +68,11 @@ public class OfflineRegion {
* regional resources. Such errors may be recoverable; for example the implementation
* will attempt to re-request failed resources based on an exponential backoff
* algorithm, or when it detects that network access has been restored.
*
* <p>
* This method will be executed on the main thread.
* </p>
*
* @param error the offline region error message
*/
void onError(OfflineRegionError error);
@@ -93,14 +99,14 @@ public class OfflineRegion {
/**
* Receives the status
*
* @param status
* @param status the offline region status
*/
void onStatus(OfflineRegionStatus status);
/**
* Receives the error message
*
* @param error
* @param error the error message
*/
void onError(String error);
}
@@ -118,7 +124,7 @@ public class OfflineRegion {
/**
* Receives the error message
*
* @param error
* @param error the error message
*/
void onError(String error);
}
@@ -127,15 +133,17 @@ public class OfflineRegion {
* A region is either inactive (not downloading, but previously-downloaded
* resources are available for use), or active (resources are being downloaded
* or will be downloaded, if necessary, when network access is available).
*
* <p>
* This state is independent of whether or not the complete set of resources
* is currently available for offline use. To check if that is the case, use
* `OfflineRegionStatus.isComplete()`.
* </p>
*/
@IntDef({STATE_INACTIVE, STATE_ACTIVE})
@Retention(RetentionPolicy.SOURCE)
public @interface DownloadState {}
public @interface DownloadState {
}
public static final int STATE_INACTIVE = 0;
public static final int STATE_ACTIVE = 1;
@@ -148,6 +156,8 @@ public class OfflineRegion {
/**
* Gets whether or not the `OfflineRegionObserver` will continue to deliver messages even if
* the region state has been set as STATE_INACTIVE.
*
* @return true if delivering inactive messages
*/
public boolean isDeliveringInactiveMessages() {
return deliverInactiveMessages;
@@ -157,6 +167,8 @@ public class OfflineRegion {
* When set true, the `OfflineRegionObserver` will continue to deliver messages even if
* the region state has been set as STATE_INACTIVE (operations happen asynchronously). If set
* false, the client won't be notified of further messages.
*
* @param deliverInactiveMessages true if it should deliver inactive messages
*/
public void setDeliverInactiveMessages(boolean deliverInactiveMessages) {
this.deliverInactiveMessages = deliverInactiveMessages;
@@ -203,6 +215,8 @@ public class OfflineRegion {
/**
* Register an observer to be notified when the state of the region changes.
*
* @param observer the observer to be notified
*/
public void setObserver(@NonNull final OfflineRegionObserver observer) {
setOfflineRegionObserver(new OfflineRegionObserver() {
@@ -246,6 +260,8 @@ public class OfflineRegion {
/**
* Pause or resume downloading of regional resources.
*
* @param state the download state
*/
public void setDownloadState(@DownloadState int state) {
this.state = state;
@@ -256,6 +272,8 @@ public class OfflineRegion {
* Retrieve the current status of the region. The query will be executed
* asynchronously and the results passed to the given callback which will be
* executed on the main thread.
*
* @param callback the callback to invoked.
*/
public void getStatus(@NonNull final OfflineRegionStatusCallback callback) {
getOfflineRegionStatus(new OfflineRegionStatusCallback() {
@@ -284,14 +302,19 @@ public class OfflineRegion {
/**
* Remove an offline region from the database and perform any resources evictions
* necessary as a result.
*
* <p>
* Eviction works by removing the least-recently requested resources not also required
* by other regions, until the database shrinks below a certain size.
*
* </p>
* <p>
* When the operation is complete or encounters an error, the given callback will be
* executed on the main thread.
*
* </p>
* <p>
* After you call this method, you may not call any additional methods on this object.
* </p>
*
* @param callback the callback to be invoked
*/
public void delete(@NonNull final OfflineRegionDeleteCallback callback) {
deleteOfflineRegion(new OfflineRegionDeleteCallback() {

View File

@@ -11,19 +11,25 @@ import android.support.annotation.ColorInt;
/**
* Constructs paint/layout properties for Layers
*
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers>Layer style documentation</a>
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers">Layer style documentation</a>
*/
public class PropertyFactory {
/**
* Set visibility
* Set the property visibility.
*
* @param value the visibility value
* @return property wrapper around visibility
*/
public static Property<String> visibility(@Property.VISIBILITY String value) {
return new LayoutProperty<>("visibility", value);
}
/**
* Set visibility
* Set the property visibility.
*
* @param function the visibility function
* @return property wrapper around a String function
*/
public static Property<Function<String>> visibility(Function<String> function) {
return new LayoutProperty<>("visibility", function);
@@ -33,6 +39,9 @@ public class PropertyFactory {
<% if (property.type == 'color') { -%>
/**
* <%- property.doc %>
*
* @param value a int color value
* @return property wrapper around String color
*/
public static Property<String> <%- camelizeWithLeadingLowercase(property.name) %>(@ColorInt int value) {
return new PaintProperty<>("<%- property.name %>", colorToRgbaString(value));
@@ -41,6 +50,9 @@ public class PropertyFactory {
<% } -%>
/**
* <%- property.doc %>
*
* @param value a <%- propertyType(property) %> value
* @return property wrapper around <%- propertyType(property) %>
*/
public static Property<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyType(property) %> value) {
return new PaintProperty<>("<%- property.name %>", value);
@@ -48,6 +60,9 @@ public class PropertyFactory {
/**
* <%- property.doc %>
*
* @param function a wrapper function for <%- propertyType(property) %>
* @return property wrapper around a <%- propertyType(property) %> function
*/
public static Property<Function<<%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(Function<<%- propertyType(property) %>> function) {
return new PaintProperty<>("<%- property.name %>", function);
@@ -57,6 +72,9 @@ public class PropertyFactory {
<% for (const property of layoutProperties) { -%>
/**
* <%- property.doc %>
*
* @param value a <%- propertyType(property) %> value
* @return property wrapper around <%- propertyType(property) %>
*/
public static Property<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyType(property) %> value) {
return new LayoutProperty<>("<%- property.name %>", value);
@@ -64,6 +82,9 @@ public class PropertyFactory {
/**
* <%- property.doc %>
*
* @param function a wrapper function for <%- propertyType(property) %>
* @return property wrapper around a <%- propertyType(property) %> function
*/
public static Property<Function<<%- propertyType(property) %>>> <%- camelizeWithLeadingLowercase(property.name) %>(Function<<%- propertyType(property) %>> function) {
return new LayoutProperty<>("<%- property.name %>", function);

View File

@@ -98,8 +98,10 @@ public class ColorUtils {
}
/**
* Convert an rgba string to a Color int
* Convert an rgba string to a Color int.
*
* @param value the String representation of rgba
* @return the int representation of rgba
* @throws ConversionException on illegal input
*/
@ColorInt