forked from upstream-mirrors/OpenTracks
Fix an issue after merge head.
This commit is contained in:
@@ -34,7 +34,6 @@ import com.google.android.apps.mytracks.util.UnitConversions;
|
|||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
@@ -189,7 +188,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
public void onSampledInTrackPoint(Location location) {
|
public void onSampledInTrackPoint(Location location) {
|
||||||
if (isResumed()) {
|
if (isResumed()) {
|
||||||
double[] data = new double[ChartView.NUM_SERIES + 1];
|
double[] data = new double[ChartView.NUM_SERIES + 1];
|
||||||
fillDataPoint(getActivity(), location, data);
|
fillDataPoint(location, data);
|
||||||
pendingPoints.add(data);
|
pendingPoints.add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,14 +196,14 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onSampledOutTrackPoint(Location location) {
|
public void onSampledOutTrackPoint(Location location) {
|
||||||
if (isResumed()) {
|
if (isResumed()) {
|
||||||
fillDataPoint(getActivity(), location, null);
|
fillDataPoint(location, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSegmentSplit(Location location) {
|
public void onSegmentSplit(Location location) {
|
||||||
if (isResumed()) {
|
if (isResumed()) {
|
||||||
fillDataPoint(getActivity(), location, null);
|
fillDataPoint(location, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,12 +437,11 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
* data[5] = cadence <br>
|
* data[5] = cadence <br>
|
||||||
* data[6] = power <br>
|
* data[6] = power <br>
|
||||||
*
|
*
|
||||||
* @param context the context
|
|
||||||
* @param location the location
|
* @param location the location
|
||||||
* @param data the data point to fill in, can be null
|
* @param data the data point to fill in, can be null
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void fillDataPoint(Context context, Location location, double data[]) {
|
void fillDataPoint(Location location, double data[]) {
|
||||||
double timeOrDistance = Double.NaN;
|
double timeOrDistance = Double.NaN;
|
||||||
double elevation = Double.NaN;
|
double elevation = Double.NaN;
|
||||||
double speed = Double.NaN;
|
double speed = Double.NaN;
|
||||||
@@ -453,9 +451,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
double power = Double.NaN;
|
double power = Double.NaN;
|
||||||
|
|
||||||
if (tripStatisticsUpdater != null) {
|
if (tripStatisticsUpdater != null) {
|
||||||
int weight = PreferencesUtils.getInt(
|
tripStatisticsUpdater.addLocation(location, recordingDistanceInterval, getActivity());
|
||||||
context, R.string.stats_weight_key, PreferencesUtils.STATS_WEIGHT_DEFAULT);
|
|
||||||
tripStatisticsUpdater.addLocation(location, recordingDistanceInterval, weight);
|
|
||||||
TripStatistics tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
TripStatistics tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
||||||
if (chartByDistance) {
|
if (chartByDistance) {
|
||||||
double distance = tripStatistics.getTotalDistance() * UnitConversions.M_TO_KM;
|
double distance = tripStatistics.getTotalDistance() * UnitConversions.M_TO_KM;
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ public class ChartFragmentTest extends AndroidTestCase {
|
|||||||
*/
|
*/
|
||||||
private double[] fillDataPointTestHelper(Location location) {
|
private double[] fillDataPointTestHelper(Location location) {
|
||||||
double[] point = new double[ChartView.NUM_SERIES + 1];
|
double[] point = new double[ChartView.NUM_SERIES + 1];
|
||||||
chartFragment.fillDataPoint(getContext(), location, point);
|
chartFragment.fillDataPoint(location, point);
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user