Fixing a few less common issues from the Market console.

This commit is contained in:
Rodrigo Damazio
2011-06-09 22:22:57 -03:00
parent 79dd8f4e49
commit 0afdeb9bcc
3 changed files with 33 additions and 23 deletions
@@ -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;
@@ -235,6 +238,11 @@ public class MapOverlay extends Overlay {
// It's safe to keep projection within a single draw operation. // It's safe to keep projection within a single draw operation.
final Projection projection = getMapProjection(mapView); final Projection projection = getMapProjection(mapView);
if (projection == null) {
Log.w(TAG, "No projection, unable to draw");
return;
}
// Get the current viewing window. // Get the current viewing window.
if (trackDrawingEnabled) { if (trackDrawingEnabled) {
Rect viewRect = getMapViewRect(mapView); Rect viewRect = getMapViewRect(mapView);
@@ -989,6 +989,7 @@ public class TrackDataHub {
// no matter how many points we get in the newest batch, we'll never exceed // no matter how many points we get in the newest batch, we'll never exceed
// MAX_DISPLAYED_TRACK_POINTS = 2 * TARGET_DISPLAYED_TRACK_POINTS before resampling. // MAX_DISPLAYED_TRACK_POINTS = 2 * TARGET_DISPLAYED_TRACK_POINTS before resampling.
long numTotalPoints = lastStoredLocationId - localFirstSeenLocationId; long numTotalPoints = lastStoredLocationId - localFirstSeenLocationId;
numTotalPoints = Math.max(0L, numTotalPoints);
pointSamplingFrequency = (int) (1 + numTotalPoints / targetNumPoints); pointSamplingFrequency = (int) (1 + numTotalPoints / targetNumPoints);
} }
@@ -59,7 +59,8 @@ public class FroyoStatusAnnouncerTask extends StatusAnnouncerTask {
@Override @Override
protected void onTtsInit(int status) { protected void onTtsInit(int status) {
super.onTtsInit(status); super.onTtsInit(status);
if (status == TextToSpeech.SUCCESS) {
if (status == TextToSpeech.SUCCESS && tts != null) {
tts.setOnUtteranceCompletedListener(utteranceListener); tts.setOnUtteranceCompletedListener(utteranceListener);
} }
} }