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

Commit

Permalink
fixup formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed May 30, 2017
1 parent 4e4e179 commit 5abe0d4
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ public void removeImage(String name) {
*/
@UiThread
public void setMinZoomPreference(
@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double minZoom) {
@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double minZoom) {
transform.setMinZoom(minZoom);
}

Expand Down Expand Up @@ -499,7 +499,7 @@ public double getMinZoomLevel() {
*/
@UiThread
public void setMaxZoomPreference(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM,
to = MapboxConstants.MAXIMUM_ZOOM) double maxZoom) {
to = MapboxConstants.MAXIMUM_ZOOM) double maxZoom) {
transform.setMaxZoom(maxZoom);
}

Expand Down Expand Up @@ -1154,7 +1154,7 @@ public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions,
@UiThread
@NonNull
public List<MarkerView> addMarkerViews(@NonNull List<? extends
BaseMarkerViewOptions> markerViewOptions) {
BaseMarkerViewOptions> markerViewOptions) {
return annotationManager.addMarkerViews(markerViewOptions, this);
}

Expand Down Expand Up @@ -1183,7 +1183,7 @@ public List<MarkerView> getMarkerViewsInRect(@NonNull RectF rect) {
@UiThread
@NonNull
public List<Marker> addMarkers(@NonNull List<? extends
BaseMarkerOptions> markerOptionsList) {
BaseMarkerOptions> markerOptionsList) {
return annotationManager.addMarkers(markerOptionsList, this);
}

Expand Down Expand Up @@ -1746,7 +1746,7 @@ public OnInfoWindowClickListener getOnInfoWindowClickListener() {
*/
@UiThread
public void setOnInfoWindowLongClickListener(@Nullable OnInfoWindowLongClickListener
listener) {
listener) {
annotationManager.getInfoWindowManager().setOnInfoWindowLongClickListener(listener);
}

Expand Down Expand Up @@ -1828,14 +1828,13 @@ public Location getMyLocation() {
*/
@UiThread
public void setOnMyLocationChangeListener(@Nullable MapboxMap.OnMyLocationChangeListener
listener) {
listener) {
trackingSettings.setOnMyLocationChangeListener(listener);
}

/**
* Removes custom location source of the my-location layer and brings back default {@link LocationSource}
* location source.
*
*/
@UiThread
public void removeLocationSource() {
Expand All @@ -1846,7 +1845,6 @@ public void removeLocationSource() {
* Replaces the location source of the my-location layer.
*
* @param locationSource A {@link LocationEngine} location source to use in the my-location layer.
*
*/
@UiThread
public void setLocationSource(@Nullable LocationEngine locationSource) {
Expand All @@ -1861,7 +1859,7 @@ public void setLocationSource(@Nullable LocationEngine locationSource) {
*/
@UiThread
public void setOnMyLocationTrackingModeChangeListener(
@Nullable MapboxMap.OnMyLocationTrackingModeChangeListener listener) {
@Nullable MapboxMap.OnMyLocationTrackingModeChangeListener listener) {
trackingSettings.setOnMyLocationTrackingModeChangeListener(listener);
}

Expand Down Expand Up @@ -1900,7 +1898,7 @@ public void snapshot(@NonNull SnapshotReadyCallback callback) {
@UiThread
@NonNull
public List<Feature> queryRenderedFeatures(@NonNull PointF coordinates, @Nullable String...
layerIds) {
layerIds) {
return nativeMapView.queryRenderedFeatures(coordinates, layerIds, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,31 @@ void onSaveInstanceState(Bundle outState) {
outState.putBoolean(MapboxConstants.STATE_MY_BEARING_TRACKING_DISMISS, isDismissBearingTrackingOnGesture());
outState.putBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED, isMyLocationEnabled());
outState.putBoolean(MapboxConstants.STATE_MY_TRACKING_MODE_DISMISS_FOR_CAMERA,
isDismissTrackingModesForCameraPositionChange());
isDismissTrackingModesForCameraPositionChange());
outState.putBoolean(MapboxConstants.STATE_USING_CUSTOM_LOCATION_SOURCE, isCustomLocationSource());
}

void onRestoreInstanceState(Bundle savedInstanceState) {
try {
setMyLocationEnabled(
savedInstanceState.getBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED),
savedInstanceState.getBoolean(MapboxConstants.STATE_USING_CUSTOM_LOCATION_SOURCE)
savedInstanceState.getBoolean(MapboxConstants.STATE_MY_LOCATION_ENABLED),
savedInstanceState.getBoolean(MapboxConstants.STATE_USING_CUSTOM_LOCATION_SOURCE)
);
} catch (SecurityException ignore) {
// User did not accept location permissions
}
// noinspection ResourceType
setMyLocationTrackingMode(savedInstanceState.getInt(
MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, MyLocationTracking.TRACKING_NONE));
MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, MyLocationTracking.TRACKING_NONE));
// noinspection ResourceType
setMyBearingTrackingMode(savedInstanceState.getInt(
MapboxConstants.STATE_MY_BEARING_TRACKING_MODE, MyBearingTracking.NONE));
MapboxConstants.STATE_MY_BEARING_TRACKING_MODE, MyBearingTracking.NONE));
setDismissLocationTrackingOnGesture(savedInstanceState.getBoolean(
MapboxConstants.STATE_MY_LOCATION_TRACKING_DISMISS, true));
MapboxConstants.STATE_MY_LOCATION_TRACKING_DISMISS, true));
setDismissBearingTrackingOnGesture(savedInstanceState.getBoolean(
MapboxConstants.STATE_MY_BEARING_TRACKING_DISMISS, true));
MapboxConstants.STATE_MY_BEARING_TRACKING_DISMISS, true));
setDismissTrackingModeForCameraPositionChange(savedInstanceState.getBoolean(
MapboxConstants.STATE_MY_TRACKING_MODE_DISMISS_FOR_CAMERA, true));
MapboxConstants.STATE_MY_TRACKING_MODE_DISMISS_FOR_CAMERA, true));
}

/**
Expand Down Expand Up @@ -247,9 +247,9 @@ public boolean isRotateGestureCurrentlyEnabled() {
// The user settings are enabled AND;
// EITHER bearing tracking is dismissed on gesture OR there is no bearing tracking
return uiSettings.isRotateGesturesEnabled()
&& (dismissBearingTrackingOnGesture
|| myLocationView.getMyBearingTrackingMode() == MyBearingTracking.NONE
|| myLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE);
&& (dismissBearingTrackingOnGesture
|| myLocationView.getMyBearingTrackingMode() == MyBearingTracking.NONE
|| myLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE);
}

/**
Expand All @@ -259,8 +259,8 @@ public boolean isRotateGestureCurrentlyEnabled() {
*/
public boolean isScrollGestureCurrentlyEnabled() {
return uiSettings.isScrollGesturesEnabled()
&& (dismissLocationTrackingOnGesture
|| myLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE);
&& (dismissLocationTrackingOnGesture
|| myLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE);
}

/**
Expand Down Expand Up @@ -371,7 +371,7 @@ void setMyLocationEnabled(boolean locationEnabled) {
private void setMyLocationEnabled(boolean locationEnabled, boolean isCustomLocationSource) {
if (!PermissionsManager.areLocationPermissionsGranted(myLocationView.getContext())) {
Timber.e("Could not activate user location tracking: "
+ "user did not accept the permission or permissions were not requested.");
+ "user did not accept the permission or permissions were not requested.");
return;
}
myLocationEnabled = locationEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public class MyLocationView extends View {
private ValueAnimator directionAnimator;

private ValueAnimator.AnimatorUpdateListener invalidateSelfOnUpdateListener =
new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
invalidate();
}
};
new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
invalidate();
}
};

private Drawable foregroundDrawable;
private Drawable foregroundBearingDrawable;
Expand Down Expand Up @@ -134,8 +134,8 @@ private void init(Context context) {

// setup LayoutParams
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
setLayoutParams(lp);

matrix = new Matrix();
Expand Down Expand Up @@ -165,7 +165,7 @@ public final void setForegroundDrawables(Drawable defaultDrawable, Drawable bear
}

if (defaultDrawable.getIntrinsicWidth() != bearingDrawable.getIntrinsicWidth()
|| defaultDrawable.getIntrinsicHeight() != bearingDrawable.getIntrinsicHeight()) {
|| defaultDrawable.getIntrinsicHeight() != bearingDrawable.getIntrinsicHeight()) {
throw new RuntimeException("The dimensions from location and bearing drawables should be match");
}

Expand Down Expand Up @@ -232,8 +232,8 @@ private void invalidateBounds() {
int horizontalOffset = backgroundOffsetLeft - backgroundOffsetRight;
int verticalOffset = backgroundOffsetTop - backgroundOffsetBottom;
backgroundBounds = new Rect(-backgroundWidth / 2 + horizontalOffset,
-backgroundHeight / 2 + verticalOffset, backgroundWidth / 2 + horizontalOffset, backgroundHeight / 2
+ verticalOffset);
-backgroundHeight / 2 + verticalOffset, backgroundWidth / 2 + horizontalOffset, backgroundHeight / 2
+ verticalOffset);
backgroundDrawable.setBounds(backgroundBounds);

int foregroundWidth = foregroundDrawable.getIntrinsicWidth();
Expand All @@ -251,7 +251,7 @@ protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

if (location == null || foregroundBounds == null || backgroundBounds == null || accuracyAnimator == null
|| screenLocation == null) {
|| screenLocation == null) {
// Not ready yet
return;
}
Expand Down Expand Up @@ -429,10 +429,11 @@ private void toggleGps(boolean enableGps) {
private void toggleGps(boolean enableGps, boolean isCustomLocationSource) {
if (enableGps) {
if (locationSource == null) {
if (!isCustomLocationSource)
if (!isCustomLocationSource) {
locationSource = LocationSource.getLocationEngine(this.getContext());
else
} else {
return;
}
}
// Set an initial location if one available
Location lastLocation = locationSource.getLastLocation();
Expand All @@ -450,8 +451,9 @@ private void toggleGps(boolean enableGps, boolean isCustomLocationSource) {

locationSource.setPriority(LocationEnginePriority.HIGH_ACCURACY);
} else {
if (locationSource == null)
if (locationSource == null) {
return;
}
// Disable location and user dot
location = null;
locationSource.removeLocationUpdates();
Expand Down Expand Up @@ -499,17 +501,17 @@ public void setMyLocationTrackingMode(@MyLocationTracking.Mode int myLocationTra
// center map directly
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(false);
mapboxMap.easeCamera(CameraUpdateFactory.newLatLng(new LatLng(location)), 0, false /*linear interpolator*/,
new MapboxMap.CancelableCallback() {
@Override
public void onCancel() {
new MapboxMap.CancelableCallback() {
@Override
public void onCancel() {

}
}

@Override
public void onFinish() {
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
}
});
@Override
public void onFinish() {
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
}
});
} else {
// do not use interpolated location from tracking mode
latLng = null;
Expand Down Expand Up @@ -687,17 +689,17 @@ private void rotateCamera(float rotation) {
builder.bearing(rotation);
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(false);
mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(builder.build()), COMPASS_UPDATE_RATE_MS,
false /*linear interpolator*/, new MapboxMap.CancelableCallback() {
@Override
public void onCancel() {
false /*linear interpolator*/, new MapboxMap.CancelableCallback() {
@Override
public void onCancel() {

}
}

@Override
public void onFinish() {
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
}
});
@Override
public void onFinish() {
mapboxMap.getTrackingSettings().setDismissTrackingModeForCameraPositionChange(true);
}
});
}

@Override
Expand Down Expand Up @@ -874,7 +876,7 @@ void updateLatLng(@NonNull final Location location) {
locationChangeAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
locationChangeAnimator.setDuration(locationUpdateDuration);
locationChangeAnimator.addUpdateListener(new MarkerCoordinateAnimatorListener(this,
latLng, newLocation
latLng, newLocation
));
locationChangeAnimator.start();
latLng = newLocation;
Expand Down

0 comments on commit 5abe0d4

Please sign in to comment.