forked from upstream-mirrors/OpenTracks
Fixing some nits from static analysis.
This commit is contained in:
@@ -593,7 +593,7 @@ public class ChartView extends View {
|
|||||||
|
|
||||||
final float x = getWaypointX(waypoint);
|
final float x = getWaypointX(waypoint);
|
||||||
c.drawLine(x, h - bottomBorder, x, topBorder, gridPaint);
|
c.drawLine(x, h - bottomBorder, x, topBorder, gridPaint);
|
||||||
c.translate(x - markerWidth / 2, markerHeight);
|
c.translate(x - (float) markerWidth / 2.0f, (float) markerHeight);
|
||||||
if (waypoints.get(i).getType() == Waypoint.TYPE_STATISTICS) {
|
if (waypoints.get(i).getType() == Waypoint.TYPE_STATISTICS) {
|
||||||
statsMarker.draw(c);
|
statsMarker.draw(c);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.apps.mytracks;
|
package com.google.android.apps.mytracks;
|
||||||
|
|
||||||
|
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.content.Waypoint;
|
import com.google.android.apps.mytracks.content.Waypoint;
|
||||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||||
import com.google.android.maps.GeoPoint;
|
import com.google.android.maps.GeoPoint;
|
||||||
@@ -33,6 +35,7 @@ import android.graphics.Point;
|
|||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -71,7 +74,7 @@ public class MapOverlay extends Overlay {
|
|||||||
private GeoPoint lastReferencePoint;
|
private GeoPoint lastReferencePoint;
|
||||||
private Rect lastViewRect;
|
private Rect lastViewRect;
|
||||||
private Path lastPath;
|
private Path lastPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a pre-processed {@code Location} to speed up drawing.
|
* Represents a pre-processed {@code Location} to speed up drawing.
|
||||||
* This class is more like a data object and doesn't provide accessors.
|
* This class is more like a data object and doesn't provide accessors.
|
||||||
@@ -93,13 +96,13 @@ public class MapOverlay extends Overlay {
|
|||||||
*/
|
*/
|
||||||
public CachedLocation(Location location) {
|
public CachedLocation(Location location) {
|
||||||
this.valid = LocationUtils.isValidLocation(location);
|
this.valid = LocationUtils.isValidLocation(location);
|
||||||
this.geoPoint = valid ? LocationUtils.getGeoPoint(location) : null;
|
this.geoPoint = valid ? LocationUtils.getGeoPoint(location) : null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MapOverlay(Context context) {
|
public MapOverlay(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
||||||
this.waypoints = new ArrayList<Waypoint>();
|
this.waypoints = new ArrayList<Waypoint>();
|
||||||
this.points = new ArrayList<CachedLocation>(1024);
|
this.points = new ArrayList<CachedLocation>(1024);
|
||||||
this.pendingPoints = new ArrayBlockingQueue<CachedLocation>(
|
this.pendingPoints = new ArrayBlockingQueue<CachedLocation>(
|
||||||
@@ -164,7 +167,7 @@ public class MapOverlay extends Overlay {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a location to the map overlay.
|
* Add a location to the map overlay.
|
||||||
*
|
*
|
||||||
* NOTE: This method doesn't take ownership of the given location, so it is
|
* NOTE: This method doesn't take ownership of the given location, so it is
|
||||||
* safe to reuse the same location while calling this method.
|
* safe to reuse the same location while calling this method.
|
||||||
*
|
*
|
||||||
@@ -172,14 +175,18 @@ public class MapOverlay extends Overlay {
|
|||||||
*/
|
*/
|
||||||
public void addLocation(Location l) {
|
public void addLocation(Location l) {
|
||||||
// Queue up in the pending queue until it's merged with {@code #points}.
|
// Queue up in the pending queue until it's merged with {@code #points}.
|
||||||
pendingPoints.offer(new CachedLocation(l));
|
if (!pendingPoints.offer(new CachedLocation(l))) {
|
||||||
|
Log.e(TAG, "Unable to add pending points");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a segment split to the map overlay.
|
* Adds a segment split to the map overlay.
|
||||||
*/
|
*/
|
||||||
public void addSegmentSplit() {
|
public void addSegmentSplit() {
|
||||||
pendingPoints.offer(new CachedLocation());
|
if (!pendingPoints.offer(new CachedLocation())) {
|
||||||
|
Log.e(TAG, "Unable to add pending points");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWaypoint(Waypoint wpt) {
|
public void addWaypoint(Waypoint wpt) {
|
||||||
@@ -203,7 +210,7 @@ public class MapOverlay extends Overlay {
|
|||||||
return waypoints.size();
|
return waypoints.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearPoints() {
|
public void clearPoints() {
|
||||||
synchronized (points) {
|
synchronized (points) {
|
||||||
points.clear();
|
points.clear();
|
||||||
@@ -238,7 +245,7 @@ public class MapOverlay extends Overlay {
|
|||||||
// Get the current viewing window.
|
// Get the current viewing window.
|
||||||
if (trackDrawingEnabled) {
|
if (trackDrawingEnabled) {
|
||||||
Rect viewRect = getMapViewRect(mapView);
|
Rect viewRect = getMapViewRect(mapView);
|
||||||
|
|
||||||
// Draw the selected track:
|
// Draw the selected track:
|
||||||
drawTrack(canvas, projection, viewRect);
|
drawTrack(canvas, projection, viewRect);
|
||||||
|
|
||||||
@@ -249,12 +256,12 @@ public class MapOverlay extends Overlay {
|
|||||||
// Draw the current location
|
// Draw the current location
|
||||||
drawMyLocation(canvas, projection);
|
drawMyLocation(canvas, projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible for testing.
|
// Visible for testing.
|
||||||
Projection getMapProjection(MapView mapView) {
|
Projection getMapProjection(MapView mapView) {
|
||||||
return mapView.getProjection();
|
return mapView.getProjection();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible for testing.
|
// Visible for testing.
|
||||||
Rect getMapViewRect(MapView mapView) {
|
Rect getMapViewRect(MapView mapView) {
|
||||||
int w = mapView.getLongitudeSpan();
|
int w = mapView.getLongitudeSpan();
|
||||||
@@ -263,12 +270,12 @@ public class MapOverlay extends Overlay {
|
|||||||
int cy = mapView.getMapCenter().getLatitudeE6();
|
int cy = mapView.getMapCenter().getLatitudeE6();
|
||||||
return new Rect(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2);
|
return new Rect(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible for testing.
|
// Visible for testing.
|
||||||
Path newPath() {
|
Path newPath() {
|
||||||
return new Path();
|
return new Path();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible for testing.
|
// Visible for testing.
|
||||||
Path getLastPath() {
|
Path getLastPath() {
|
||||||
return lastPath;
|
return lastPath;
|
||||||
@@ -304,9 +311,9 @@ public class MapOverlay extends Overlay {
|
|||||||
synchronized (points) {
|
synchronized (points) {
|
||||||
// Merge the pending points with the list of cached locations.
|
// Merge the pending points with the list of cached locations.
|
||||||
final GeoPoint referencePoint = projection.fromPixels(0, 0);
|
final GeoPoint referencePoint = projection.fromPixels(0, 0);
|
||||||
int newPoints = pendingPoints.drainTo(points);
|
int newPoints = pendingPoints.drainTo(points);
|
||||||
boolean newProjection = !viewRect.equals(lastViewRect) ||
|
boolean newProjection = !viewRect.equals(lastViewRect) ||
|
||||||
!referencePoint.equals(lastReferencePoint);
|
!referencePoint.equals(lastReferencePoint);
|
||||||
if (newPoints == 0 && lastPath != null && !newProjection) {
|
if (newPoints == 0 && lastPath != null && !newProjection) {
|
||||||
// No need to recreate path (same points and viewing area).
|
// No need to recreate path (same points and viewing area).
|
||||||
path = lastPath;
|
path = lastPath;
|
||||||
@@ -318,12 +325,12 @@ public class MapOverlay extends Overlay {
|
|||||||
} else if (lastPath != null && !newProjection) {
|
} else if (lastPath != null && !newProjection) {
|
||||||
// Incremental update of the path, without repositioning the view.
|
// Incremental update of the path, without repositioning the view.
|
||||||
path = lastPath;
|
path = lastPath;
|
||||||
updatePath(projection, viewRect, path, numPoints - newPoints);
|
updatePath(projection, viewRect, path, numPoints - newPoints);
|
||||||
} else {
|
} else {
|
||||||
// The view has changed so we have to start from scratch.
|
// The view has changed so we have to start from scratch.
|
||||||
path = newPath();
|
path = newPath();
|
||||||
path.incReserve(numPoints);
|
path.incReserve(numPoints);
|
||||||
updatePath(projection, viewRect, path, 0);
|
updatePath(projection, viewRect, path, 0);
|
||||||
}
|
}
|
||||||
lastPath = path;
|
lastPath = path;
|
||||||
}
|
}
|
||||||
@@ -344,7 +351,7 @@ public class MapOverlay extends Overlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the "Start" marker.
|
// Draw the "Start" marker.
|
||||||
for (int i = 0; i < points.size(); ++i) {
|
for (int i = 0; i < points.size(); ++i) {
|
||||||
if (points.get(i).valid) {
|
if (points.get(i).valid) {
|
||||||
@@ -354,7 +361,7 @@ public class MapOverlay extends Overlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePath(Projection projection, Rect viewRect, Path path,
|
private void updatePath(Projection projection, Rect viewRect, Path path,
|
||||||
int startLocationIdx) {
|
int startLocationIdx) {
|
||||||
// Whether to start a new segment on new valid and visible point.
|
// Whether to start a new segment on new valid and visible point.
|
||||||
@@ -370,7 +377,7 @@ public class MapOverlay extends Overlay {
|
|||||||
newSegment = true;
|
newSegment = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final GeoPoint geoPoint = loc.geoPoint;
|
final GeoPoint geoPoint = loc.geoPoint;
|
||||||
// Check if this breaks the existing segment.
|
// Check if this breaks the existing segment.
|
||||||
boolean visible = alwaysVisible || viewRect.contains(
|
boolean visible = alwaysVisible || viewRect.contains(
|
||||||
@@ -380,7 +387,7 @@ public class MapOverlay extends Overlay {
|
|||||||
newSegment = true;
|
newSegment = true;
|
||||||
}
|
}
|
||||||
lastVisible = visible;
|
lastVisible = visible;
|
||||||
|
|
||||||
// Either move to beginning of a new segment or continue the old one.
|
// Either move to beginning of a new segment or continue the old one.
|
||||||
projection.toPixels(geoPoint, pt);
|
projection.toPixels(geoPoint, pt);
|
||||||
if (newSegment) {
|
if (newSegment) {
|
||||||
@@ -391,7 +398,7 @@ public class MapOverlay extends Overlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible for testing.
|
// Visible for testing.
|
||||||
Point drawElement(Canvas canvas, Projection projection, GeoPoint geoPoint,
|
Point drawElement(Canvas canvas, Projection projection, GeoPoint geoPoint,
|
||||||
Drawable element, int offsetX, int offsetY) {
|
Drawable element, int offsetX, int offsetY) {
|
||||||
|
|||||||
@@ -644,7 +644,7 @@ public class SendToFusionTables implements Runnable {
|
|||||||
// to fit the completion percentage range alloted to track data upload.
|
// to fit the completion percentage range alloted to track data upload.
|
||||||
double totalPercentage =
|
double totalPercentage =
|
||||||
(totalLocationsRead + totalLocationsPrepared + totalLocationsUploaded)
|
(totalLocationsRead + totalLocationsPrepared + totalLocationsUploaded)
|
||||||
/ (totalLocations * 3);
|
/ (totalLocations * 3.0);
|
||||||
|
|
||||||
double scaledPercentage = totalPercentage
|
double scaledPercentage = totalPercentage
|
||||||
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.apps.mytracks.io.backup;
|
package com.google.android.apps.mytracks.io.backup;
|
||||||
|
|
||||||
|
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.Constants;
|
import com.google.android.apps.mytracks.Constants;
|
||||||
import com.google.android.apps.mytracks.content.TrackPointsColumns;
|
import com.google.android.apps.mytracks.content.TrackPointsColumns;
|
||||||
import com.google.android.apps.mytracks.content.TracksColumns;
|
import com.google.android.apps.mytracks.content.TracksColumns;
|
||||||
@@ -205,7 +207,9 @@ class ExternalFileBackup {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// We tried to delete the partially created file, but do nothing
|
// We tried to delete the partially created file, but do nothing
|
||||||
// if that also fails.
|
// if that also fails.
|
||||||
outputFile.delete();
|
if (!outputFile.delete()) {
|
||||||
|
Log.w(TAG, "Failed to delete file " + outputFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010 Google Inc.
|
* Copyright 2010 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
* the License at
|
* the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
@@ -15,7 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.apps.mytracks.io.file;
|
package com.google.android.apps.mytracks.io.file;
|
||||||
|
|
||||||
|
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||||
|
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -24,18 +27,18 @@ import java.io.File;
|
|||||||
* @author Sandor Dornbush
|
* @author Sandor Dornbush
|
||||||
*/
|
*/
|
||||||
public class TempFileCleaner {
|
public class TempFileCleaner {
|
||||||
|
|
||||||
private long currentTimeMillis;
|
private long currentTimeMillis;
|
||||||
|
|
||||||
public static void clean() {
|
public static void clean() {
|
||||||
(new TempFileCleaner(System.currentTimeMillis())).cleanImpl();
|
(new TempFileCleaner(System.currentTimeMillis())).cleanImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @VisibleForTesting
|
// @VisibleForTesting
|
||||||
TempFileCleaner(long time) {
|
TempFileCleaner(long time) {
|
||||||
currentTimeMillis = time;
|
currentTimeMillis = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanImpl() {
|
private void cleanImpl() {
|
||||||
if (!Environment.getExternalStorageState().equals(
|
if (!Environment.getExternalStorageState().equals(
|
||||||
Environment.MEDIA_MOUNTED)) {
|
Environment.MEDIA_MOUNTED)) {
|
||||||
@@ -64,7 +67,9 @@ public class TempFileCleaner {
|
|||||||
long oldest = currentTimeMillis - 1000 * 3600;
|
long oldest = currentTimeMillis - 1000 * 3600;
|
||||||
for (File f : dir.listFiles()) {
|
for (File f : dir.listFiles()) {
|
||||||
if (f.lastModified() < oldest) {
|
if (f.lastModified() < oldest) {
|
||||||
f.delete();
|
if (!f.delete()) {
|
||||||
|
Log.w(TAG, "Failed to delete file " + f.getAbsolutePath());
|
||||||
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.apps.mytracks.io.file;
|
package com.google.android.apps.mytracks.io.file;
|
||||||
|
|
||||||
|
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.Constants;
|
import com.google.android.apps.mytracks.Constants;
|
||||||
import com.google.android.apps.mytracks.content.MyTracksLocation;
|
import com.google.android.apps.mytracks.content.MyTracksLocation;
|
||||||
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||||
@@ -120,7 +122,9 @@ class TrackWriterImpl implements TrackWriter {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.i(Constants.TAG, "The track write was interrupted");
|
Log.i(Constants.TAG, "The track write was interrupted");
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
file.delete();
|
if (!file.delete()) {
|
||||||
|
Log.w(TAG, "Failed to delete file " + file.getAbsolutePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
success = false;
|
success = false;
|
||||||
errorMessage = R.string.error_operation_cancelled;
|
errorMessage = R.string.error_operation_cancelled;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.google.android.apps.mytracks.io.mymaps;
|
|||||||
|
|
||||||
import com.google.android.maps.GeoPoint;
|
import com.google.android.maps.GeoPoint;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +49,8 @@ class MyMapsFeature {
|
|||||||
/** The metadata of this feature in a format efficient for transmission. */
|
/** The metadata of this feature in a format efficient for transmission. */
|
||||||
private MyMapsFeatureMetadata featureInfo = new MyMapsFeatureMetadata();
|
private MyMapsFeatureMetadata featureInfo = new MyMapsFeatureMetadata();
|
||||||
|
|
||||||
|
private final Random random = new Random();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a valid but empty feature. It will default to a
|
* Initializes a valid but empty feature. It will default to a
|
||||||
* {@link #MARKER} with a blue placemark with a dot as an icon at the
|
* {@link #MARKER} with a blue placemark with a dot as an icon at the
|
||||||
@@ -61,7 +64,7 @@ class MyMapsFeature {
|
|||||||
*
|
*
|
||||||
* @param point The new point to add
|
* @param point The new point to add
|
||||||
*/
|
*/
|
||||||
public synchronized void addPoint(GeoPoint point) {
|
public void addPoint(GeoPoint point) {
|
||||||
latitudeE6.add(point.getLatitudeE6());
|
latitudeE6.add(point.getLatitudeE6());
|
||||||
longitudeE6.add(point.getLongitudeE6());
|
longitudeE6.add(point.getLongitudeE6());
|
||||||
}
|
}
|
||||||
@@ -70,10 +73,10 @@ class MyMapsFeature {
|
|||||||
* Generates a new local id for this feature based on the current time and
|
* Generates a new local id for this feature based on the current time and
|
||||||
* a random number.
|
* a random number.
|
||||||
*/
|
*/
|
||||||
public synchronized void generateAndroidId() {
|
void generateAndroidId() {
|
||||||
Long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
Integer random = (int) (Math.random() * 10000);
|
int rand = random.nextInt(10000);
|
||||||
androidId = time.toString() + "." + random.toString();
|
androidId = time + "." + rand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +84,7 @@ class MyMapsFeature {
|
|||||||
*
|
*
|
||||||
* @return The local id for this feature
|
* @return The local id for this feature
|
||||||
*/
|
*/
|
||||||
public String getAndroidId() {
|
String getAndroidId() {
|
||||||
return androidId;
|
return androidId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009 Google Inc.
|
* Copyright 2009 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
* the License at
|
* the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
@@ -45,7 +45,9 @@ public class SensorManagerFactory {
|
|||||||
if (prefs == null) {
|
if (prefs == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context = context.getApplicationContext();
|
||||||
|
|
||||||
String sensor = prefs.getString(context.getString(R.string.sensor_type_key), null);
|
String sensor = prefs.getString(context.getString(R.string.sensor_type_key), null);
|
||||||
Log.i(Constants.TAG, "Creating sensor of type: " + sensor);
|
Log.i(Constants.TAG, "Creating sensor of type: " + sensor);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user