mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Merge heads
This commit is contained in:
@@ -208,7 +208,7 @@ limitations under the License.
|
||||
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.AccountChooserActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.ConfirmSharingActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.settings.BackupSettingsActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.settings.BackupResetSettingsActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.settings.ChartSettingsActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.settings.GoogleSettingsActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.settings.MapSettingsActivity" />
|
||||
|
||||
@@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<!-- Do not translate any arrays in this file. -->
|
||||
<string-array name="activity_types">
|
||||
<item>@string/activity_type_airplane</item>
|
||||
@@ -160,32 +161,37 @@ limitations under the License.
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
<string-array name="sensor_type_all_options">
|
||||
<item>@string/value_none</item>
|
||||
<item>@string/settings_sensor_type_ant</item>
|
||||
<item>@string/settings_sensor_type_polar</item>
|
||||
<item>@string/settings_sensor_type_zephyr</item>
|
||||
<item>@string/settings_sensor_type_ant</item>
|
||||
<item>@string/value_none</item>
|
||||
</string-array>
|
||||
<string-array name="sensor_type_all_values">
|
||||
<item>@string/sensor_type_value_none</item>
|
||||
<item>@string/sensor_type_value_ant</item>
|
||||
<item>@string/sensor_type_value_polar</item>
|
||||
<item>@string/sensor_type_value_zephyr</item>
|
||||
<item>@string/sensor_type_value_ant</item>
|
||||
<item>@string/sensor_type_value_none</item>
|
||||
</string-array>
|
||||
<string-array name="sensor_type_bluetooth_options">
|
||||
<item>@string/value_none</item>
|
||||
<item>@string/settings_sensor_type_polar</item>
|
||||
<item>@string/settings_sensor_type_zephyr</item>
|
||||
<item>@string/value_none</item>
|
||||
</string-array>
|
||||
<string-array name="sensor_type_bluetooth_values">
|
||||
<item>@string/sensor_type_value_none</item>
|
||||
<item>@string/sensor_type_value_polar</item>
|
||||
<item>@string/sensor_type_value_zephyr</item>
|
||||
<item>@string/sensor_type_value_none</item>
|
||||
</string-array>
|
||||
<string-array name="track_color_mode_options">
|
||||
<item>@string/settings_map_track_color_mode_single</item>
|
||||
<item>@string/settings_map_track_color_mode_fixed</item>
|
||||
<item>@string/settings_map_track_color_mode_dynamic</item>
|
||||
</string-array>
|
||||
<string-array name="track_color_mode_summary">
|
||||
<item>@string/settings_map_track_color_mode_single</item>
|
||||
<item>@string/settings_map_track_color_mode_fixed_summary</item>
|
||||
<item>@string/settings_map_track_color_mode_dynamic_summary</item>
|
||||
</string-array>
|
||||
<string-array name="track_color_mode_values">
|
||||
<item>@string/settings_map_track_color_mode_single_value</item>
|
||||
<item>@string/settings_map_track_color_mode_fixed_value</item>
|
||||
@@ -256,4 +262,5 @@ limitations under the License.
|
||||
<item>@string/waypoint_type_water_fountain</item>
|
||||
<item>@string/waypoint_type_waypoint</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
@@ -71,8 +71,7 @@ limitations under the License.
|
||||
|
||||
<!-- Keys for non-persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. -->
|
||||
<string name="settings_backup_key">settingsBackup</string>
|
||||
<string name="settings_backup_now_key">settingsBackupNow</string>
|
||||
<string name="settings_backup_restore_key">settingsBackupRestore</string>
|
||||
<string name="settings_backup_reset_key">settingsBackupReset</string>
|
||||
<string name="settings_chart_key">settingsChart</string>
|
||||
<string name="settings_google_key">settingsGoogle</string>
|
||||
<string name="settings_map_key">settingsMap</string>
|
||||
@@ -81,6 +80,7 @@ limitations under the License.
|
||||
<string name="settings_map_slow_display_key">settingsMapSlowDisplay</string>
|
||||
<string name="settings_recording_key">settingsRecording</string>
|
||||
<string name="settings_reset_key">settingsReset</string>
|
||||
<string name="settings_restore_key">settingsRestore</string>
|
||||
<string name="settings_sensor_key">settingsSensor</string>
|
||||
<string name="settings_sensor_ant_key">settingsSensorAnt</string>
|
||||
<string name="settings_sensor_ant_reset_bike_cadence_sensor_key">settingsSensorAntResetBikeCadenceSensor</string>
|
||||
|
||||
+139
-162
@@ -1585,7 +1585,7 @@ limitations under the License.
|
||||
<string name="settings_not_while_recording"
|
||||
translation_description="In settings, the summary for an option that is not available during a
|
||||
track recording.">
|
||||
Not available while recording a track.
|
||||
Not available while recording a track
|
||||
</string>
|
||||
<string name="settings_show"
|
||||
translation_description="In settings, the section label to show additional values.
|
||||
@@ -1594,19 +1594,18 @@ limitations under the License.
|
||||
Show
|
||||
</string>
|
||||
|
||||
<!-- Settings Backup -->
|
||||
<string name="settings_backup"
|
||||
translation_description="In the 'Settings' page, the option to change the data backup related
|
||||
settings.
|
||||
<!-- Settings Backup Reset -->
|
||||
<string name="settings_backup_reset"
|
||||
translation_description="In the 'Settings' page, the option backup and reset.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Backup
|
||||
Backup & reset
|
||||
</string>
|
||||
|
||||
<!-- Settings Backup Now -->
|
||||
<string name="settings_backup_now"
|
||||
translation_description="In the 'Backup' settings, the option to backup to the external storage
|
||||
now.
|
||||
translation_description="In the 'Backup and reset' settings, the option to backup to the
|
||||
external storage now.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Backup now
|
||||
@@ -1616,15 +1615,15 @@ limitations under the License.
|
||||
Unable to backup.
|
||||
</string>
|
||||
<string name="settings_backup_now_progress_message"
|
||||
translation_description="In the 'Backup' settings, after pressing the 'Backup now' option, the
|
||||
progress message telling the user that it is writing all tracks and settings to the external
|
||||
storage.">
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Backup now'
|
||||
option, the progress message telling the user that it is writing all tracks and settings to
|
||||
the external storage.">
|
||||
Writing all tracks and settings…
|
||||
</string>
|
||||
<string name="settings_backup_now_summary"
|
||||
translation_description="In the 'Backup' settings, the summary for the 'Backup now' option
|
||||
explaining that all tracks and settings will be written to the external storage.">
|
||||
Write a full copy of all your tracks and settings to the external storage.
|
||||
translation_description="In the 'Backup and reset' settings, the summary for the 'Backup now'
|
||||
option explaining that all tracks and settings will be written to the external storage.">
|
||||
Write a full copy of all your tracks and settings to the external storage
|
||||
</string>
|
||||
<string name="settings_backup_now_success"
|
||||
translation_description="When backing up to the external storage, the success message">
|
||||
@@ -1633,16 +1632,16 @@ limitations under the License.
|
||||
|
||||
<!-- Settings Backup Restore -->
|
||||
<string name="settings_backup_restore"
|
||||
translation_description="In the 'Backup' settings, the option to restore from the external
|
||||
storage.
|
||||
translation_description="In the 'Backup and reset' settings, the option to restore from the
|
||||
external storage.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Restore now
|
||||
</string>
|
||||
<string name="settings_backup_restore_confirm_message"
|
||||
translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the
|
||||
message in the alert dialog asking the user to confirm that he wants to restore from a backup
|
||||
and it will overwrite all the current tracks and settings.">
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now'
|
||||
option, the message in the alert dialog asking the user to confirm that he wants to restore
|
||||
from a backup and it will overwrite all the current tracks and settings.">
|
||||
Restoring a backup from the external storage will overwrite all your current tracks and
|
||||
settings.
|
||||
</string>
|
||||
@@ -1651,25 +1650,26 @@ limitations under the License.
|
||||
Unable to restore from backup.
|
||||
</string>
|
||||
<string name="settings_backup_restore_no_backup"
|
||||
translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the
|
||||
message in the alert dialog informing the user that there is no backup to restore from.">
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now'
|
||||
option, the message in the alert dialog informing the user that there is no backup to restore
|
||||
from.">
|
||||
No backup found.
|
||||
</string>
|
||||
<string name="settings_backup_restore_progress_message"
|
||||
translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the
|
||||
progress message informing that My Tracks is reading all tracks and settings from the backup
|
||||
on the external storage.">
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now'
|
||||
option, the progress message informing that My Tracks is reading all tracks and settings from
|
||||
the backup on the external storage.">
|
||||
Reading all tracks and settings…
|
||||
</string>
|
||||
<string name="settings_backup_restore_select_title"
|
||||
translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the
|
||||
title in the picker dialog asking the user to select a backup.">
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now'
|
||||
option, the title in the picker dialog asking the user to select a backup.">
|
||||
Select a backup to restore
|
||||
</string>
|
||||
<string name="settings_backup_restore_summary"
|
||||
translation_description="In the 'Backup' settings, the summary for the 'Restore now' option
|
||||
explaining that it restores all tracks and settings from the external storage.">
|
||||
Restore all tracks and settings from the external storage.
|
||||
translation_description="In the 'Backup and reset' settings, the summary for the 'Restore now'
|
||||
option explaining that it restores all tracks and settings from the external storage.">
|
||||
Restore all tracks and settings from the external storage
|
||||
</string>
|
||||
<string name="settings_backup_restore_success"
|
||||
translation_description="When restoring from backup, the success message.">
|
||||
@@ -1820,73 +1820,84 @@ limitations under the License.
|
||||
|
||||
<!-- Settings Recording -->
|
||||
<string name="settings_recording"
|
||||
translation_description="In the 'Settings' page, the option to change the track recording
|
||||
settings.
|
||||
translation_description="In the 'Settings' page, the option to change the recording settings.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Recording
|
||||
</string>
|
||||
<string name="settings_recording_auto_resume_track_timeout_always_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume' setting
|
||||
when 'Always' is selected.">
|
||||
Always resume a recording after reboot
|
||||
</string>
|
||||
<string name="settings_recording_auto_resume_track_timeout_never_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume' setting
|
||||
when 'Never' is selected.">
|
||||
Never resume a recording after reboot
|
||||
</string>
|
||||
<string name="settings_recording_auto_resume_track_timeout_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume' setting
|
||||
when a time value is selected.
|
||||
|
||||
%1$s time value. E.g., '5 min'.">
|
||||
Resume a recording after reboot if the last recorded loation was within the last %1$s
|
||||
</string>
|
||||
<string name="settings_recording_auto_resume_track_timeout_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure resuming a
|
||||
recording track after reboot.
|
||||
translation_description="In the 'Recording' settings, the title to configure automatically
|
||||
resuming a recording after reboot.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Auto-resume
|
||||
</string>
|
||||
<string name="settings_recording_auto_resume_track_timeout_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Auto-resume' setting.
|
||||
Occasionaly, phones will reboot due to crashes or users would need to change battery during a
|
||||
long recording. My Tracks will resume a recording after reboot if it was recording beforehand
|
||||
and that the last recorded time is recent, within certain minutes.">
|
||||
Recording is resumed after reboot if the last recorded time is within this.
|
||||
</string>
|
||||
<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.
|
||||
activity type for a new track. E.g., 'hiking'.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Default activity
|
||||
Default activity type
|
||||
</string>
|
||||
<string name="settings_recording_default_activity_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Default activity'
|
||||
setting.">
|
||||
Default activity type for a new track.
|
||||
<string name="settings_recording_location_frequency_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for how frequent a location
|
||||
should be recorded.
|
||||
|
||||
%1$s distance or time. E.g., '5 m' or '1 s'.">
|
||||
%1$s between recorded locations
|
||||
</string>
|
||||
<string name="settings_recording_max_recording_distance_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Max distance'
|
||||
setting.
|
||||
|
||||
%1$s distance value. E.g., '5 m'.">
|
||||
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"
|
||||
translation_description="In the 'Recording' settings, the title to configure the maximum
|
||||
distance.
|
||||
distance between 2 locations in a segment. A new segment is created if the distance between 2
|
||||
locations is greater than this value.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Max distance
|
||||
</string>
|
||||
<string name="settings_recording_max_recording_distance_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'Max distance'
|
||||
setting.">
|
||||
Maximum distance between locations in the same segment.
|
||||
</string>
|
||||
<string name="settings_recording_min_recording_distance_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the minimum
|
||||
distance.
|
||||
translation_description="In the 'Recording' settings, the title to configure the distance
|
||||
between two recorded locations.
|
||||
|
||||
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.">
|
||||
Minimum distance between recorded locations.
|
||||
Recording distance interval
|
||||
</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.
|
||||
two recorded locations.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Location frequency
|
||||
Recording time interval
|
||||
</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 name="settings_recording_min_required_accuracy_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'GPS accuracy'
|
||||
setting.
|
||||
|
||||
%1$s distance value. E.g., '10 m'.">
|
||||
Location is ignored if its accuracy is less than %1$s
|
||||
</string>
|
||||
<string name="settings_recording_min_required_accuracy_title"
|
||||
translation_description="In the 'Recording' settings, the title to configure the GPS accuracy.
|
||||
@@ -1894,211 +1905,173 @@ limitations under the License.
|
||||
Character limit: ~23 (1 line)">
|
||||
GPS accuracy
|
||||
</string>
|
||||
<string name="settings_recording_min_required_accuracy_summary"
|
||||
translation_description="In the 'Recording' settings, the summary for the 'GPS accuracy'
|
||||
setting..">
|
||||
GPS location is ignored if it is not this accurate.
|
||||
</string>
|
||||
<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' setting
|
||||
to use the track starting time in the ISO-8601 format as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Default track name'
|
||||
setting to use the track starting time in the ISO-8601 format as the default 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' setting to
|
||||
use the track starting time in the local default format as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Defaul track name'
|
||||
setting to use the track starting time in the local format as the default 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' setting to
|
||||
use the track location as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Defaul track name'
|
||||
setting to use the track starting location as the default 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' setting to
|
||||
use a number as the track name.
|
||||
translation_description="In the 'Recording' settings, the option in the 'Default track name'
|
||||
setting to use number as the default 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.
|
||||
translation_description="In the 'Recording' settings, the option to configure how the default
|
||||
track name is named.
|
||||
|
||||
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'
|
||||
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.
|
||||
Default track name
|
||||
</string>
|
||||
|
||||
<!-- Settings Reset -->
|
||||
<string name="settings_reset"
|
||||
translation_description="In the 'Settings' page, the option to reset everything to the defaults.
|
||||
translation_description="In the 'Backup and reset' settings, the option to reset all settings to
|
||||
the default values.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Reset
|
||||
</string>
|
||||
<string name="settings_reset_confirm_message"
|
||||
translation_description="In the 'Settings' page, after pressing the 'Reset' option, the
|
||||
confirmation dialog message informing the user that all settings will be reverted.">
|
||||
All your settings will be erased and reverted to the default values. Saved tracks will be
|
||||
preserved.
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Reset' option,
|
||||
the confirmation dialog message informing the user that all settings will be reverted.">
|
||||
All settings will be erased and reverted to the default values. Saved tracks will be preserved.
|
||||
</string>
|
||||
<string name="settings_reset_done"
|
||||
translation_description="In the 'Settings' page, after pressing the 'Reset' option, the
|
||||
confirmation dialog informing the user that all settings have been reverted to their
|
||||
defaults.">
|
||||
All settings have been reverted to their defaults.
|
||||
translation_description="In the 'Backup and reset' settings, after pressing the 'Reset' option,
|
||||
the confirmation dialog informing the user that all settings have been reverted to the default
|
||||
values.">
|
||||
All settings have been reverted to the default values.
|
||||
</string>
|
||||
<string name="settings_reset_summary"
|
||||
translation_description="In the 'Settings' page, the summary for the 'Reset' option explaining
|
||||
reverting all the settings to the default values.">
|
||||
Revert all your settings to the default values.
|
||||
translation_description="In the 'Backup and reset' settings, the summary for the 'Reset' option
|
||||
explaining it will revert all settings to the default values.">
|
||||
Revert all your settings to the default values
|
||||
</string>
|
||||
|
||||
<!-- Settings Sensor -->
|
||||
<string name="settings_sensor"
|
||||
translation_description="In the 'Settings' page, the option to change the sensor related
|
||||
settings.
|
||||
translation_description="In the 'Settings' page, the option to change the sensor settings.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Sensor
|
||||
</string>
|
||||
<string name="settings_sensor_ant_options"
|
||||
translation_description="In the 'Sensor' settings, the section header to configure the ANT+
|
||||
options. Note that ANT+ is a radio standard.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
ANT+ options
|
||||
<string name="settings_sensor_ant_not_connected"
|
||||
translation_description="In the 'Sensor' settings, the summary to indicate that an ANT+ sensor
|
||||
is not connected.">
|
||||
Not connected
|
||||
</string>
|
||||
<string name="settings_sensor_ant_paired"
|
||||
translation_description="In the 'Sensor' settings, the summary to indicate the paired ANT+
|
||||
device. Note that ANT+ is a radio standard.
|
||||
translation_description="In the 'Sensor' settings, the summary to indicate that an ANT+ sensor
|
||||
is paired. Note that ANT+ is a radio standard.
|
||||
|
||||
%1$d: device id number. E.g., '1'.">
|
||||
Paired with: %1$d
|
||||
Paired with %1$d
|
||||
</string>
|
||||
<string name="settings_sensor_ant_reset_bike_cadence_sensor"
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+' section, the option to reset
|
||||
an ANT+ bike cadence sensor. Note that ANT+ is a radio standard.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Reset bike cadence
|
||||
</string>
|
||||
<string name="settings_sensor_ant_reset_combined_bike_sensor"
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+' section, the option to reset
|
||||
an ANT+ combined bike cadence and speed sensor. Note that ANT+ is a radio standard.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Reset combined bike
|
||||
</string>
|
||||
<string name="settings_sensor_ant_reset_heart_rate_monitor"
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+' section, the option to reset
|
||||
an ANT+ heart rate monitor. Note that ANT+ is a radio standard.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Reset heart rate
|
||||
</string>
|
||||
<string name="settings_sensor_ant_reset_speed_distance_monitor"
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset
|
||||
translation_description="In the 'Sensor' settings, under the 'ANT+' section, the option to reset
|
||||
an ANT+ stride based speed distance monitor, also known as foot pod. Note that ANT+ is a radio
|
||||
standard.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Reset foot pod
|
||||
</string>
|
||||
<string name="settings_sensor_bluetooth_options"
|
||||
translation_description="In the 'Sensor' settings, the section header to configure the Bluetooth
|
||||
options.
|
||||
<string name="settings_sensor_bluetooth"
|
||||
translation_description="In the 'Sensor' settings, the section to configure the Bluetooth
|
||||
settings.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Bluetooth options
|
||||
Bluetooth
|
||||
</string>
|
||||
<string name="settings_sensor_bluetooth_pairing"
|
||||
translation_description="In the 'Sensor' settings, under the 'Bluetooth options' configurations,
|
||||
the option to pair with a Bluetooth device.
|
||||
translation_description="In the 'Sensor' settings, under the 'Bluetooth' section, the option to
|
||||
pair with a Bluetooth sensor.
|
||||
|
||||
Character limit: ~26 (1 line)">
|
||||
Bluetooth pairing
|
||||
</string>
|
||||
<string name="settings_sensor_bluetooth_pairing_summary"
|
||||
translation_description="In the 'Sensor' settings, under the 'Bluetooth options' configurations,
|
||||
the summary for the 'Bluetooth pairing' option explaining that it will open the Android's
|
||||
Bluetooth settings to pair a device.">
|
||||
Open Android\'s Bluetooth settings to pair a device.
|
||||
translation_description="In the 'Sensor' settings, under the 'Bluetooth' section, the summary
|
||||
for the 'Bluetooth pairing' option explaining that it will open the Android's Bluetooth
|
||||
settings to pair a sensor.">
|
||||
Open Android\'s Bluetooth settings to pair a sensor
|
||||
</string>
|
||||
<string name="settings_sensor_bluetooth_sensor"
|
||||
translation_description="In the 'Sensor' settings, under the 'Bluetooth options' configurations,
|
||||
the dropdown option to pick a Bluetooth sensor.
|
||||
translation_description="In the 'Sensor' settings, under the 'Bluetooth' section, the picker to
|
||||
choose a Bluetooth sensor.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Bluetooth sensor
|
||||
</string>
|
||||
<string name="settings_sensor_bluetooth_sensor_summary"
|
||||
translation_description="In the 'Sensor' settings, under the 'Bluetooth options' configurations,
|
||||
the summary for the 'Bluetooth sensor' dropdown option explaining it is to pick a Bluetooth
|
||||
sensor to connect to.">
|
||||
The Bluetooth sensor to connect to.
|
||||
</string>
|
||||
<string name="settings_sensor_connected"
|
||||
translation_description="The message when connected to a sensor.
|
||||
translation_description="A message when a sensor is connected.
|
||||
|
||||
%1$s: sensor name. E.g., 'polar bluetooth'.">
|
||||
%1$s: sensor name. E.g., 'Polar Bluetooth'.">
|
||||
Connected to %1$s
|
||||
</string>
|
||||
<string name="settings_sensor_not_connected"
|
||||
translation_description="The message when not connected to a sensor.">
|
||||
Not connected.
|
||||
</string>
|
||||
<string name="settings_sensor_type"
|
||||
translation_description="In the 'Sensor' settings, the dropdown option to choose a sensor type.
|
||||
translation_description="In the 'Sensor' settings, the picker to choose a sensor type.
|
||||
|
||||
Character limit: ~23 (1 line)">
|
||||
Sensor type
|
||||
</string>
|
||||
<string name="settings_sensor_type_ant"
|
||||
translation_description="In the 'Sensor' settings, for the 'Sensor type' dropdown, the option to
|
||||
connect to an ANT+ sensor. Note that ANT+ is a radio standard.
|
||||
translation_description="In the 'Sensor' settings, the option in the 'Sensor type' picker to
|
||||
choose an ANT+ sensor. Note that ANT+ is a radio standard.
|
||||
|
||||
Character limit: ~20 (1 line)">
|
||||
ANT+
|
||||
</string>
|
||||
<string name="settings_sensor_type_polar"
|
||||
translation_description="In the 'Sensor' settings, for the 'Sensor type' dropdown, the option to
|
||||
connect to a Polar bluetooth sensor. Do not translate Polar, the company name, but can
|
||||
translate Bluetooth, the radio standard.
|
||||
translation_description="In the 'Sensor' settings, the option in the 'Sensor type' picker to
|
||||
choose a Polar bluetooth sensor. Do not translate Polar, the company name, but can translate
|
||||
Bluetooth, the radio standard.
|
||||
|
||||
Character limit: ~20 (1 line)">
|
||||
Polar Bluetooth
|
||||
</string>
|
||||
<string name="settings_sensor_type_summary"
|
||||
translation_description="In the 'Sensor' settings, the summary for the 'Sensor type' option
|
||||
explaining that it is to configure the type of sensor to connect to.">
|
||||
The type of sensor to connect to.
|
||||
</string>
|
||||
<string name="settings_sensor_type_zephyr"
|
||||
translation_description="In the 'Sensor' settings, for the 'Sensor type' dropdown, the option to
|
||||
connect to a Zephyr bluetooth sensor. Do not translate Zephyr, the company name, but can
|
||||
translate Bluetooth, the radio standard.
|
||||
translation_description="In the 'Sensor' settings, the option in the 'Sensor type' picker to
|
||||
choose a Zephyr bluetooth sensor. Do not translate Zephyr, the company name, but can translate
|
||||
Bluetooth, the radio standard.
|
||||
|
||||
Character limit: ~20 (1 line)">
|
||||
Zephyr Bluetooth
|
||||
@@ -2660,6 +2633,10 @@ limitations under the License.
|
||||
translation_description="In a setting picker, the value to turn off the feature.">
|
||||
Off
|
||||
</string>
|
||||
<string name="value_smallest"
|
||||
translation_description="In a setting picker, the value to use the smallest value.">
|
||||
Smallest
|
||||
</string>
|
||||
<string name="value_smallest_recommended"
|
||||
translation_description="In a setting picker, the value to use the smallest value, also the
|
||||
recommended value.">
|
||||
|
||||
@@ -15,13 +15,17 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/settings_backup" >
|
||||
android:title="@string/settings_backup_reset" >
|
||||
<Preference
|
||||
android:key="@string/settings_backup_now_key"
|
||||
android:key="@string/settings_backup_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_backup_now" />
|
||||
<Preference
|
||||
android:key="@string/settings_backup_restore_key"
|
||||
android:key="@string/settings_restore_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_backup_restore" />
|
||||
<Preference
|
||||
android:key="@string/settings_reset_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_reset" />
|
||||
</PreferenceScreen>
|
||||
@@ -23,7 +23,7 @@ limitations under the License.
|
||||
android:title="@string/settings_sensor_type" />
|
||||
<PreferenceCategory
|
||||
android:key="@string/settings_sensor_bluetooth_key"
|
||||
android:title="@string/settings_sensor_bluetooth_options" >
|
||||
android:title="@string/settings_sensor_bluetooth" >
|
||||
<Preference
|
||||
android:key="@string/settings_sensor_bluetooth_pairing_key"
|
||||
android:persistent="false"
|
||||
@@ -36,7 +36,7 @@ limitations under the License.
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="@string/settings_sensor_ant_key"
|
||||
android:title="@string/settings_sensor_ant_options" >
|
||||
android:title="@string/settings_sensor_type_ant" >
|
||||
<Preference
|
||||
android:key="@string/settings_sensor_ant_reset_heart_rate_monitor_key"
|
||||
android:persistent="false"
|
||||
|
||||
@@ -45,11 +45,7 @@ limitations under the License.
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_sensor" />
|
||||
<Preference
|
||||
android:key="@string/settings_backup_key"
|
||||
android:key="@string/settings_backup_reset_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_backup" />
|
||||
<Preference
|
||||
android:key="@string/settings_reset_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_reset" />
|
||||
android:title="@string/settings_backup_reset" />
|
||||
</PreferenceScreen>
|
||||
@@ -124,7 +124,7 @@ public class TrackEditActivity extends AbstractMyTracksActivity {
|
||||
Button cancel = (Button) findViewById(R.id.track_edit_cancel);
|
||||
if (getIntent().getBooleanExtra(EXTRA_NEW_TRACK, false)) {
|
||||
String trackName = TrackNameUtils.getTrackName(
|
||||
this, -1L, -1L, myTracksProviderUtils.getLastValidTrackPoint(trackId));
|
||||
this, -1L, -1L, myTracksProviderUtils.getFirstValidTrackPoint(trackId));
|
||||
if (trackName != null) {
|
||||
name.setText(trackName);
|
||||
}
|
||||
|
||||
+31
-79
@@ -52,7 +52,7 @@ public class AbstractSettingsActivity extends PreferenceActivity {
|
||||
preferenceManager.setSharedPreferencesMode(Context.MODE_PRIVATE);
|
||||
|
||||
// Set up automatic preferences backup
|
||||
backupPreferencesListener = new BackupPreferencesListener(this);
|
||||
backupPreferencesListener = new BackupPreferencesListener(this);
|
||||
|
||||
preferenceManager.getSharedPreferences()
|
||||
.registerOnSharedPreferenceChangeListener(backupPreferencesListener);
|
||||
@@ -77,114 +77,66 @@ public class AbstractSettingsActivity extends PreferenceActivity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a preference.
|
||||
* Configures a list preference.
|
||||
*
|
||||
* @param preference the preference
|
||||
* @param options the list of displayed options
|
||||
* @param values the list of stored values
|
||||
* @param summaryId the summary id
|
||||
* @param value the stored value
|
||||
* @param listPreference the list preference
|
||||
* @param summary the summary array
|
||||
* @param options the options array
|
||||
* @param values the values array
|
||||
* @param value the value
|
||||
* @param listener optional listener
|
||||
*/
|
||||
protected void configurePreference(final Preference preference, final String[] options,
|
||||
final String[] values, final int summaryId, String value) {
|
||||
configurePreference(preference, options, values, summaryId, value, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a preference.
|
||||
*
|
||||
* @param preference the preference
|
||||
* @param options the list of displayed options
|
||||
* @param values the list of stored values
|
||||
* @param summaryId the summary id
|
||||
* @param value the stored value
|
||||
* @param listener listener to invoke
|
||||
*/
|
||||
protected void configurePreference(final Preference preference, final String[] options,
|
||||
final String[] values, final int summaryId, String value,
|
||||
protected void configureListPreference(ListPreference listPreference, final String[] summary,
|
||||
final String[] options, final String[] values, String value,
|
||||
final OnPreferenceChangeListener listener) {
|
||||
if (options != null) {
|
||||
((ListPreference) preference).setEntries(options);
|
||||
}
|
||||
if (values != null) {
|
||||
((ListPreference) preference).setEntryValues(values);
|
||||
}
|
||||
preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
listPreference.setEntryValues(values);
|
||||
listPreference.setEntries(options);
|
||||
listPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
||||
updatePreferenceSummary(pref, options, values, summaryId, (String) newValue);
|
||||
updatePreferenceSummary(pref, summary, values, (String) newValue);
|
||||
if (listener != null) {
|
||||
listener.onPreferenceChange(pref, newValue);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
updatePreferenceSummary(preference, options, values, summaryId, value);
|
||||
updatePreferenceSummary(listPreference, summary, values, value);
|
||||
if (listener != null) {
|
||||
listener.onPreferenceChange(preference, value);
|
||||
listener.onPreferenceChange(listPreference, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected void configurePreference(final Preference preference, final String[] options,
|
||||
final String[] values, String value, final OnPreferenceChangeListener listener) {
|
||||
if (options != null) {
|
||||
((ListPreference) preference).setEntries(options);
|
||||
}
|
||||
if (values != null) {
|
||||
((ListPreference) preference).setEntryValues(values);
|
||||
}
|
||||
preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
||||
if (listener != null) {
|
||||
listener.onPreferenceChange(pref, newValue);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (listener != null) {
|
||||
listener.onPreferenceChange(preference, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a preference when a stored value changes.
|
||||
* Update the preference summary.
|
||||
*
|
||||
* @param preference the preference
|
||||
* @param options the list of displayed options
|
||||
* @param values the list of stored values
|
||||
* @param summaryId the summary id
|
||||
* @param value the stored value
|
||||
* @param summary the summary array
|
||||
* @param values the values array
|
||||
* @param value the value
|
||||
*/
|
||||
private void updatePreferenceSummary(
|
||||
Preference preference, String[] options, String[] values, int summaryId, String value) {
|
||||
String summary = getString(summaryId);
|
||||
String option;
|
||||
if (options != null && values != null) {
|
||||
option = getOption(options, values, value);
|
||||
if (option == null) {
|
||||
option = getString(R.string.value_unknown);
|
||||
}
|
||||
Preference preference, String[] summary, String[] values, String value) {
|
||||
int index = getIndex(values, value);
|
||||
if (index == -1) {
|
||||
preference.setSummary(R.string.value_unknown);
|
||||
} else {
|
||||
option = value != null && value.length() != 0 ? value : getString(R.string.value_unknown);
|
||||
preference.setSummary(summary[index]);
|
||||
}
|
||||
summary += "\n" + option;
|
||||
preference.setSummary(summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display option for a stored value.
|
||||
* Get the array index for a value.
|
||||
*
|
||||
* @param options the list of the display options
|
||||
* @param values the list of the stored values
|
||||
* @param value the store value
|
||||
* @param values the array
|
||||
* @param value the value
|
||||
*/
|
||||
private String getOption(String[] options, String[] values, String value) {
|
||||
private int getIndex(String[] values, String value) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (value.equals(values[i])) {
|
||||
return options[i];
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
+94
-35
@@ -33,19 +33,24 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* An activity for accessing the backup settings.
|
||||
* An activity for accessing the backup and reset settings.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class BackupSettingsActivity extends AbstractSettingsActivity {
|
||||
public class BackupResetSettingsActivity extends AbstractSettingsActivity {
|
||||
|
||||
private static final String TAG = BackupResetSettingsActivity.class.getSimpleName();
|
||||
private static final int DIALOG_CONFIRM_RESTORE_ID = 0;
|
||||
private static final int DIALOG_CONFIRM_RESET_ID = 1;
|
||||
|
||||
private SharedPreferences sharedPreferences;
|
||||
private Preference backupPreference;
|
||||
private Preference restorePreference;
|
||||
private Preference restoreNowPreference;
|
||||
private Preference resetPreference;
|
||||
|
||||
private long recordingTrackId = PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
|
||||
|
||||
@@ -57,12 +62,10 @@ public class BackupSettingsActivity extends AbstractSettingsActivity {
|
||||
sharedPreferenceChangeListener = new OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||
if (key == null || key.equals(PreferencesUtils.getKey(
|
||||
BackupSettingsActivity.this, R.string.recording_track_id_key))) {
|
||||
if (key != null && key.equals(PreferencesUtils.getKey(
|
||||
BackupResetSettingsActivity.this, R.string.recording_track_id_key))) {
|
||||
recordingTrackId = PreferencesUtils.getLong(
|
||||
BackupSettingsActivity.this, R.string.recording_track_id_key);
|
||||
}
|
||||
if (key != null) {
|
||||
BackupResetSettingsActivity.this, R.string.recording_track_id_key);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -77,60 +80,81 @@ public class BackupSettingsActivity extends AbstractSettingsActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R.xml.backup_reset_settings);
|
||||
|
||||
sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
|
||||
addPreferencesFromResource(R.xml.backup_settings);
|
||||
backupPreference = findPreference(getString(R.string.settings_backup_now_key));
|
||||
backupPreference = findPreference(getString(R.string.settings_backup_key));
|
||||
backupPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent intent = IntentUtils.newIntent(BackupSettingsActivity.this, BackupActivity.class);
|
||||
Intent intent = IntentUtils.newIntent(
|
||||
BackupResetSettingsActivity.this, BackupActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
restorePreference = findPreference(getString(R.string.settings_backup_restore_key));
|
||||
restorePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
restoreNowPreference = findPreference(getString(R.string.settings_restore_key));
|
||||
restoreNowPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
showDialog(DIALOG_CONFIRM_RESTORE_ID);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
resetPreference = findPreference(getString(R.string.settings_reset_key));
|
||||
resetPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference arg0) {
|
||||
showDialog(DIALOG_CONFIRM_RESET_ID);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
if (id != DIALOG_CONFIRM_RESTORE_ID) {
|
||||
return null;
|
||||
Dialog dialog;
|
||||
switch (id) {
|
||||
case DIALOG_CONFIRM_RESTORE_ID:
|
||||
dialog = DialogUtils.createConfirmationDialog(this,
|
||||
R.string.settings_backup_restore_confirm_message,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface d, int which) {
|
||||
Intent intent = IntentUtils.newIntent(
|
||||
BackupResetSettingsActivity.this, RestoreChooserActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case DIALOG_CONFIRM_RESET_ID:
|
||||
dialog = DialogUtils.createConfirmationDialog(
|
||||
this, R.string.settings_reset_confirm_message, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface d, int button) {
|
||||
onResetPreferencesConfirmed();
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
dialog = null;
|
||||
}
|
||||
return DialogUtils.createConfirmationDialog(this,
|
||||
R.string.settings_backup_restore_confirm_message, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = IntentUtils.newIntent(
|
||||
BackupSettingsActivity.this, RestoreChooserActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||
sharedPreferenceChangeListener.onSharedPreferenceChanged(null, null);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||
recordingTrackId = PreferencesUtils.getLong(this, R.string.recording_track_id_key);
|
||||
updateUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
sharedPreferences.unregisterOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||
}
|
||||
|
||||
@@ -140,10 +164,45 @@ public class BackupSettingsActivity extends AbstractSettingsActivity {
|
||||
private void updateUi() {
|
||||
boolean isRecording = recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
|
||||
backupPreference.setEnabled(!isRecording);
|
||||
restorePreference.setEnabled(!isRecording);
|
||||
backupPreference.setSummary(
|
||||
isRecording ? R.string.settings_not_while_recording : R.string.settings_backup_now_summary);
|
||||
restorePreference.setSummary(isRecording ? R.string.settings_not_while_recording
|
||||
|
||||
restoreNowPreference.setEnabled(!isRecording);
|
||||
restoreNowPreference.setSummary(isRecording ? R.string.settings_not_while_recording
|
||||
: R.string.settings_backup_restore_summary);
|
||||
|
||||
resetPreference.setEnabled(!isRecording);
|
||||
resetPreference.setSummary(
|
||||
isRecording ? R.string.settings_not_while_recording : R.string.settings_reset_summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback when the user confirms resetting all settings.
|
||||
*/
|
||||
private void onResetPreferencesConfirmed() {
|
||||
// Change preferences in a separate thread
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i(TAG, "Resetting all settings");
|
||||
|
||||
// Actually wipe preferences and save synchronously
|
||||
sharedPreferences.edit().clear().commit();
|
||||
|
||||
// Give UI feedback in the UI thread
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(
|
||||
BackupResetSettingsActivity.this, R.string.settings_reset_done, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
// Restart the settings activity so all changes are loaded
|
||||
Intent intent = getIntent()
|
||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,6 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
||||
|
||||
private static final String TAG = MapSettingsActivity.class.getSimpleName();
|
||||
|
||||
private ListPreference trackColorModePreference;
|
||||
private EditTextPreference slowPreference;
|
||||
private EditTextPreference mediumPreference;
|
||||
private EditTextPreference percentagePreference;
|
||||
@@ -52,8 +51,6 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R.xml.map_settings);
|
||||
|
||||
trackColorModePreference = (ListPreference) findPreference(
|
||||
getString(R.string.track_color_mode_key));
|
||||
slowPreference = (EditTextPreference) findPreference(
|
||||
getString(R.string.settings_map_slow_display_key));
|
||||
mediumPreference = (EditTextPreference) findPreference(
|
||||
@@ -79,6 +76,8 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
||||
* Configures the track color mode preference.
|
||||
*/
|
||||
private void configTrackColorModePerference() {
|
||||
ListPreference preference = (ListPreference) findPreference(
|
||||
getString(R.string.track_color_mode_key));
|
||||
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
@@ -86,11 +85,12 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
String trackColorMode = PreferencesUtils.getString(
|
||||
String value = PreferencesUtils.getString(
|
||||
this, R.string.track_color_mode_key, PreferencesUtils.TRACK_COLOR_MODE_DEFAULT);
|
||||
configurePreference(trackColorModePreference,
|
||||
getResources().getStringArray(R.array.track_color_mode_options),
|
||||
getResources().getStringArray(R.array.track_color_mode_values), trackColorMode, listener);
|
||||
String[] values = getResources().getStringArray(R.array.track_color_mode_values);
|
||||
String[] options = getResources().getStringArray(R.array.track_color_mode_options);
|
||||
String[] summary = getResources().getStringArray(R.array.track_color_mode_summary);
|
||||
configureListPreference(preference, summary, options, values, value, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,13 +204,6 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
|
||||
getString(R.string.settings_map_track_color_mode_fixed_value));
|
||||
boolean isDynamicValue = trackColorMode.equals(
|
||||
getString(R.string.settings_map_track_color_mode_dynamic_value));
|
||||
if (isDynamicValue) {
|
||||
trackColorModePreference.setSummary(R.string.settings_map_track_color_mode_dynamic_summary);
|
||||
} else if (isFixedValue) {
|
||||
trackColorModePreference.setSummary(R.string.settings_map_track_color_mode_fixed_summary);
|
||||
} else {
|
||||
trackColorModePreference.setSummary(R.string.settings_map_track_color_mode_single);
|
||||
}
|
||||
slowPreference.setEnabled(isFixedValue);
|
||||
mediumPreference.setEnabled(isFixedValue);
|
||||
percentagePreference.setEnabled(isDynamicValue);
|
||||
|
||||
+181
-120
@@ -41,178 +41,224 @@ 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));
|
||||
configurePreference(voiceFrequencyListPreference,
|
||||
StringUtils.getFrequencyOptions(this, metricUnits),
|
||||
getResources().getStringArray(R.array.frequency_values),
|
||||
R.string.settings_recording_voice_frequency_summary, String.valueOf(voiceFrequencyValue));
|
||||
configFrequencyPreference(R.string.voice_frequency_key,
|
||||
PreferencesUtils.VOICE_FREQUENCY_DEFAULT, R.array.frequency_values, metricUnits);
|
||||
configFrequencyPreference(R.string.split_frequency_key,
|
||||
PreferencesUtils.SPLIT_FREQUENCY_DEFAULT, R.array.frequency_values, metricUnits);
|
||||
configTrackName();
|
||||
configDefaultActivity();
|
||||
configListPreference(R.string.min_recording_interval_key,
|
||||
PreferencesUtils.MIN_RECORDING_INTERVAL_DEFAULT, R.array.min_recording_interval_values,
|
||||
metricUnits);
|
||||
configListPreference(R.string.min_recording_distance_key,
|
||||
PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT, R.array.min_recording_distance_values,
|
||||
metricUnits);
|
||||
configListPreference(R.string.max_recording_distance_key,
|
||||
PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT, R.array.max_recording_distance_values,
|
||||
metricUnits);
|
||||
configListPreference(R.string.min_required_accuracy_key,
|
||||
PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT, R.array.min_required_accuracy_values,
|
||||
metricUnits);
|
||||
configListPreference(R.string.auto_resume_track_timeout_key,
|
||||
PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT,
|
||||
R.array.auto_resume_track_timeout_values, metricUnits);
|
||||
}
|
||||
|
||||
int splitFrequencyValue = PreferencesUtils.getInt(
|
||||
this, R.string.split_frequency_key, PreferencesUtils.SPLIT_FREQUENCY_DEFAULT);
|
||||
ListPreference splitFrequencyListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.split_frequency_key));
|
||||
configurePreference(splitFrequencyListPreference,
|
||||
StringUtils.getFrequencyOptions(this, metricUnits),
|
||||
getResources().getStringArray(R.array.frequency_values),
|
||||
R.string.settings_recording_split_frequency_summary, String.valueOf(splitFrequencyValue));
|
||||
private void configFrequencyPreference(
|
||||
int key, int defaultValue, int valueArray, boolean metricUnits) {
|
||||
ListPreference preference = (ListPreference) findPreference(getString(key));
|
||||
int value = PreferencesUtils.getInt(this, key, defaultValue);
|
||||
String[] values = getResources().getStringArray(valueArray);
|
||||
String[] options = StringUtils.getFrequencyOptions(this, metricUnits);
|
||||
configureListPreference(preference, options, options, values, String.valueOf(value), null);
|
||||
}
|
||||
|
||||
String trackNameValue = PreferencesUtils.getString(
|
||||
private void configTrackName() {
|
||||
ListPreference preference = (ListPreference) findPreference(getString(R.string.track_name_key));
|
||||
String value = 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[] values = getResources().getStringArray(R.array.track_name_values);
|
||||
String[] options = getResources().getStringArray(R.array.track_name_options);
|
||||
configureListPreference(preference, options, options, values, value, null);
|
||||
}
|
||||
|
||||
String defaultActivityValue = PreferencesUtils.getString(
|
||||
private void configDefaultActivity() {
|
||||
Preference preference = findPreference(getString(R.string.default_activity_key));
|
||||
String value = 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);
|
||||
preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
||||
String stringValue = (String) newValue;
|
||||
pref.setSummary(stringValue != null
|
||||
&& !stringValue.equals(PreferencesUtils.DEFAULT_ACTIVITY_DEFAULT) ? stringValue
|
||||
: getString(R.string.value_unknown));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
preference.setSummary(
|
||||
value != null && !value.equals(PreferencesUtils.DEFAULT_ACTIVITY_DEFAULT) ? value
|
||||
: getString(R.string.value_unknown));
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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 configListPreference(
|
||||
int key, int defaultValue, int valueArray, boolean metricUnits) {
|
||||
ListPreference preference = (ListPreference) findPreference(getString(key));
|
||||
int value = PreferencesUtils.getInt(this, key, defaultValue);
|
||||
String[] values = getResources().getStringArray(valueArray);
|
||||
String[] options = new String[values.length];
|
||||
String[] summary = new String[values.length];
|
||||
switch (key) {
|
||||
case R.string.min_recording_interval_key:
|
||||
setMinRecordingIntervalSummaryAndOptions(summary, options, values);
|
||||
break;
|
||||
case R.string.min_recording_distance_key:
|
||||
setMinRecordingDistanceSummaryAndOptions(summary, options, values, metricUnits);
|
||||
break;
|
||||
case R.string.max_recording_distance_key:
|
||||
setMaxRecordingDistanceSummaryAndOptions(summary, options, values, metricUnits);
|
||||
break;
|
||||
case R.string.min_required_accuracy_key:
|
||||
setMinRequiredAccuracySummaryAndOptions(summary, options, values, metricUnits);
|
||||
break;
|
||||
case R.string.auto_resume_track_timeout_key:
|
||||
setAutoResumeTrackTimeoutSummaryAndOptions(summary, options, values);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
configureListPreference(preference, summary, options, values, String.valueOf(value), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min recording interval display options.
|
||||
* Sets the min recording interval summary and options.
|
||||
*
|
||||
* @param summary the summary
|
||||
* @param options the options
|
||||
* @param values the values
|
||||
*/
|
||||
private String[] getMinRecordingIntervalOptions() {
|
||||
String[] values = getResources().getStringArray(R.array.min_recording_interval_values);
|
||||
String[] options = new String[values.length];
|
||||
private void setMinRecordingIntervalSummaryAndOptions(
|
||||
String[] summary, String[] options, String[] values) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE:
|
||||
options[i] = getString(R.string.value_adapt_battery_life);
|
||||
summary[i] = options[i];
|
||||
break;
|
||||
case PreferencesUtils.MIN_RECORDING_INTERVAL_ADAPT_ACCURACY:
|
||||
options[i] = getString(R.string.value_adapt_accuracy);
|
||||
summary[i] = options[i];
|
||||
break;
|
||||
case PreferencesUtils.MIN_RECORDING_INTERVAL_DEFAULT:
|
||||
options[i] = getString(R.string.value_smallest_recommended);
|
||||
summary[i] = getString(R.string.value_smallest);
|
||||
break;
|
||||
default:
|
||||
options[i] = value < 60 ? getString(R.string.value_integer_second, value)
|
||||
: getString(R.string.value_integer_minute, value / 60);
|
||||
summary[i] = getString(
|
||||
R.string.settings_recording_location_frequency_summary, options[i]);
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min recording distance display options.
|
||||
* Sets the min recording distance summary and options.
|
||||
*
|
||||
* @param metricUnits true to display metric units
|
||||
* @param summary the summary
|
||||
* @param options the options
|
||||
* @param values the values
|
||||
* @param metricUnits true for metric units
|
||||
*/
|
||||
private String[] getMinRecordingDistanceOptions(boolean metricUnits) {
|
||||
String[] values = getResources().getStringArray(R.array.min_recording_distance_values);
|
||||
String[] options = new String[values.length];
|
||||
private void setMinRecordingDistanceSummaryAndOptions(
|
||||
String[] summary, String[] options, String[] values, boolean metricUnits) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
String displayValue;
|
||||
if (metricUnits) {
|
||||
options[i] = getString(
|
||||
value == PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_meter_recommended
|
||||
: R.string.value_integer_meter, value);
|
||||
displayValue = getString(R.string.value_integer_meter, value);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} 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);
|
||||
displayValue = getString(R.string.value_integer_feet, feet);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MIN_RECORDING_DISTANCE_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
}
|
||||
}
|
||||
summary[i] = getString(R.string.settings_recording_location_frequency_summary, displayValue);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max recording distance display options.
|
||||
* Sets the max recording distance summary and options.
|
||||
*
|
||||
* @param metricUnits true to display metric units
|
||||
* @param summary the summary
|
||||
* @param options the options
|
||||
* @param values the values
|
||||
* @param metricUnits true for metric units
|
||||
*/
|
||||
private String[] getMaxRecordingDistanceOptions(boolean metricUnits) {
|
||||
String[] values = getResources().getStringArray(R.array.max_recording_distance_values);
|
||||
String[] options = new String[values.length];
|
||||
private void setMaxRecordingDistanceSummaryAndOptions(
|
||||
String[] summary, String[] options, String[] values, boolean metricUnits) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
String displayValue;
|
||||
if (metricUnits) {
|
||||
options[i] = getString(
|
||||
value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT ? R.string.value_integer_meter_recommended
|
||||
: R.string.value_integer_meter, value);
|
||||
displayValue = getString(R.string.value_integer_meter, value);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} 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);
|
||||
displayValue = getString(R.string.value_integer_feet, feet);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} else {
|
||||
double mile = feet * UnitConversions.FT_TO_MI;
|
||||
options[i] = getString(R.string.value_float_mile, mile);
|
||||
displayValue = getString(R.string.value_float_mile, mile);
|
||||
options[i] = displayValue;
|
||||
}
|
||||
}
|
||||
summary[i] = getString(
|
||||
R.string.settings_recording_max_recording_distance_summary, displayValue);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min required accuracy display options.
|
||||
* Sets the min required accuracy summary and options.
|
||||
*
|
||||
* @param metricUnits true to display metric units
|
||||
* @param summary the summary
|
||||
* @param options the options
|
||||
* @param values the values
|
||||
* @param metricUnits true for metric units
|
||||
*/
|
||||
private String[] getMinRequiredAccuracyOptions(boolean metricUnits) {
|
||||
String[] values = getResources().getStringArray(R.array.min_required_accuracy_values);
|
||||
String[] options = new String[values.length];
|
||||
private void setMinRequiredAccuracySummaryAndOptions(
|
||||
String[] summary, String[] options, String[] values, boolean metricUnits) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
String displayValue;
|
||||
if (metricUnits) {
|
||||
displayValue = getString(R.string.value_integer_meter, value);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||
@@ -224,11 +270,12 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
options[i] = getString(R.string.value_integer_meter_poor_gps, value);
|
||||
break;
|
||||
default:
|
||||
options[i] = getString(R.string.value_integer_meter, value);
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} else {
|
||||
int feet = (int) (value * UnitConversions.M_TO_FT);
|
||||
if (feet < 2000) {
|
||||
displayValue = getString(R.string.value_integer_feet, feet);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||
@@ -237,38 +284,52 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
|
||||
options[i] = getString(R.string.value_integer_feet_excellent_gps, feet);
|
||||
break;
|
||||
default:
|
||||
options[i] = getString(R.string.value_integer_feet, feet);
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} 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);
|
||||
displayValue = getString(R.string.value_float_mile, mile);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MIN_REQUIRED_ACCURACY_POOR:
|
||||
options[i] = getString(R.string.value_float_mile_poor_gps, mile);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
summary[i] = getString(
|
||||
R.string.settings_recording_min_required_accuracy_summary, displayValue);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the auto resume track timeout display options.
|
||||
* Sets the auto resume track timeout summary and options.
|
||||
*
|
||||
* @param summary the summary
|
||||
* @param options the options
|
||||
* @param values the values
|
||||
*/
|
||||
private String[] getAutoResumeTrackTimeoutOptions() {
|
||||
String[] values = getResources().getStringArray(R.array.auto_resume_track_timeout_values);
|
||||
String[] options = new String[values.length];
|
||||
private void setAutoResumeTrackTimeoutSummaryAndOptions(
|
||||
String[] summary, String[] options, String[] values) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
switch (value) {
|
||||
case PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_NEVER:
|
||||
options[i] = getString(R.string.value_never);
|
||||
summary[i] = getString(
|
||||
R.string.settings_recording_auto_resume_track_timeout_never_summary);
|
||||
break;
|
||||
case PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_ALWAYS:
|
||||
options[i] = getString(R.string.value_always);
|
||||
summary[i] = getString(
|
||||
R.string.settings_recording_auto_resume_track_timeout_always_summary);
|
||||
break;
|
||||
default:
|
||||
options[i] = getString(R.string.value_integer_minute, value);
|
||||
summary[i] = getString(
|
||||
R.string.settings_recording_auto_resume_track_timeout_summary, options[i]);
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
+45
-34
@@ -49,23 +49,8 @@ public class SensorSettingsActivity extends AbstractSettingsActivity {
|
||||
addPreferencesFromResource(R.xml.sensor_settings);
|
||||
|
||||
boolean hasAntSupport = AntInterface.hasAntSupport(this);
|
||||
ListPreference sensorTypeListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.sensor_type_key));
|
||||
String[] sensorTypeOptions = getResources().getStringArray(
|
||||
hasAntSupport ? R.array.sensor_type_all_options : R.array.sensor_type_bluetooth_options);
|
||||
String[] sensorTypeValues = getResources().getStringArray(
|
||||
hasAntSupport ? R.array.sensor_type_all_values : R.array.sensor_type_bluetooth_values);
|
||||
String sensorTypeValue = PreferencesUtils.getString(
|
||||
this, R.string.sensor_type_key, PreferencesUtils.SENSOR_TYPE_DEFAULT);
|
||||
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
updateUiBySensorType((String) newValue);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
configurePreference(sensorTypeListPreference, sensorTypeOptions, sensorTypeValues,
|
||||
R.string.settings_sensor_type_summary, sensorTypeValue, listener);
|
||||
|
||||
configSensorType(hasAntSupport);
|
||||
|
||||
findPreference(getString(R.string.settings_sensor_bluetooth_pairing_key))
|
||||
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@@ -84,6 +69,31 @@ public class SensorSettingsActivity extends AbstractSettingsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void configSensorType(boolean hasAntSupport) {
|
||||
ListPreference preference = (ListPreference) findPreference(
|
||||
getString(R.string.sensor_type_key));
|
||||
String value = PreferencesUtils.getString(
|
||||
this, R.string.sensor_type_key, PreferencesUtils.SENSOR_TYPE_DEFAULT);
|
||||
String[] options = getResources().getStringArray(
|
||||
hasAntSupport ? R.array.sensor_type_all_options : R.array.sensor_type_bluetooth_options);
|
||||
String[] values = getResources().getStringArray(
|
||||
hasAntSupport ? R.array.sensor_type_all_values : R.array.sensor_type_bluetooth_values);
|
||||
|
||||
if (!hasAntSupport && value.equals(R.string.sensor_type_value_ant)) {
|
||||
value = PreferencesUtils.SENSOR_TYPE_DEFAULT;
|
||||
PreferencesUtils.setString(this, R.string.sensor_type_key, value);
|
||||
}
|
||||
|
||||
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
||||
updateUiBySensorType((String) newValue);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
configureListPreference(preference, options, options, values, value, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the UI based on the sensor type.
|
||||
*
|
||||
@@ -120,7 +130,7 @@ public class SensorSettingsActivity extends AbstractSettingsActivity {
|
||||
preference.setEnabled(enabled);
|
||||
int deviceId = PreferencesUtils.getInt(this, valueKey, AntSensorManager.WILDCARD);
|
||||
if (deviceId == AntSensorManager.WILDCARD) {
|
||||
preference.setSummary(R.string.settings_sensor_not_connected);
|
||||
preference.setSummary(R.string.settings_sensor_ant_not_connected);
|
||||
} else {
|
||||
preference.setSummary(getString(R.string.settings_sensor_ant_paired, deviceId));
|
||||
}
|
||||
@@ -128,7 +138,7 @@ public class SensorSettingsActivity extends AbstractSettingsActivity {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference pref) {
|
||||
PreferencesUtils.setInt(SensorSettingsActivity.this, valueKey, AntSensorManager.WILDCARD);
|
||||
pref.setSummary(R.string.settings_sensor_not_connected);
|
||||
pref.setSummary(R.string.settings_sensor_ant_not_connected);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -138,14 +148,20 @@ public class SensorSettingsActivity extends AbstractSettingsActivity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateBluetoothSensorListPreference();
|
||||
|
||||
// Update each time in case the list of bluetooth sensors has changed
|
||||
configBluetoothSensor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the bluetooth sensor list preference.
|
||||
* Configures the bluetooth sensor.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void updateBluetoothSensorListPreference() {
|
||||
private void configBluetoothSensor() {
|
||||
ListPreference preference = (ListPreference) findPreference(
|
||||
getString(R.string.bluetooth_sensor_key));
|
||||
String value = PreferencesUtils.getString(
|
||||
this, R.string.bluetooth_sensor_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT);
|
||||
List<String> optionsList = new ArrayList<String>();
|
||||
List<String> valuesList = new ArrayList<String>();
|
||||
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
@@ -155,22 +171,17 @@ public class SensorSettingsActivity extends AbstractSettingsActivity {
|
||||
String[] options = optionsList.toArray(new String[optionsList.size()]);
|
||||
String[] values = valuesList.toArray(new String[valuesList.size()]);
|
||||
|
||||
String bluetoothSensorValue = PreferencesUtils.getString(
|
||||
this, R.string.bluetooth_sensor_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT);
|
||||
ListPreference bluetoothSensorListPreference = (ListPreference) findPreference(
|
||||
getString(R.string.bluetooth_sensor_key));
|
||||
if (valuesList.size() == 1) {
|
||||
if (!valuesList.get(0).equals(bluetoothSensorValue)) {
|
||||
bluetoothSensorValue = valuesList.get(0);
|
||||
PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, bluetoothSensorValue);
|
||||
if (!valuesList.get(0).equals(value)) {
|
||||
value = valuesList.get(0);
|
||||
PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, value);
|
||||
}
|
||||
} else {
|
||||
if (!valuesList.contains(bluetoothSensorValue)) {
|
||||
bluetoothSensorValue = PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT;
|
||||
PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, bluetoothSensorValue);
|
||||
if (!valuesList.contains(value)) {
|
||||
value = PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT;
|
||||
PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, value);
|
||||
}
|
||||
}
|
||||
configurePreference(bluetoothSensorListPreference, options, values,
|
||||
R.string.settings_sensor_bluetooth_sensor_summary, bluetoothSensorValue);
|
||||
configureListPreference(preference, options, options, values, value, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,22 +16,13 @@
|
||||
|
||||
package com.google.android.apps.mytracks.settings;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* An activity for accessing settings.
|
||||
@@ -41,11 +32,6 @@ import android.widget.Toast;
|
||||
*/
|
||||
public class SettingsActivity extends AbstractSettingsActivity {
|
||||
|
||||
private static final String TAG = SettingsActivity.class.getSimpleName();
|
||||
private static final int DIALOG_CONFIRM_RESET_ID = 0;
|
||||
|
||||
private Preference resetPreference;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle) {
|
||||
@@ -59,16 +45,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
||||
configPreference(R.string.settings_recording_key, RecordingSettingsActivity.class);
|
||||
configPreference(R.string.settings_sharing_key, SharingSettingsActivity.class);
|
||||
configPreference(R.string.settings_sensor_key, SensorSettingsActivity.class);
|
||||
configPreference(R.string.settings_backup_key, BackupSettingsActivity.class);
|
||||
|
||||
resetPreference = findPreference(getString(R.string.settings_reset_key));
|
||||
resetPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference arg0) {
|
||||
showDialog(DIALOG_CONFIRM_RESET_ID);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
configPreference(R.string.settings_backup_reset_key, BackupResetSettingsActivity.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,58 +65,4 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
boolean isRecording = PreferencesUtils.getLong(this, R.string.recording_track_id_key)
|
||||
!= PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
|
||||
resetPreference.setEnabled(!isRecording);
|
||||
resetPreference.setSummary(isRecording ? R.string.settings_not_while_recording
|
||||
: R.string.settings_reset_summary);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
if (id != DIALOG_CONFIRM_RESET_ID) {
|
||||
return null;
|
||||
}
|
||||
return DialogUtils.createConfirmationDialog(
|
||||
this, R.string.settings_reset_confirm_message, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int button) {
|
||||
onResetPreferencesConfirmed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback when the user confirms resetting all settings.
|
||||
*/
|
||||
private void onResetPreferencesConfirmed() {
|
||||
// Change preferences in a separate thread
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i(TAG, "Resetting all settings");
|
||||
SharedPreferences sharedPreferences = getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
// Actually wipe preferences and save synchronously
|
||||
sharedPreferences.edit().clear().commit();
|
||||
|
||||
// Give UI feedback in the UI thread
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(SettingsActivity.this, R.string.settings_reset_done, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
// Restart the settings activity so all changes are loaded
|
||||
Intent intent = getIntent()
|
||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.location.Location;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Utilities for track name.
|
||||
@@ -65,7 +66,7 @@ public class TrackNameUtils {
|
||||
if (startTime == -1L) {
|
||||
return null;
|
||||
}
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(ISO_8601_FORMAT);
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(ISO_8601_FORMAT, Locale.US);
|
||||
return dateFormat.format(startTime);
|
||||
} else if (trackName.equals(
|
||||
context.getString(R.string.settings_recording_track_name_number_value))) {
|
||||
|
||||
@@ -227,6 +227,13 @@ public interface MyTracksProviderUtils {
|
||||
*/
|
||||
public long getLastTrackPointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the first valid location for a track. Returns null if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public Location getFirstValidTrackPoint(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last valid location for a track. Returns null if it doesn't exist.
|
||||
*
|
||||
|
||||
+12
@@ -748,6 +748,18 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
return -1L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getFirstValidTrackPoint(long trackId) {
|
||||
if (trackId < 0) {
|
||||
return null;
|
||||
}
|
||||
String selection = TrackPointsColumns._ID + "=(select min(" + TrackPointsColumns._ID + ") from "
|
||||
+ TrackPointsColumns.TABLE_NAME + " WHERE " + TrackPointsColumns.TRACKID + "=? AND "
|
||||
+ TrackPointsColumns.LATITUDE + "<=" + MAX_LATITUDE + ")";
|
||||
String[] selectionArgs = new String[] { Long.toString(trackId) };
|
||||
return findTrackPointBy(selection, selectionArgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLastValidTrackPoint(long trackId) {
|
||||
if (trackId < 0) {
|
||||
|
||||
Reference in New Issue
Block a user