Update MapSettings according to settings style guide

This commit is contained in:
Jimmy Shih
2013-01-16 15:15:59 -08:00
parent 8b92bd7367
commit e1e11586b0
12 changed files with 320 additions and 283 deletions
+6 -4
View File
@@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Keys for persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. -->
<string name="allow_access_key">allowAccess</string>
<string name="ant_bike_cadence_sensor_id_key">antBikeCadenceSensorId</string>
@@ -30,9 +31,9 @@ limitations under the License.
<string name="chart_show_power_key">chartShowPower</string>
<string name="chart_show_speed_key">chartShowSpeed</string>
<string name="default_activity_key">defaultActivity</string>
<string name="google_settings_account_key">googleSettingsAccount</string>
<string name="google_settings_drive_sync_key">googleSettingsDriveSync</string>
<string name="google_settings_maps_public_key">googleSettingsMapsPublic</string>
<string name="default_map_public_key">defaultMapPublic</string>
<string name="drive_sync_key">driveSync</string>
<string name="google_account_key">googleAccount</string>
<string name="max_recording_distance_key">maxRecordingDistance</string>
<string name="metric_units_key">metricUnits</string>
<string name="min_recording_distance_key">minRecordingDistance</string>
@@ -69,11 +70,11 @@ limitations under the License.
<string name="selected_track_id_key">selectedTrackId</string>
<!-- Keys for non-persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. -->
<string name="google_settings_key">googleSettings</string>
<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_chart_key">settingsChart</string>
<string name="settings_google_key">settingsGoogle</string>
<string name="settings_map_key">settingsMap</string>
<string name="settings_map_medium_display_key">settingsMapMediumDisplay</string>
<string name="settings_map_percentage_display_key">settingsMapPercentageDisplay</string>
@@ -91,4 +92,5 @@ limitations under the License.
<string name="settings_sensor_root_key">settingsSensorRoot</string>
<string name="settings_sharing_key">settingsSharing</string>
<string name="settings_stats_key">settingsStats</string>
</resources>
+132 -128
View File
@@ -378,7 +378,7 @@ limitations under the License.
<string name="description_activity_type"
translation_description="Activity type description.
%1$s activity type. E.g., 'hiking'">
%1$s activity type. E.g., 'hiking'.">
Activity type: %1$s
</string>
<string name="description_average_moving_pace"
@@ -493,7 +493,7 @@ limitations under the License.
<string name="description_moving_time"
translation_description="Moving time description.
%1$s time. E.g., '1:08:59'">
%1$s time. E.g., '1:08:59'.">
Moving time: %1$s
</string>
<string name="description_pace_imperial"
@@ -507,7 +507,7 @@ limitations under the License.
<string name="description_recorded_time"
translation_description="Recorded time description.
%1$s time. E.g, '2/15/2012 1:40 PM'">
%1$s time. E.g., '2/15/2012 1:40 PM'.">
Recorded: %1$s
</string>
<string name="description_sensor_cadence"
@@ -544,7 +544,7 @@ limitations under the License.
<string name="description_total_time"
translation_description="Total time description.
%1$s time. E.g., '1:08:59'">
%1$s time. E.g., '1:08:59'.">
Total time: %1$s
</string>
<string name="description_track_point"
@@ -719,61 +719,6 @@ limitations under the License.
Success
</string>
<!-- Google Settings -->
<string name="google_settings_title"
translation_description="In the 'Settings' page, the option to change the Google settings.
Character limit: ~23 (1 line)">
Google
</string>
<string name="google_settings_account_title"
translation_description="In the 'Google' settings, the option to switch Google account.
Character limit: ~23 (1 line)">
Switch account
</string>
<string name="google_settings_drive_sync_title"
translation_description="In the 'Google' settings, the checkbox to sync tracks with Google
Drive.
Character limit: ~23 (1 line)">
Sync Google Drive
</string>
<string name="google_settings_drive_sync_summary_on"
translation_description="In the 'Google' settings, the summary for the 'Sync Google Drive'
checkbox when it is checked explaining that all tracks will be synced to a Google Drive
account.
%1$s account name. E.g., 'foo@foo.com'.">
All tracks will be synced to %1$s Google Drive
</string>
<string name="google_settings_maps_public_title"
translation_description="In the 'Google' settings, the checkbox to make new maps created in
Google Maps public instead of unlisted. See
http://support.google.com/maps/bin/answer.py?answer=144365 for public versus unlisted.
Character limit: ~23 (1 line)">
New maps public
</string>
<string name="google_settings_maps_public_summary_off"
translation_description="In the 'Google' settings, the summary for the 'New maps public'
checkbox when it is unchecked explaining that new maps created in Google Maps will be
unlisted, instead of public. See http://support.google.com/maps/bin/answer.py?answer=144365
for public versus unlisted.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=144365'.">
New maps created in Google Maps will be unlisted, instead of public. See %1$s for more info.
</string>
<string name="google_settings_maps_public_summary_on"
translation_description="In the 'Google' settings, the summary for the 'New maps public'
checkbox when it is checked explaining that new maps created in Google Maps will be public,
instead of unlisted. See http://support.google.com/maps/bin/answer.py?answer=144365 for public
versus unlisted.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=144365'.">
New maps created in Google Maps will be public, instead of unlisted. See %1$s for more info.
</string>
<!-- Gps -->
<string name="gps_google_location_settings"
translation_description="In Android, the Google location settings to modify location settings
@@ -1208,7 +1153,7 @@ limitations under the License.
translation_description="Under the import all menu option, the submenu option to import all
files of a certain file format.
%1$s: file format. e.g., 'GPX', 'KML'
%1$s: file format. E.g., 'GPX'.
Character limit: ~20 (1 line)">
Import %1$s
</string>
@@ -1447,7 +1392,7 @@ limitations under the License.
translation_description="For a marker returned in the search result, the text field indicating
the track that the marker belongs to.
%1$s: track name. E.g., 'Grand Canyon trail'">
%1$s: track name. E.g., 'Grand Canyon trail'.">
In track \'%1$s\'.
</string>
<string name="search_voice_prompt"
@@ -1555,9 +1500,9 @@ limitations under the License.
</string>
<string name="send_google_track_part_label"
translation_description="When sending a track to Google, the label to name segments of a large
track. E.g., 'track_name (Part 1)'
track. E.g., 'track_name (Part 1)'.
%1$s: track name. E.g., 'track_name'
%1$s: track name. E.g., 'track_name'.
%2$d: part number. E.g., '1'.">
%1$s (Part %2$d)
</string>
@@ -1565,7 +1510,7 @@ limitations under the License.
<!-- Sensor State -->
<string name="sensor_state_battery"
translation_description="In the 'Sensor state' page, the label for the battery level on the bike
sensor. E.g, 'Battery level: 50 %'.">
sensor. E.g., 'Battery level: 50 %'.">
Battery level
</string>
<string name="sensor_state_cadence"
@@ -1749,70 +1694,129 @@ limitations under the License.
X axis
</string>
<!-- Settings Google -->
<string name="settings_google"
translation_description="In the 'Settings' page, the option to change the Google settings.
Character limit: ~23 (1 line)">
Google
</string>
<string name="settings_google_account_title"
translation_description="In the 'Google' settings, the option to switch Google account.
Character limit: ~23 (1 line)">
Switch account
</string>
<string name="settings_google_drive_sync_summary_on"
translation_description="In the 'Google' settings, the summary for the 'Sync Google Drive'
checkbox when it is checked explaining that all tracks will be synced to a Google Drive
account.
%1$s account name. E.g., 'foo@foo.com'.">
All tracks will be synced to %1$s Google Drive
</string>
<string name="settings_google_drive_sync_title"
translation_description="In the 'Google' settings, the checkbox to sync tracks with Google
Drive.
Character limit: ~23 (1 line)">
Sync Google Drive
</string>
<string name="settings_google_maps_public_summary_off"
translation_description="In the 'Google' settings, the summary for the 'New maps public'
checkbox when it is unchecked explaining that new maps created in Google Maps will be
unlisted, instead of public. See http://support.google.com/maps/bin/answer.py?answer=144365
for public versus unlisted.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=144365'.">
New maps created in Google Maps will be unlisted, instead of public. See %1$s for more info.
</string>
<string name="settings_google_maps_public_summary_on"
translation_description="In the 'Google' settings, the summary for the 'New maps public'
checkbox when it is checked explaining that new maps created in Google Maps will be public,
instead of unlisted. See http://support.google.com/maps/bin/answer.py?answer=144365 for public
versus unlisted.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=144365'.">
New maps created in Google Maps will be public, instead of unlisted. See %1$s for more info.
</string>
<string name="settings_google_maps_public_title"
translation_description="In the 'Google' settings, the checkbox to make new maps created in
Google Maps public instead of unlisted. See
http://support.google.com/maps/bin/answer.py?answer=144365 for public versus unlisted.
Character limit: ~23 (1 line)">
New maps public
</string>
<!-- Settings Map -->
<string name="settings_map_medium"
translation_description="In the 'Map' settings, under the 'Fixed thresholds' configurations, the
option for configuring the top medium speed.
translation_description="In the 'Map' settings, under the 'Fixed thresholds' section, the option
to configure the top medium speed.
Character limit: ~23 (1 line)">
Top medium speed
</string>
<string name="settings_map_percentage"
translation_description="In the 'Map' settings, under the 'Dynamic thresholds' configurations,
the option for configuring the percentage from the average speed for the medium speed range.
</string><string name="settings_map_percentage"
translation_description="In the 'Map' settings, under the 'Dynamic thresholds' section, the
option to configure the medium speed range as a percentage from the average speed.
Character limit: ~23 (1 line)">
Percentage from average
</string>
<string name="settings_map_percentage_summary"
translation_description="In the 'Map' settings, under the 'Dynamic thresholds' configurations,
the summary for the 'Percentage from average' option explaining that it sets the percentage
from the average speed for the medium speed range. The 'Dynamic thresholds' track color mode
uses different colors to color a track depending on whether the speed is above, in, or below
the medium speed range.">
Percentage from the average speed for the medium speed range.
translation_description="In the 'Map' settings, under the 'Dynamic thresholds' section, the
summary for the 'Percentage from average' option explaining that the medium speed range is set
as a percentage from the average speed.
%1$d: an integer value. E.g., '15'.">
The medium speed range is %1$d %% from the average speed
</string>
<string name="settings_map_slow"
translation_description="In the 'Map' settings, under the 'Fixed thresholds' configurations, the
option for configuring the top slow speed.
translation_description="In the 'Map' settings, under the 'Fixed thresholds' section, the option
to configure the top slow speed.
Character limit: ~23 (1 line)">
Top slow speed
</string>
<string name="settings_map_track_color_mode"
translation_description="In the 'Map' settings, the option to select a track color mode for how
to use different colors to color a track based on slow, medium, and fast speed.
translation_description="In the 'Map' settings, the picker to select how track color is
configured.
Character limit: ~23 (1 line)">
Track color
</string>
<string name="settings_map_track_color_mode_dynamic"
translation_description="In the 'Map' settings, for the 'Track color mode' dropdown, the option
to use different colors to color a track based on dynamically determined speed thresholds.
</string><string name="settings_map_track_color_mode_dynamic"
translation_description="In the 'Map' settings, for the 'Track color' picker, the option to use
dynamic thresholds to set slow, medium, and fast speed when coloring a track based on speed.
Character limit: ~20 (1 line)">
Dynamic thresholds
</string>
<string name="settings_map_track_color_mode_dynamic_summary"
translation_description="In the 'Map' settings, the summary for the 'Track color' picker when
the 'Dynamic thresholds' is selected explaining that it uses dynamic thresholds to set slow,
medium, and fast speed when coloring a track based on speed.">
Use dynamic thresholds to set slow, medium, and fast speed when coloring a track based on speed
</string>
<string name="settings_map_track_color_mode_fixed"
translation_description="In the 'Map' settings, for the 'Track color mode' dropdown, the option
to use different colors to color a track based on fixed speed thresholds.
translation_description="In the 'Map' settings, for the 'Track color' picker, the option to use
fixed thresholds to set slow, medium, and fast speed when coloring a track based on speed.
Character limit: ~20 (1 line)">
Fixed thresholds
</string>
<string name="settings_map_track_color_mode_fixed_summary"
translation_description="In the 'Map' settings, the summary for the 'Track color' picker when
the 'Fixed thresholds' is selected explaining that it uses fixed thresholds to set slow,
medium, and fast speed when coloring a track based on speed.">
Use fixed thresholds to set slow, medium, and fast speed when coloring a track based on speed
</string>
<string name="settings_map_track_color_mode_single"
translation_description="In the 'Map' settings, for the 'Track color mode' dropdown, the option
to use a single color for all speeds.
translation_description="In the 'Map' settings, for the 'Track color' picker, the option to use
a single color to color a track.
Character limit: ~20 (1 line)">
Single color
</string>
<string name="settings_map_track_color_mode_summary"
translation_description="In the 'Map' settings, the summary for the 'Track color mode' option
explaining that it configures how colors are used to color a track based on slow, medium, and
fast speed.">
The way to color a track based on slow, medium, and fast speed.
</string>
<!-- Settings Recording -->
<string name="settings_recording"
@@ -2211,7 +2215,7 @@ limitations under the License.
translation_description="When sharing a track URL with friends, the body of the message. Note
that \n is the newline character.
%1$s: url. E.g, 'https://maps.google.com/maps'.
%1$s: url. E.g., 'https://maps.google.com/maps'.
%2$s: track description.">
I think you might be interested in this track:\n\n%1$s\n\n%2$s
</string>
@@ -2449,7 +2453,7 @@ limitations under the License.
km
</string>
<string name="unit_kilometer_per_hour"
translation_description="Abbreviation for kilometers per hour. E.g, '5 km/h'.">
translation_description="Abbreviation for kilometers per hour. E.g., '5 km/h'.">
km/h
</string>
<string name="unit_meter"
@@ -2461,15 +2465,15 @@ limitations under the License.
mi
</string>
<string name="unit_mile_per_hour"
translation_description="Abbreviation for miles per hour. E.g, '5 mi/h'.">
translation_description="Abbreviation for miles per hour. E.g., '5 mi/h'.">
mi/h
</string>
<string name="unit_minute_per_kilometer"
translation_description="Abbreviation for minutes per kilometer. E.g, '5 min/km'.">
translation_description="Abbreviation for minutes per kilometer. E.g., '5 min/km'.">
min/km
</string>
<string name="unit_minute_per_mile"
translation_description="Abbreviation for minutes per mile. E.g, '5 min/mi'.">
translation_description="Abbreviation for minutes per mile. E.g., '5 min/mi'.">
min/mi
</string>
@@ -2488,160 +2492,160 @@ limitations under the License.
</string>
<string name="value_coordinate_degree"
translation_description="To display a latitude or longitude coordinate in degree. E.g.,
2.2 \u00B0. \u00B0 is the unicode value for the degree symbol.
'2.2 \u00B0'. \u00B0 is the unicode value for the degree symbol.
%1$s: a string value of the coordinate. E.g., '2.2'">
%1$s: a string value of the coordinate. E.g., '2.2'.">
%1$s \u00B0
</string>
<string name="value_float_feet"
translation_description="Display a float value in feet (ft).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f ft
</string>
<string name="value_float_kilometer"
translation_description="Display a float value in kilometers (km).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f km
</string>
<string name="value_float_kilometer_hour"
translation_description="Display a float value in kilometers per hour (km/h).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f km/h
</string>
<string name="value_float_meter"
translation_description="Display a float value in meters (m).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f m
</string>
<string name="value_float_mile"
translation_description="Display a float value in miles (mi).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f mi
</string>
<string name="value_float_mile_hour"
translation_description="Display a float value in miles per hour (mi/h).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f mi/h
</string>
<string name="value_float_mile_poor_gps"
translation_description="In a setting picker, the string format to display a float value in
miles (mi), recommended when having poor GPS signal.
%1$.1f: a float number. E.g., '2.2'">
%1$.1f: a float number. E.g., '2.2'.">
%1$.1f mi (poor GPS)
</string>
<string name="value_float_minute_kilometer"
translation_description="Display a float value in minutes per kilometer (min/km).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f min/km
</string>
<string name="value_float_minute_mile"
translation_description="Display a float value in minutes per mile (min/mi).
%1$.2f: a float number. E.g., '2.22'">
%1$.2f: a float number. E.g., '2.22'.">
%1$.2f min/mi
</string>
<string name="value_integer_feet"
translation_description="In a setting picker, the string format to display an integer value in
feet (ft).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d ft
</string>
<string name="value_integer_feet_excellent_gps"
translation_description="In a setting picker, the string format to display an integer value in
feet (ft), recommended when having excellent GPS signal.
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d ft (excellent GPS)
</string>
<string name="value_integer_feet_recommended"
translation_description="In a setting picker, the string format to display an integer value in
feet (ft) and that the value is the recommended value.
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d ft (recommended)
</string>
<string name="value_integer_kilometer"
translation_description="In a setting picker, the string format to display an integer value in
kilometers (km).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d km
</string>
<string name="value_integer_kilometer_hour"
translation_description="Display an integer value in kilometers per hour (km/h).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d km/h
</string>
<string name="value_integer_meter"
translation_description="In a setting picker, the string format to display an integer value in
meters (m).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d m
</string>
<string name="value_integer_meter_excellent_gps"
translation_description="In a setting picker, the string format to display an integer value in
meters (m), recommended when having excellent GPS signal.
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d m (excellent GPS)
</string>
<string name="value_integer_meter_poor_gps"
translation_description="In a setting picker, the string format to display an integer value in
meters (m), recommended when having poor GPS signal.
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d m (poor GPS)
</string>
<string name="value_integer_meter_recommended"
translation_description="In a setting picker, the string format to display an integer value in
meters (m) and that the value is the recommended value.
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d m (recommended)
</string>
<string name="value_integer_mile"
translation_description="In a setting picker, the string format to display an integer value in
miles (mi).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d mi
</string>
<string name="value_integer_mile_hour"
translation_description="Display an integer value in miles per hour (mi/h).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d mi/h
</string>
<string name="value_integer_minute"
translation_description="In a setting picker, the string format to display an integer value in
minutes (min).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d min
</string>
<string name="value_integer_percent"
translation_description="To display a value in percent like 2 %. %% is the escape sequence for
the percent symbol.
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d %%
</string>
<string name="value_integer_second"
translation_description="In a setting picker, the string format to display an integer value in
seconds (s).
%1$d: an integer value. E.g., '2'">
%1$d: an integer value. E.g., '2'.">
%1$d s
</string>
<string name="value_never"
@@ -2835,10 +2839,10 @@ limitations under the License.
<string name="voice_template"
translation_description="For the voice announcement, the template to make an announcement.
%1$s: distance string. E.g., '1 mile' or '1.2 miles', '1 kilometer', '2.2 kilometers'
%2$s: time string. E.g., '1 hour and 30 minutes' or '20 minutes 1 second'
%3$s: speed/pace string. For speed, e.g., '2.2 miles per hour', '1 kilometer per hour'. For
pace, e.g., '2 hours 1 minute per mile', '30 minutes 1 second per kilometer'.">
%1$s: distance string. E.g., '2.2 kilometers'.
%2$s: time string. E.g., '20 minutes 1 second'.
%3$s: speed/pace string. E.g., '2.2 miles per hour' for speed and
'30 minutes 1 second per kilometer' for pace.">
My Tracks %1$s in %2$s at %3$s.
</string>
<string name="voice_total_distance_kilometers_few"
+7 -7
View File
@@ -15,17 +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/google_settings_title" >
android:title="@string/settings_google" >
<ListPreference
android:defaultValue=""
android:key="@string/google_settings_account_key"
android:title="@string/google_settings_account_title" />
android:key="@string/google_account_key"
android:title="@string/settings_google_account_title" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/google_settings_drive_sync_key"
android:title="@string/google_settings_drive_sync_title" />
android:key="@string/drive_sync_key"
android:title="@string/settings_google_drive_sync_title" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/google_settings_maps_public_key"
android:title="@string/google_settings_maps_public_title" />
android:key="@string/default_map_public_key"
android:title="@string/settings_google_maps_public_title" />
</PreferenceScreen>
+2 -2
View File
@@ -17,9 +17,9 @@ limitations under the License.
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/menu_settings" >
<Preference
android:key="@string/google_settings_key"
android:key="@string/settings_google_key"
android:persistent="false"
android:title="@string/google_settings_title" />
android:title="@string/settings_google" />
<Preference
android:key="@string/settings_map_key"
android:persistent="false"
@@ -98,7 +98,7 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
RadioButton newMapRadioButton = (RadioButton) view.findViewById(
R.id.choose_upload_service_new_map);
boolean defaultMapPublic = PreferencesUtils.getBoolean(activity,
R.string.google_settings_maps_public_key, PreferencesUtils.GOOGLE_SETTINGS_MAPS_PUBLIC_DEFAULT);
R.string.default_map_public_key, PreferencesUtils.DEFAULT_MAP_PUBLIC_DEFAULT);
newMapRadioButton.setText(defaultMapPublic ? R.string.send_google_new_public_map
: R.string.send_google_new_unlisted_map);
@@ -223,7 +223,7 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask {
return true;
} else {
boolean defaultMapPublic = PreferencesUtils.getBoolean(
context, R.string.google_settings_maps_public_key, PreferencesUtils.GOOGLE_SETTINGS_MAPS_PUBLIC_DEFAULT);
context, R.string.default_map_public_key, PreferencesUtils.DEFAULT_MAP_PUBLIC_DEFAULT);
try {
String description = track.getCategory() + "\n" + track.getDescription() + "\n"
+ context.getString(R.string.send_google_by_my_tracks, "", "");
@@ -91,13 +91,13 @@ public class AccountChooserActivity extends Activity {
if (accounts.length == 1) {
sendRequest.setAccount(accounts[0]);
PreferencesUtils.setString(this, R.string.google_settings_account_key, accounts[0].name);
PreferencesUtils.setString(this, R.string.google_account_key, accounts[0].name);
getPermission(MapsConstants.SERVICE_NAME, sendRequest.isSendMaps(), mapsCallback);
return;
}
String googleAccount = PreferencesUtils.getString(this, R.string.google_settings_account_key,
PreferencesUtils.GOOGLE_SETTINGS_ACCOUNT_DEFAULT);
String googleAccount = PreferencesUtils.getString(this, R.string.google_account_key,
PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
for (int i = 0; i < accounts.length; i++) {
if (accounts[i].name.equals(googleAccount)) {
sendRequest.setAccount(accounts[i]);
@@ -161,7 +161,7 @@ public class AccountChooserActivity extends Activity {
int position = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
Account account = accounts[position];
PreferencesUtils.setString(
AccountChooserActivity.this, R.string.google_settings_account_key, account.name);
AccountChooserActivity.this, R.string.google_account_key, account.name);
sendRequest.setAccount(account);
getPermission(MapsConstants.SERVICE_NAME, sendRequest.isSendMaps(), mapsCallback);
}
@@ -125,6 +125,28 @@ public class AbstractSettingsActivity extends PreferenceActivity {
}
}
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.
*
@@ -38,8 +38,8 @@ import java.util.List;
*/
public class GoogleSettingsActivity extends AbstractSettingsActivity {
private ListPreference googleSettingsAccount;
private CheckBoxPreference settingsGoogleDriveSync;
private ListPreference googleAccount;
private CheckBoxPreference driveSync;
@SuppressWarnings("deprecation")
@Override
@@ -47,8 +47,8 @@ public class GoogleSettingsActivity extends AbstractSettingsActivity {
super.onCreate(bundle);
addPreferencesFromResource(R.xml.google_settings);
googleSettingsAccount = (ListPreference) findPreference(
getString(R.string.google_settings_account_key));
googleAccount = (ListPreference) findPreference(
getString(R.string.google_account_key));
List<String> entries = new ArrayList<String>();
List<String> entryValues = new ArrayList<String>();
Account[] accounts = AccountManager.get(this).getAccountsByType(Constants.ACCOUNT_TYPE);
@@ -57,11 +57,11 @@ public class GoogleSettingsActivity extends AbstractSettingsActivity {
entryValues.add(account.name);
}
entries.add(getString(R.string.value_none));
entryValues.add(PreferencesUtils.GOOGLE_SETTINGS_ACCOUNT_DEFAULT);
entryValues.add(PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
googleSettingsAccount.setEntries(entries.toArray(new CharSequence[entries.size()]));
googleSettingsAccount.setEntryValues(entryValues.toArray(new CharSequence[entries.size()]));
googleSettingsAccount.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
googleAccount.setEntries(entries.toArray(new CharSequence[entries.size()]));
googleAccount.setEntryValues(entryValues.toArray(new CharSequence[entries.size()]));
googleAccount.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
updateUi((String) newValue, true);
@@ -69,19 +69,19 @@ public class GoogleSettingsActivity extends AbstractSettingsActivity {
}
});
settingsGoogleDriveSync = (CheckBoxPreference) findPreference(
getString(R.string.google_settings_drive_sync_key));
driveSync = (CheckBoxPreference) findPreference(
getString(R.string.drive_sync_key));
CheckBoxPreference settingsGoogleMapsPublic = (CheckBoxPreference) findPreference(
getString(R.string.google_settings_maps_public_key));
settingsGoogleMapsPublic.setSummaryOn(getString(R.string.google_settings_maps_public_summary_on,
getString(R.string.default_map_public_key));
settingsGoogleMapsPublic.setSummaryOn(getString(R.string.settings_google_maps_public_summary_on,
getString(R.string.maps_public_unlisted_url)));
settingsGoogleMapsPublic.setSummaryOff(getString(
R.string.google_settings_maps_public_summary_off,
R.string.settings_google_maps_public_summary_off,
getString(R.string.maps_public_unlisted_url)));
String account = PreferencesUtils.getString(this, R.string.google_settings_account_key,
PreferencesUtils.GOOGLE_SETTINGS_ACCOUNT_DEFAULT);
String account = PreferencesUtils.getString(this, R.string.google_account_key,
PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
updateUi(account, false);
}
@@ -92,15 +92,15 @@ public class GoogleSettingsActivity extends AbstractSettingsActivity {
* @param uncheckDriveSync true to uncheck drive sync
*/
private void updateUi(String account, boolean uncheckDriveSync) {
googleSettingsAccount.setSummary(PreferencesUtils.GOOGLE_SETTINGS_ACCOUNT_DEFAULT.equals(
googleAccount.setSummary(PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT.equals(
account) ? getString(R.string.value_unknown)
: account);
boolean hasAccount = !PreferencesUtils.GOOGLE_SETTINGS_ACCOUNT_DEFAULT.equals(account);
settingsGoogleDriveSync.setEnabled(hasAccount);
settingsGoogleDriveSync.setSummaryOn(
getString(R.string.google_settings_drive_sync_summary_on, account));
boolean hasAccount = !PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT.equals(account);
driveSync.setEnabled(hasAccount);
driveSync.setSummaryOn(
getString(R.string.settings_google_drive_sync_summary_on, account));
if (uncheckDriveSync) {
settingsGoogleDriveSync.setChecked(false);
driveSync.setChecked(false);
}
}
}
@@ -41,9 +41,10 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
private static final String TAG = MapSettingsActivity.class.getSimpleName();
private EditTextPreference slowEditTextPreference;
private EditTextPreference mediumEditTextPreference;
private EditTextPreference percentageEditTextPreference;
private ListPreference trackColorModePreference;
private EditTextPreference slowPreference;
private EditTextPreference mediumPreference;
private EditTextPreference percentagePreference;
@SuppressWarnings("deprecation")
@Override
@@ -51,15 +52,33 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
super.onCreate(bundle);
addPreferencesFromResource(R.xml.map_settings);
slowEditTextPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_slow_display_key));
mediumEditTextPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_medium_display_key));
percentageEditTextPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_percentage_display_key));
ListPreference trackColorModeListPreference = (ListPreference) findPreference(
trackColorModePreference = (ListPreference) findPreference(
getString(R.string.track_color_mode_key));
slowPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_slow_display_key));
mediumPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_medium_display_key));
percentagePreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_percentage_display_key));
configTrackColorModePerference();
configSpeedPreference(slowPreference, R.string.track_color_mode_slow_key,
PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT);
configSpeedPreference(mediumPreference, R.string.track_color_mode_medium_key,
PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT);
configPercentagePreference();
updateSpeedSummary(slowPreference, R.string.track_color_mode_slow_key,
PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT);
updateSpeedSummary(mediumPreference, R.string.track_color_mode_medium_key,
PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT);
updatePercentageSummary();
}
/**
* Configures the track color mode preference.
*/
private void configTrackColorModePerference() {
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -67,52 +86,61 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
return true;
}
};
String trackColorModeValue = PreferencesUtils.getString(
String trackColorMode = PreferencesUtils.getString(
this, R.string.track_color_mode_key, PreferencesUtils.TRACK_COLOR_MODE_DEFAULT);
configurePreference(trackColorModeListPreference,
configurePreference(trackColorModePreference,
getResources().getStringArray(R.array.track_color_mode_options),
getResources().getStringArray(R.array.track_color_mode_values),
R.string.settings_map_track_color_mode_summary, trackColorModeValue, listener);
configureSpeedEditTextPreference(R.string.track_color_mode_slow_key);
configureSpeedEditTextPreference(R.string.track_color_mode_medium_key);
configurePercentageEditTextPreference();
updatePercentageSummary();
getResources().getStringArray(R.array.track_color_mode_values), trackColorMode, listener);
}
/**
* Configures the speed edit text preference.
* Configures the speed preference.
*
* @param keyId the key id
* @param preference the preference
* @param key the key
* @param defaultValue the default value
*/
private void configureSpeedEditTextPreference(final int keyId) {
final EditTextPreference editTextPreference = keyId == R.string.track_color_mode_slow_key ? slowEditTextPreference
: mediumEditTextPreference;
editTextPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
private void configSpeedPreference(
EditTextPreference preference, final int key, final int defaultValue) {
preference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
storeSpeedValue(keyId, (String) newValue);
updateSpeedSummary(keyId);
public boolean onPreferenceChange(Preference pref, Object newValue) {
// Need to obtain the current min and max values
int minValue;
int maxValue;
if (key == R.string.track_color_mode_slow_key) {
minValue = 0;
maxValue = PreferencesUtils.getInt(
MapSettingsActivity.this, R.string.track_color_mode_medium_key,
PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT);
} else {
minValue = PreferencesUtils.getInt(
MapSettingsActivity.this, R.string.track_color_mode_slow_key,
PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT);
maxValue = Integer.MAX_VALUE;
}
storeSpeedValue(key, minValue, maxValue, defaultValue, (String) newValue);
updateSpeedSummary(pref, key, defaultValue);
return true;
}
});
editTextPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
int value = getSpeedDisplayValue(keyId);
((EditTextPreference) preference).getEditText().setText(String.valueOf(value));
public boolean onPreferenceClick(Preference pref) {
int value = getSpeedDisplayValue(key, defaultValue);
((EditTextPreference) pref).getEditText().setText(String.valueOf(value));
return true;
}
});
configureImeActionDone(editTextPreference);
configImeActionDone(preference);
}
/**
* Configures the percentage edit text preference.
* Configures the percentage preference.
*/
private void configurePercentageEditTextPreference() {
percentageEditTextPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
private void configPercentagePreference() {
percentagePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String displayValue = (String) newValue;
@@ -132,7 +160,7 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
return true;
}
});
percentageEditTextPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
percentagePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
int value = PreferencesUtils.getInt(
@@ -142,7 +170,7 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
return true;
}
});
configureImeActionDone(percentageEditTextPreference);
configImeActionDone(percentagePreference);
}
/**
@@ -150,7 +178,7 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
*
* @param editTextPreference the edit text preference
*/
private void configureImeActionDone(final EditTextPreference editTextPreference) {
private void configImeActionDone(final EditTextPreference editTextPreference) {
editTextPreference.getEditText()
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
@@ -166,13 +194,6 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
});
}
@Override
protected void onResume() {
super.onResume();
updateSpeedSummary(R.string.track_color_mode_slow_key);
updateSpeedSummary(R.string.track_color_mode_medium_key);
}
/**
* Updates the UI by the track color mode.
*
@@ -183,32 +204,54 @@ 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));
slowEditTextPreference.setEnabled(isFixedValue);
mediumEditTextPreference.setEnabled(isFixedValue);
percentageEditTextPreference.setEnabled(isDynamicValue);
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);
}
/**
* Stores the speed value, always in metric units.
* Updates a speed summary.
*
* @param preference the preference
* @param keyId the key id
* @param defaultValue the default value
*/
private void updateSpeedSummary(Preference preference, int keyId, int defaultValue) {
boolean metric = PreferencesUtils.getBoolean(
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
int displayValue = getSpeedDisplayValue(keyId, defaultValue);
preference.setSummary(getString(
metric ? R.string.value_integer_kilometer_hour : R.string.value_integer_mile_hour,
displayValue));
}
/**
* Updates the percentage summary.
*/
private void updatePercentageSummary() {
int value = PreferencesUtils.getInt(this, R.string.track_color_mode_percentage_key,
PreferencesUtils.TRACK_COLOR_MODE_PERCENTAGE_DEFAULT);
percentagePreference.setSummary(getString(R.string.settings_map_percentage_summary, value));
}
/**
* Stores a speed value, always in metric units.
*
* @param keyId the key id
* @param minValue the min value
* @param maxValue the max value
* @param defaultValue the default value
* @param displayValue the display value
*/
private void storeSpeedValue(int keyId, String displayValue) {
int maxValue;
int minValue;
int defaultValue;
if (keyId == R.string.track_color_mode_slow_key) {
minValue = 0;
maxValue = PreferencesUtils.getInt(this, R.string.track_color_mode_medium_key,
PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT);
defaultValue = PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT;
} else {
minValue = PreferencesUtils.getInt(
this, R.string.track_color_mode_slow_key, PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT);
maxValue = Integer.MAX_VALUE;
defaultValue = PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT;
}
private void storeSpeedValue(
int keyId, int minValue, int maxValue, int defaultValue, String displayValue) {
int value;
try {
value = Integer.parseInt(displayValue);
@@ -231,14 +274,13 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
}
/**
* Gets the speed display value, in metric or imperial depending on the
* preferred units.
* Gets a speed display value in metric or imperial depending on the preferred
* units.
*
* @param keyId the key id
* @param defaultValue the default value
*/
private int getSpeedDisplayValue(int keyId) {
int defaultValue = keyId == R.string.track_color_mode_slow_key ? PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT
: PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT;
private int getSpeedDisplayValue(int keyId, int defaultValue) {
int value = PreferencesUtils.getInt(this, keyId, defaultValue);
if (!PreferencesUtils.getBoolean(
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT)) {
@@ -246,31 +288,4 @@ public class MapSettingsActivity extends AbstractSettingsActivity {
}
return value;
}
/**
* Updates the speed summary.
*
* @param keyId the key id
*/
private void updateSpeedSummary(int keyId) {
EditTextPreference editTextPreference = keyId == R.string.track_color_mode_slow_key ? slowEditTextPreference
: mediumEditTextPreference;
boolean metric = PreferencesUtils.getBoolean(
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
int displayValue = getSpeedDisplayValue(keyId);
editTextPreference.setSummary(getString(
metric ? R.string.value_integer_kilometer_hour : R.string.value_integer_mile_hour,
displayValue));
}
/**
* Updates the percentage summary.
*/
private void updatePercentageSummary() {
int value = PreferencesUtils.getInt(MapSettingsActivity.this,
R.string.track_color_mode_percentage_key,
PreferencesUtils.TRACK_COLOR_MODE_PERCENTAGE_DEFAULT);
percentageEditTextPreference.setSummary(getString(R.string.settings_map_percentage_summary)
+ "\n" + getString(R.string.value_integer_percent, value));
}
}
@@ -52,7 +52,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
super.onCreate(bundle);
addPreferencesFromResource(R.xml.settings);
configPreference(R.string.google_settings_key, GoogleSettingsActivity.class);
configPreference(R.string.settings_google_key, GoogleSettingsActivity.class);
configPreference(R.string.settings_map_key, MapSettingsActivity.class);
configPreference(R.string.settings_chart_key, ChartSettingsActivity.class);
configPreference(R.string.settings_stats_key, StatsSettingsActivity.class);
@@ -36,35 +36,36 @@ public class PreferencesUtils {
public static final boolean ALLOW_ACCESS_DEFAULT = false;
public static final int AUTO_RESUME_TRACK_CURRENT_RETRY_DEFAULT = 0;
// Values for auto_resume_track_timeout_key
public static final int AUTO_RESUME_TRACK_TIMEOUT_ALWAYS = -1;
public static final int AUTO_RESUME_TRACK_TIMEOUT_DEFAULT = 10;
public static final int AUTO_RESUME_TRACK_TIMEOUT_NEVER = 0;
public static final String BLUETOOTH_SENSOR_DEFAULT = "";
public static final boolean CHART_BY_DISTANCE_DEFAULT = true;
public static final boolean CHART_SHOW_CADENCE_DEFAULT = true;
public static final boolean CHART_SHOW_ELEVATION_DEFAULT = true;
public static final boolean CHART_SHOW_HEART_RATE_DEFAULT = true;
public static final boolean CHART_SHOW_POWER_DEFAULT = true;
public static final boolean CHART_SHOW_SPEED_DEFAULT = true;
public static final String DEFAULT_ACTIVITY_DEFAULT = "";
public static final boolean DEFAULT_MAP_PUBLIC_DEFAULT = false;
public static final boolean DRIVE_SYNC_DEFAULT = false;
// Value for split_frequency_key and voice_frequency_key
public static final int FREQUENCY_OFF = 0;
public static final String GOOGLE_SETTINGS_ACCOUNT_DEFAULT = "";
public static final boolean GOOGLE_SETTINGS_DRIVE_SYNC_DEFAULT = false;
public static final boolean GOOGLE_SETTINGS_MAPS_PUBLIC_DEFAULT = false;
public static final String GOOGLE_ACCOUNT_DEFAULT = "";
public static final int MAX_RECORDING_DISTANCE_DEFAULT = 200;
public static final boolean METRIC_UNITS_DEFAULT = true;
public static final int MIN_RECORDING_DISTANCE_DEFAULT = 5;
// Values for min_recording_interval_key
public static final int MIN_RECORDING_INTERVAL_ADAPT_ACCURACY = -1;
public static final int MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE = -2;
public static final int MIN_RECORDING_INTERVAL_DEFAULT = 0;
// Values for min_required_accuracy
public static final int MIN_REQUIRED_ACCURACY_DEFAULT = 200;
public static final int MIN_REQUIRED_ACCURACY_EXCELLENT = 10;
public static final int MIN_REQUIRED_ACCURACY_POOR = 5000;
@@ -77,30 +78,23 @@ public class PreferencesUtils {
public static final boolean SEND_TO_DOCS_DEFAULT = true;
public static final boolean SEND_TO_FUSION_TABLES_DEFAULT = true;
public static final boolean SEND_TO_MAPS_DEFAULT = true;
public static final String SENSOR_TYPE_DEFAULT = "NONE";
public static final String SENSOR_TYPE_DEFAULT = "NONE";
public static final boolean SHOW_CONFIRM_PLAY_DIALOG_DEFAULT = true;
public static final boolean SHOW_CONFIRM_SHARING_DIALOG_DEFAULT = true;
public static final int SPLIT_FREQUENCY_DEFAULT = 0;
public static final boolean STATS_SHOW_COORDINATE_DEFAULT = false;
public static final boolean STATS_SHOW_ELEVATION_DEFAULT = false;
public static final boolean STATS_SHOW_GRADE_DEFAULT = false;
public static final boolean STATS_SHOW_MOVING_TIME_DEFAULT = false;
public static final String TRACK_COLOR_MODE_DEFAULT = "SINGLE";
public static final int TRACK_COLOR_MODE_MEDIUM_DEFAULT = 15;
public static final int TRACK_COLOR_MODE_PERCENTAGE_DEFAULT = 25;
public static final int TRACK_COLOR_MODE_SLOW_DEFAULT = 9;
public static final String TRACK_NAME_DEFAULT = "LOCATION";
public static final int TRACK_WIDGET_ITEM1_DEFAULT = 3; // moving time
public static final int TRACK_WIDGET_ITEM2_DEFAULT = 0; // distance
public static final int TRACK_WIDGET_ITEM3_DEFAULT = 1; // total time
public static final int TRACK_WIDGET_ITEM4_DEFAULT = 2; // average speed
public static final int VOICE_FREQUENCY_DEFAULT = 0;
private PreferencesUtils() {}