[core] remove trailing whitespace, add trailing newlines, add space after //
This commit is contained in:
@@ -101,4 +101,4 @@ public final class Mapbox {
|
||||
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
|
||||
return (activeNetwork != null && activeNetwork.isConnected());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class InfoWindow {
|
||||
// Calculate x-offset for update method
|
||||
viewWidthOffset = x - coordinates.x - offsetX;
|
||||
|
||||
close(); //if it was already opened
|
||||
close(); // if it was already opened
|
||||
mapView.addView(view, lp);
|
||||
isVisible = true;
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ public class MarkerViewManager implements MapView.OnMapChangedListener {
|
||||
if (view != null) {
|
||||
if (marker.getWidth() == 0) {
|
||||
if (view.getMeasuredWidth() == 0) {
|
||||
//Ensure the marker's view is measured first
|
||||
// Ensure the marker's view is measured first
|
||||
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||
}
|
||||
marker.setWidth(view.getMeasuredWidth());
|
||||
|
||||
@@ -38,6 +38,6 @@ public class MyBearingTracking {
|
||||
*/
|
||||
public static final int GPS = 0x00000008;
|
||||
|
||||
//public static final int COMBINED = 0x00000012;
|
||||
// public static final int COMBINED = 0x00000012;
|
||||
|
||||
}
|
||||
|
||||
@@ -34,4 +34,4 @@ public class MyLocationTracking {
|
||||
*/
|
||||
public static final int TRACKING_FOLLOW = 0x00000004;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ public class InvalidMarkerPositionException extends RuntimeException {
|
||||
+ "Missing the required position field. "
|
||||
+ "Provide a non null LatLng as position to the Marker.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ public class TelemetryServiceNotConfiguredException extends RuntimeException {
|
||||
+ "\nFor an example visit http://goo.gl/cET0Jn. For more information visit https://www.mapbox.com/android-sdk/.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,4 +100,4 @@ public class LatLngSpan implements Parcelable {
|
||||
out.writeDouble(mLatitudeSpan);
|
||||
out.writeDouble(mLongitudeSpan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,4 +127,4 @@ public class VisibleRegion implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class HTTPRequest implements Callback {
|
||||
body = response.body().bytes();
|
||||
} catch (IOException ioException) {
|
||||
onFailure(ioException);
|
||||
//throw ioException;
|
||||
// throw ioException;
|
||||
return;
|
||||
} finally {
|
||||
response.body().close();
|
||||
@@ -202,4 +202,4 @@ class HTTPRequest implements Callback {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class LocationServices implements LostApiClient.ConnectionCallbacks,
|
||||
|
||||
@Override
|
||||
public void onConnected() {
|
||||
//noinspection MissingPermission
|
||||
// noinspection MissingPermission
|
||||
Location lastLocation = FusedLocationApi.getLastLocation(locationClient);
|
||||
if (lastLocation != null) {
|
||||
this.lastLocation = lastLocation;
|
||||
@@ -110,7 +110,7 @@ public class LocationServices implements LostApiClient.ConnectionCallbacks,
|
||||
.setFastestInterval(1000)
|
||||
.setSmallestDisplacement(3.0f)
|
||||
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
//noinspection MissingPermission
|
||||
// noinspection MissingPermission
|
||||
FusedLocationApi.requestLocationUpdates(locationClient, locationRequest, this);
|
||||
} else {
|
||||
// LocationRequest Tuned for PASSIVE
|
||||
@@ -118,7 +118,7 @@ public class LocationServices implements LostApiClient.ConnectionCallbacks,
|
||||
.setFastestInterval(1000)
|
||||
.setSmallestDisplacement(3.0f)
|
||||
.setPriority(LocationRequest.PRIORITY_NO_POWER);
|
||||
//noinspection MissingPermission
|
||||
// noinspection MissingPermission
|
||||
FusedLocationApi.requestLocationUpdates(locationClient, locationRequest, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class AnnotationManager {
|
||||
if (ids != null) {
|
||||
id = ids[i];
|
||||
} else {
|
||||
//unit test
|
||||
// unit test
|
||||
id++;
|
||||
}
|
||||
m.setId(id);
|
||||
|
||||
@@ -181,7 +181,7 @@ final class MapGestureDetector {
|
||||
*/
|
||||
boolean onGenericMotionEvent(MotionEvent event) {
|
||||
// Mouse events
|
||||
//if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { // this is not available before API 18
|
||||
// if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { // this is not available before API 18
|
||||
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == InputDevice.SOURCE_CLASS_POINTER) {
|
||||
// Choose the action
|
||||
switch (event.getActionMasked()) {
|
||||
@@ -653,4 +653,4 @@ final class MapGestureDetector {
|
||||
void setOnScrollListener(MapboxMap.OnScrollListener onScrollListener) {
|
||||
this.onScrollListener = onScrollListener;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public final class MapboxMap {
|
||||
@UiThread
|
||||
public <T extends Layer> T getLayerAs(@NonNull String layerId) {
|
||||
try {
|
||||
//noinspection unchecked
|
||||
// noinspection unchecked
|
||||
return (T) nativeMapView.getLayer(layerId);
|
||||
} catch (ClassCastException exception) {
|
||||
Timber.e(String.format("Layer: %s is a different type: %s", layerId, exception));
|
||||
@@ -297,7 +297,7 @@ public final class MapboxMap {
|
||||
@UiThread
|
||||
public <T extends Source> T getSourceAs(@NonNull String sourceId) {
|
||||
try {
|
||||
//noinspection unchecked
|
||||
// noinspection unchecked
|
||||
return (T) nativeMapView.getSource(sourceId);
|
||||
} catch (ClassCastException exception) {
|
||||
Timber.e(String.format("Source: %s is a different type: %s", sourceId, exception));
|
||||
@@ -2032,4 +2032,4 @@ public final class MapboxMap {
|
||||
Transform getTransform() {
|
||||
return transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1161,4 +1161,4 @@ public class MapboxMapOptions implements Parcelable {
|
||||
result = 31 * result + (style != null ? style.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,16 +843,16 @@ final class NativeMapView {
|
||||
if (isDestroyedOn("addImage")) {
|
||||
return;
|
||||
}
|
||||
//Check/correct config
|
||||
// Check/correct config
|
||||
if (image.getConfig() != Bitmap.Config.ARGB_8888) {
|
||||
image = image.copy(Bitmap.Config.ARGB_8888, false);
|
||||
}
|
||||
|
||||
//Get pixels
|
||||
// Get pixels
|
||||
ByteBuffer buffer = ByteBuffer.allocate(image.getByteCount());
|
||||
image.copyPixelsToBuffer(buffer);
|
||||
|
||||
//Determine pixel ratio
|
||||
// Determine pixel ratio
|
||||
float density = image.getDensity() == Bitmap.DENSITY_NONE ? Bitmap.DENSITY_NONE : image.getDensity();
|
||||
float pixelRatio = density / DisplayMetrics.DENSITY_DEFAULT;
|
||||
|
||||
|
||||
@@ -152,4 +152,4 @@ public class SupportMapFragment extends Fragment {
|
||||
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
|
||||
this.onMapReadyCallback = onMapReadyCallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ public final class TrackingSettings {
|
||||
} catch (SecurityException ignore) {
|
||||
// User did not accept location permissions
|
||||
}
|
||||
//noinspection ResourceType
|
||||
// noinspection ResourceType
|
||||
setMyLocationTrackingMode(savedInstanceState.getInt(
|
||||
MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, MyLocationTracking.TRACKING_NONE));
|
||||
//noinspection ResourceType
|
||||
// noinspection ResourceType
|
||||
setMyBearingTrackingMode(savedInstanceState.getInt(
|
||||
MapboxConstants.STATE_MY_BEARING_TRACKING_MODE, MyBearingTracking.NONE));
|
||||
setDismissLocationTrackingOnGesture(savedInstanceState.getBoolean(
|
||||
|
||||
@@ -27,11 +27,11 @@ public class ConnectivityReceiver extends BroadcastReceiver {
|
||||
*/
|
||||
public static synchronized ConnectivityReceiver instance(Context context) {
|
||||
if (INSTANCE == null) {
|
||||
//Register new instance
|
||||
// Register new instance
|
||||
INSTANCE = new ConnectivityReceiver();
|
||||
context.registerReceiver(INSTANCE, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
|
||||
|
||||
//Add default listeners
|
||||
// Add default listeners
|
||||
INSTANCE.addListener(new NativeConnectivityListener());
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ConnectivityReceiver extends BroadcastReceiver {
|
||||
boolean connected = isConnected(context);
|
||||
Timber.v("Connected: " + connected);
|
||||
|
||||
//Loop over listeners
|
||||
// Loop over listeners
|
||||
for (ConnectivityListener listener : listeners) {
|
||||
listener.onNetworkStateChanged(connected);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
public abstract class Property<T> {
|
||||
|
||||
//VISIBILITY: Whether this layer is displayed.
|
||||
// VISIBILITY: Whether this layer is displayed.
|
||||
|
||||
/**
|
||||
* The layer is shown.
|
||||
@@ -30,7 +30,7 @@ public abstract class Property<T> {
|
||||
public @interface VISIBILITY {
|
||||
}
|
||||
|
||||
//LINE_CAP: The display of line endings.
|
||||
// LINE_CAP: The display of line endings.
|
||||
|
||||
/**
|
||||
* A cap with a squared-off end which is drawn to the exact endpoint of the line.
|
||||
@@ -59,7 +59,7 @@ public abstract class Property<T> {
|
||||
public @interface LINE_CAP {
|
||||
}
|
||||
|
||||
//LINE_JOIN: The display of lines when joining.
|
||||
// LINE_JOIN: The display of lines when joining.
|
||||
|
||||
/**
|
||||
* A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the
|
||||
@@ -89,7 +89,7 @@ public abstract class Property<T> {
|
||||
public @interface LINE_JOIN {
|
||||
}
|
||||
|
||||
//SYMBOL_PLACEMENT: Label placement relative to its geometry.
|
||||
// SYMBOL_PLACEMENT: Label placement relative to its geometry.
|
||||
|
||||
/**
|
||||
* The label is placed at the point where the geometry is located.
|
||||
@@ -111,7 +111,7 @@ public abstract class Property<T> {
|
||||
public @interface SYMBOL_PLACEMENT {
|
||||
}
|
||||
|
||||
//ICON_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of icons.
|
||||
// ICON_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of icons.
|
||||
|
||||
/**
|
||||
* When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, aligns icons east-west. When
|
||||
@@ -142,7 +142,7 @@ public abstract class Property<T> {
|
||||
public @interface ICON_ROTATION_ALIGNMENT {
|
||||
}
|
||||
|
||||
//ICON_TEXT_FIT: Scales the icon to fit around the associated text.
|
||||
// ICON_TEXT_FIT: Scales the icon to fit around the associated text.
|
||||
|
||||
/**
|
||||
* The icon is displayed at its intrinsic aspect ratio.
|
||||
@@ -174,7 +174,7 @@ public abstract class Property<T> {
|
||||
public @interface ICON_TEXT_FIT {
|
||||
}
|
||||
|
||||
//TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched.
|
||||
// TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched.
|
||||
|
||||
/**
|
||||
* The text is aligned to the plane of the map.
|
||||
@@ -201,7 +201,7 @@ public abstract class Property<T> {
|
||||
public @interface TEXT_PITCH_ALIGNMENT {
|
||||
}
|
||||
|
||||
//TEXT_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of the individual
|
||||
// TEXT_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of the individual
|
||||
// glyphs forming the text.
|
||||
|
||||
/**
|
||||
@@ -233,7 +233,7 @@ public abstract class Property<T> {
|
||||
public @interface TEXT_ROTATION_ALIGNMENT {
|
||||
}
|
||||
|
||||
//TEXT_JUSTIFY: Text justification options.
|
||||
// TEXT_JUSTIFY: Text justification options.
|
||||
|
||||
/**
|
||||
* The text is aligned to the left.
|
||||
@@ -260,7 +260,7 @@ public abstract class Property<T> {
|
||||
public @interface TEXT_JUSTIFY {
|
||||
}
|
||||
|
||||
//TEXT_ANCHOR: Part of the text placed closest to the anchor.
|
||||
// TEXT_ANCHOR: Part of the text placed closest to the anchor.
|
||||
|
||||
/**
|
||||
* The center of the text is placed closest to the anchor.
|
||||
@@ -317,7 +317,7 @@ public abstract class Property<T> {
|
||||
public @interface TEXT_ANCHOR {
|
||||
}
|
||||
|
||||
//TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property.
|
||||
// TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property.
|
||||
|
||||
/**
|
||||
* The text is not altered.
|
||||
@@ -344,7 +344,7 @@ public abstract class Property<T> {
|
||||
public @interface TEXT_TRANSFORM {
|
||||
}
|
||||
|
||||
//FILL_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
// FILL_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
|
||||
/**
|
||||
* The fill is translated relative to the map.
|
||||
@@ -366,7 +366,7 @@ public abstract class Property<T> {
|
||||
public @interface FILL_TRANSLATE_ANCHOR {
|
||||
}
|
||||
|
||||
//LINE_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
// LINE_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
|
||||
/**
|
||||
* The line is translated relative to the map.
|
||||
@@ -388,7 +388,7 @@ public abstract class Property<T> {
|
||||
public @interface LINE_TRANSLATE_ANCHOR {
|
||||
}
|
||||
|
||||
//ICON_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
// ICON_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
|
||||
/**
|
||||
* Icons are translated relative to the map.
|
||||
@@ -410,7 +410,7 @@ public abstract class Property<T> {
|
||||
public @interface ICON_TRANSLATE_ANCHOR {
|
||||
}
|
||||
|
||||
//TEXT_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
// TEXT_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
|
||||
/**
|
||||
* The text is translated relative to the map.
|
||||
@@ -432,7 +432,7 @@ public abstract class Property<T> {
|
||||
public @interface TEXT_TRANSLATE_ANCHOR {
|
||||
}
|
||||
|
||||
//CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
// CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point.
|
||||
|
||||
/**
|
||||
* The circle is translated relative to the map.
|
||||
@@ -454,7 +454,7 @@ public abstract class Property<T> {
|
||||
public @interface CIRCLE_TRANSLATE_ANCHOR {
|
||||
}
|
||||
|
||||
//CIRCLE_PITCH_SCALE: Controls the scaling behavior of the circle when the map is pitched.
|
||||
// CIRCLE_PITCH_SCALE: Controls the scaling behavior of the circle when the map is pitched.
|
||||
|
||||
/**
|
||||
* Circles are scaled according to their apparent distance to the camera.
|
||||
@@ -476,7 +476,7 @@ public abstract class Property<T> {
|
||||
public @interface CIRCLE_PITCH_SCALE {
|
||||
}
|
||||
|
||||
//Class definition
|
||||
// Class definition
|
||||
public final String name;
|
||||
public final T value;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class PropertyValue<T> {
|
||||
@Nullable
|
||||
public Function<T> getFunction() {
|
||||
if (isFunction()) {
|
||||
//noinspection unchecked
|
||||
// noinspection unchecked
|
||||
return (Function<T>) value;
|
||||
} else {
|
||||
Timber.w("not a function, try value");
|
||||
@@ -41,7 +41,7 @@ public class PropertyValue<T> {
|
||||
@Nullable
|
||||
public T getValue() {
|
||||
if (isValue()) {
|
||||
//noinspection unchecked
|
||||
// noinspection unchecked
|
||||
return (T) value;
|
||||
} else {
|
||||
Timber.w("not a value, try function");
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
public abstract class Property<T> {
|
||||
|
||||
//VISIBILITY: Whether this layer is displayed.
|
||||
// VISIBILITY: Whether this layer is displayed.
|
||||
|
||||
/**
|
||||
* The layer is shown.
|
||||
@@ -33,7 +33,7 @@ public abstract class Property<T> {
|
||||
public @interface VISIBILITY {}
|
||||
|
||||
<% for (const property of properties) { -%>
|
||||
//<%- snakeCaseUpper(property.name) %>: <%- property.doc %>
|
||||
// <%- snakeCaseUpper(property.name) %>: <%- property.doc %>
|
||||
|
||||
<% for (const value in property.values) { -%>
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ public abstract class Property<T> {
|
||||
|
||||
<% } -%>
|
||||
|
||||
//Class definition
|
||||
// Class definition
|
||||
public final String name;
|
||||
public final T value;
|
||||
|
||||
|
||||
@@ -160,8 +160,8 @@ public class GeoJsonSource extends Source {
|
||||
}
|
||||
|
||||
protected void setRawJson(String geoJson) {
|
||||
//Wrap the String in a map as an Object is expected by the
|
||||
//style conversion template
|
||||
// Wrap the String in a map as an Object is expected by the
|
||||
// style conversion template
|
||||
HashMap<String, String> wrapper = new HashMap<>();
|
||||
wrapper.put("data", geoJson);
|
||||
nativeSetGeoJson(wrapper);
|
||||
|
||||
@@ -117,10 +117,10 @@ public class MapboxEventManager {
|
||||
*/
|
||||
public void initialize(@NonNull Context context, @NonNull String accessToken) {
|
||||
|
||||
//Timber.i("Telemetry initialize() called...");
|
||||
// Timber.i("Telemetry initialize() called...");
|
||||
|
||||
if (initialized) {
|
||||
//Timber.i("Mapbox Telemetry has already been initialized.");
|
||||
// Timber.i("Mapbox Telemetry has already been initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class MapboxEventManager {
|
||||
Context.MODE_PRIVATE);
|
||||
|
||||
// Determine if Telemetry Should Be Enabled
|
||||
///Timber.i("Right before Telemetry set enabled in initialized()");
|
||||
/// Timber.i("Right before Telemetry set enabled in initialized()");
|
||||
setTelemetryEnabled(prefs.getBoolean(MapboxConstants.MAPBOX_SHARED_PREFERENCE_KEY_TELEMETRY_ENABLED, true));
|
||||
|
||||
// Load / Create Vendor Id
|
||||
@@ -171,7 +171,7 @@ public class MapboxEventManager {
|
||||
String stagingAccessToken = appInfo.metaData.getString(MapboxConstants.KEY_META_DATA_STAGING_ACCESS_TOKEN);
|
||||
|
||||
if (TextUtils.isEmpty(stagingURL) || TextUtils.isEmpty(stagingAccessToken)) {
|
||||
//Timber.d("Looking in SharedPreferences for Staging Credentials");
|
||||
// Timber.d("Looking in SharedPreferences for Staging Credentials");
|
||||
stagingURL = prefs.getString(MapboxConstants.MAPBOX_SHARED_PREFERENCE_KEY_TELEMETRY_STAGING_URL, null);
|
||||
stagingAccessToken = prefs.getString(
|
||||
MapboxConstants.MAPBOX_SHARED_PREFERENCE_KEY_TELEMETRY_STAGING_ACCESS_TOKEN, null);
|
||||
@@ -191,7 +191,7 @@ public class MapboxEventManager {
|
||||
}
|
||||
|
||||
} catch (Exception exception) {
|
||||
//Timber.e("Error Trying to load Staging Credentials: ", exception);
|
||||
// Timber.e("Error Trying to load Staging Credentials: ", exception);
|
||||
}
|
||||
|
||||
// Register for battery updates
|
||||
@@ -227,7 +227,7 @@ public class MapboxEventManager {
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
//Timber.w("Error checking for Telemetry Service Config: ", exception);
|
||||
// Timber.w("Error checking for Telemetry Service Config: ", exception);
|
||||
}
|
||||
throw new TelemetryServiceNotConfiguredException();
|
||||
}
|
||||
@@ -246,26 +246,26 @@ public class MapboxEventManager {
|
||||
* @param telemetryEnabled True to start telemetry, false to stop it
|
||||
*/
|
||||
public void setTelemetryEnabled(boolean telemetryEnabled) {
|
||||
//Timber.i("this.telemetryEnabled = " + this.telemetryEnabled + "; telemetryEnabled = " + telemetryEnabled);
|
||||
// Timber.i("this.telemetryEnabled = " + this.telemetryEnabled + "; telemetryEnabled = " + telemetryEnabled);
|
||||
if (this.telemetryEnabled == telemetryEnabled) {
|
||||
//Timber.d("No need to start / stop telemetry as it's already in that state.");
|
||||
// Timber.d("No need to start / stop telemetry as it's already in that state.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (telemetryEnabled) {
|
||||
//Timber.d("Starting Telemetry Up!");
|
||||
// Timber.d("Starting Telemetry Up!");
|
||||
// Start It Up
|
||||
context.startService(new Intent(context, TelemetryService.class));
|
||||
|
||||
// Make sure Ambient Mode is started at a minimum
|
||||
if (LocationServices.getLocationServices(context).areLocationPermissionsGranted()) {
|
||||
//Timber.i("Permissions are good, see if GPS is enabled and if not then setup Ambient.");
|
||||
// Timber.i("Permissions are good, see if GPS is enabled and if not then setup Ambient.");
|
||||
if (LocationServices.getLocationServices(context).isGpsEnabled()) {
|
||||
LocationServices.getLocationServices(context).toggleGPS(false);
|
||||
}
|
||||
} else {
|
||||
// Start timer that checks for Permissions
|
||||
//Timber.i("Permissions are not good. Need to do some looping to check on stuff.");
|
||||
// Timber.i("Permissions are not good. Need to do some looping to check on stuff.");
|
||||
|
||||
final Handler permsHandler = new Handler();
|
||||
Runnable runnable = new Runnable() {
|
||||
@@ -275,7 +275,7 @@ public class MapboxEventManager {
|
||||
@Override
|
||||
public void run() {
|
||||
if (LocationServices.getLocationServices(context).areLocationPermissionsGranted()) {
|
||||
//Timber.i("Permissions finally granted, so starting Ambient if GPS isn't already enabled");
|
||||
// Timber.i("Permissions finally granted, so starting Ambient if GPS isn't already enabled");
|
||||
// Start Ambient
|
||||
if (LocationServices.getLocationServices(context).isGpsEnabled()) {
|
||||
LocationServices.getLocationServices(context).toggleGPS(false);
|
||||
@@ -283,7 +283,7 @@ public class MapboxEventManager {
|
||||
} else {
|
||||
// Restart Handler
|
||||
long nextWaitTime = exponentialBackoffCounter.getNextCount();
|
||||
//Timber.i("Permissions not granted yet... let's try again in " + nextWaitTime/1000 + " seconds");
|
||||
// Timber.i("Permissions not granted yet... let's try again in " + nextWaitTime/1000 + " seconds");
|
||||
permsHandler.postDelayed(this, nextWaitTime);
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public class MapboxEventManager {
|
||||
timer = new Timer();
|
||||
timer.schedule(new FlushEventsTimerTask(), flushDelayInitialInMillis, flushDelayInMillis);
|
||||
} else {
|
||||
//Timber.d("Shutting Telemetry Down");
|
||||
// Timber.d("Shutting Telemetry Down");
|
||||
// Shut It Down
|
||||
events.removeAllElements();
|
||||
context.stopService(new Intent(context, TelemetryService.class));
|
||||
@@ -322,7 +322,7 @@ public class MapboxEventManager {
|
||||
* NOTE: Permission set to package private to enable only telemetry code to use this.
|
||||
*/
|
||||
void flushEventsQueueImmediately() {
|
||||
//Timber.i("flushEventsQueueImmediately() called...");
|
||||
// Timber.i("flushEventsQueueImmediately() called...");
|
||||
new FlushTheEventsTask().execute();
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public class MapboxEventManager {
|
||||
}
|
||||
events.add(event);
|
||||
if (events.size() == FLUSH_EVENTS_CAP) {
|
||||
//Timber.d("eventsSize == flushCap so send data.");
|
||||
// Timber.d("eventsSize == flushCap so send data.");
|
||||
flushEventsQueueImmediately();
|
||||
}
|
||||
}
|
||||
@@ -437,7 +437,7 @@ public class MapboxEventManager {
|
||||
eventWithAttributes.put(MapboxEvent.ATTRIBUTE_CELLULAR_NETWORK_TYPE, getCellularNetworkType());
|
||||
eventWithAttributes.put(MapboxEvent.ATTRIBUTE_WIFI, getConnectedToWifi());
|
||||
} else {
|
||||
//Timber.w("This is not an event type in the Events Data Model.");
|
||||
// Timber.w("This is not an event type in the Events Data Model.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ public class MapboxEventManager {
|
||||
|
||||
// Send to Server Immediately
|
||||
flushEventsQueueImmediately();
|
||||
//Timber.d("turnstile event pushed.");
|
||||
// Timber.d("turnstile event pushed.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -485,7 +485,7 @@ public class MapboxEventManager {
|
||||
return hex;
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
//Timber.w("Error encoding string, will return in original form.", exception);
|
||||
// Timber.w("Error encoding string, will return in original form.", exception);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ public class MapboxEventManager {
|
||||
status = true;
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
//Timber.w("Error getting Wifi Connection Status: ", exception);
|
||||
// Timber.w("Error getting Wifi Connection Status: ", exception);
|
||||
status = false;
|
||||
}
|
||||
}
|
||||
@@ -642,13 +642,13 @@ public class MapboxEventManager {
|
||||
protected Void doInBackground(Void... voids) {
|
||||
|
||||
if (events.isEmpty()) {
|
||||
//Timber.d("No events in the queue to send so returning.");
|
||||
// Timber.d("No events in the queue to send so returning.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check for NetworkConnectivity
|
||||
if (!Mapbox.isConnected()) {
|
||||
//Timber.w("Not connected to network, so empty events cache and return without attempting to send events");
|
||||
// Timber.w("Not connected to network, so empty events cache and return without attempting to send events");
|
||||
// Make sure that events don't pile up when Offline
|
||||
// and thus impact available memory over time.
|
||||
events.removeAllElements();
|
||||
@@ -772,7 +772,7 @@ public class MapboxEventManager {
|
||||
.post(body)
|
||||
.build();
|
||||
response = client.newCall(request).execute();
|
||||
//Timber.d("response code = " + response.code() + " for events " + events.size());
|
||||
// Timber.d("response code = " + response.code() + " for events " + events.size());
|
||||
|
||||
} catch (Exception exception) {
|
||||
Timber.e("FlushTheEventsTask borked: ", exception);
|
||||
@@ -825,4 +825,4 @@ public class MapboxEventManager {
|
||||
return attempt * BASE_TIME;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,4 +119,4 @@ public class ColorUtils {
|
||||
throw new ConversionException("Not a valid rgb/rgba value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user