forked from upstream-mirrors/OpenTracks
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 -->
|
<!-- Settings Recording -->
|
||||||
<string name="settings_recording"
|
<string name="settings_recording"
|
||||||
translation_description="In the 'Settings' page, the option to change the track recording
|
translation_description="In the 'Settings' page, the option to change the track recording
|
||||||
related settings.
|
settings.
|
||||||
|
|
||||||
Character limit: ~26 (1 line)">
|
Character limit: ~26 (1 line)">
|
||||||
Recording
|
Recording
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_auto_resume"
|
<string name="settings_recording_auto_resume_track_timeout_title"
|
||||||
translation_description="In the 'Recording' settings, the dropdown option to configure the
|
translation_description="In the 'Recording' settings, the title to configure the maximum time
|
||||||
timeout after which a recorded track will not be continued after device reboot.
|
after which a previously recording track will not be resumed after reboot.
|
||||||
|
|
||||||
Character limit: ~23 (1 line)">
|
Character limit: ~23 (1 line)">
|
||||||
Auto-resume
|
Auto-resume
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_auto_resume_summary"
|
<string name="settings_recording_auto_resume_track_timeout_summary"
|
||||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume' dropdown
|
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume'
|
||||||
option explaining that it configures the maximum time after which a previous recording will
|
setting.">
|
||||||
not be resumed after device reboot.">
|
Maximum time after which a previously recording track will not be resumed after reboot.
|
||||||
Maximum time after which a previously recording track will not be resumed after device reboot.
|
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_default_activity"
|
<string name="settings_recording_default_activity_title"
|
||||||
translation_description="In the 'Recording' settings, the option to specify a new track's
|
translation_description="In the 'Recording' settings, the title to configure the default
|
||||||
default activity type.
|
activity type for a new track.
|
||||||
|
|
||||||
Character limit: ~23 (1 line)">
|
Character limit: ~23 (1 line)">
|
||||||
Default activity
|
Default activity
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_default_activity_summary"
|
<string name="settings_recording_default_activity_summary"
|
||||||
translation_description="In the 'Recording' settings, the summary for the 'Default activity'
|
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.
|
Default activity type for a new track.
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_distance"
|
<string name="settings_recording_max_recording_distance_title"
|
||||||
translation_description="In the 'Recording' settings, the dropdown option to configure the
|
translation_description="In the 'Recording' settings, the title to configure the maximum
|
||||||
distance between two recorded points.
|
distance.
|
||||||
|
|
||||||
Character limit: ~23 (1 line)">
|
Character limit: ~23 (1 line)">
|
||||||
Distance interval
|
Max distance
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_distance_summary"
|
<string name="settings_recording_max_recording_distance_summary"
|
||||||
translation_description="In the 'Recording' settings, the summary for the 'Distance interval'
|
translation_description="In the 'Recording' settings, the summary for the 'Max distance'
|
||||||
dropdown option explaining that it configures the smallest distance between two recordings of
|
setting.">
|
||||||
your position.">
|
New segment is created if the distance since the last recorded location is greater than this.
|
||||||
Smallest distance between two recordings of your position.
|
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_gps_accuracy"
|
<string name="settings_recording_min_recording_distance_title"
|
||||||
translation_description="In the 'Recording' settings, the dropdown option to configure the
|
translation_description="In the 'Recording' settings, the title to configure the minimum
|
||||||
required GPS accuracy. If a GPS position's accuracy is below the requirement, then it will not
|
distance.
|
||||||
be used.
|
|
||||||
|
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)">
|
Character limit: ~23 (1 line)">
|
||||||
GPS accuracy
|
GPS accuracy
|
||||||
</string>
|
</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'
|
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
|
setting..">
|
||||||
GPS position's accuracy is below the requirement, then it will not be used.">
|
GPS location is ignored if it is not this accurate.
|
||||||
GPS position will be ignored if it is not this accurate.
|
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_interval"
|
<string name="settings_recording_split_frequency_summary"
|
||||||
translation_description="In the 'Recording' settings, the dropdown option to configure the time
|
translation_description="In the 'Recording' settings, the summary for the 'Split frequency'
|
||||||
between two recorded points.
|
setting.">
|
||||||
|
Time/distance between two split markers.
|
||||||
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>
|
</string>
|
||||||
<string name="settings_recording_track_name_date_iso_8601_option"
|
<string name="settings_recording_track_name_date_iso_8601_option"
|
||||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
translation_description="In the 'Recording' settings, the option in the 'Track name' setting
|
||||||
list to use the track start time in ISO-8601 date format as the track name.
|
to use the track starting time in the ISO-8601 format as the track name.
|
||||||
|
|
||||||
Character limit: ~20 (1 line)">
|
Character limit: ~20 (1 line)">
|
||||||
Date (ISO 8601)
|
Date (ISO 8601)
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_track_name_date_local_option"
|
<string name="settings_recording_track_name_date_local_option"
|
||||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
translation_description="In the 'Recording' settings, the option in the 'Track name' setting to
|
||||||
list to use the track start time in local date format as the track name.
|
use the track starting time in the local default format as the track name.
|
||||||
|
|
||||||
Character limit: ~20 (1 line)">
|
Character limit: ~20 (1 line)">
|
||||||
Date (local)
|
Date (local)
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_track_name_location_option"
|
<string name="settings_recording_track_name_location_option"
|
||||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
translation_description="In the 'Recording' settings, the option in the 'Track name' setting to
|
||||||
list to use the track location as the track name.
|
use the track location as the track name.
|
||||||
|
|
||||||
Character limit: ~20 (1 line)">
|
Character limit: ~20 (1 line)">
|
||||||
Location
|
Location
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_recording_track_name_number_option"
|
<string name="settings_recording_track_name_number_option"
|
||||||
translation_description="In the 'Recording' settings, the option in the 'Track name' dropdown
|
translation_description="In the 'Recording' settings, the option in the 'Track name' setting to
|
||||||
list to use a number as the track name.
|
use a number as the track name.
|
||||||
|
|
||||||
Character limit: ~20 (1 line)">
|
Character limit: ~20 (1 line)">
|
||||||
Number
|
Number
|
||||||
</string>
|
</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"
|
<string name="settings_recording_track_name_summary"
|
||||||
translation_description="In the 'Recording' settings, the summary for the 'Track name' dropdown
|
translation_description="In the 'Recording' settings, the summary for the 'Track name'
|
||||||
list explaining that it chooses the default track name format.">
|
setting.">
|
||||||
Default track name
|
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>
|
</string>
|
||||||
|
|
||||||
<!-- Settings Reset -->
|
<!-- Settings Reset -->
|
||||||
@@ -2040,12 +2042,6 @@ limitations under the License.
|
|||||||
Show
|
Show
|
||||||
</string>
|
</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 -->
|
<!-- Settings Stats -->
|
||||||
<string name="settings_stats_coordinate"
|
<string name="settings_stats_coordinate"
|
||||||
translation_description="In the 'Stats settings, the option to show latitude and longitude.
|
translation_description="In the 'Stats settings, the option to show latitude and longitude.
|
||||||
@@ -2093,12 +2089,6 @@ limitations under the License.
|
|||||||
Switch account
|
Switch account
|
||||||
</string>
|
</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 -->
|
<!-- Share Track -->
|
||||||
<string name="share_track_confirm_message"
|
<string name="share_track_confirm_message"
|
||||||
translation_description="The confirmation message when sharing a track with friends.
|
translation_description="The confirmation message when sharing a track with friends.
|
||||||
|
|||||||
@@ -20,55 +20,45 @@ limitations under the License.
|
|||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
android:entryValues="@array/frequency_values"
|
android:entryValues="@array/frequency_values"
|
||||||
android:key="@string/voice_frequency_key"
|
android:key="@string/voice_frequency_key"
|
||||||
android:summary="@string/settings_voice_frequency_title"
|
|
||||||
android:title="@string/menu_voice_frequency" />
|
android:title="@string/menu_voice_frequency" />
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
android:entryValues="@array/frequency_values"
|
android:entryValues="@array/frequency_values"
|
||||||
android:key="@string/split_frequency_key"
|
android:key="@string/split_frequency_key"
|
||||||
android:summary="@string/settings_split_frequency_title"
|
|
||||||
android:title="@string/menu_split_frequency" />
|
android:title="@string/menu_split_frequency" />
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="@string/settings_recording_track_name_location_value"
|
android:defaultValue="@string/settings_recording_track_name_location_value"
|
||||||
android:entries="@array/track_name_options"
|
|
||||||
android:entryValues="@array/track_name_values"
|
android:entryValues="@array/track_name_values"
|
||||||
android:key="@string/track_name_key"
|
android:key="@string/track_name_key"
|
||||||
android:summary="@string/settings_recording_track_name_summary"
|
android:title="@string/settings_recording_track_name_title" />
|
||||||
android:title="@string/settings_recording_track_name" />
|
|
||||||
<com.google.android.apps.mytracks.AutoCompleteTextPreference
|
<com.google.android.apps.mytracks.AutoCompleteTextPreference
|
||||||
android:defaultValue=""
|
android:defaultValue=""
|
||||||
android:hint="@string/track_edit_activity_type_hint"
|
android:hint="@string/track_edit_activity_type_hint"
|
||||||
android:key="@string/default_activity_key"
|
android:key="@string/default_activity_key"
|
||||||
android:summary="@string/settings_recording_default_activity_summary"
|
android:title="@string/settings_recording_default_activity_title" />
|
||||||
android:title="@string/settings_recording_default_activity" />
|
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
android:entryValues="@array/min_recording_interval_values"
|
android:entryValues="@array/min_recording_interval_values"
|
||||||
android:key="@string/min_recording_interval_key"
|
android:key="@string/min_recording_interval_key"
|
||||||
android:summary="@string/settings_recording_interval_summary"
|
android:title="@string/settings_recording_min_recording_interval_title" />
|
||||||
android:title="@string/settings_recording_interval" />
|
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="5"
|
android:defaultValue="5"
|
||||||
android:entryValues="@array/min_recording_distance_values"
|
android:entryValues="@array/min_recording_distance_values"
|
||||||
android:key="@string/min_recording_distance_key"
|
android:key="@string/min_recording_distance_key"
|
||||||
android:summary="@string/settings_recording_distance_summary"
|
android:title="@string/settings_recording_min_recording_distance_title" />
|
||||||
android:title="@string/settings_recording_distance" />
|
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="200"
|
android:defaultValue="200"
|
||||||
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="@string/settings_recording_track_distance_summary"
|
android:title="@string/settings_recording_max_recording_distance_title" />
|
||||||
android:title="@string/settings_recording_track_distance" />
|
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="200"
|
android:defaultValue="200"
|
||||||
android:entryValues="@array/min_required_accuracy_values"
|
android:entryValues="@array/min_required_accuracy_values"
|
||||||
android:key="@string/min_required_accuracy_key"
|
android:key="@string/min_required_accuracy_key"
|
||||||
android:summary="@string/settings_recording_gps_accuracy_summary"
|
android:title="@string/settings_recording_min_required_accuracy_title" />
|
||||||
android:title="@string/settings_recording_gps_accuracy" />
|
|
||||||
<com.google.android.apps.mytracks.IntegerListPreference
|
<com.google.android.apps.mytracks.IntegerListPreference
|
||||||
android:defaultValue="10"
|
android:defaultValue="10"
|
||||||
android:entryValues="@array/auto_resume_track_timeout_values"
|
android:entryValues="@array/auto_resume_track_timeout_values"
|
||||||
android:key="@string/auto_resume_track_timeout_key"
|
android:key="@string/auto_resume_track_timeout_key"
|
||||||
android:summary="@string/settings_recording_auto_resume_summary"
|
android:title="@string/settings_recording_auto_resume_track_timeout_title" />
|
||||||
android:title="@string/settings_recording_auto_resume" />
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
@@ -358,13 +358,12 @@ public class TrackDetailActivity extends AbstractMyTracksActivity implements Del
|
|||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_voice_frequency:
|
case R.id.track_detail_voice_frequency:
|
||||||
FrequencyDialogFragment.newInstance(R.string.voice_frequency_key,
|
FrequencyDialogFragment.newInstance(R.string.voice_frequency_key,
|
||||||
PreferencesUtils.VOICE_FREQUENCY_DEFAULT,
|
PreferencesUtils.VOICE_FREQUENCY_DEFAULT, R.string.menu_voice_frequency)
|
||||||
R.string.settings_voice_frequency_title)
|
|
||||||
.show(getSupportFragmentManager(), FrequencyDialogFragment.FREQUENCY_DIALOG_TAG);
|
.show(getSupportFragmentManager(), FrequencyDialogFragment.FREQUENCY_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_split_frequency:
|
case R.id.track_detail_split_frequency:
|
||||||
FrequencyDialogFragment.newInstance(R.string.split_frequency_key,
|
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);
|
.show(getSupportFragmentManager(), FrequencyDialogFragment.FREQUENCY_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_send_google:
|
case R.id.track_detail_send_google:
|
||||||
|
|||||||
+1
-1
@@ -82,7 +82,7 @@ public class FrequencyDialogFragment extends DialogFragment {
|
|||||||
private String[] getFrequencyDisplayOptions() {
|
private String[] getFrequencyDisplayOptions() {
|
||||||
boolean metricUnits = PreferencesUtils.getBoolean(
|
boolean metricUnits = PreferencesUtils.getBoolean(
|
||||||
activity, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
|
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.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An activity for accessing recording settings.
|
* An activity for accessing recording settings.
|
||||||
@@ -40,43 +41,138 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
boolean metricUnits = PreferencesUtils.getBoolean(
|
boolean metricUnits = PreferencesUtils.getBoolean(
|
||||||
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
|
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(
|
ListPreference voiceFrequencyListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.voice_frequency_key));
|
getString(R.string.voice_frequency_key));
|
||||||
voiceFrequencyListPreference.setEntries(
|
configurePreference(voiceFrequencyListPreference,
|
||||||
StringUtils.getFrequencyDisplayOptions(this, metricUnits));
|
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(
|
ListPreference splitFrequencyListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.split_frequency_key));
|
getString(R.string.split_frequency_key));
|
||||||
splitFrequencyListPreference.setEntries(
|
configurePreference(splitFrequencyListPreference,
|
||||||
StringUtils.getFrequencyDisplayOptions(this, metricUnits));
|
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(
|
ListPreference minRecordingIntervalListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.min_recording_interval_key));
|
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(
|
ListPreference minRecordingDistanceListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.min_recording_distance_key));
|
getString(R.string.min_recording_distance_key));
|
||||||
minRecordingDistanceListPreference.setEntries(
|
configurePreference(minRecordingDistanceListPreference,
|
||||||
getMinRecordingDistanceDisplayOptions(metricUnits));
|
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(
|
ListPreference maxRecordingDistanceListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.max_recording_distance_key));
|
getString(R.string.max_recording_distance_key));
|
||||||
maxRecordingDistanceListPreference.setEntries(
|
configurePreference(maxRecordingDistanceListPreference,
|
||||||
getMaxRecordingDistanceDisplayOptions(metricUnits));
|
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(
|
ListPreference minRequiredAccuracyListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.min_required_accuracy_key));
|
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(
|
ListPreference autoResumeTrackTimeoutListPreference = (ListPreference) findPreference(
|
||||||
getString(R.string.auto_resume_track_timeout_key));
|
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.
|
* Gets the min recording interval display options.
|
||||||
*/
|
*/
|
||||||
private String[] getMinRecordingIntervalDisplayOptions() {
|
private String[] getMinRecordingIntervalOptions() {
|
||||||
String[] values = getResources().getStringArray(R.array.min_recording_interval_values);
|
String[] values = getResources().getStringArray(R.array.min_recording_interval_values);
|
||||||
String[] options = new String[values.length];
|
String[] options = new String[values.length];
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
@@ -104,20 +200,20 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
*
|
*
|
||||||
* @param metricUnits true to display metric units
|
* @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[] values = getResources().getStringArray(R.array.min_recording_distance_values);
|
||||||
String[] options = new String[values.length];
|
String[] options = new String[values.length];
|
||||||
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]);
|
||||||
if (metricUnits) {
|
if (metricUnits) {
|
||||||
options[i] = getString(value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT
|
options[i] = getString(
|
||||||
? R.string.value_integer_meter_recommended
|
value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_meter_recommended
|
||||||
: R.string.value_integer_meter, value);
|
: R.string.value_integer_meter, value);
|
||||||
} else {
|
} else {
|
||||||
int feet = (int) (value * UnitConversions.M_TO_FT);
|
int feet = (int) (value * UnitConversions.M_TO_FT);
|
||||||
options[i] = getString(value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT
|
options[i] = getString(
|
||||||
? R.string.value_integer_feet_recommended
|
value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_feet_recommended
|
||||||
: R.string.value_integer_feet, feet);
|
: R.string.value_integer_feet, feet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
@@ -128,21 +224,21 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
*
|
*
|
||||||
* @param metricUnits true to display metric units
|
* @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[] values = getResources().getStringArray(R.array.max_recording_distance_values);
|
||||||
String[] options = new String[values.length];
|
String[] options = new String[values.length];
|
||||||
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]);
|
||||||
if (metricUnits) {
|
if (metricUnits) {
|
||||||
options[i] = getString(value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT
|
options[i] = getString(
|
||||||
? R.string.value_integer_meter_recommended
|
value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_meter_recommended
|
||||||
: R.string.value_integer_meter, value);
|
: R.string.value_integer_meter, value);
|
||||||
} else {
|
} else {
|
||||||
int feet = (int) (value * UnitConversions.M_TO_FT);
|
int feet = (int) (value * UnitConversions.M_TO_FT);
|
||||||
if (feet < 2000) {
|
if (feet < 2000) {
|
||||||
options[i] = getString(value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT
|
options[i] = getString(
|
||||||
? R.string.value_integer_feet_recommended
|
value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_feet_recommended
|
||||||
: R.string.value_integer_feet, feet);
|
: R.string.value_integer_feet, feet);
|
||||||
} else {
|
} else {
|
||||||
double mile = feet * UnitConversions.FT_TO_MI;
|
double mile = feet * UnitConversions.FT_TO_MI;
|
||||||
options[i] = getString(R.string.value_float_mile, mile);
|
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
|
* @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[] values = getResources().getStringArray(R.array.min_required_accuracy_values);
|
||||||
String[] options = new String[values.length];
|
String[] options = new String[values.length];
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
@@ -191,9 +287,9 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double mile = feet * UnitConversions.FT_TO_MI;
|
double mile = feet * UnitConversions.FT_TO_MI;
|
||||||
options[i] = getString(value == PreferencesUtils.MIN_REQUIRED_ACCURACY_POOR
|
options[i] = getString(
|
||||||
? R.string.value_float_mile_poor_gps
|
value == PreferencesUtils.MIN_REQUIRED_ACCURACY_POOR ? R.string.value_float_mile_poor_gps
|
||||||
: R.string.value_float_mile, mile);
|
: R.string.value_float_mile, mile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,7 +299,7 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
|||||||
/**
|
/**
|
||||||
* Gets the auto resume track timeout display options.
|
* 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[] values = getResources().getStringArray(R.array.auto_resume_track_timeout_values);
|
||||||
String[] options = new String[values.length];
|
String[] options = new String[values.length];
|
||||||
for (int i = 0; i < values.length; i++) {
|
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_MEDIUM_DEFAULT = 15;
|
||||||
public static final int TRACK_COLOR_MODE_PERCENTAGE_DEFAULT = 25;
|
public static final int TRACK_COLOR_MODE_PERCENTAGE_DEFAULT = 25;
|
||||||
public static final int TRACK_COLOR_MODE_SLOW_DEFAULT = 9;
|
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;
|
public static final int VOICE_FREQUENCY_DEFAULT = 0;
|
||||||
|
|
||||||
private PreferencesUtils() {}
|
private PreferencesUtils() {}
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ public class StringUtils {
|
|||||||
* @param context the context
|
* @param context the context
|
||||||
* @param metricUnits true to display in metric units
|
* @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[] values = context.getResources().getStringArray(R.array.frequency_values);
|
||||||
String[] options = new String[values.length];
|
String[] options = new String[values.length];
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class TrackNameUtils {
|
|||||||
public static String getTrackName(
|
public static String getTrackName(
|
||||||
Context context, long trackId, long startTime, Location location) {
|
Context context, long trackId, long startTime, Location location) {
|
||||||
String trackName = PreferencesUtils.getString(context, R.string.track_name_key,
|
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(
|
if (trackName.equals(
|
||||||
context.getString(R.string.settings_recording_track_name_date_local_value))) {
|
context.getString(R.string.settings_recording_track_name_date_local_value))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user