forked from upstream-mirrors/OpenTracks
fix naming for the pace of reading of GPS location in settings
Fixes #1840
This commit is contained in:
committed by
Dennis Guse
parent
c48f9b0818
commit
91b5c148cc
@@ -100,7 +100,7 @@ public class GpsStatusTest {
|
||||
// given
|
||||
GpsStatusManager subject = new GpsStatusManager(context, statusList::add, new Handler());
|
||||
subject.onRecordingDistanceChanged(Distance.of(10));
|
||||
subject.onMinRecordingIntervalChanged(GpsStatusManager.SIGNAL_LOST_THRESHOLD.multipliedBy(-1));
|
||||
subject.onMinSamplingIntervalChanged(GpsStatusManager.SIGNAL_LOST_THRESHOLD.multipliedBy(-1));
|
||||
|
||||
// when / then
|
||||
subject.start();
|
||||
@@ -124,7 +124,7 @@ public class GpsStatusTest {
|
||||
// given
|
||||
GpsStatusManager subject = new GpsStatusManager(context, statusList::add, new Handler(handlerThread.getLooper()));
|
||||
subject.onRecordingDistanceChanged(Distance.of(10));
|
||||
subject.onMinRecordingIntervalChanged(GpsStatusManager.SIGNAL_LOST_THRESHOLD.multipliedBy(-1).plus(Duration.ofMillis(10)));
|
||||
subject.onMinSamplingIntervalChanged(GpsStatusManager.SIGNAL_LOST_THRESHOLD.multipliedBy(-1).plus(Duration.ofMillis(10)));
|
||||
|
||||
// when / then
|
||||
subject.start();
|
||||
|
||||
@@ -79,13 +79,13 @@ public class GPSManager implements SensorConnector, LocationListenerCompat, GpsS
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
boolean registerListener = false;
|
||||
|
||||
if (PreferencesUtils.isKey(R.string.min_recording_interval_key, key)) {
|
||||
if (PreferencesUtils.isKey(R.string.min_sampling_interval_key, key)) {
|
||||
registerListener = true;
|
||||
|
||||
gpsInterval = PreferencesUtils.getMinRecordingInterval();
|
||||
gpsInterval = PreferencesUtils.getMinSamplingInterval();
|
||||
|
||||
if (gpsStatusManager != null) {
|
||||
gpsStatusManager.onMinRecordingIntervalChanged(gpsInterval);
|
||||
gpsStatusManager.onMinSamplingIntervalChanged(gpsInterval);
|
||||
}
|
||||
}
|
||||
if (PreferencesUtils.isKey(R.string.recording_gps_accuracy_key, key)) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class GpsStatusManager {
|
||||
this.handler = handler;
|
||||
|
||||
onRecordingDistanceChanged(PreferencesUtils.getRecordingDistanceInterval());
|
||||
onMinRecordingIntervalChanged(PreferencesUtils.getMinRecordingInterval());
|
||||
onMinSamplingIntervalChanged(PreferencesUtils.getMinSamplingInterval());
|
||||
}
|
||||
|
||||
public void start() {
|
||||
@@ -76,7 +76,7 @@ class GpsStatusManager {
|
||||
horizontalAccuracyThreshold = value;
|
||||
}
|
||||
|
||||
public void onMinRecordingIntervalChanged(Duration value) {
|
||||
public void onMinSamplingIntervalChanged(Duration value) {
|
||||
signalLostThreshold = SIGNAL_LOST_THRESHOLD.plus(value); //TODO Reschedule gpsStatusTimer?
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class GpsSettingsFragment extends PreferenceFragmentCompat {
|
||||
.setSummaryProvider(
|
||||
preference -> {
|
||||
Distance distance = PreferencesUtils.getRecordingDistanceInterval();
|
||||
return getString(R.string.settings_recording_location_frequency_summary, formatter.formatDistance(distance));
|
||||
return getString(R.string.settings_recording_location_distance_summary, formatter.formatDistance(distance));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -48,10 +48,10 @@ public class GpsSettingsFragment extends PreferenceFragmentCompat {
|
||||
}
|
||||
);
|
||||
|
||||
findPreference(getString(R.string.min_recording_interval_key))
|
||||
findPreference(getString(R.string.min_sampling_interval_key))
|
||||
.setSummaryProvider(
|
||||
preference -> {
|
||||
Duration interval = PreferencesUtils.getMinRecordingInterval();
|
||||
Duration interval = PreferencesUtils.getMinSamplingInterval();
|
||||
return getString(R.string.settings_recording_location_frequency_summary, getString(R.string.value_integer_second, interval.getSeconds()));
|
||||
}
|
||||
);
|
||||
@@ -67,8 +67,8 @@ public class GpsSettingsFragment extends PreferenceFragmentCompat {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
ListPreference minRecordingInterval = findPreference(getString(R.string.min_recording_interval_key));
|
||||
minRecordingInterval.setEntries(PreferencesUtils.getMinRecordingIntervalEntries());
|
||||
ListPreference minSamplingInterval = findPreference(getString(R.string.min_sampling_interval_key));
|
||||
minSamplingInterval.setEntries(PreferencesUtils.getMinSamplingIntervalEntries());
|
||||
|
||||
ListPreference recordingDistanceInterval = findPreference(getString(R.string.recording_distance_interval_key));
|
||||
recordingDistanceInterval.setEntries(PreferencesUtils.getRecordingDistanceIntervalEntries());
|
||||
|
||||
@@ -535,18 +535,18 @@ public class PreferencesUtils {
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static Duration getMinRecordingInterval() {
|
||||
final Duration MIN_RECORDING_INTERVAL = getMinRecordingIntervalDefault();
|
||||
return Duration.ofSeconds(getInt(R.string.min_recording_interval_key, (int) MIN_RECORDING_INTERVAL.getSeconds()));
|
||||
public static Duration getMinSamplingInterval() {
|
||||
final Duration MIN_SAMPLING_INTERVAL = getMinSamplingIntervalDefault();
|
||||
return Duration.ofSeconds(getInt(R.string.min_sampling_interval_key, (int) MIN_SAMPLING_INTERVAL.getSeconds()));
|
||||
}
|
||||
|
||||
public static Duration getMinRecordingIntervalDefault() {
|
||||
return Duration.ofSeconds(Integer.parseInt(resources.getString(R.string.min_recording_interval_default)));
|
||||
public static Duration getMinSamplingIntervalDefault() {
|
||||
return Duration.ofSeconds(Integer.parseInt(resources.getString(R.string.min_sampling_interval_default)));
|
||||
}
|
||||
|
||||
static String[] getMinRecordingIntervalEntries() {
|
||||
String[] entryValues = resources.getStringArray(R.array.min_recording_interval_values);
|
||||
long recommended = PreferencesUtils.getMinRecordingIntervalDefault().getSeconds();
|
||||
static String[] getMinSamplingIntervalEntries() {
|
||||
String[] entryValues = resources.getStringArray(R.array.min_sampling_interval_values);
|
||||
long recommended = PreferencesUtils.getMinSamplingIntervalDefault().getSeconds();
|
||||
String[] entries = new String[entryValues.length];
|
||||
for (int i = 0; i < entryValues.length; i++) {
|
||||
int value = Integer.parseInt(entryValues[i]);
|
||||
|
||||
@@ -90,10 +90,10 @@
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
|
||||
<string name="min_recording_interval_key" translatable="false">minRecordingIntervalV2</string>
|
||||
<string name="min_recording_interval_default" translatable="false">0</string>
|
||||
<string-array name="min_recording_interval_values">
|
||||
<item>@string/min_recording_interval_default</item>
|
||||
<string name="min_sampling_interval_key" translatable="false">minRecordingIntervalV2</string>
|
||||
<string name="min_sampling_interval_default" translatable="false">0</string>
|
||||
<string-array name="min_sampling_interval_values">
|
||||
<item>@string/min_sampling_interval_default</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
|
||||
@@ -388,7 +388,7 @@ limitations under the License.
|
||||
<string name="settings_recording_fullscreen_on_while_recording_title">Fullscreen</string>
|
||||
<string name="settings_recording_fullscreen_on_while_recording_summary">While recording, present in fullscreen.</string>
|
||||
<string name="settings_recording_default_activity_title">Default activity type</string>
|
||||
<string name="settings_recording_location_frequency_summary">%1$s between recorded locations</string>
|
||||
<string name="settings_recording_location_frequency_summary">%1$s between location checks</string>
|
||||
<string name="settings_recording_max_recording_distance_summary">A new segment is created if the distance between two locations is greater than %1$s</string>
|
||||
<string name="settings_recording_max_recording_distance_title">Max distance</string>
|
||||
<string name="settings_recording_min_recording_distance_title">Recording distance interval</string>
|
||||
@@ -709,4 +709,6 @@ limitations under the License.
|
||||
<string name="always">Always</string>
|
||||
|
||||
<string name="introduction_osm_dashboard">OpenTracks itself does not provide a map. Please install OSMDashboard to view your recordings on a map.</string>
|
||||
<string name="settings_recording_min_sampling_interval_title">Sampling time interval</string>
|
||||
<string name="settings_recording_location_distance_summary">%1$s between recorded locations</string>
|
||||
</resources>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
android:title="@string/settings_gps_title">
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="@string/min_recording_interval_default"
|
||||
android:entryValues="@array/min_recording_interval_values"
|
||||
android:key="@string/min_recording_interval_key"
|
||||
android:title="@string/settings_recording_min_recording_interval_title" />
|
||||
android:defaultValue="@string/min_sampling_interval_default"
|
||||
android:entryValues="@array/min_sampling_interval_values"
|
||||
android:key="@string/min_sampling_interval_key"
|
||||
android:title="@string/settings_recording_min_sampling_interval_title" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="@string/recording_distance_interval_default"
|
||||
|
||||
Reference in New Issue
Block a user