forked from upstream-mirrors/OpenTracks
Chagne gps accuracy default tp 50m
This commit is contained in:
@@ -143,16 +143,16 @@ limitations under the License.
|
|||||||
<item>900</item>
|
<item>900</item>
|
||||||
<item>1800</item>
|
<item>1800</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="min_required_accuracy_values">
|
<string-array name="recording_gps_accuracy_values">
|
||||||
<item>10</item>
|
<item>10</item>
|
||||||
<item>20</item>
|
<item>20</item>
|
||||||
|
<item>30</item>
|
||||||
<item>50</item>
|
<item>50</item>
|
||||||
<item>100</item>
|
<item>100</item>
|
||||||
<item>200</item>
|
<item>200</item>
|
||||||
<item>500</item>
|
<item>500</item>
|
||||||
<item>1000</item>
|
<item>1000</item>
|
||||||
<item>2000</item>
|
<item>2000</item>
|
||||||
<item>5000</item>
|
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="sensor_type_all_options">
|
<string-array name="sensor_type_all_options">
|
||||||
<item>@string/settings_sensor_type_polar</item>
|
<item>@string/settings_sensor_type_polar</item>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ limitations under the License.
|
|||||||
<string name="max_recording_distance_key">maxRecordingDistance</string>
|
<string name="max_recording_distance_key">maxRecordingDistance</string>
|
||||||
<string name="min_recording_distance_key">minRecordingDistance</string>
|
<string name="min_recording_distance_key">minRecordingDistance</string>
|
||||||
<string name="min_recording_interval_key">minRecordingInterval</string>
|
<string name="min_recording_interval_key">minRecordingInterval</string>
|
||||||
<string name="min_required_accuracy_key">minRequiredAccuracy</string>
|
<string name="recording_gps_accuracy_key">recordingGpsAccuracy</string>
|
||||||
<string name="report_speed_key">reportSpeed</string>
|
<string name="report_speed_key">reportSpeed</string>
|
||||||
<string name="sensor_type_key">sensorType</string>
|
<string name="sensor_type_key">sensorType</string>
|
||||||
<string name="share_track_invite_key">shareTrackInvite</string>
|
<string name="share_track_invite_key">shareTrackInvite</string>
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ limitations under the License.
|
|||||||
android:key="@string/max_recording_distance_key"
|
android:key="@string/max_recording_distance_key"
|
||||||
android:title="@string/settings_recording_max_recording_distance_title" />
|
android:title="@string/settings_recording_max_recording_distance_title" />
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="200"
|
android:defaultValue="50"
|
||||||
android:key="@string/min_required_accuracy_key"
|
android:key="@string/recording_gps_accuracy_key"
|
||||||
android:title="@string/settings_recording_min_required_accuracy_title" />
|
android:title="@string/settings_recording_min_required_accuracy_title" />
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="10"
|
android:defaultValue="10"
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class TrackDataHub implements DataSourceListener {
|
|||||||
private boolean recordingTrackPaused;
|
private boolean recordingTrackPaused;
|
||||||
private boolean metricUnits;
|
private boolean metricUnits;
|
||||||
private boolean reportSpeed;
|
private boolean reportSpeed;
|
||||||
private int minRequiredAccuracy;
|
private int recordingGpsAccuracy;
|
||||||
private int minRecordingDistance;
|
private int minRecordingDistance;
|
||||||
|
|
||||||
// Track points sampling state
|
// Track points sampling state
|
||||||
@@ -295,13 +295,13 @@ public class TrackDataHub implements DataSourceListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (key == null
|
if (key == null
|
||||||
|| key.equals(PreferencesUtils.getKey(context, R.string.min_required_accuracy_key))) {
|
|| key.equals(PreferencesUtils.getKey(context, R.string.recording_gps_accuracy_key))) {
|
||||||
minRequiredAccuracy = PreferencesUtils.getInt(context, R.string.min_required_accuracy_key,
|
recordingGpsAccuracy = PreferencesUtils.getInt(context, R.string.recording_gps_accuracy_key,
|
||||||
PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT);
|
PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT);
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
for (TrackDataListener trackDataListener :
|
for (TrackDataListener trackDataListener :
|
||||||
trackDataManager.getListeners(TrackDataType.PREFERENCE)) {
|
trackDataManager.getListeners(TrackDataType.PREFERENCE)) {
|
||||||
if (trackDataListener.onMinRequiredAccuracy(minRequiredAccuracy)) {
|
if (trackDataListener.onRecordingGpsAccuracy(recordingGpsAccuracy)) {
|
||||||
loadDataForListener(trackDataListener);
|
loadDataForListener(trackDataListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,7 @@ public class TrackDataHub implements DataSourceListener {
|
|||||||
trackDataManager.getListeners(TrackDataType.PREFERENCE)) {
|
trackDataManager.getListeners(TrackDataType.PREFERENCE)) {
|
||||||
trackDataListener.onMetricUnitsChanged(metricUnits);
|
trackDataListener.onMetricUnitsChanged(metricUnits);
|
||||||
trackDataListener.onReportSpeedChanged(reportSpeed);
|
trackDataListener.onReportSpeedChanged(reportSpeed);
|
||||||
trackDataListener.onMinRequiredAccuracy(minRequiredAccuracy);
|
trackDataListener.onRecordingGpsAccuracy(recordingGpsAccuracy);
|
||||||
trackDataListener.onMinRecordingDistanceChanged(minRecordingDistance);
|
trackDataListener.onMinRecordingDistanceChanged(minRecordingDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ public class TrackDataHub implements DataSourceListener {
|
|||||||
if (trackDataTypes.contains(TrackDataType.PREFERENCE)) {
|
if (trackDataTypes.contains(TrackDataType.PREFERENCE)) {
|
||||||
trackDataListener.onMetricUnitsChanged(metricUnits);
|
trackDataListener.onMetricUnitsChanged(metricUnits);
|
||||||
trackDataListener.onReportSpeedChanged(reportSpeed);
|
trackDataListener.onReportSpeedChanged(reportSpeed);
|
||||||
trackDataListener.onMinRequiredAccuracy(minRequiredAccuracy);
|
trackDataListener.onRecordingGpsAccuracy(recordingGpsAccuracy);
|
||||||
trackDataListener.onMinRecordingDistanceChanged(minRecordingDistance);
|
trackDataListener.onMinRecordingDistanceChanged(minRecordingDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,13 +580,11 @@ public class TrackDataHub implements DataSourceListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the minRequiredAccuracy.
|
* Gets the recordingGpsAccuracy.
|
||||||
*
|
|
||||||
* @return the minRequiredAccuracy
|
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
int getMinRequiredAccuracy() {
|
int getRecordingGpsAccuracy() {
|
||||||
return minRequiredAccuracy;
|
return recordingGpsAccuracy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -109,12 +109,12 @@ public interface TrackDataListener {
|
|||||||
public boolean onReportSpeedChanged(boolean reportSpeed);
|
public boolean onReportSpeedChanged(boolean reportSpeed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the min required accuracy preference value is changed.
|
* Called when the recording gps accuracy preference value is changed.
|
||||||
*
|
*
|
||||||
* @param minRequiredAccuracy the new value
|
* @param recordingGpsAccuracy the new value
|
||||||
* @return true to reload all the data, false otherwise
|
* @return true to reload all the data, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean onMinRequiredAccuracy(int minRequiredAccuracy);
|
public boolean onRecordingGpsAccuracy(int recordingGpsAccuracy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the min recording distance preference value is changed.
|
* Called when the min recording distance preference value is changed.
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMinRequiredAccuracy(int minRequiredAccuracy) {
|
public boolean onRecordingGpsAccuracy(int minRequiredAccuracy) {
|
||||||
// We don't care.
|
// We don't care.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class MyTracksMapFragment extends SupportMapFragment implements TrackData
|
|||||||
// Current location
|
// Current location
|
||||||
private Location currentLocation;
|
private Location currentLocation;
|
||||||
private Location lastTrackPoint;
|
private Location lastTrackPoint;
|
||||||
private int minRequiredAccuracy = PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT;
|
private int recordingGpsAccuracy = PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True to continue keeping the current location visible on the screen.
|
* True to continue keeping the current location visible on the screen.
|
||||||
@@ -492,8 +492,8 @@ public class MyTracksMapFragment extends SupportMapFragment implements TrackData
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMinRequiredAccuracy(int newValue) {
|
public boolean onRecordingGpsAccuracy(int newValue) {
|
||||||
minRequiredAccuracy = newValue;
|
recordingGpsAccuracy = newValue;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ public class MyTracksMapFragment extends SupportMapFragment implements TrackData
|
|||||||
hasGoodFix = false;
|
hasGoodFix = false;
|
||||||
} else {
|
} else {
|
||||||
hasFix = !LocationUtils.isLocationOld(currentLocation);
|
hasFix = !LocationUtils.isLocationOld(currentLocation);
|
||||||
hasGoodFix = currentLocation.getAccuracy() <= minRequiredAccuracy;
|
hasGoodFix = currentLocation.getAccuracy() <= recordingGpsAccuracy;
|
||||||
}
|
}
|
||||||
if (!hasFix) {
|
if (!hasFix) {
|
||||||
message = getString(R.string.gps_wait_for_signal);
|
message = getString(R.string.gps_wait_for_signal);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
|
|
||||||
private Location lastLocation = null;
|
private Location lastLocation = null;
|
||||||
private TripStatistics lastTripStatistics = null;
|
private TripStatistics lastTripStatistics = null;
|
||||||
private int minRequiredAccuracy = PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT;
|
private int recordingGpsAccuracy = PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT;
|
||||||
|
|
||||||
// A runnable to update the total time field.
|
// A runnable to update the total time field.
|
||||||
private final Runnable updateTotalTime = new Runnable() {
|
private final Runnable updateTotalTime = new Runnable() {
|
||||||
@@ -148,7 +148,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
|
|
||||||
if (lastLocation != null) {
|
if (lastLocation != null) {
|
||||||
boolean hasFix = !LocationUtils.isLocationOld(lastLocation);
|
boolean hasFix = !LocationUtils.isLocationOld(lastLocation);
|
||||||
boolean hasGoodFix = lastLocation.getAccuracy() <= minRequiredAccuracy;
|
boolean hasGoodFix = lastLocation.getAccuracy() <= recordingGpsAccuracy;
|
||||||
|
|
||||||
if (!hasFix || !hasGoodFix) {
|
if (!hasFix || !hasGoodFix) {
|
||||||
lastLocation = null;
|
lastLocation = null;
|
||||||
@@ -207,8 +207,8 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMinRequiredAccuracy(int newValue) {
|
public boolean onRecordingGpsAccuracy(int newValue) {
|
||||||
minRequiredAccuracy = newValue;
|
recordingGpsAccuracy = newValue;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class TrackRecordingService extends Service {
|
|||||||
private LocationListenerPolicy locationListenerPolicy;
|
private LocationListenerPolicy locationListenerPolicy;
|
||||||
private int minRecordingDistance;
|
private int minRecordingDistance;
|
||||||
private int maxRecordingDistance;
|
private int maxRecordingDistance;
|
||||||
private int minRequiredAccuracy;
|
private int recordingGpsAccuracy;
|
||||||
private int autoResumeTrackTimeout;
|
private int autoResumeTrackTimeout;
|
||||||
private long currentRecordingInterval;
|
private long currentRecordingInterval;
|
||||||
|
|
||||||
@@ -204,10 +204,11 @@ public class TrackRecordingService extends Service {
|
|||||||
R.string.max_recording_distance_key,
|
R.string.max_recording_distance_key,
|
||||||
PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT);
|
PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT);
|
||||||
}
|
}
|
||||||
if (key == null
|
if (key == null || key.equals(
|
||||||
|| key.equals(PreferencesUtils.getKey(context, R.string.min_required_accuracy_key))) {
|
PreferencesUtils.getKey(context, R.string.recording_gps_accuracy_key))) {
|
||||||
minRequiredAccuracy = PreferencesUtils.getInt(context,
|
recordingGpsAccuracy = PreferencesUtils.getInt(context,
|
||||||
R.string.min_required_accuracy_key, PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT);
|
R.string.recording_gps_accuracy_key,
|
||||||
|
PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT);
|
||||||
}
|
}
|
||||||
if (key == null || key.equals(
|
if (key == null || key.equals(
|
||||||
PreferencesUtils.getKey(context, R.string.auto_resume_track_timeout_key))) {
|
PreferencesUtils.getKey(context, R.string.auto_resume_track_timeout_key))) {
|
||||||
@@ -887,7 +888,7 @@ public class TrackRecordingService extends Service {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location.getAccuracy() > minRequiredAccuracy) {
|
if (location.getAccuracy() > recordingGpsAccuracy) {
|
||||||
Log.d(TAG, "Ignore onLocationChangedAsync. Poor accuracy.");
|
Log.d(TAG, "Ignore onLocationChangedAsync. Poor accuracy.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -55,8 +55,8 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
configListPreference(R.string.max_recording_distance_key,
|
configListPreference(R.string.max_recording_distance_key,
|
||||||
PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT, R.array.max_recording_distance_values,
|
PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT, R.array.max_recording_distance_values,
|
||||||
metricUnits);
|
metricUnits);
|
||||||
configListPreference(R.string.min_required_accuracy_key,
|
configListPreference(R.string.recording_gps_accuracy_key,
|
||||||
PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT, R.array.min_required_accuracy_values,
|
PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT, R.array.recording_gps_accuracy_values,
|
||||||
metricUnits);
|
metricUnits);
|
||||||
configListPreference(R.string.auto_resume_track_timeout_key,
|
configListPreference(R.string.auto_resume_track_timeout_key,
|
||||||
PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT,
|
PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT,
|
||||||
@@ -121,8 +121,8 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
case R.string.max_recording_distance_key:
|
case R.string.max_recording_distance_key:
|
||||||
setMaxRecordingDistanceSummaryAndOptions(summary, options, values, metricUnits);
|
setMaxRecordingDistanceSummaryAndOptions(summary, options, values, metricUnits);
|
||||||
break;
|
break;
|
||||||
case R.string.min_required_accuracy_key:
|
case R.string.recording_gps_accuracy_key:
|
||||||
setMinRequiredAccuracySummaryAndOptions(summary, options, values, metricUnits);
|
setRecordingGpsAccuracySummaryAndOptions(summary, options, values, metricUnits);
|
||||||
break;
|
break;
|
||||||
case R.string.auto_resume_track_timeout_key:
|
case R.string.auto_resume_track_timeout_key:
|
||||||
setAutoResumeTrackTimeoutSummaryAndOptions(summary, options, values);
|
setAutoResumeTrackTimeoutSummaryAndOptions(summary, options, values);
|
||||||
@@ -248,14 +248,14 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the min required accuracy summary and options.
|
* Sets the recording gps accuracy summary and options.
|
||||||
*
|
*
|
||||||
* @param summary the summary
|
* @param summary the summary
|
||||||
* @param options the options
|
* @param options the options
|
||||||
* @param values the values
|
* @param values the values
|
||||||
* @param metricUnits true for metric units
|
* @param metricUnits true for metric units
|
||||||
*/
|
*/
|
||||||
private void setMinRequiredAccuracySummaryAndOptions(
|
private void setRecordingGpsAccuracySummaryAndOptions(
|
||||||
String[] summary, String[] options, String[] values, boolean metricUnits) {
|
String[] summary, String[] options, String[] values, boolean metricUnits) {
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
int value = Integer.parseInt(values[i]);
|
int value = Integer.parseInt(values[i]);
|
||||||
@@ -263,13 +263,13 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
if (metricUnits) {
|
if (metricUnits) {
|
||||||
displayValue = getString(R.string.value_integer_meter, value);
|
displayValue = getString(R.string.value_integer_meter, value);
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT:
|
case PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT:
|
||||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||||
break;
|
break;
|
||||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_EXCELLENT:
|
case PreferencesUtils.RECORDING_GPS_ACCURACY_EXCELLENT:
|
||||||
options[i] = getString(R.string.value_integer_meter_excellent_gps, value);
|
options[i] = getString(R.string.value_integer_meter_excellent_gps, value);
|
||||||
break;
|
break;
|
||||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_POOR:
|
case PreferencesUtils.RECORDING_GPS_ACCURACY_POOR:
|
||||||
options[i] = getString(R.string.value_integer_meter_poor_gps, value);
|
options[i] = getString(R.string.value_integer_meter_poor_gps, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -280,10 +280,10 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
if (feet < 2000) {
|
if (feet < 2000) {
|
||||||
displayValue = getString(R.string.value_integer_feet, feet);
|
displayValue = getString(R.string.value_integer_feet, feet);
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT:
|
case PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT:
|
||||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||||
break;
|
break;
|
||||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_EXCELLENT:
|
case PreferencesUtils.RECORDING_GPS_ACCURACY_EXCELLENT:
|
||||||
options[i] = getString(R.string.value_integer_feet_excellent_gps, feet);
|
options[i] = getString(R.string.value_integer_feet_excellent_gps, feet);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -293,7 +293,7 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
double mile = feet * UnitConversions.FT_TO_MI;
|
double mile = feet * UnitConversions.FT_TO_MI;
|
||||||
displayValue = getString(R.string.value_float_mile, mile);
|
displayValue = getString(R.string.value_float_mile, mile);
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_POOR:
|
case PreferencesUtils.RECORDING_GPS_ACCURACY_POOR:
|
||||||
options[i] = getString(R.string.value_float_mile_poor_gps, mile);
|
options[i] = getString(R.string.value_float_mile_poor_gps, mile);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -83,11 +83,11 @@ public class PreferencesUtils {
|
|||||||
public static final int MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE = -2;
|
public static final int MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE = -2;
|
||||||
public static final int MIN_RECORDING_INTERVAL_DEFAULT = 0;
|
public static final int MIN_RECORDING_INTERVAL_DEFAULT = 0;
|
||||||
|
|
||||||
// Values for min_required_accuracy
|
// Values for recording_gps_accuracy
|
||||||
public static final int MIN_REQUIRED_ACCURACY_DEFAULT = 200;
|
public static final int RECORDING_GPS_ACCURACY_DEFAULT = 50;
|
||||||
public static final int MIN_REQUIRED_ACCURACY_EXCELLENT = 10;
|
public static final int RECORDING_GPS_ACCURACY_EXCELLENT = 10;
|
||||||
public static final int MIN_REQUIRED_ACCURACY_POOR = 5000;
|
public static final int RECORDING_GPS_ACCURACY_POOR = 2000;
|
||||||
|
|
||||||
public static final long RECORDING_TRACK_ID_DEFAULT = -1L;
|
public static final long RECORDING_TRACK_ID_DEFAULT = -1L;
|
||||||
public static final boolean RECORDING_TRACK_PAUSED_DEFAULT = true;
|
public static final boolean RECORDING_TRACK_PAUSED_DEFAULT = true;
|
||||||
public static final boolean REPORT_SPEED_DEFAULT = true;
|
public static final boolean REPORT_SPEED_DEFAULT = true;
|
||||||
|
|||||||
@@ -529,21 +529,23 @@ public class TrackDataHubTest extends AndroidTestCase {
|
|||||||
PreferencesUtils.setBoolean(context, R.string.report_speed_key, true);
|
PreferencesUtils.setBoolean(context, R.string.report_speed_key, true);
|
||||||
PreferencesUtils.setString(
|
PreferencesUtils.setString(
|
||||||
context, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT);
|
context, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT);
|
||||||
PreferencesUtils.setInt(context, R.string.min_required_accuracy_key,
|
PreferencesUtils.setInt(context, R.string.recording_gps_accuracy_key,
|
||||||
PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT);
|
PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT);
|
||||||
PreferencesUtils.setInt(context, R.string.min_recording_distance_key,
|
PreferencesUtils.setInt(context, R.string.min_recording_distance_key,
|
||||||
PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT);
|
PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT);
|
||||||
|
|
||||||
dataSource.registerOnSharedPreferenceChangeListener(capture(preferenceChangeListenerCapture));
|
dataSource.registerOnSharedPreferenceChangeListener(capture(preferenceChangeListenerCapture));
|
||||||
expect(trackDataListener1.onMetricUnitsChanged(true)).andReturn(false);
|
expect(trackDataListener1.onMetricUnitsChanged(true)).andReturn(false);
|
||||||
expect(trackDataListener1.onReportSpeedChanged(true)).andReturn(false);
|
expect(trackDataListener1.onReportSpeedChanged(true)).andReturn(false);
|
||||||
expect(trackDataListener1.onMinRequiredAccuracy(PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT))
|
expect(
|
||||||
|
trackDataListener1.onRecordingGpsAccuracy(PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT))
|
||||||
.andReturn(false);
|
.andReturn(false);
|
||||||
expect(trackDataListener1.onMinRecordingDistanceChanged(
|
expect(trackDataListener1.onMinRecordingDistanceChanged(
|
||||||
PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT)).andReturn(false);
|
PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT)).andReturn(false);
|
||||||
expect(trackDataListener2.onMetricUnitsChanged(true)).andReturn(false);
|
expect(trackDataListener2.onMetricUnitsChanged(true)).andReturn(false);
|
||||||
expect(trackDataListener2.onReportSpeedChanged(true)).andReturn(false);
|
expect(trackDataListener2.onReportSpeedChanged(true)).andReturn(false);
|
||||||
expect(trackDataListener2.onMinRequiredAccuracy(PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT))
|
expect(
|
||||||
|
trackDataListener2.onRecordingGpsAccuracy(PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT))
|
||||||
.andReturn(false);
|
.andReturn(false);
|
||||||
expect(trackDataListener2.onMinRecordingDistanceChanged(
|
expect(trackDataListener2.onMinRecordingDistanceChanged(
|
||||||
PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT)).andReturn(false);
|
PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT)).andReturn(false);
|
||||||
@@ -749,14 +751,14 @@ public class TrackDataHubTest extends AndroidTestCase {
|
|||||||
*/
|
*/
|
||||||
public void testNotifyPreferenceChanged_minRequiredAccuracy() {
|
public void testNotifyPreferenceChanged_minRequiredAccuracy() {
|
||||||
int value = 1;
|
int value = 1;
|
||||||
PreferencesUtils.setInt(context, R.string.min_required_accuracy_key, value);
|
PreferencesUtils.setInt(context, R.string.recording_gps_accuracy_key, value);
|
||||||
trackDataHub.notifyPreferenceChanged(PreferencesUtils
|
trackDataHub.notifyPreferenceChanged(PreferencesUtils
|
||||||
.getKey(context, R.string.min_required_accuracy_key));
|
.getKey(context, R.string.recording_gps_accuracy_key));
|
||||||
assertEquals(value, trackDataHub.getMinRequiredAccuracy());
|
assertEquals(value, trackDataHub.getRecordingGpsAccuracy());
|
||||||
PreferencesUtils.setInt(context, R.string.min_required_accuracy_key, value + 1);
|
PreferencesUtils.setInt(context, R.string.recording_gps_accuracy_key, value + 1);
|
||||||
trackDataHub.notifyPreferenceChanged(PreferencesUtils
|
trackDataHub.notifyPreferenceChanged(PreferencesUtils
|
||||||
.getKey(context, R.string.min_required_accuracy_key));
|
.getKey(context, R.string.recording_gps_accuracy_key));
|
||||||
assertEquals(value + 1, trackDataHub.getMinRequiredAccuracy());
|
assertEquals(value + 1, trackDataHub.getRecordingGpsAccuracy());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-3
@@ -669,14 +669,14 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
|||||||
|
|
||||||
@MediumTest
|
@MediumTest
|
||||||
public void testWithProperties_minRequiredAccuracyDefault() throws Exception {
|
public void testWithProperties_minRequiredAccuracyDefault() throws Exception {
|
||||||
PreferencesUtils.setInt(context, R.string.min_required_accuracy_key,
|
PreferencesUtils.setInt(context, R.string.recording_gps_accuracy_key,
|
||||||
PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT);
|
PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT);
|
||||||
fullRecordingSession();
|
fullRecordingSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
@MediumTest
|
@MediumTest
|
||||||
public void testWithProperties_minRequiredAccuracy() throws Exception {
|
public void testWithProperties_minRequiredAccuracy() throws Exception {
|
||||||
PreferencesUtils.setInt(context, R.string.min_required_accuracy_key, 500);
|
PreferencesUtils.setInt(context, R.string.recording_gps_accuracy_key, 500);
|
||||||
fullRecordingSession();
|
fullRecordingSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user