mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
Update recording settings to display the current
value in the summary.
This commit is contained in:
@@ -1684,129 +1684,131 @@ limitations under the License.
|
||||
<!-- Settings Recording -->
|
||||
<string name="settings_recording"
|
||||
translation_description="In the 'Settings' page, the option to change the track recording
|
||||
related settings.
|
||||
settings.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Recording
|
||||
</string>
|
||||
<string name="settings_recording_auto_resume"
|
||||
translation_description="In the 'Recording' settings, the dropdown option to configure the
|
||||
timeout after which a recorded track will not be continued after device reboot.
|
||||
<string name="settings_recording_auto_resume_track_timeout_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the maximum time
|
||||
after which a previously recording track will not be resumed after reboot.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Auto-resume
|
||||
</string>
|
||||
<string name="settings_recording_auto_resume_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume' dropdown
|
||||
option explaining that it configures the maximum time after which a previous recording will
|
||||
not be resumed after device reboot.">
|
||||
Maximum time after which a previously recording track will not be resumed after device reboot.
|
||||
<string name="settings_recording_auto_resume_track_timeout_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume'
|
||||
setting.">
|
||||
Maximum time after which a previously recording track will not be resumed after reboot.
|
||||
</string>
|
||||
<string name="settings_recording_default_activity"
|
||||
translation_description="In the 'Recording' settings, the option to specify a new track's
|
||||
default activity type.
|
||||
<string name="settings_recording_default_activity_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the default
|
||||
activity type for a new track.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Default activity
|
||||
</string>
|
||||
<string name="settings_recording_default_activity_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Default activity'
|
||||
option explaining that it sets the default activity type for a new track.">
|
||||
setting.">
|
||||
Default activity type for a new track.
|
||||
</string>
|
||||
<string name="settings_recording_distance"
|
||||
translation_description="In the 'Recording' settings, the dropdown option to configure the
|
||||
distance between two recorded points.
|
||||
<string name="settings_recording_max_recording_distance_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the maximum
|
||||
distance.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Distance interval
|
||||
Max distance
|
||||
</string>
|
||||
<string name="settings_recording_distance_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Distance interval'
|
||||
dropdown option explaining that it configures the smallest distance between two recordings of
|
||||
your position.">
|
||||
Smallest distance between two recordings of your position.
|
||||
<string name="settings_recording_max_recording_distance_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Max distance'
|
||||
setting.">
|
||||
New segment is created if the distance since the last recorded location is greater than this.
|
||||
</string>
|
||||
<string name="settings_recording_gps_accuracy"
|
||||
translation_description="In the 'Recording' settings, the dropdown option to configure the
|
||||
required GPS accuracy. If a GPS position's accuracy is below the requirement, then it will not
|
||||
be used.
|
||||
<string name="settings_recording_min_recording_distance_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the minimum
|
||||
distance.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Min distance
|
||||
</string>
|
||||
<string name="settings_recording_min_recording_distance_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Min distance'
|
||||
setting.">
|
||||
GPS location is ignored if the distance since the last recorded location is less than this.
|
||||
</string>
|
||||
<string name="settings_recording_min_recording_interval_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the time between
|
||||
two GPS locations.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Location frequency
|
||||
</string>
|
||||
<string name="settings_recording_min_recording_interval_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Location frequency'
|
||||
setting.">
|
||||
Time between two GPS locations.
|
||||
</string>
|
||||
<string name="settings_recording_min_required_accuracy_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the GPS accuracy.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
GPS accuracy
|
||||
</string>
|
||||
<string name="settings_recording_gps_accuracy_summary"
|
||||
<string name="settings_recording_min_required_accuracy_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'GPS accuracy'
|
||||
dropdown option explaining that it configures the required accuracy for your position. If a
|
||||
GPS position's accuracy is below the requirement, then it will not be used.">
|
||||
GPS position will be ignored if it is not this accurate.
|
||||
setting..">
|
||||
GPS location is ignored if it is not this accurate.
|
||||
</string>
|
||||
<string name="settings_recording_interval"
|
||||
translation_description="In the 'Recording' settings, the dropdown option to configure the time
|
||||
between two recorded points.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Time interval
|
||||
</string>
|
||||
<string name="settings_recording_interval_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Time interval'
|
||||
dropdown option explaining that it configures the smallest time interval between two
|
||||
recordings of your position.">
|
||||
Smallest time interval between two recordings of your position.
|
||||
</string>
|
||||
<string name="settings_recording_track_distance"
|
||||
translation_description="In the 'Recording' settings, the dropdown option to configure the
|
||||
distance between two tracks.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Max interval
|
||||
</string>
|
||||
<string name="settings_recording_track_distance_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Max interval'
|
||||
dropdown option explaining that it configures the maximum distance for two recorded points for
|
||||
them to be still considered as the same track.">
|
||||
Maximum distance between two recordings of your position. If two positions are further than
|
||||
this, the track will be split.
|
||||
</string>
|
||||
<string name="settings_recording_track_name"
|
||||
translation_description="In the 'Recording' settings, the title for the dropdown list to choose
|
||||
the default track name.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Track name
|
||||
<string name="settings_recording_split_frequency_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Split frequency'
|
||||
setting.">
|
||||
Time/distance between two split markers.
|
||||
</string>
|
||||
<string name="settings_recording_track_name_date_iso_8601_option"
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
||||
list to use the track start time in ISO-8601 date format as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' setting
|
||||
to use the track starting time in the ISO-8601 format as the track name.
|
||||
|
||||
Character limit: ~20 (1 line)">
|
||||
Date (ISO 8601)
|
||||
</string>
|
||||
<string name="settings_recording_track_name_date_local_option"
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
||||
list to use the track start time in local date format as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' setting to
|
||||
use the track starting time in the local default format as the track name.
|
||||
|
||||
Character limit: ~20 (1 line)">
|
||||
Date (local)
|
||||
</string>
|
||||
<string name="settings_recording_track_name_location_option"
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
||||
list to use the track location as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' setting to
|
||||
use the track location as the track name.
|
||||
|
||||
Character limit: ~20 (1 line)">
|
||||
Location
|
||||
</string>
|
||||
<string name="settings_recording_track_name_number_option"
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
||||
list to use a number as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Track name' setting to
|
||||
use a number as the track name.
|
||||
|
||||
Character limit: ~20 (1 line)">
|
||||
Number
|
||||
</string>
|
||||
<string name="settings_recording_track_name_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the way to name a
|
||||
new track.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Track name
|
||||
</string>
|
||||
<string name="settings_recording_track_name_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Track name' dropdown
|
||||
list explaining that it chooses the default track name format.">
|
||||
Default track name
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Track name'
|
||||
setting.">
|
||||
Way to name a new track.
|
||||
</string>
|
||||
<string name="settings_recording_voice_frequency_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Voice frequency'
|
||||
setting.">
|
||||
Time/distance between two voice announcements.
|
||||
</string>
|
||||
|
||||
<!-- Settings Reset -->
|
||||
@@ -2040,12 +2042,6 @@ limitations under the License.
|
||||
Show
|
||||
</string>
|
||||
|
||||
<!-- Settings Split -->
|
||||
<string name="settings_split_frequency_title"
|
||||
translation_description="In title of the 'Split frequency' dialog.">
|
||||
Time/distance between two split markers
|
||||
</string>
|
||||
|
||||
<!-- Settings Stats -->
|
||||
<string name="settings_stats_coordinate"
|
||||
translation_description="In the 'Stats settings, the option to show latitude and longitude.
|
||||
@@ -2093,12 +2089,6 @@ limitations under the License.
|
||||
Switch account
|
||||
</string>
|
||||
|
||||
<!-- Settings Voice -->
|
||||
<string name="settings_voice_frequency_title"
|
||||
translation_description="The title of the 'Voice frequency' dialog.">
|
||||
Time/distance between two voice announcements
|
||||
</string>
|
||||
|
||||
<!-- Share Track -->
|
||||
<string name="share_track_confirm_message"
|
||||
translation_description="The confirmation message when sharing a track with friends.
|
||||
|
||||
@@ -20,55 +20,45 @@ limitations under the License.
|
||||
android:defaultValue="0"
|
||||
android:entryValues="@array/frequency_values"
|
||||
android:key="@string/voice_frequency_key"
|
||||
android:summary="@string/settings_voice_frequency_title"
|
||||
android:title="@string/menu_voice_frequency" />
|
||||
<com.google.android.apps.mytracks.IntegerListPreference
|
||||
android:defaultValue="0"
|
||||
android:entryValues="@array/frequency_values"
|
||||
android:key="@string/split_frequency_key"
|
||||
android:summary="@string/settings_split_frequency_title"
|
||||
android:title="@string/menu_split_frequency" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/settings_recording_track_name_location_value"
|
||||
android:entries="@array/track_name_options"
|
||||
android:entryValues="@array/track_name_values"
|
||||
android:key="@string/track_name_key"
|
||||
android:summary="@string/settings_recording_track_name_summary"
|
||||
android:title="@string/settings_recording_track_name" />
|
||||
android:title="@string/settings_recording_track_name_title" />
|
||||
<com.google.android.apps.mytracks.AutoCompleteTextPreference
|
||||
android:defaultValue=""
|
||||
android:hint="@string/track_edit_activity_type_hint"
|
||||
android:key="@string/default_activity_key"
|
||||
android:summary="@string/settings_recording_default_activity_summary"
|
||||
android:title="@string/settings_recording_default_activity" />
|
||||
android:title="@string/settings_recording_default_activity_title" />
|
||||
<com.google.android.apps.mytracks.IntegerListPreference
|
||||
android:defaultValue="0"
|
||||
android:entryValues="@array/min_recording_interval_values"
|
||||
android:key="@string/min_recording_interval_key"
|
||||
android:summary="@string/settings_recording_interval_summary"
|
||||
android:title="@string/settings_recording_interval" />
|
||||
android:title="@string/settings_recording_min_recording_interval_title" />
|
||||
<com.google.android.apps.mytracks.IntegerListPreference
|
||||
android:defaultValue="5"
|
||||
android:entryValues="@array/min_recording_distance_values"
|
||||
android:key="@string/min_recording_distance_key"
|
||||
android:summary="@string/settings_recording_distance_summary"
|
||||
android:title="@string/settings_recording_distance" />
|
||||
android:title="@string/settings_recording_min_recording_distance_title" />
|
||||
<com.google.android.apps.mytracks.IntegerListPreference
|
||||
android:defaultValue="200"
|
||||
android:entryValues="@array/max_recording_distance_values"
|
||||
android:key="@string/max_recording_distance_key"
|
||||
android:summary="@string/settings_recording_track_distance_summary"
|
||||
android:title="@string/settings_recording_track_distance" />
|
||||
android:title="@string/settings_recording_max_recording_distance_title" />
|
||||
<com.google.android.apps.mytracks.IntegerListPreference
|
||||
android:defaultValue="200"
|
||||
android:entryValues="@array/min_required_accuracy_values"
|
||||
android:key="@string/min_required_accuracy_key"
|
||||
android:summary="@string/settings_recording_gps_accuracy_summary"
|
||||
android:title="@string/settings_recording_gps_accuracy" />
|
||||
android:title="@string/settings_recording_min_required_accuracy_title" />
|
||||
<com.google.android.apps.mytracks.IntegerListPreference
|
||||
android:defaultValue="10"
|
||||
android:entryValues="@array/auto_resume_track_timeout_values"
|
||||
android:key="@string/auto_resume_track_timeout_key"
|
||||
android:summary="@string/settings_recording_auto_resume_summary"
|
||||
android:title="@string/settings_recording_auto_resume" />
|
||||
android:title="@string/settings_recording_auto_resume_track_timeout_title" />
|
||||
</PreferenceScreen>
|
||||
@@ -358,13 +358,12 @@ public class TrackDetailActivity extends AbstractMyTracksActivity implements Del
|
||||
return true;
|
||||
case R.id.track_detail_voice_frequency:
|
||||
FrequencyDialogFragment.newInstance(R.string.voice_frequency_key,
|
||||
PreferencesUtils.VOICE_FREQUENCY_DEFAULT,
|
||||
R.string.settings_voice_frequency_title)
|
||||
PreferencesUtils.VOICE_FREQUENCY_DEFAULT, R.string.menu_voice_frequency)
|
||||
.show(getSupportFragmentManager(), FrequencyDialogFragment.FREQUENCY_DIALOG_TAG);
|
||||
return true;
|
||||
case R.id.track_detail_split_frequency:
|
||||
FrequencyDialogFragment.newInstance(R.string.split_frequency_key,
|
||||
PreferencesUtils.SPLIT_FREQUENCY_DEFAULT, R.string.settings_split_frequency_title)
|
||||
PreferencesUtils.SPLIT_FREQUENCY_DEFAULT, R.string.menu_split_frequency)
|
||||
.show(getSupportFragmentManager(), FrequencyDialogFragment.FREQUENCY_DIALOG_TAG);
|
||||
return true;
|
||||
case R.id.track_detail_send_google:
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class FrequencyDialogFragment extends DialogFragment {
|
||||
private String[] getFrequencyDisplayOptions() {
|
||||
boolean metricUnits = PreferencesUtils.getBoolean(
|
||||
activity, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
|
||||
return StringUtils.getFrequencyDisplayOptions(activity, metricUnits);
|
||||
return StringUtils.getFrequencyOptions(activity, metricUnits);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+127
-31
@@ -23,6 +23,7 @@ import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
|
||||
/**
|
||||
* An activity for accessing recording settings.
|
||||
@@ -40,43 +41,138 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
boolean metricUnits = PreferencesUtils.getBoolean(
|
||||
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
|
||||
|
||||
int voiceFrequencyValue = PreferencesUtils.getInt(
|
||||
this, R.string.voice_frequency_key, PreferencesUtils.VOICE_FREQUENCY_DEFAULT);
|
||||
ListPreference voiceFrequencyListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.voice_frequency_key));
|
||||
voiceFrequencyListPreference.setEntries(
|
||||
StringUtils.getFrequencyDisplayOptions(this, metricUnits));
|
||||
configurePreference(voiceFrequencyListPreference,
|
||||
StringUtils.getFrequencyOptions(this, metricUnits),
|
||||
getResources().getStringArray(R.array.frequency_values),
|
||||
R.string.settings_recording_voice_frequency_summary, String.valueOf(voiceFrequencyValue));
|
||||
|
||||
int splitFrequencyValue = PreferencesUtils.getInt(
|
||||
this, R.string.split_frequency_key, PreferencesUtils.SPLIT_FREQUENCY_DEFAULT);
|
||||
ListPreference splitFrequencyListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.split_frequency_key));
|
||||
splitFrequencyListPreference.setEntries(
|
||||
StringUtils.getFrequencyDisplayOptions(this, metricUnits));
|
||||
configurePreference(splitFrequencyListPreference,
|
||||
StringUtils.getFrequencyOptions(this, metricUnits),
|
||||
getResources().getStringArray(R.array.frequency_values),
|
||||
R.string.settings_recording_split_frequency_summary, String.valueOf(splitFrequencyValue));
|
||||
|
||||
String trackNameValue = PreferencesUtils.getString(
|
||||
this, R.string.track_name_key, PreferencesUtils.TRACK_NAME_DEFAULT);
|
||||
ListPreference trackNameListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.track_name_key));
|
||||
configurePreference(trackNameListPreference,
|
||||
getResources().getStringArray(R.array.track_name_options),
|
||||
getResources().getStringArray(R.array.track_name_values),
|
||||
R.string.settings_recording_track_name_summary, trackNameValue);
|
||||
|
||||
String defaultActivityValue = PreferencesUtils.getString(
|
||||
this, R.string.default_activity_key, PreferencesUtils.DEFAULT_ACTIVITY_DEFAULT);
|
||||
Preference defaultActivityPreference = findPreference(getString(R.string.default_activity_key));
|
||||
configurePreference(defaultActivityPreference, null, null,
|
||||
R.string.settings_recording_default_activity_summary, defaultActivityValue);
|
||||
|
||||
int minRecordingIntervalValue = PreferencesUtils.getInt(
|
||||
this, R.string.min_recording_interval_key, PreferencesUtils.MIN_RECORDING_INTERVAL_DEFAULT);
|
||||
ListPreference minRecordingIntervalListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.min_recording_interval_key));
|
||||
minRecordingIntervalListPreference.setEntries(getMinRecordingIntervalDisplayOptions());
|
||||
configurePreference(minRecordingIntervalListPreference, getMinRecordingIntervalOptions(),
|
||||
getResources().getStringArray(R.array.min_recording_interval_values),
|
||||
R.string.settings_recording_min_recording_interval_summary,
|
||||
String.valueOf(minRecordingIntervalValue));
|
||||
|
||||
int minRecordingDistanceValue = PreferencesUtils.getInt(
|
||||
this, R.string.min_recording_distance_key, PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT);
|
||||
ListPreference minRecordingDistanceListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.min_recording_distance_key));
|
||||
minRecordingDistanceListPreference.setEntries(
|
||||
getMinRecordingDistanceDisplayOptions(metricUnits));
|
||||
configurePreference(minRecordingDistanceListPreference,
|
||||
getMinRecordingDistanceOptions(metricUnits),
|
||||
getResources().getStringArray(R.array.min_recording_distance_values),
|
||||
R.string.settings_recording_min_recording_distance_summary,
|
||||
String.valueOf(minRecordingDistanceValue));
|
||||
|
||||
int maxRecordingDistanceValue = PreferencesUtils.getInt(
|
||||
this, R.string.max_recording_distance_key, PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT);
|
||||
ListPreference maxRecordingDistanceListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.max_recording_distance_key));
|
||||
maxRecordingDistanceListPreference.setEntries(
|
||||
getMaxRecordingDistanceDisplayOptions(metricUnits));
|
||||
configurePreference(maxRecordingDistanceListPreference,
|
||||
getMaxRecordingDistanceOptions(metricUnits),
|
||||
getResources().getStringArray(R.array.max_recording_distance_values),
|
||||
R.string.settings_recording_max_recording_distance_summary,
|
||||
String.valueOf(maxRecordingDistanceValue));
|
||||
|
||||
int minRequiredAcuracyValue = PreferencesUtils.getInt(
|
||||
this, R.string.min_required_accuracy_key, PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT);
|
||||
ListPreference minRequiredAccuracyListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.min_required_accuracy_key));
|
||||
minRequiredAccuracyListPreference.setEntries(getMinRequiredAccuracyDisplayOptions(metricUnits));
|
||||
configurePreference(minRequiredAccuracyListPreference,
|
||||
getMinRequiredAccuracyOptions(metricUnits),
|
||||
getResources().getStringArray(R.array.min_required_accuracy_values),
|
||||
R.string.settings_recording_min_required_accuracy_summary,
|
||||
String.valueOf(minRequiredAcuracyValue));
|
||||
|
||||
int autoResumeTrackTimeoutValue = PreferencesUtils.getInt(this,
|
||||
R.string.auto_resume_track_timeout_key, PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT);
|
||||
ListPreference autoResumeTrackTimeoutListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.auto_resume_track_timeout_key));
|
||||
autoResumeTrackTimeoutListPreference.setEntries(getAutoResumeTrackTimeoutDisplayOptions());
|
||||
configurePreference(autoResumeTrackTimeoutListPreference, getAutoResumeTrackTimeoutOptions(),
|
||||
getResources().getStringArray(R.array.auto_resume_track_timeout_values),
|
||||
R.string.settings_recording_auto_resume_track_timeout_summary,
|
||||
String.valueOf(autoResumeTrackTimeoutValue));
|
||||
}
|
||||
|
||||
private void configurePreference(final Preference preference, final String[] options,
|
||||
final String[] values, final int summaryId, String value) {
|
||||
if (options != null) {
|
||||
((ListPreference) preference).setEntries(options);
|
||||
}
|
||||
preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
||||
updatePreferenceSummary(pref, options, values, summaryId, (String) newValue);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
updatePreferenceSummary(preference, options, values, summaryId, value);
|
||||
}
|
||||
|
||||
private void updatePreferenceSummary(
|
||||
Preference listPreference, String[] options, String[] values, int summaryId, String value) {
|
||||
String summary = getString(summaryId);
|
||||
String option;
|
||||
if (options != null && values != null) {
|
||||
option = getOption(options, values, value);
|
||||
} else {
|
||||
option = value != null && value.length() != 0 ? value : getString(R.string.value_unknown);
|
||||
}
|
||||
if (option != null) {
|
||||
summary += "\n" + option;
|
||||
}
|
||||
listPreference.setSummary(summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display option for a stored value.
|
||||
*
|
||||
* @param options list of the display options
|
||||
* @param values list of the stored values
|
||||
* @param value the store value
|
||||
*/
|
||||
private String getOption(String[] options, String[] values, String value) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (value.equals(values[i])) {
|
||||
return options[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min recording interval display options.
|
||||
*/
|
||||
private String[] getMinRecordingIntervalDisplayOptions() {
|
||||
private String[] getMinRecordingIntervalOptions() {
|
||||
String[] values = getResources().getStringArray(R.array.min_recording_interval_values);
|
||||
String[] options = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
@@ -104,20 +200,20 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
*
|
||||
* @param metricUnits true to display metric units
|
||||
*/
|
||||
private String[] getMinRecordingDistanceDisplayOptions(boolean metricUnits) {
|
||||
private String[] getMinRecordingDistanceOptions(boolean metricUnits) {
|
||||
String[] values = getResources().getStringArray(R.array.min_recording_distance_values);
|
||||
String[] options = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
if (metricUnits) {
|
||||
options[i] = getString(value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT
|
||||
? R.string.value_integer_meter_recommended
|
||||
: R.string.value_integer_meter, value);
|
||||
options[i] = getString(
|
||||
value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_meter_recommended
|
||||
: R.string.value_integer_meter, value);
|
||||
} else {
|
||||
int feet = (int) (value * UnitConversions.M_TO_FT);
|
||||
options[i] = getString(value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT
|
||||
? R.string.value_integer_feet_recommended
|
||||
: R.string.value_integer_feet, feet);
|
||||
options[i] = getString(
|
||||
value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_feet_recommended
|
||||
: R.string.value_integer_feet, feet);
|
||||
}
|
||||
}
|
||||
return options;
|
||||
@@ -128,21 +224,21 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
*
|
||||
* @param metricUnits true to display metric units
|
||||
*/
|
||||
private String[] getMaxRecordingDistanceDisplayOptions(boolean metricUnits) {
|
||||
private String[] getMaxRecordingDistanceOptions(boolean metricUnits) {
|
||||
String[] values = getResources().getStringArray(R.array.max_recording_distance_values);
|
||||
String[] options = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
if (metricUnits) {
|
||||
options[i] = getString(value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT
|
||||
? R.string.value_integer_meter_recommended
|
||||
: R.string.value_integer_meter, value);
|
||||
options[i] = getString(
|
||||
value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_meter_recommended
|
||||
: R.string.value_integer_meter, value);
|
||||
} else {
|
||||
int feet = (int) (value * UnitConversions.M_TO_FT);
|
||||
if (feet < 2000) {
|
||||
options[i] = getString(value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT
|
||||
? R.string.value_integer_feet_recommended
|
||||
: R.string.value_integer_feet, feet);
|
||||
options[i] = getString(
|
||||
value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_feet_recommended
|
||||
: R.string.value_integer_feet, feet);
|
||||
} else {
|
||||
double mile = feet * UnitConversions.FT_TO_MI;
|
||||
options[i] = getString(R.string.value_float_mile, mile);
|
||||
@@ -157,7 +253,7 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
*
|
||||
* @param metricUnits true to display metric units
|
||||
*/
|
||||
private String[] getMinRequiredAccuracyDisplayOptions(boolean metricUnits) {
|
||||
private String[] getMinRequiredAccuracyOptions(boolean metricUnits) {
|
||||
String[] values = getResources().getStringArray(R.array.min_required_accuracy_values);
|
||||
String[] options = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
@@ -191,9 +287,9 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
}
|
||||
} else {
|
||||
double mile = feet * UnitConversions.FT_TO_MI;
|
||||
options[i] = getString(value == PreferencesUtils.MIN_REQUIRED_ACCURACY_POOR
|
||||
? R.string.value_float_mile_poor_gps
|
||||
: R.string.value_float_mile, mile);
|
||||
options[i] = getString(
|
||||
value == PreferencesUtils.MIN_REQUIRED_ACCURACY_POOR ? R.string.value_float_mile_poor_gps
|
||||
: R.string.value_float_mile, mile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,7 +299,7 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
/**
|
||||
* Gets the auto resume track timeout display options.
|
||||
*/
|
||||
private String[] getAutoResumeTrackTimeoutDisplayOptions() {
|
||||
private String[] getAutoResumeTrackTimeoutOptions() {
|
||||
String[] values = getResources().getStringArray(R.array.auto_resume_track_timeout_values);
|
||||
String[] options = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
|
||||
@@ -84,6 +84,9 @@ public class PreferencesUtils {
|
||||
public static final int TRACK_COLOR_MODE_MEDIUM_DEFAULT = 15;
|
||||
public static final int TRACK_COLOR_MODE_PERCENTAGE_DEFAULT = 25;
|
||||
public static final int TRACK_COLOR_MODE_SLOW_DEFAULT = 9;
|
||||
|
||||
public static final String TRACK_NAME_DEFAULT = "LOCATION";
|
||||
|
||||
public static final int VOICE_FREQUENCY_DEFAULT = 0;
|
||||
|
||||
private PreferencesUtils() {}
|
||||
|
||||
@@ -291,7 +291,7 @@ public class StringUtils {
|
||||
* @param context the context
|
||||
* @param metricUnits true to display in metric units
|
||||
*/
|
||||
public static String[] getFrequencyDisplayOptions(Context context, boolean metricUnits) {
|
||||
public static String[] getFrequencyOptions(Context context, boolean metricUnits) {
|
||||
String[] values = context.getResources().getStringArray(R.array.frequency_values);
|
||||
String[] options = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TrackNameUtils {
|
||||
public static String getTrackName(
|
||||
Context context, long trackId, long startTime, Location location) {
|
||||
String trackName = PreferencesUtils.getString(context, R.string.track_name_key,
|
||||
context.getString(R.string.settings_recording_track_name_location_value));
|
||||
PreferencesUtils.TRACK_NAME_DEFAULT);
|
||||
|
||||
if (trackName.equals(
|
||||
context.getString(R.string.settings_recording_track_name_date_local_value))) {
|
||||
|
||||
Reference in New Issue
Block a user