Settings: removed some default definitions from code into xml.

This commit is contained in:
Dennis Guse
2019-11-05 21:14:17 +01:00
parent 41e7870509
commit 2a60aa8f59
19 changed files with 185 additions and 97 deletions
@@ -135,7 +135,7 @@ public class TrackRecordingServiceTest {
createDummyTrack(trackId, System.currentTimeMillis(), true); createDummyTrack(trackId, System.currentTimeMillis(), true);
// Clear the number of attempts and set the timeout to 10 min. // Clear the number of attempts and set the timeout to 10 min.
updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT); updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, context.getResources().getInteger(R.integer.auto_resume_track_timeout_default));
// Start the service in "resume" mode (simulates the on-reboot action). // Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent(context); Intent startIntent = createStartIntent(context);
@@ -154,7 +154,7 @@ public class TrackRecordingServiceTest {
@MediumTest @MediumTest
@Test @Test
public void testResumeAfterReboot_simulateReboot() throws Exception { public void testResumeAfterReboot_simulateReboot() throws Exception {
updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT); updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, context.getResources().getInteger(R.integer.auto_resume_track_timeout_default));
ITrackRecordingService service = ((ITrackRecordingService) mServiceRule.bindService(createStartIntent(context))); ITrackRecordingService service = ((ITrackRecordingService) mServiceRule.bindService(createStartIntent(context)));
Assert.assertFalse(service.isRecording()); Assert.assertFalse(service.isRecording());
@@ -184,7 +184,7 @@ public class TrackRecordingServiceTest {
createDummyTrack(trackId, System.currentTimeMillis(), false); createDummyTrack(trackId, System.currentTimeMillis(), false);
// Clear the number of attempts and set the timeout to 10 min. // Clear the number of attempts and set the timeout to 10 min.
updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT); updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, context.getResources().getInteger(R.integer.auto_resume_track_timeout_default));
// Start the service in "resume" mode (simulates the on-reboot action). // Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent(context); Intent startIntent = createStartIntent(context);
@@ -207,7 +207,7 @@ public class TrackRecordingServiceTest {
createDummyTrack(trackId, System.currentTimeMillis() - 1500 * 60 * 1000, true); createDummyTrack(trackId, System.currentTimeMillis() - 1500 * 60 * 1000, true);
// Clear the number of attempts and set the timeout to 10 min. // Clear the number of attempts and set the timeout to 10 min.
updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT); updateAutoResumePrefs(context, PreferencesUtils.AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT, context.getResources().getInteger(R.integer.auto_resume_track_timeout_default));
// Start the service in "resume" mode (simulates the on-reboot action). // Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent(context); Intent startIntent = createStartIntent(context);
@@ -230,7 +230,7 @@ public class TrackRecordingServiceTest {
createDummyTrack(trackId, System.currentTimeMillis(), true); createDummyTrack(trackId, System.currentTimeMillis(), true);
// Set the number of attempts to max. // Set the number of attempts to max.
updateAutoResumePrefs(context, TrackRecordingService.MAX_AUTO_RESUME_TRACK_RETRY_ATTEMPTS, PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT); updateAutoResumePrefs(context, TrackRecordingService.MAX_AUTO_RESUME_TRACK_RETRY_ATTEMPTS, context.getResources().getInteger(R.integer.auto_resume_track_timeout_default));
// Start the service in "resume" mode (simulates the on-reboot action). // Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent(context); Intent startIntent = createStartIntent(context);
@@ -103,7 +103,7 @@ public class TrackRecordingServiceTestLooper {
@MediumTest @MediumTest
@Test @Test
public void testWithProperties_voiceFrequencyDefault() throws TimeoutException { public void testWithProperties_voiceFrequencyDefault() throws TimeoutException {
PreferencesUtils.setInt(context, R.string.voice_frequency_key, PreferencesUtils.VOICE_FREQUENCY_DEFAULT); PreferencesUtils.setInt(context, R.string.voice_frequency_key, context.getResources().getInteger(R.integer.voice_frequency_default));
fullRecordingSession(); fullRecordingSession();
} }
@@ -125,7 +125,7 @@ public class TrackRecordingServiceTestLooper {
@MediumTest @MediumTest
@Test @Test
public void testWithProperties_maxRecordingDistanceDefault() throws TimeoutException { public void testWithProperties_maxRecordingDistanceDefault() throws TimeoutException {
PreferencesUtils.setInt(context, R.string.max_recording_distance_key, PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT); PreferencesUtils.setInt(context, R.string.max_recording_distance_key, context.getResources().getInteger(R.integer.max_recording_distance_default));
fullRecordingSession(); fullRecordingSession();
} }
@@ -153,7 +153,7 @@ public class TrackRecordingServiceTestLooper {
@MediumTest @MediumTest
@Test @Test
public void testWithProperties_splitFrequencyDefault() throws TimeoutException { public void testWithProperties_splitFrequencyDefault() throws TimeoutException {
PreferencesUtils.setInt(context, R.string.split_frequency_key, PreferencesUtils.SPLIT_FREQUENCY_DEFAULT); PreferencesUtils.setInt(context, R.string.split_frequency_key, context.getResources().getInteger(R.integer.split_frequency_default));
fullRecordingSession(); fullRecordingSession();
} }
@@ -188,7 +188,7 @@ public class TrackRecordingServiceTestLooper {
@MediumTest @MediumTest
@Test @Test
public void testWithProperties_minRecordingIntervalDefault() throws TimeoutException { public void testWithProperties_minRecordingIntervalDefault() throws TimeoutException {
PreferencesUtils.setInt(context, R.string.min_recording_interval_key, PreferencesUtils.MIN_RECORDING_INTERVAL_DEFAULT); PreferencesUtils.setInt(context, R.string.min_recording_interval_key, context.getResources().getInteger(R.integer.min_recording_interval_default));
fullRecordingSession(); fullRecordingSession();
} }
@@ -83,7 +83,7 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
recordingTrackId = PreferencesUtils.getRecordingTrackId(MarkerListActivity.this); recordingTrackId = PreferencesUtils.getRecordingTrackId(MarkerListActivity.this);
} }
if (PreferencesUtils.isKey(MarkerListActivity.this, R.string.recording_track_paused_key, key)) { if (PreferencesUtils.isKey(MarkerListActivity.this, R.string.recording_track_paused_key, key)) {
recordingTrackPaused = PreferencesUtils.getBoolean(MarkerListActivity.this, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); recordingTrackPaused = PreferencesUtils.isRecordingTrackPaused(MarkerListActivity.this);
} }
if (key != null) { if (key != null) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@@ -150,7 +150,7 @@ public class SearchListActivity extends AbstractListActivity implements DeleteMa
recordingTrackId = PreferencesUtils.getRecordingTrackId(SearchListActivity.this); recordingTrackId = PreferencesUtils.getRecordingTrackId(SearchListActivity.this);
} }
if (PreferencesUtils.isKey(SearchListActivity.this, R.string.recording_track_paused_key, key)) { if (PreferencesUtils.isKey(SearchListActivity.this, R.string.recording_track_paused_key, key)) {
recordingTrackPaused = PreferencesUtils.getBoolean(SearchListActivity.this, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); recordingTrackPaused = PreferencesUtils.isRecordingTrackPaused(SearchListActivity.this);
} }
if (key != null) { if (key != null) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@@ -131,7 +131,7 @@ public class TrackDetailActivity extends AbstractListActivity implements ChooseA
} }
if (PreferencesUtils.isKey(TrackDetailActivity.this, R.string.recording_track_paused_key, key)) { if (PreferencesUtils.isKey(TrackDetailActivity.this, R.string.recording_track_paused_key, key)) {
recordingTrackPaused = PreferencesUtils.getBoolean(TrackDetailActivity.this, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); recordingTrackPaused = PreferencesUtils.isRecordingTrackPaused(TrackDetailActivity.this);
} }
if (PreferencesUtils.isKey(TrackDetailActivity.this, R.string.stats_show_on_lockscreen_while_recording_key, key)) { if (PreferencesUtils.isKey(TrackDetailActivity.this, R.string.stats_show_on_lockscreen_while_recording_key, key)) {
@@ -145,9 +145,7 @@ public class TrackListActivity extends AbstractListActivity implements ConfirmDe
} }
} }
if (PreferencesUtils.isKey(TrackListActivity.this, R.string.recording_track_paused_key, key)) { if (PreferencesUtils.isKey(TrackListActivity.this, R.string.recording_track_paused_key, key)) {
recordingTrackPaused = PreferencesUtils.getBoolean(TrackListActivity.this, recordingTrackPaused = PreferencesUtils.isRecordingTrackPaused(TrackListActivity.this);
R.string.recording_track_paused_key,
PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT);
} }
if (key != null) { if (key != null) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@@ -258,7 +258,7 @@ public class TrackDataHub implements DataSourceListener {
recordingTrackId = PreferencesUtils.getRecordingTrackId(context); recordingTrackId = PreferencesUtils.getRecordingTrackId(context);
} }
if (PreferencesUtils.isKey(context, R.string.recording_track_paused_key, key)) { if (PreferencesUtils.isKey(context, R.string.recording_track_paused_key, key)) {
recordingTrackPaused = PreferencesUtils.getBoolean(context, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); recordingTrackPaused = PreferencesUtils.isRecordingTrackPaused(context);
} }
if (PreferencesUtils.isKey(context, R.string.stats_units_key, key)) { if (PreferencesUtils.isKey(context, R.string.stats_units_key, key)) {
metricUnits = PreferencesUtils.isMetricUnits(context); metricUnits = PreferencesUtils.isMetricUnits(context);
@@ -281,7 +281,7 @@ public class TrackDataHub implements DataSourceListener {
} }
} }
if (PreferencesUtils.isKey(context, R.string.recording_gps_accuracy_key, key)) { if (PreferencesUtils.isKey(context, R.string.recording_gps_accuracy_key, key)) {
recordingGpsAccuracy = PreferencesUtils.getInt(context, R.string.recording_gps_accuracy_key, PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT); recordingGpsAccuracy = PreferencesUtils.getRecordingGPSAccuracy(context);
if (key != null) { if (key != null) {
for (TrackDataListener trackDataListener : trackDataManager.getListeners(TrackDataType.PREFERENCE)) { for (TrackDataListener trackDataListener : trackDataManager.getListeners(TrackDataType.PREFERENCE)) {
if (trackDataListener.onRecordingGpsAccuracy(recordingGpsAccuracy)) { if (trackDataListener.onRecordingGpsAccuracy(recordingGpsAccuracy)) {
@@ -291,7 +291,7 @@ public class TrackDataHub implements DataSourceListener {
} }
} }
if (PreferencesUtils.isKey(context, R.string.recording_distance_interval_key, key)) { if (PreferencesUtils.isKey(context, R.string.recording_distance_interval_key, key)) {
recordingDistanceInterval = PreferencesUtils.getInt(context, R.string.recording_distance_interval_key, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT); recordingDistanceInterval = PreferencesUtils.getRecordingDistanceInterval(context);
if (key != null) { if (key != null) {
for (TrackDataListener trackDataListener : trackDataManager.getListeners(TrackDataType.PREFERENCE)) { for (TrackDataListener trackDataListener : trackDataManager.getListeners(TrackDataType.PREFERENCE)) {
if (trackDataListener.onRecordingDistanceIntervalChanged(recordingDistanceInterval)) { if (trackDataListener.onRecordingDistanceIntervalChanged(recordingDistanceInterval)) {
@@ -263,8 +263,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
} }
reportSpeed = speed; reportSpeed = speed;
chartView.setReportSpeed(reportSpeed); chartView.setReportSpeed(reportSpeed);
boolean chartShowSpeed = PreferencesUtils.getBoolean( boolean chartShowSpeed = PreferencesUtils.shouldChartShowSpeed(getActivity());
getActivity(), R.string.chart_show_speed_key, PreferencesUtils.CHART_SHOW_SPEED_DEFAULT);
setSeriesEnabled(ChartView.SPEED_SERIES, chartShowSpeed && reportSpeed); setSeriesEnabled(ChartView.SPEED_SERIES, chartShowSpeed && reportSpeed);
setSeriesEnabled(ChartView.PACE_SERIES, chartShowSpeed && !reportSpeed); setSeriesEnabled(ChartView.PACE_SERIES, chartShowSpeed && !reportSpeed);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@@ -309,24 +308,24 @@ public class ChartFragment extends Fragment implements TrackDataListener {
reloadTrackDataHub(); reloadTrackDataHub();
needUpdate = true; needUpdate = true;
} }
if (setSeriesEnabled(ChartView.ELEVATION_SERIES, PreferencesUtils.getBoolean(getActivity(), R.string.chart_show_elevation_key, PreferencesUtils.CHART_SHOW_ELEVATION_DEFAULT))) { if (setSeriesEnabled(ChartView.ELEVATION_SERIES, PreferencesUtils.shouldChartShowElevation(getActivity()))) {
needUpdate = true; needUpdate = true;
} }
boolean chartShowSpeed = PreferencesUtils.getBoolean(getActivity(), R.string.chart_show_speed_key, PreferencesUtils.CHART_SHOW_SPEED_DEFAULT); boolean chartShowSpeed = PreferencesUtils.shouldChartShowSpeed(getActivity());
if (setSeriesEnabled(ChartView.SPEED_SERIES, chartShowSpeed && reportSpeed)) { if (setSeriesEnabled(ChartView.SPEED_SERIES, chartShowSpeed && reportSpeed)) {
needUpdate = true; needUpdate = true;
} }
if (setSeriesEnabled(ChartView.PACE_SERIES, chartShowSpeed && !reportSpeed)) { if (setSeriesEnabled(ChartView.PACE_SERIES, chartShowSpeed && !reportSpeed)) {
needUpdate = true; needUpdate = true;
} }
if (setSeriesEnabled(ChartView.POWER_SERIES, PreferencesUtils.getBoolean(getActivity(), R.string.chart_show_power_key, PreferencesUtils.CHART_SHOW_POWER_DEFAULT))) { if (setSeriesEnabled(ChartView.POWER_SERIES, PreferencesUtils.shouldChartShowPower(getActivity()))) {
needUpdate = true; needUpdate = true;
} }
if (setSeriesEnabled(ChartView.CADENCE_SERIES, PreferencesUtils.getBoolean(getActivity(), R.string.chart_show_cadence_key, PreferencesUtils.CHART_SHOW_CADENCE_DEFAULT))) { if (setSeriesEnabled(ChartView.CADENCE_SERIES, PreferencesUtils.shouldChartShowCadence(getActivity()))) {
needUpdate = true; needUpdate = true;
} }
if (setSeriesEnabled(ChartView.HEART_RATE_SERIES, PreferencesUtils.getBoolean(getActivity(), R.string.chart_show_heart_rate_key, PreferencesUtils.CHART_SHOW_HEART_RATE_DEFAULT))) { if (setSeriesEnabled(ChartView.HEART_RATE_SERIES, PreferencesUtils.shouldChartShowHeartRate(getActivity()))) {
needUpdate = true; needUpdate = true;
} }
if (needUpdate) { if (needUpdate) {
@@ -27,7 +27,6 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.content.ContentProviderUtils; import de.dennisguse.opentracks.content.ContentProviderUtils;
import de.dennisguse.opentracks.content.Track; import de.dennisguse.opentracks.content.Track;
import de.dennisguse.opentracks.content.TracksColumns; import de.dennisguse.opentracks.content.TracksColumns;
@@ -100,7 +99,7 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
try { try {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY); Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
boolean isRecording = PreferencesUtils.isRecording(exportActivity); boolean isRecording = PreferencesUtils.isRecording(exportActivity);
boolean isPaused = PreferencesUtils.getBoolean(exportActivity, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); boolean isPaused = PreferencesUtils.isRecordingTrackPaused(exportActivity);
// Get the wake lock if not recording or paused // Get the wake lock if not recording or paused
if (!isRecording || isPaused) { if (!isRecording || isPaused) {
wakeLock = SystemUtils.acquireWakeLock(exportActivity, wakeLock); wakeLock = SystemUtils.acquireWakeLock(exportActivity, wakeLock);
@@ -102,7 +102,7 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
this.context = context; this.context = context;
this.importTrackId = importTrackId; this.importTrackId = importTrackId;
this.contentProviderUtils = contentProviderUtils; this.contentProviderUtils = contentProviderUtils;
this.recordingDistanceInterval = PreferencesUtils.getInt(context, R.string.recording_distance_interval_key, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT); this.recordingDistanceInterval = PreferencesUtils.getRecordingDistanceInterval(context);
trackIds = new ArrayList<>(); trackIds = new ArrayList<>();
waypoints = new ArrayList<>(); waypoints = new ArrayList<>();
} }
@@ -28,7 +28,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.content.ContentProviderUtils; import de.dennisguse.opentracks.content.ContentProviderUtils;
import de.dennisguse.opentracks.content.Track; import de.dennisguse.opentracks.content.Track;
import de.dennisguse.opentracks.io.file.TrackFileFormat; import de.dennisguse.opentracks.io.file.TrackFileFormat;
@@ -104,7 +103,7 @@ public class ImportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY); Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
// Get the wake lock if not recording or paused // Get the wake lock if not recording or paused
boolean isRecording = PreferencesUtils.isRecording(importActivity); boolean isRecording = PreferencesUtils.isRecording(importActivity);
boolean isPaused = PreferencesUtils.getBoolean(importActivity, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); boolean isPaused = PreferencesUtils.isRecordingTrackPaused(importActivity);
if (!isRecording || isPaused) { if (!isRecording || isPaused) {
wakeLock = SystemUtils.acquireWakeLock(importActivity, wakeLock); wakeLock = SystemUtils.acquireWakeLock(importActivity, wakeLock);
} }
@@ -124,7 +124,7 @@ public class TrackRecordingService extends Service {
} }
} }
if (PreferencesUtils.isKey(context, R.string.recording_track_paused_key, key)) { if (PreferencesUtils.isKey(context, R.string.recording_track_paused_key, key)) {
recordingTrackPaused = PreferencesUtils.getBoolean(context, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); recordingTrackPaused = PreferencesUtils.isRecordingTrackPaused(context);
} }
if (PreferencesUtils.isKey(context, R.string.stats_units_key, key)) { if (PreferencesUtils.isKey(context, R.string.stats_units_key, key)) {
boolean metricUnits = PreferencesUtils.isMetricUnits(context); boolean metricUnits = PreferencesUtils.isMetricUnits(context);
@@ -132,13 +132,13 @@ public class TrackRecordingService extends Service {
splitExecutor.setMetricUnits(metricUnits); splitExecutor.setMetricUnits(metricUnits);
} }
if (PreferencesUtils.isKey(context, R.string.voice_frequency_key, key)) { if (PreferencesUtils.isKey(context, R.string.voice_frequency_key, key)) {
voiceExecutor.setTaskFrequency(PreferencesUtils.getInt(context, R.string.voice_frequency_key, PreferencesUtils.VOICE_FREQUENCY_DEFAULT)); voiceExecutor.setTaskFrequency(PreferencesUtils.getVoiceFrequency(context));
} }
if (PreferencesUtils.isKey(context, R.string.split_frequency_key, key)) { if (PreferencesUtils.isKey(context, R.string.split_frequency_key, key)) {
splitExecutor.setTaskFrequency(PreferencesUtils.getInt(context, R.string.split_frequency_key, PreferencesUtils.SPLIT_FREQUENCY_DEFAULT)); splitExecutor.setTaskFrequency(PreferencesUtils.getSplitFrequency(context));
} }
if (PreferencesUtils.isKey(context, R.string.min_recording_interval_key, key)) { if (PreferencesUtils.isKey(context, R.string.min_recording_interval_key, key)) {
int minRecordingInterval = PreferencesUtils.getInt(context, R.string.min_recording_interval_key, PreferencesUtils.MIN_RECORDING_INTERVAL_DEFAULT); int minRecordingInterval = PreferencesUtils.getMinRecordingInterval(context);
switch (minRecordingInterval) { switch (minRecordingInterval) {
case PreferencesUtils.MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE: case PreferencesUtils.MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE:
// Choose battery life over moving time accuracy. // Choose battery life over moving time accuracy.
@@ -153,16 +153,16 @@ public class TrackRecordingService extends Service {
} }
} }
if (PreferencesUtils.isKey(context, R.string.recording_distance_interval_key, key)) { if (PreferencesUtils.isKey(context, R.string.recording_distance_interval_key, key)) {
recordingDistanceInterval = PreferencesUtils.getInt(context, R.string.recording_distance_interval_key, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT); recordingDistanceInterval = PreferencesUtils.getRecordingDistanceInterval(context);
} }
if (PreferencesUtils.isKey(context, R.string.max_recording_distance_key, key)) { if (PreferencesUtils.isKey(context, R.string.max_recording_distance_key, key)) {
maxRecordingDistance = PreferencesUtils.getInt(context, R.string.max_recording_distance_key, PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT); maxRecordingDistance = PreferencesUtils.getMaxRecordingDistance(context);
} }
if (PreferencesUtils.isKey(context, R.string.recording_gps_accuracy_key, key)) { if (PreferencesUtils.isKey(context, R.string.recording_gps_accuracy_key, key)) {
recordingGpsAccuracy = PreferencesUtils.getInt(context, R.string.recording_gps_accuracy_key, PreferencesUtils.RECORDING_GPS_ACCURACY_DEFAULT); recordingGpsAccuracy = PreferencesUtils.getRecordingGPSAccuracy(context);
} }
if (PreferencesUtils.isKey(context, R.string.auto_resume_track_timeout_key, key)) { if (PreferencesUtils.isKey(context, R.string.auto_resume_track_timeout_key, key)) {
autoResumeTrackTimeout = PreferencesUtils.getInt(context, R.string.auto_resume_track_timeout_key, PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT); autoResumeTrackTimeout = PreferencesUtils.getAutoResumeTrackTimeout(context);
} }
} }
}; };
@@ -471,12 +471,12 @@ public class TrackRecordingService extends Service {
} }
PreferencesUtils.incrementAutoResumeTrackCurrentRetryDefault(this); PreferencesUtils.incrementAutoResumeTrackCurrentRetryDefault(this);
if (autoResumeTrackTimeout == PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_NEVER) { if (autoResumeTrackTimeout == context.getResources().getInteger(R.integer.auto_resume_track_timeout_never)) {
Log.d(TAG, "Not resuming. Auto-resume track timeout set to never."); Log.d(TAG, "Not resuming. Auto-resume track timeout set to never.");
return false; return false;
} }
if (autoResumeTrackTimeout == PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_ALWAYS) { if (autoResumeTrackTimeout == context.getResources().getInteger(R.integer.auto_resume_track_timeout_always)) {
Log.d(TAG, "Resuming. Auto-resume track timeout set to always."); Log.d(TAG, "Resuming. Auto-resume track timeout set to always.");
return true; return true;
} }
@@ -203,9 +203,9 @@ public class TrackRecordingServiceConnection implements ServiceConnection, Death
if (PreferencesUtils.isRecording(context)) { if (PreferencesUtils.isRecording(context)) {
PreferencesUtils.setLong(context, R.string.recording_track_id_key, PreferencesUtils.RECORDING_TRACK_ID_DEFAULT); PreferencesUtils.setLong(context, R.string.recording_track_id_key, PreferencesUtils.RECORDING_TRACK_ID_DEFAULT);
} }
boolean recordingTrackPaused = PreferencesUtils.getBoolean(context, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); boolean recordingTrackPaused = PreferencesUtils.isRecordingTrackPaused(context);
if (!recordingTrackPaused) { if (!recordingTrackPaused) {
PreferencesUtils.setBoolean(context, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); PreferencesUtils.defaultRecordingTrackPaused(context);
} }
} }
@@ -168,15 +168,12 @@ final class PreferenceHelper {
static void setAutoResumeTrackTimeoutOptions(Context context, String[] options, String[] values) { static void setAutoResumeTrackTimeoutOptions(Context context, String[] options, String[] values) {
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]);
switch (value) { if (value == context.getResources().getInteger(R.integer.auto_resume_track_timeout_never)) {
case PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_NEVER: options[i] = context.getString(R.string.value_never);
options[i] = context.getString(R.string.value_never); } else if (value == context.getResources().getInteger(R.integer.auto_resume_track_timeout_always)) {
break; options[i] = context.getString(R.string.value_always);
case PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_ALWAYS: } else {
options[i] = context.getString(R.string.value_always); options[i] = context.getString(R.string.value_integer_minute, value);
break;
default:
options[i] = context.getString(R.string.value_integer_minute, value);
} }
} }
} }
@@ -36,43 +36,36 @@ public class PreferencesUtils {
* Preferences values. * Preferences values.
* The defaults need to match the defaults in the xml files. * The defaults need to match the defaults in the xml files.
*/ */
// Values for auto_resume_track_timeout_key @Deprecated
public static final int AUTO_RESUME_TRACK_TIMEOUT_ALWAYS = -1; public static final boolean RECORDING_TRACK_PAUSED_DEFAULT = true;
public static final int AUTO_RESUME_TRACK_TIMEOUT_DEFAULT = 10;
public static final int AUTO_RESUME_TRACK_TIMEOUT_NEVER = 0;
public static final String BLUETOOTH_SENSOR_DEFAULT = ""; public static final String BLUETOOTH_SENSOR_DEFAULT = "";
public static final boolean CHART_SHOW_CADENCE_DEFAULT = true;
public static final boolean CHART_SHOW_ELEVATION_DEFAULT = true;
public static final boolean CHART_SHOW_HEART_RATE_DEFAULT = true;
public static final boolean CHART_SHOW_POWER_DEFAULT = true;
public static final boolean CHART_SHOW_SPEED_DEFAULT = true;
// Value for split_frequency_key and voice_frequency_key // Value for split_frequency_key and voice_frequency_key
@Deprecated
public static final int FREQUENCY_OFF = 0; public static final int FREQUENCY_OFF = 0;
@Deprecated
public static final int MAX_RECORDING_DISTANCE_DEFAULT = 200; public static final int MAX_RECORDING_DISTANCE_DEFAULT = 200;
// Values for min_recording_interval_key // Values for min_recording_interval_key
@Deprecated
public static final int MIN_RECORDING_INTERVAL_ADAPT_ACCURACY = -1; public static final int MIN_RECORDING_INTERVAL_ADAPT_ACCURACY = -1;
@Deprecated
public static final int MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE = -2; public static final int MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE = -2;
@Deprecated
public static final int MIN_RECORDING_INTERVAL_DEFAULT = 0; public static final int MIN_RECORDING_INTERVAL_DEFAULT = 0;
@Deprecated
public static final int RECORDING_DISTANCE_INTERVAL_DEFAULT = 10; public static final int RECORDING_DISTANCE_INTERVAL_DEFAULT = 10;
// Values for recording_gps_accuracy // Values for recording_gps_accuracy
@Deprecated
public static final int RECORDING_GPS_ACCURACY_DEFAULT = 50; public static final int RECORDING_GPS_ACCURACY_DEFAULT = 50;
@Deprecated
public static final int RECORDING_GPS_ACCURACY_EXCELLENT = 10; public static final int RECORDING_GPS_ACCURACY_EXCELLENT = 10;
@Deprecated
public static final int RECORDING_GPS_ACCURACY_POOR = 2000; public static final int RECORDING_GPS_ACCURACY_POOR = 2000;
static final boolean STATS_SHOW_COORDINATE_DEFAULT = false;
public static final boolean RECORDING_TRACK_PAUSED_DEFAULT = true;
public static final int SPLIT_FREQUENCY_DEFAULT = 0;
static final boolean STATS_SHOW_ELEVATION_DEFAULT = false;
// Track widget
public static final int VOICE_FREQUENCY_DEFAULT = 0;
private PreferencesUtils() { private PreferencesUtils() {
} }
@@ -209,7 +202,7 @@ public class PreferencesUtils {
* @param context the context * @param context the context
* @param keyId the key id * @param keyId the key id
*/ */
public static long getLong(Context context, int keyId, long defaultValue) { private static long getLong(Context context, int keyId, long defaultValue) {
SharedPreferences sharedPreferences = getSharedPreferences(context); SharedPreferences sharedPreferences = getSharedPreferences(context);
return sharedPreferences.getLong(getKey(context, keyId), defaultValue); return sharedPreferences.getLong(getKey(context, keyId), defaultValue);
} }
@@ -260,8 +253,8 @@ public class PreferencesUtils {
* @param context the context * @param context the context
*/ */
public static boolean isMetricUnits(Context context) { public static boolean isMetricUnits(Context context) {
String statsUnitDefault = context.getString(R.string.stats_units_default); final String STATS_UNIT = context.getString(R.string.stats_units_default);
return statsUnitDefault.equals(getString(context, R.string.stats_units_key, statsUnitDefault)); return STATS_UNIT.equals(getString(context, R.string.stats_units_key, STATS_UNIT));
} }
/** /**
@@ -275,21 +268,96 @@ public class PreferencesUtils {
return STATS_RATE_DEFAULT.equals(getString(context, R.string.stats_rate_key, STATS_RATE_DEFAULT)); return STATS_RATE_DEFAULT.equals(getString(context, R.string.stats_rate_key, STATS_RATE_DEFAULT));
} }
/** public static int getAutoResumeTrackTimeout(Context context) {
* Returns true if chart x axis is by distance, false if by time. final int AUTO_RESUME_TRACK_TIMEOUT = context.getResources().getInteger(R.integer.auto_resume_track_timeout_default);
* return PreferencesUtils.getInt(context, R.string.auto_resume_track_timeout_key, AUTO_RESUME_TRACK_TIMEOUT);
* @param context the context }
*/
public static boolean isRecordingTrackPaused(Context context) {
final boolean RECORDING_TRACK_PAUSED = context.getResources().getBoolean(R.bool.recording_track_paused_default);
return PreferencesUtils.getBoolean(context, R.string.recording_track_paused_key, RECORDING_TRACK_PAUSED);
}
public static void defaultRecordingTrackPaused(Context context) {
final boolean RECORDING_TRACK_PAUSED = context.getResources().getBoolean(R.bool.recording_track_paused_default);
PreferencesUtils.setBoolean(context, R.string.recording_track_paused_key, RECORDING_TRACK_PAUSED);
}
public static boolean isChartByDistance(Context context) { public static boolean isChartByDistance(Context context) {
final String CHART_X_AXIS_DEFAULT = context.getString(R.string.chart_x_axis_default); final String CHART_X_AXIS_DEFAULT = context.getString(R.string.chart_x_axis_default);
return CHART_X_AXIS_DEFAULT.equals(getString(context, R.string.chart_x_axis_key, CHART_X_AXIS_DEFAULT)); return CHART_X_AXIS_DEFAULT.equals(getString(context, R.string.chart_x_axis_key, CHART_X_AXIS_DEFAULT));
} }
public static boolean shouldChartShowCadence(Context context) {
final boolean CHART_SHOW_CADENCE = context.getResources().getBoolean(R.bool.chart_show_cadence_default);
return PreferencesUtils.getBoolean(context, R.string.chart_show_cadence_key, CHART_SHOW_CADENCE);
}
public static boolean shouldChartShowElevation(Context context) {
final boolean CHART_SHOW_ELEVATION = context.getResources().getBoolean(R.bool.chart_show_elevation_default);
return PreferencesUtils.getBoolean(context, R.string.chart_show_elevation_key, CHART_SHOW_ELEVATION);
}
public static boolean shouldChartShowHeartRate(Context context) {
final boolean CHART_SHOW_HEARTRATE = context.getResources().getBoolean(R.bool.chart_show_heart_rate_default);
return PreferencesUtils.getBoolean(context, R.string.chart_show_heart_rate_key, CHART_SHOW_HEARTRATE);
}
public static boolean shouldChartShowPower(Context context) {
final boolean CHART_SHOW_POWER = context.getResources().getBoolean(R.bool.chart_show_power_default);
return PreferencesUtils.getBoolean(context, R.string.chart_show_power_key, CHART_SHOW_POWER);
}
public static boolean shouldChartShowSpeed(Context context) {
final boolean CHART_SHOW_SPEED = context.getResources().getBoolean(R.bool.chart_show_speed_default);
return PreferencesUtils.getBoolean(context, R.string.chart_show_speed_key, CHART_SHOW_SPEED);
}
public static boolean shouldShowStatsOnLockscreen(Context context) { public static boolean shouldShowStatsOnLockscreen(Context context) {
final boolean STATS_SHOW_ON_LOCKSCREEN_DEFAULT = context.getResources().getBoolean(R.bool.stats_show_on_lockscreen_while_recording_default); final boolean STATS_SHOW_ON_LOCKSCREEN_DEFAULT = context.getResources().getBoolean(R.bool.stats_show_on_lockscreen_while_recording_default);
return getBoolean(context, R.string.stats_show_on_lockscreen_while_recording_key, STATS_SHOW_ON_LOCKSCREEN_DEFAULT); return getBoolean(context, R.string.stats_show_on_lockscreen_while_recording_key, STATS_SHOW_ON_LOCKSCREEN_DEFAULT);
} }
public static boolean isShowStatsGradeElevation(Context context) {
final boolean STATS_SHOW_GRADE_ELEVATION = context.getResources().getBoolean(R.bool.stats_show_grade_elevation_default);
return PreferencesUtils.getBoolean(context, R.string.stats_show_grade_elevation_key, STATS_SHOW_GRADE_ELEVATION);
}
public static boolean isStatsShowCoordinate(Context context) {
final boolean STATS_SHOW_COORDINATE = context.getResources().getBoolean(R.bool.stats_show_coordinate_default);
return PreferencesUtils.getBoolean(context, R.string.stats_show_coordinate_key, STATS_SHOW_COORDINATE);
}
public static int getVoiceFrequency(Context context) {
final int VOICE_FREQUENCY_DEFAULT = context.getResources().getInteger(R.integer.voice_frequency_default);
return PreferencesUtils.getInt(context, R.string.voice_frequency_key, VOICE_FREQUENCY_DEFAULT);
}
public static int getSplitFrequency(Context context) {
final int SPLIT_FREQUENCY_DEFAULT = context.getResources().getInteger(R.integer.split_frequency_default);
return PreferencesUtils.getInt(context, R.string.split_frequency_key, SPLIT_FREQUENCY_DEFAULT);
}
public static int getRecordingDistanceInterval(Context context) {
final int RECORDING_DISTANCE_INTERVAL = context.getResources().getInteger(R.integer.recording_distance_interval_default);
return PreferencesUtils.getInt(context, R.string.recording_distance_interval_key, RECORDING_DISTANCE_INTERVAL);
}
public static int getMaxRecordingDistance(Context context) {
final int MAX_RECORDING_DISTANCE = context.getResources().getInteger(R.integer.max_recording_distance_default);
return PreferencesUtils.getInt(context, R.string.max_recording_distance_key, MAX_RECORDING_DISTANCE);
}
public static int getMinRecordingInterval(Context context) {
final int MIN_RECORDING_INTERVAL = context.getResources().getInteger(R.integer.min_recording_interval_default);
return PreferencesUtils.getInt(context, R.string.min_recording_interval_key, MIN_RECORDING_INTERVAL);
}
public static int getRecordingGPSAccuracy(Context context) {
final int RECORDING_GPS_ACCURACY = context.getResources().getInteger(R.integer.recording_gps_accuracy_default);
return PreferencesUtils.getInt(context, R.string.recording_gps_accuracy_key, RECORDING_GPS_ACCURACY);
}
public static boolean isRecording(Context context) { public static boolean isRecording(Context context) {
long recordingTrackId = PreferencesUtils.getRecordingTrackId(context); long recordingTrackId = PreferencesUtils.getRecordingTrackId(context);
return recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT; return recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
@@ -70,7 +70,7 @@ public class StatsUtils {
} }
// Set elevation // Set elevation
boolean showGradeElevation = PreferencesUtils.getBoolean(activity, R.string.stats_show_grade_elevation_key, PreferencesUtils.STATS_SHOW_ELEVATION_DEFAULT) && isRecording; boolean showGradeElevation = isRecording && PreferencesUtils.isShowStatsGradeElevation(activity);
View elevationContainer = activity.findViewById(R.id.stats_elevation); View elevationContainer = activity.findViewById(R.id.stats_elevation);
elevationContainer.setVisibility(showGradeElevation ? View.VISIBLE : View.GONE); elevationContainer.setVisibility(showGradeElevation ? View.VISIBLE : View.GONE);
@@ -85,7 +85,7 @@ public class StatsUtils {
} }
// Set coordinate // Set coordinate
boolean showCoordinate = isRecording && PreferencesUtils.getBoolean(activity, R.string.stats_show_coordinate_key, PreferencesUtils.STATS_SHOW_COORDINATE_DEFAULT); boolean showCoordinate = isRecording && PreferencesUtils.isStatsShowCoordinate(activity);
View coordinateSeparator = activity.findViewById(R.id.stats_coordinate_separator); View coordinateSeparator = activity.findViewById(R.id.stats_coordinate_separator);
coordinateSeparator.setVisibility(showCoordinate ? View.VISIBLE : View.GONE); coordinateSeparator.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
@@ -241,7 +241,7 @@ public class StatsUtils {
// Set elevation // Set elevation
{ {
boolean showElevation = PreferencesUtils.getBoolean(activity, R.string.stats_show_grade_elevation_key, PreferencesUtils.STATS_SHOW_ELEVATION_DEFAULT); boolean showElevation = PreferencesUtils.isShowStatsGradeElevation(activity);
View gradeElevationSeparator = activity.findViewById(R.id.stats_elevation_separator); View gradeElevationSeparator = activity.findViewById(R.id.stats_elevation_separator);
gradeElevationSeparator.setVisibility(showElevation ? View.VISIBLE : View.GONE); gradeElevationSeparator.setVisibility(showElevation ? View.VISIBLE : View.GONE);
@@ -18,5 +18,7 @@ limitations under the License.
<!--But they should not get backed up or restored.--> <!--But they should not get backed up or restored.-->
<string name="auto_resume_track_current_retry_key" translatable="false">autoResumeTrackCurrentRetry</string> <string name="auto_resume_track_current_retry_key" translatable="false">autoResumeTrackCurrentRetry</string>
<string name="recording_track_id_key" translatable="false">recordingTrackId</string> <string name="recording_track_id_key" translatable="false">recordingTrackId</string>
<string name="recording_track_paused_key" translatable="false">recordingTrackPaused</string> <string name="recording_track_paused_key" translatable="false">recordingTrackPaused</string>
<bool name="recording_track_paused_default" translatable="false">false</bool>
</resources> </resources>
+38 -12
View File
@@ -2,15 +2,25 @@
<resources> <resources>
<!-- Do not translate anything in this file directly. --> <!-- Do not translate anything in this file directly. -->
<string name="chart_show_cadence_key" translatable="false">chartShowCadence</string> <string name="chart_show_cadence_key" translatable="false">chartShowCadence</string>
<bool name="chart_show_cadence_default" translatable="false">true</bool>
<string name="chart_show_elevation_key" translatable="false">chartShowElevation</string> <string name="chart_show_elevation_key" translatable="false">chartShowElevation</string>
<bool name="chart_show_elevation_default" translatable="false">true</bool>
<string name="chart_show_heart_rate_key" translatable="false">chartShowHeartRate</string> <string name="chart_show_heart_rate_key" translatable="false">chartShowHeartRate</string>
<bool name="chart_show_heart_rate_default" translatable="false">true</bool>
<string name="chart_show_power_key" translatable="false">chartShowPower</string> <string name="chart_show_power_key" translatable="false">chartShowPower</string>
<bool name="chart_show_power_default" translatable="false">true</bool>
<string name="chart_show_speed_key" translatable="false">chartShowSpeed</string> <string name="chart_show_speed_key" translatable="false">chartShowSpeed</string>
<bool name="chart_show_speed_default" translatable="false">true</bool>
<string name="stats_show_coordinate_key" translatable="false">statsShowCoordinate</string> <string name="stats_show_coordinate_key" translatable="false">statsShowCoordinate</string>
<bool name="stats_show_coordinate_default" translatable="false">false</bool> <bool name="stats_show_coordinate_default" translatable="false">false</bool>
<string name="stats_show_grade_elevation_key" translatable="false">statsShowGradeElevation</string> <string name="stats_show_grade_elevation_key" translatable="false">statsShowGradeElevation</string>
<bool name="stats_show_grade_elevation_default" translatable="false">false</bool>
<string name="stats_show_on_lockscreen_while_recording_key" translatable="false">trackdetail_show_on_lockscreen_while_recording</string> <string name="stats_show_on_lockscreen_while_recording_key" translatable="false">trackdetail_show_on_lockscreen_while_recording</string>
<bool name="stats_show_on_lockscreen_while_recording_default" translatable="false">false</bool> <bool name="stats_show_on_lockscreen_while_recording_default" translatable="false">false</bool>
@@ -92,12 +102,15 @@
</string-array> </string-array>
<string name="auto_resume_track_timeout_key" translatable="false">autoResumeTrackTimeout</string> <string name="auto_resume_track_timeout_key" translatable="false">autoResumeTrackTimeout</string>
<integer name="auto_resume_track_timeout_default" translatable="false">10</integer>
<integer name="auto_resume_track_timeout_always" translatable="false">-1</integer>
<integer name="auto_resume_track_timeout_never" translatable="false">0</integer>
<string-array name="auto_resume_track_timeout_values"> <string-array name="auto_resume_track_timeout_values">
<item>0</item> <item>@integer/auto_resume_track_timeout_never</item>
<item>5</item> <item>5</item>
<item>10</item> <item>@integer/auto_resume_track_timeout_default</item>
<item>15</item> <item>15</item>
<item>-1</item> <item>@integer/auto_resume_track_timeout_always</item>
</string-array> </string-array>
<string name="chart_x_axis_key" translatable="false">chartXAxis</string> <string name="chart_x_axis_key" translatable="false">chartXAxis</string>
@@ -114,9 +127,14 @@
</string-array> </string-array>
<string name="split_frequency_key" translatable="false">splitFrequency</string> <string name="split_frequency_key" translatable="false">splitFrequency</string>
<integer name="split_frequency_default" translatable="false">@integer/frequency_default
</integer>
<string name="voice_frequency_key" translatable="false">voiceFrequency</string> <string name="voice_frequency_key" translatable="false">voiceFrequency</string>
<integer name="voice_frequency_default" translatable="false">@integer/frequency_default
</integer>
<integer name="frequency_default" translatable="false">0</integer>
<string-array name="frequency_values"> <string-array name="frequency_values">
<item>0</item> <item>@integer/frequency_default</item>
<item>1</item> <item>1</item>
<item>2</item> <item>2</item>
<item>5</item> <item>5</item>
@@ -133,31 +151,36 @@
</string-array> </string-array>
<string name="recording_distance_interval_key" translatable="false">recordingDistanceInterval</string> <string name="recording_distance_interval_key" translatable="false">recordingDistanceInterval</string>
<integer name="recording_distance_interval_default" translatable="false">10</integer>
<string-array name="recording_distance_interval_values"> <string-array name="recording_distance_interval_values">
<item>1</item> <item>1</item>
<item>2</item> <item>2</item>
<item>5</item> <item>5</item>
<item>10</item> <item>@integer/recording_distance_interval_default</item>
<item>20</item> <item>20</item>
<item>50</item> <item>50</item>
<item>100</item> <item>100</item>
</string-array> </string-array>
<string name="max_recording_distance_key" translatable="false">maxRecordingDistance</string> <string name="max_recording_distance_key" translatable="false">maxRecordingDistance</string>
<integer name="max_recording_distance_default" translatable="false">200</integer>
<string-array name="max_recording_distance_values"> <string-array name="max_recording_distance_values">
<item>50</item> <item>50</item>
<item>100</item> <item>100</item>
<item>200</item> <item>@integer/max_recording_distance_default</item>
<item>500</item> <item>500</item>
<item>1000</item> <item>1000</item>
<item>5000</item> <item>5000</item>
</string-array> </string-array>
<string name="min_recording_interval_key" translatable="false">minRecordingInterval</string> <string name="min_recording_interval_key" translatable="false">minRecordingInterval</string>
<integer name="min_recording_interval_default" translatable="false">0</integer>
<integer name="min_recording_interval_adapt_accuracy" translatable="false">-1</integer>
<integer name="min_recording_interval_adapt_battery_life" translatable="false">-2</integer>
<string-array name="min_recording_interval_values"> <string-array name="min_recording_interval_values">
<item>-2</item> <item>@integer/min_recording_interval_adapt_battery_life</item>
<item>-1</item> <item>@integer/min_recording_interval_adapt_accuracy</item>
<item>0</item> <item>@integer/min_recording_interval_default</item>
<item>2</item> <item>2</item>
<item>3</item> <item>3</item>
<item>4</item> <item>4</item>
@@ -174,16 +197,19 @@
</string-array> </string-array>
<string name="recording_gps_accuracy_key" translatable="false">recordingGpsAccuracy</string> <string name="recording_gps_accuracy_key" translatable="false">recordingGpsAccuracy</string>
<integer name="recording_gps_accuracy_default" translatable="false">50</integer>
<integer name="recording_gps_accuracy_excellent" translatable="false">10</integer>
<integer name="recording_gps_accuracy_poor" translatable="false">2000</integer>
<string-array name="recording_gps_accuracy_values"> <string-array name="recording_gps_accuracy_values">
<item>10</item> <item>@integer/recording_gps_accuracy_excellent</item>
<item>20</item> <item>20</item>
<item>30</item> <item>30</item>
<item>50</item> <item>@integer/recording_gps_accuracy_default</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>@integer/recording_gps_accuracy_poor</item>
</string-array> </string-array>
<string name="stats_rate_key" translatable="false">statsRate</string> <string name="stats_rate_key" translatable="false">statsRate</string>
+5 -5
View File
@@ -35,7 +35,7 @@ limitations under the License.
<PreferenceCategory android:title="@string/settings_show"> <PreferenceCategory android:title="@string/settings_show">
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="@bool/stats_show_grade_elevation_default"
android:key="@string/stats_show_grade_elevation_key" android:key="@string/stats_show_grade_elevation_key"
android:title="@string/settings_stats_grade_elevation" /> android:title="@string/settings_stats_grade_elevation" />
<CheckBoxPreference <CheckBoxPreference
@@ -73,13 +73,13 @@ limitations under the License.
android:summary="@string/settings_recording_show_on_lockscreen_while_recording_summary" android:summary="@string/settings_recording_show_on_lockscreen_while_recording_summary"
android:title="@string/settings_recording_show_on_lockscreen_while_recording_title" /> android:title="@string/settings_recording_show_on_lockscreen_while_recording_title" />
<ListPreference <ListPreference
android:defaultValue="0" android:defaultValue="@integer/voice_frequency_default"
android:entryValues="@array/frequency_values" android:entryValues="@array/frequency_values"
android:key="@string/voice_frequency_key" android:key="@string/voice_frequency_key"
android:summary="%s" android:summary="%s"
android:title="@string/menu_voice_frequency" /> android:title="@string/menu_voice_frequency" />
<ListPreference <ListPreference
android:defaultValue="0" android:defaultValue="@integer/split_frequency_default"
android:entryValues="@array/frequency_values" android:entryValues="@array/frequency_values"
android:key="@string/split_frequency_key" android:key="@string/split_frequency_key"
android:summary="%s" android:summary="%s"
@@ -98,13 +98,13 @@ limitations under the License.
android:summary="%s" android:summary="%s"
android:title="@string/settings_recording_min_recording_interval_title" /> android:title="@string/settings_recording_min_recording_interval_title" />
<ListPreference <ListPreference
android:defaultValue="10" android:defaultValue="@integer/recording_distance_interval_default"
android:entryValues="@array/recording_distance_interval_values" android:entryValues="@array/recording_distance_interval_values"
android:key="@string/recording_distance_interval_key" android:key="@string/recording_distance_interval_key"
android:summary="%s" android:summary="%s"
android:title="@string/settings_recording_min_recording_distance_title" /> android:title="@string/settings_recording_min_recording_distance_title" />
<ListPreference <ListPreference
android:defaultValue="200" android:defaultValue="@integer/max_recording_distance_default"
android:entryValues="@array/max_recording_distance_values" android:entryValues="@array/max_recording_distance_values"
android:key="@string/max_recording_distance_key" android:key="@string/max_recording_distance_key"
android:summary="%s" android:summary="%s"