Merge heads

This commit is contained in:
youtaol
2013-08-22 10:14:45 +08:00
parent 83b1fb67bf
commit b6b54923b2
37 changed files with 434 additions and 221 deletions
+2 -2
View File
@@ -68,12 +68,12 @@ limitations under the License.
</TableLayout> </TableLayout>
<ImageView <ImageView
android:id="@+id/list_item_photo" android:id="@+id/list_item_photo"
android:layout_gravity="center" android:adjustViewBounds="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_width="0dp" android:layout_width="0dp"
android:scaleType="centerCrop" /> android:scaleType="fitCenter" />
</LinearLayout> </LinearLayout>
<TableLayout <TableLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -27,10 +27,11 @@ limitations under the License.
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical" > android:orientation="vertical" >
<ImageView <ImageView
android:adjustViewBounds="true"
android:id="@+id/marker_detail_waypoint_photo" android:id="@+id/marker_detail_waypoint_photo"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:scaleType="centerInside" /> android:scaleType="fitCenter" />
<TextView <TextView
android:id="@+id/marker_detail_waypoint_name" android:id="@+id/marker_detail_waypoint_name"
style="@style/TextLarge.WithTopMargin" /> style="@style/TextLarge.WithTopMargin" />
-4
View File
@@ -43,9 +43,5 @@ limitations under the License.
android:singleLine="false" android:singleLine="false"
android:visibility="gone" > android:visibility="gone" >
</MultiAutoCompleteTextView> </MultiAutoCompleteTextView>
<TextView
android:text="@string/share_track_footer"
android:layout_marginTop="16dp"
style="@style/TextSmall" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
@@ -92,6 +92,14 @@ limitations under the License.
<item>15</item> <item>15</item>
<item>-1</item> <item>-1</item>
</string-array> </string-array>
<string-array name="chart_x_axis_options">
<item>@string/settings_chart_by_distance</item>
<item>@string/settings_chart_by_time</item>
</string-array>
<string-array name="chart_x_axis_values">
<item>@string/chart_x_axis_distance</item>
<item>@string/chart_x_axis_time</item>
</string-array>
<string-array name="frequency_values"> <string-array name="frequency_values">
<item>0</item> <item>0</item>
<item>1</item> <item>1</item>
@@ -176,6 +184,18 @@ limitations under the License.
<item>@string/sensor_type_value_zephyr</item> <item>@string/sensor_type_value_zephyr</item>
<item>@string/sensor_type_value_none</item> <item>@string/sensor_type_value_none</item>
</string-array> </string-array>
<string-array name="stats_rate_imperial_options">
<item>@string/description_speed_imperial</item>
<item>@string/description_pace_imperial</item>
</string-array>
<string-array name="stats_rate_metric_options">
<item>@string/description_speed_metric</item>
<item>@string/description_pace_metric</item>
</string-array>
<string-array name="stats_rate_values">
<item>@string/stats_rate_speed</item>
<item>@string/stats_rate_pace</item>
</string-array>
<string-array name="stats_units_options"> <string-array name="stats_units_options">
<item>@string/settings_stats_units_metric</item> <item>@string/settings_stats_units_metric</item>
<item>@string/settings_stats_units_imperial</item> <item>@string/settings_stats_units_imperial</item>
+4
View File
@@ -16,6 +16,8 @@ limitations under the License.
--> -->
<resources> <resources>
<!-- DO NOT TRANSLATE ANY STRINGS IN THIS FILE. --> <!-- DO NOT TRANSLATE ANY STRINGS IN THIS FILE. -->
<string name="chart_x_axis_distance">DISTANCE</string>
<string name="chart_x_axis_time">TIME</string>
<string name="eula_korean">위치정보서비스 및 위치기반서비스 이용약관\n <string name="eula_korean">위치정보서비스 및 위치기반서비스 이용약관\n
\n \n
다음은 구글코리아 유한회사(이하 “Google”)가 Google의 제품에 대하여 제공하고 있는 위치기반서비스에 적용되는 이용조건입니다. 아래 이용조건은 이동통신사업자의 가입신청서에 포함된 위치정보 수집동의 및 모바일 단말기 이용조건과 함께 적용됩니다.\n 다음은 구글코리아 유한회사(이하 “Google”)가 Google의 제품에 대하여 제공하고 있는 위치기반서비스에 적용되는 이용조건입니다. 아래 이용조건은 이동통신사업자의 가입신청서에 포함된 위치정보 수집동의 및 모바일 단말기 이용조건과 함께 적용됩니다.\n
@@ -93,6 +95,8 @@ Google은 이용자에 대한 위치정보의 이용∙제공사실을 위치정
<string name="settings_recording_track_name_date_local_value">DATE_LOCAL</string> <string name="settings_recording_track_name_date_local_value">DATE_LOCAL</string>
<string name="settings_recording_track_name_location_value">LOCATION</string> <string name="settings_recording_track_name_location_value">LOCATION</string>
<string name="settings_recording_track_name_number_value">NUMBER</string> <string name="settings_recording_track_name_number_value">NUMBER</string>
<string name="stats_rate_pace">PACE</string>
<string name="stats_rate_speed">SPEED</string>
<string name="stats_units_imperial">IMPERIAL</string> <string name="stats_units_imperial">IMPERIAL</string>
<string name="stats_units_metric">METRIC</string> <string name="stats_units_metric">METRIC</string>
<string name="track_action_end">com.google.android.apps.mytracks.END_CURRENT_TRACK</string> <string name="track_action_end">com.google.android.apps.mytracks.END_CURRENT_TRACK</string>
+3 -3
View File
@@ -18,12 +18,12 @@ limitations under the License.
<!-- Keys for persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. --> <!-- Keys for persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. -->
<string name="allow_access_key">allowAccess</string> <string name="allow_access_key">allowAccess</string>
<string name="auto_resume_track_timeout_key">autoResumeTrackTimeout</string> <string name="auto_resume_track_timeout_key">autoResumeTrackTimeout</string>
<string name="chart_by_distance_key">chartByDistance</string>
<string name="chart_show_cadence_key">chartShowCadence</string> <string name="chart_show_cadence_key">chartShowCadence</string>
<string name="chart_show_elevation_key">chartShowElevation</string> <string name="chart_show_elevation_key">chartShowElevation</string>
<string name="chart_show_heart_rate_key">chartShowHeartRate</string> <string name="chart_show_heart_rate_key">chartShowHeartRate</string>
<string name="chart_show_power_key">chartShowPower</string> <string name="chart_show_power_key">chartShowPower</string>
<string name="chart_show_speed_key">chartShowSpeed</string> <string name="chart_show_speed_key">chartShowSpeed</string>
<string name="chart_x_axis_key">chartXAxis</string>
<string name="default_activity_key">defaultActivity</string> <string name="default_activity_key">defaultActivity</string>
<string name="export_external_storage_format_key">exportExternalStorageFormat</string> <string name="export_external_storage_format_key">exportExternalStorageFormat</string>
<string name="export_google_fusion_tables_public_key">exportGoogleFusionTablesPublic</string> <string name="export_google_fusion_tables_public_key">exportGoogleFusionTablesPublic</string>
@@ -34,14 +34,14 @@ limitations under the License.
<string name="min_recording_interval_key">minRecordingInterval</string> <string name="min_recording_interval_key">minRecordingInterval</string>
<string name="recording_distance_interval_key">recordingDistanceInterval</string> <string name="recording_distance_interval_key">recordingDistanceInterval</string>
<string name="recording_gps_accuracy_key">recordingGpsAccuracy</string> <string name="recording_gps_accuracy_key">recordingGpsAccuracy</string>
<string name="report_speed_key">reportSpeed</string>
<string name="sensor_type_key">sensorType</string> <string name="sensor_type_key">sensorType</string>
<string name="share_track_invite_key">shareTrackInvite</string> <string name="share_track_invite_key">shareTrackInvite</string>
<string name="share_track_public_key">shareTrackPublic</string> <string name="share_track_public_key">shareTrackPublic</string>
<string name="split_frequency_key">splitFrequency</string> <string name="split_frequency_key">splitFrequency</string>
<string name="stats_rate_key">statsRate</string>
<string name="stats_show_coordinate_key">statsShowCoordinate</string> <string name="stats_show_coordinate_key">statsShowCoordinate</string>
<string name="stats_show_grade_elevation_key">statsShowGradeElevation</string> <string name="stats_show_grade_elevation_key">statsShowGradeElevation</string>
<string name="stats_units_key">statsdUnits</string> <string name="stats_units_key">statsUnits</string>
<string name="track_color_mode_medium_key">trackColorModeMedium</string> <string name="track_color_mode_medium_key">trackColorModeMedium</string>
<string name="track_color_mode_percentage_key">trackColorModePercentage</string> <string name="track_color_mode_percentage_key">trackColorModePercentage</string>
<string name="track_color_mode_slow_key">trackColorModeSlow</string> <string name="track_color_mode_slow_key">trackColorModeSlow</string>
+69 -37
View File
@@ -774,9 +774,9 @@ limitations under the License.
translation_description="The text on a button to say cancel."> translation_description="The text on a button to say cancel.">
Cancel Cancel
</string> </string>
<string name="generic_confirm_title" <string name="generic_delete_selected_confirm_title"
translation_description="The title on a confirmation dialog asking the user if he is sure?"> translation_description="When deleting selected items, the title of the confirmation dialog.">
Are you sure? Delete selected?
</string> </string>
<string name="generic_description" <string name="generic_description"
translation_description="The text label for entering a description."> translation_description="The text label for entering a description.">
@@ -1001,6 +1001,10 @@ limitations under the License.
translation_description="When deleting one marker, the confirmation message."> translation_description="When deleting one marker, the confirmation message.">
The marker will be permanently deleted from the device. The marker will be permanently deleted from the device.
</string> </string>
<string name="marker_delete_one_confirm_title"
translation_description="When deleting one marker, the title of the confirmation dialog.">
Delete marker?
</string>
<string name="marker_delete_multiple_confirm_message" <string name="marker_delete_multiple_confirm_message"
translation_description="When deleting multiple markers, the confirmation message."> translation_description="When deleting multiple markers, the confirmation message.">
All markers for this track will be permanently deleted from the device. All markers for this track will be permanently deleted from the device.
@@ -1484,29 +1488,39 @@ limitations under the License.
Backup &amp; reset Backup &amp; reset
</string> </string>
<!-- Settings Backup Now --> <!-- Settings Backup -->
<string name="settings_backup_now" <string name="settings_backup"
translation_description="In the 'Backup and reset' settings, the option to backup to the translation_description="In the 'Backup and reset' settings, the option to backup to the
external storage now. external storage.
Character limit: ~26 (1 line)"> Character limit: ~26 (1 line)">
Backup now Backup
</string>
<string name="settings_backup_confirm_message"
translation_description="In the 'Backup and reset' settings, after pressing the 'Backup' option,
the confirmation message.
%1$s the directory. E.g., '/MyTracks/backups'.">
This will write a full copy of all your tracks and settings to &#8216;%1$s&#8217; on the
external storage.
</string>
<string name="settings_backup_confirm_title"
translation_description="In the 'Backup and reset' settings, after pressing the 'Backup' option,
the title of the confirmation dialog.
Character limit: ~26 (1 line)">
Backup now?
</string> </string>
<string name="settings_backup_now_error" <string name="settings_backup_now_error"
translation_description="When backing up to the external storage, the error message."> translation_description="When backing up to the external storage, the error message.">
Unable to backup. Unable to backup.
</string> </string>
<string name="settings_backup_now_progress_message" <string name="settings_backup_now_progress_message"
translation_description="In the 'Backup and reset' settings, after pressing the 'Backup now' translation_description="In the 'Backup and reset' settings, after pressing the 'Backup' option,
option, the progress message telling the user that it is writing all tracks and settings to the progress message telling the user that it is writing all tracks and settings to the
the external storage."> external storage.">
Writing all tracks and settings&#8230; Writing all tracks and settings&#8230;
</string> </string>
<string name="settings_backup_now_summary"
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" <string name="settings_backup_now_success"
translation_description="When backing up to the external storage, the success message"> translation_description="When backing up to the external storage, the success message">
Finished backup. Finished backup.
@@ -1518,22 +1532,26 @@ limitations under the License.
external storage. external storage.
Character limit: ~26 (1 line)"> Character limit: ~26 (1 line)">
Restore now Restore
</string> </string>
<string name="settings_backup_restore_confirm_message" <string name="settings_backup_restore_confirm_message"
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now' translation_description="In the 'Backup and reset' settings, after pressing the 'Restore'
option, the message in the alert dialog asking the user to confirm that he wants to restore option, the confirmation message.">
from a backup.">
Restoring a backup from external storage will delete all your tracks and settings, and update Restoring a backup from external storage will delete all your tracks and settings, and update
them with the backup copy. Google Drive sync will be turned off. No tracks will be deleted on them with the backup copy. Google Drive sync will be turned off. No tracks will be deleted on
Google Drive and on external storage. Google Drive and on external storage.
</string> </string>
<string name="settings_backup_restore_confirm_title"
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore'
option, the title of the confirmation dialog.">
Restore now?
</string>
<string name="settings_backup_restore_error" <string name="settings_backup_restore_error"
translation_description="When restoring from backup, the error message."> translation_description="When restoring from backup, the error message.">
Unable to restore from backup. Unable to restore from backup.
</string> </string>
<string name="settings_backup_restore_no_backups" <string name="settings_backup_restore_no_backups"
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now' translation_description="In the 'Backup and reset' settings, after pressing the 'Restore'
option, the message in the alert dialog informing the user that there is no backups to restore option, the message in the alert dialog informing the user that there is no backups to restore
from. from.
@@ -1541,21 +1559,16 @@ limitations under the License.
No backups found in %1$s. No backups found in %1$s.
</string> </string>
<string name="settings_backup_restore_progress_message" <string name="settings_backup_restore_progress_message"
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now' translation_description="In the 'Backup and reset' settings, after pressing the 'Restore'
option, the progress message informing that My Tracks is reading all tracks and settings from option, the progress message informing that My Tracks is reading all tracks and settings from
the backup on the external storage."> the backup on the external storage.">
Reading all tracks and settings&#8230; Reading all tracks and settings&#8230;
</string> </string>
<string name="settings_backup_restore_select_title" <string name="settings_backup_restore_select_title"
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now' translation_description="In the 'Backup and reset' settings, after pressing the 'Restore'
option, the title in the picker dialog asking the user to select a backup."> option, the title in the picker dialog asking the user to select a backup.">
Select a backup to restore Select a backup to restore
</string> </string>
<string name="settings_backup_restore_summary"
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" <string name="settings_backup_restore_success"
translation_description="When restoring from backup, the success message."> translation_description="When restoring from backup, the success message.">
Finished restoring from backup. Finished restoring from backup.
@@ -1595,6 +1608,11 @@ limitations under the License.
This will remove any association between your tracks and %1$s Google Drive. Google Drive sync This will remove any association between your tracks and %1$s Google Drive. Google Drive sync
will be turned off. No tracks will be deleted on %1$s Google Drive. will be turned off. No tracks will be deleted on %1$s Google Drive.
</string> </string>
<string name="settings_google_account_confirm_title"
translation_description="In the 'Accounts and sync' settings, after pressing 'Switch account',
the title of the confirmation dialog.">
Switch account?
</string>
<string name="settings_google_account_title" <string name="settings_google_account_title"
translation_description="In the 'Accounts and sync' settings, the option to switch Google translation_description="In the 'Accounts and sync' settings, the option to switch Google
account. account.
@@ -1818,17 +1836,17 @@ limitations under the License.
All settings will be reverted to the default values. This will not delete any tracks on the All settings will be reverted to the default values. This will not delete any tracks on the
device or on Google Drive. device or on Google Drive.
</string> </string>
<string name="settings_reset_confirm_title"
translation_description="In the 'Backup and reset' settings, after pressing the 'Reset' option,
the title of the confirmation dialog.">
Reset now?
</string>
<string name="settings_reset_done" <string name="settings_reset_done"
translation_description="In the 'Backup and reset' settings, after pressing the 'Reset' option, 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 the confirmation dialog informing the user that all settings have been reverted to the default
values."> values.">
All settings have been reverted to the default values. All settings have been reverted to the default values.
</string> </string>
<string name="settings_reset_summary"
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 --> <!-- Settings Sensor -->
<string name="settings_sensor" <string name="settings_sensor"
@@ -1964,6 +1982,11 @@ limitations under the License.
Other apps, including future apps, will be able to control and access My Tracks data. There will Other apps, including future apps, will be able to control and access My Tracks data. There will
be no further notification. be no further notification.
</string> </string>
<string name="settings_sharing_allow_access_confirm_title"
translation_description="In the 'Sharing' settings, after checking the 'Allow access' checkbox,
the title of the confirmation dialog.">
Allow access?
</string>
<string name="settings_sharing_allow_access_summary_off" <string name="settings_sharing_allow_access_summary_off"
translation_description="In the 'Sharing' settings, the summary for the 'Allow access' checkbox translation_description="In the 'Sharing' settings, the summary for the 'Allow access' checkbox
option when it is unchecked explaining that other apps cannot read, write, start/stop option when it is unchecked explaining that other apps cannot read, write, start/stop
@@ -2021,10 +2044,6 @@ limitations under the License.
translation_description="The hint for the auto complete text box for entering email addresses."> translation_description="The hint for the auto complete text box for entering email addresses.">
Email addresses Email addresses
</string> </string>
<string name="share_track_footer"
translation_description="The dialog footer when sharing a track via Google Drive.">
This will upload your track to Google Drive.
</string>
<string name="share_track_invite" <string name="share_track_invite"
translation_description="The checkbox to invite people to view a track."> translation_description="The checkbox to invite people to view a track.">
Invite people to view Invite people to view
@@ -2213,11 +2232,19 @@ limitations under the License.
All tracks and markers will be permanently deleted from the device. Google Drive sync will be All tracks and markers will be permanently deleted from the device. Google Drive sync will be
turned off. No tracks will be deleted on Google Drive and on external storage. turned off. No tracks will be deleted on Google Drive and on external storage.
</string> </string>
<string name="track_delete_all_confirm_title"
translation_description="When deleting all the tracks, the title of the confirmation dialog.">
Delete all?
</string>
<string name="track_delete_one_confirm_message" <string name="track_delete_one_confirm_message"
translation_description="When deleting one track, the confirmation message."> translation_description="When deleting one track, the confirmation message.">
The track and its markers will be permanently deleted from the device. If Google Drive sync is The track and its markers will be permanently deleted from the device. If Google Drive sync is
enabled, this will also delete the track on Google Drive. enabled, this will also delete the track on Google Drive.
</string> </string>
<string name="track_delete_one_confirm_title"
translation_description="When deleting one track, the title of the confirmation dialog.">
Delete track?
</string>
<string name="track_delete_multiple_confirm_message" <string name="track_delete_multiple_confirm_message"
translation_description="When deleting multiple tracks, the confirmation message."> translation_description="When deleting multiple tracks, the confirmation message.">
The selected tracks and their markers will be permanently deleted from the device. If Google The selected tracks and their markers will be permanently deleted from the device. If Google
@@ -2254,7 +2281,12 @@ limitations under the License.
</string> </string>
<string name="track_detail_play_confirm_message" <string name="track_detail_play_confirm_message"
translation_description="The confirmation message when playing a track in Google Earth."> translation_description="The confirmation message when playing a track in Google Earth.">
Play in Google Earth will save your track to external storage. This will save your track to external storage.
</string>
<string name="track_detail_play_confirm_title"
translation_description="When playing a track in Google Earth, the title of the confirmation
dialog.">
Play in Google Earth?
</string> </string>
<string name="track_detail_stats_tab" <string name="track_detail_stats_tab"
translation_description="In the track detail page, the title of the tab showing the stats."> translation_description="In the track detail page, the title of the tab showing the stats.">
+1 -1
View File
@@ -19,7 +19,7 @@ limitations under the License.
<Preference <Preference
android:key="@string/settings_backup_key" android:key="@string/settings_backup_key"
android:persistent="false" android:persistent="false"
android:title="@string/settings_backup_now" /> android:title="@string/settings_backup" />
<Preference <Preference
android:key="@string/settings_restore_key" android:key="@string/settings_restore_key"
android:persistent="false" android:persistent="false"
+3 -5
View File
@@ -16,11 +16,9 @@ limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/track_detail_chart_tab" > android:title="@string/track_detail_chart_tab" >
<CheckBoxPreference <ListPreference
android:defaultValue="true" android:defaultValue="@string/chart_x_axis_distance"
android:key="@string/chart_by_distance_key" android:key="@string/chart_x_axis_key"
android:summaryOff="@string/settings_chart_by_time"
android:summaryOn="@string/settings_chart_by_distance"
android:title="@string/settings_chart_x_axis" /> android:title="@string/settings_chart_x_axis" />
<PreferenceCategory android:title="@string/settings_show" > <PreferenceCategory android:title="@string/settings_show" >
<CheckBoxPreference <CheckBoxPreference
+3 -3
View File
@@ -20,9 +20,9 @@ limitations under the License.
android:defaultValue="@string/stats_units_metric" android:defaultValue="@string/stats_units_metric"
android:key="@string/stats_units_key" android:key="@string/stats_units_key"
android:title="@string/settings_stats_units_title" /> android:title="@string/settings_stats_units_title" />
<CheckBoxPreference <ListPreference
android:defaultValue="true" android:defaultValue="@string/stats_rate_speed"
android:key="@string/report_speed_key" android:key="@string/stats_rate_key"
android:title="@string/settings_stats_rate_title" /> android:title="@string/settings_stats_rate_title" />
<PreferenceCategory android:title="@string/settings_show" > <PreferenceCategory android:title="@string/settings_show" >
<CheckBoxPreference <CheckBoxPreference
@@ -282,9 +282,8 @@ public class TrackDataHub implements DataSourceListener {
} }
} }
if (key == null if (key == null
|| key.equals(PreferencesUtils.getKey(context, R.string.report_speed_key))) { || key.equals(PreferencesUtils.getKey(context, R.string.stats_rate_key))) {
reportSpeed = PreferencesUtils.getBoolean( reportSpeed = PreferencesUtils.isReportSpeed(context);
context, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
if (key != null) { if (key != null) {
for (TrackDataListener trackDataListener : for (TrackDataListener trackDataListener :
trackDataManager.getListeners(TrackDataType.PREFERENCE)) { trackDataManager.getListeners(TrackDataType.PREFERENCE)) {
@@ -65,7 +65,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
private long startTime; private long startTime;
private boolean metricUnits = true; private boolean metricUnits = true;
private boolean reportSpeed = PreferencesUtils.REPORT_SPEED_DEFAULT; private boolean reportSpeed = true;
private int recordingDistanceInterval = PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT; private int recordingDistanceInterval = PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT;
// Modes of operation // Modes of operation
@@ -305,8 +305,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
*/ */
private void checkChartSettings() { private void checkChartSettings() {
boolean needUpdate = false; boolean needUpdate = false;
if (chartByDistance != PreferencesUtils.getBoolean(getActivity(), if (chartByDistance != PreferencesUtils.isChartByDistance(getActivity())) {
R.string.chart_by_distance_key, PreferencesUtils.CHART_BY_DISTANCE_DEFAULT)) {
chartByDistance = !chartByDistance; chartByDistance = !chartByDistance;
chartView.setChartByDistance(chartByDistance); chartView.setChartByDistance(chartByDistance);
reloadTrackDataHub(); reloadTrackDataHub();
@@ -82,15 +82,19 @@ public class ConfirmDeleteDialogFragment extends DialogFragment {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS); final long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS);
int titleId;
int messageId; int messageId;
if (trackIds.length == 1 && trackIds[0] == -1L) { if (trackIds.length == 1 && trackIds[0] == -1L) {
titleId = R.string.track_delete_all_confirm_title;
messageId = R.string.track_delete_all_confirm_message; messageId = R.string.track_delete_all_confirm_message;
} else { } else {
titleId = trackIds.length > 1 ? R.string.generic_delete_selected_confirm_title
: R.string.track_delete_one_confirm_title;
messageId = trackIds.length > 1 ? R.string.track_delete_multiple_confirm_message messageId = trackIds.length > 1 ? R.string.track_delete_multiple_confirm_message
: R.string.track_delete_one_confirm_message; : R.string.track_delete_one_confirm_message;
} }
return DialogUtils.createConfirmationDialog( return DialogUtils.createConfirmationDialog(
getActivity(), messageId, new DialogInterface.OnClickListener() { getActivity(), titleId, getString(messageId), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
caller.onConfirmDeleteDone(trackIds); caller.onConfirmDeleteDone(trackIds);
@@ -16,11 +16,11 @@
package com.google.android.apps.mytracks.fragments; package com.google.android.apps.mytracks.fragments;
import com.google.android.apps.mytracks.util.DialogUtils;
import com.google.android.apps.mytracks.util.PreferencesUtils; import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.maps.mytracks.R; import com.google.android.maps.mytracks.R;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
@@ -92,8 +92,8 @@ public class ConfirmPlayDialogFragment extends DialogFragment {
textView.setText(R.string.track_detail_play_confirm_message); textView.setText(R.string.track_detail_play_confirm_message);
checkBox = (CheckBox) view.findViewById(R.id.confirm_dialog_check_box); checkBox = (CheckBox) view.findViewById(R.id.confirm_dialog_check_box);
return new AlertDialog.Builder(fragmentActivity).setNegativeButton(R.string.generic_no, null) return DialogUtils.createConfirmationDialog(fragmentActivity,
.setPositiveButton(R.string.generic_yes, new DialogInterface.OnClickListener() { R.string.track_detail_play_confirm_title, view, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS); long[] trackIds = getArguments().getLongArray(KEY_TRACK_IDS);
@@ -101,6 +101,6 @@ public class ConfirmPlayDialogFragment extends DialogFragment {
fragmentActivity, R.string.confirm_play_earth_key, !checkBox.isChecked()); fragmentActivity, R.string.confirm_play_earth_key, !checkBox.isChecked());
caller.onConfirmPlayDone(trackIds); caller.onConfirmPlayDone(trackIds);
} }
}).setTitle(R.string.generic_confirm_title).setView(view).create(); });
} }
} }
@@ -77,10 +77,12 @@ public class DeleteMarkerDialogFragment extends DialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final FragmentActivity fragmentActivity = getActivity(); final FragmentActivity fragmentActivity = getActivity();
final long[] markerIds = getArguments().getLongArray(KEY_MARKER_IDS); final long[] markerIds = getArguments().getLongArray(KEY_MARKER_IDS);
int titleId = markerIds.length > 1 ? R.string.generic_delete_selected_confirm_title
: R.string.marker_delete_one_confirm_title;
int messageId = markerIds.length > 1 ? R.string.marker_delete_multiple_confirm_message int messageId = markerIds.length > 1 ? R.string.marker_delete_multiple_confirm_message
: R.string.marker_delete_one_confirm_message; : R.string.marker_delete_one_confirm_message;
return DialogUtils.createConfirmationDialog( return DialogUtils.createConfirmationDialog(
fragmentActivity, messageId, new DialogInterface.OnClickListener() { fragmentActivity, titleId, getString(messageId), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
new Thread(new Runnable() { new Thread(new Runnable() {
@@ -181,7 +181,7 @@ public class MarkerDetailFragment extends Fragment {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
int displayHeight = defaultDisplay.getHeight(); int displayHeight = defaultDisplay.getHeight();
bitmap = PhotoUtils.setImageVew( bitmap = PhotoUtils.setImageVew(
imageView, Uri.parse(photoUrl), displayWidth, displayHeight, true); imageView, Uri.parse(photoUrl), displayWidth, displayHeight);
} }
TextView name = (TextView) getView().findViewById(R.id.marker_detail_waypoint_name); TextView name = (TextView) getView().findViewById(R.id.marker_detail_waypoint_name);
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks.io.file;
import com.google.android.apps.mytracks.content.DescriptionGenerator; import com.google.android.apps.mytracks.content.DescriptionGenerator;
import com.google.android.apps.mytracks.content.DescriptionGeneratorImpl; import com.google.android.apps.mytracks.content.DescriptionGeneratorImpl;
import com.google.android.apps.mytracks.content.MyTracksLocation; import com.google.android.apps.mytracks.content.MyTracksLocation;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.Sensor; import com.google.android.apps.mytracks.content.Sensor;
import com.google.android.apps.mytracks.content.Sensor.SensorData; import com.google.android.apps.mytracks.content.Sensor.SensorData;
import com.google.android.apps.mytracks.content.Sensor.SensorDataSet; import com.google.android.apps.mytracks.content.Sensor.SensorDataSet;
@@ -30,7 +31,9 @@ import com.google.android.maps.mytracks.R;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import android.content.Context; import android.content.Context;
import android.database.Cursor;
import android.location.Location; import android.location.Location;
import android.net.Uri;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -66,6 +69,7 @@ public class KmlTrackWriter implements TrackFormatWriter {
private final Context context; private final Context context;
private final DescriptionGenerator descriptionGenerator; private final DescriptionGenerator descriptionGenerator;
private final MyTracksProviderUtils myTracksProviderUtils;
private PrintWriter printWriter; private PrintWriter printWriter;
private ArrayList<Integer> powerList = new ArrayList<Integer>(); private ArrayList<Integer> powerList = new ArrayList<Integer>();
private ArrayList<Integer> cadenceList = new ArrayList<Integer>(); private ArrayList<Integer> cadenceList = new ArrayList<Integer>();
@@ -82,6 +86,7 @@ public class KmlTrackWriter implements TrackFormatWriter {
KmlTrackWriter(Context context, DescriptionGenerator descriptionGenerator) { KmlTrackWriter(Context context, DescriptionGenerator descriptionGenerator) {
this.context = context; this.context = context;
this.descriptionGenerator = descriptionGenerator; this.descriptionGenerator = descriptionGenerator;
this.myTracksProviderUtils = MyTracksProviderUtils.Factory.get(context);
} }
@Override @Override
@@ -158,8 +163,15 @@ public class KmlTrackWriter implements TrackFormatWriter {
if (printWriter != null) { if (printWriter != null) {
String styleName = waypoint.getType() == WaypointType.STATISTICS ? STATISTICS_STYLE String styleName = waypoint.getType() == WaypointType.STATISTICS ? STATISTICS_STYLE
: WAYPOINT_STYLE; : WAYPOINT_STYLE;
writePlacemark(waypoint.getName(), waypoint.getCategory(), waypoint.getDescription(), String photoUrl = waypoint.getPhotoUrl();
styleName, waypoint.getLocation()); if (photoUrl != null && !photoUrl.equals("")) {
float heading = getHeading(waypoint.getTrackId(), waypoint.getLocation());
writePhotoOverlay(waypoint.getName(), waypoint.getCategory(), waypoint.getDescription(),
styleName, waypoint.getLocation(), photoUrl, heading);
} else {
writePlacemark(waypoint.getName(), waypoint.getCategory(), waypoint.getDescription(),
styleName, waypoint.getLocation());
}
} }
} }
@@ -307,6 +319,76 @@ public class KmlTrackWriter implements TrackFormatWriter {
} }
} }
/**
* Writes a photo overlay.
*
* @param name the name
* @param category the category
* @param description the description
* @param styleName the style name
* @param location the location
* @param photoUrl the photo url
* @param heading the heading
*/
private void writePhotoOverlay(String name, String category, String description, String styleName,
Location location, String photoUrl, float heading) {
if (location != null) {
printWriter.println("<PhotoOverlay>");
printWriter.println("<name>" + StringUtils.formatCData(name) + "</name>");
printWriter.println("<description>"
+ StringUtils.formatCData(StringUtils.getCategoryDescription(category, description))
+ "</description>");
printWriter.print("<Camera>");
printWriter.print("<longitude>" + location.getLongitude() + "</longitude>");
printWriter.print("<latitude>" + location.getLatitude() + "</latitude>");
printWriter.print("<altitude>20</altitude>");
printWriter.print("<heading>" + heading + "</heading>");
printWriter.print("<tilt>90</tilt>");
printWriter.println("</Camera>");
printWriter.println("<styleUrl>#" + styleName + "</styleUrl>");
printWriter.println("<Icon><href>" + Uri.decode(photoUrl) + "</href></Icon>");
printWriter.print("<ViewVolume>");
printWriter.print("<near>10</near>");
printWriter.print("<leftFov>-60</leftFov>");
printWriter.print("<rightFov>60</rightFov>");
printWriter.print("<bottomFov>-45</bottomFov>");
printWriter.print("<topFov>45</topFov>");
printWriter.println("</ViewVolume>");
printWriter.println("<Point>");
printWriter.println("<coordinates>" + getCoordinates(location, ",") + "</coordinates>");
printWriter.println("</Point>");
printWriter.println("</PhotoOverlay>");
}
}
/**
* Gets the heading to a location.
*
* @param trackId the track id containing the location
* @param location the location
*/
private float getHeading(long trackId, Location location) {
long trackPointId = myTracksProviderUtils.getTrackPointId(trackId, location);
if (trackPointId == -1L) {
return location.getBearing();
}
Cursor cursor = null;
Location viewLocation;
try {
cursor = myTracksProviderUtils.getTrackPointCursor(trackId, trackPointId, 10, true);
if (cursor == null || cursor.getCount() == 0) {
return location.getBearing();
}
cursor.moveToPosition(cursor.getCount() - 1);
viewLocation = myTracksProviderUtils.createTrackPoint(cursor);
} finally {
if (cursor != null) {
cursor.close();
}
}
return viewLocation.bearingTo(location);
}
private String getCoordinates(Location location, String separator) { private String getCoordinates(Location location, String separator) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append(location.getLongitude() + separator + location.getLatitude()); buffer.append(location.getLongitude() + separator + location.getLatitude());
@@ -228,8 +228,7 @@ public class AnnouncementPeriodicTask implements PeriodicTask {
@VisibleForTesting @VisibleForTesting
protected String getAnnouncement(TripStatistics tripStatistics) { protected String getAnnouncement(TripStatistics tripStatistics) {
boolean metricUnits = PreferencesUtils.isMetricUnits(context); boolean metricUnits = PreferencesUtils.isMetricUnits(context);
boolean reportSpeed = PreferencesUtils.getBoolean( boolean reportSpeed = PreferencesUtils.isReportSpeed(context);
context, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
double distance = tripStatistics.getTotalDistance() * UnitConversions.M_TO_KM; double distance = tripStatistics.getTotalDistance() * UnitConversions.M_TO_KM;
double speed = tripStatistics.getAverageMovingSpeed() * UnitConversions.MS_TO_KMH; double speed = tripStatistics.getAverageMovingSpeed() * UnitConversions.MS_TO_KMH;
@@ -21,6 +21,7 @@ import com.google.android.apps.mytracks.io.backup.BackupActivity;
import com.google.android.apps.mytracks.io.backup.RestoreChooserActivity; import com.google.android.apps.mytracks.io.backup.RestoreChooserActivity;
import com.google.android.apps.mytracks.io.sync.SyncUtils; import com.google.android.apps.mytracks.io.sync.SyncUtils;
import com.google.android.apps.mytracks.util.DialogUtils; import com.google.android.apps.mytracks.util.DialogUtils;
import com.google.android.apps.mytracks.util.FileUtils;
import com.google.android.apps.mytracks.util.IntentUtils; import com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.apps.mytracks.util.PreferencesUtils; import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.maps.mytracks.R; import com.google.android.maps.mytracks.R;
@@ -45,8 +46,9 @@ import android.widget.Toast;
public class BackupResetSettingsActivity extends AbstractSettingsActivity { public class BackupResetSettingsActivity extends AbstractSettingsActivity {
private static final String TAG = BackupResetSettingsActivity.class.getSimpleName(); private static final String TAG = BackupResetSettingsActivity.class.getSimpleName();
private static final int DIALOG_CONFIRM_RESTORE_ID = 0; private static final int DIALOG_CONFIRM_BACKUP_ID = 0;
private static final int DIALOG_CONFIRM_RESET_ID = 1; private static final int DIALOG_CONFIRM_RESTORE_ID = 1;
private static final int DIALOG_CONFIRM_RESET_ID = 2;
private SharedPreferences sharedPreferences; private SharedPreferences sharedPreferences;
private Preference backupPreference; private Preference backupPreference;
@@ -89,9 +91,7 @@ public class BackupResetSettingsActivity extends AbstractSettingsActivity {
backupPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() { backupPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
Intent intent = IntentUtils.newIntent( showDialog(DIALOG_CONFIRM_BACKUP_ID);
BackupResetSettingsActivity.this, BackupActivity.class);
startActivity(intent);
return true; return true;
} }
}); });
@@ -116,11 +116,26 @@ public class BackupResetSettingsActivity extends AbstractSettingsActivity {
@Override @Override
protected Dialog onCreateDialog(int id) { protected Dialog onCreateDialog(int id) {
String message;
Dialog dialog; Dialog dialog;
switch (id) { switch (id) {
case DIALOG_CONFIRM_BACKUP_ID:
message = getString(R.string.settings_backup_confirm_message,
FileUtils.getDirectoryDisplayName(FileUtils.BACKUPS_DIR));
dialog = DialogUtils.createConfirmationDialog(this, R.string.settings_backup_confirm_title,
message, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
Intent intent = IntentUtils.newIntent(
BackupResetSettingsActivity.this, BackupActivity.class);
startActivity(intent);
}
});
break;
case DIALOG_CONFIRM_RESTORE_ID: case DIALOG_CONFIRM_RESTORE_ID:
message = getString(R.string.settings_backup_restore_confirm_message);
dialog = DialogUtils.createConfirmationDialog(this, dialog = DialogUtils.createConfirmationDialog(this,
R.string.settings_backup_restore_confirm_message, R.string.settings_backup_restore_confirm_title, message,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface d, int which) { public void onClick(DialogInterface d, int which) {
@@ -131,8 +146,9 @@ public class BackupResetSettingsActivity extends AbstractSettingsActivity {
}); });
break; break;
case DIALOG_CONFIRM_RESET_ID: case DIALOG_CONFIRM_RESET_ID:
dialog = DialogUtils.createConfirmationDialog( message = getString(R.string.settings_reset_confirm_message);
this, R.string.settings_reset_confirm_message, new DialogInterface.OnClickListener() { dialog = DialogUtils.createConfirmationDialog(this, R.string.settings_reset_confirm_title,
message, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface d, int button) { public void onClick(DialogInterface d, int button) {
onResetPreferencesConfirmed(); onResetPreferencesConfirmed();
@@ -164,17 +180,13 @@ public class BackupResetSettingsActivity extends AbstractSettingsActivity {
*/ */
private void updateUi() { private void updateUi() {
boolean isRecording = recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT; boolean isRecording = recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
String summary = isRecording ? getString(R.string.settings_not_while_recording) : "";
backupPreference.setEnabled(!isRecording); backupPreference.setEnabled(!isRecording);
backupPreference.setSummary( backupPreference.setSummary(summary);
isRecording ? R.string.settings_not_while_recording : R.string.settings_backup_now_summary);
restoreNowPreference.setEnabled(!isRecording); restoreNowPreference.setEnabled(!isRecording);
restoreNowPreference.setSummary(isRecording ? R.string.settings_not_while_recording restoreNowPreference.setSummary(summary);
: R.string.settings_backup_restore_summary);
resetPreference.setEnabled(!isRecording); resetPreference.setEnabled(!isRecording);
resetPreference.setSummary( resetPreference.setSummary(summary);
isRecording ? R.string.settings_not_while_recording : R.string.settings_reset_summary);
} }
/** /**
@@ -21,6 +21,7 @@ import com.google.android.maps.mytracks.R;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
/** /**
* An activity for accessing chart settings. * An activity for accessing chart settings.
@@ -34,6 +35,7 @@ public class ChartSettingsActivity extends AbstractSettingsActivity {
protected void onCreate(Bundle bundle) { protected void onCreate(Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
addPreferencesFromResource(R.xml.chart_settings); addPreferencesFromResource(R.xml.chart_settings);
configXAxisListPreference();
} }
@Override @Override
@@ -46,9 +48,21 @@ public class ChartSettingsActivity extends AbstractSettingsActivity {
private void updateUi() { private void updateUi() {
CheckBoxPreference speedCheckBoxPreference = (CheckBoxPreference) findPreference( CheckBoxPreference speedCheckBoxPreference = (CheckBoxPreference) findPreference(
getString(R.string.chart_show_speed_key)); getString(R.string.chart_show_speed_key));
boolean reportSpeed = PreferencesUtils.getBoolean( speedCheckBoxPreference.setTitle(
this, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT); PreferencesUtils.isReportSpeed(this) ? R.string.stats_speed : R.string.stats_pace);
speedCheckBoxPreference.setTitle(reportSpeed ? R.string.stats_speed }
: R.string.stats_pace);
/**
* Configures the x axis list preference.
*/
private void configXAxisListPreference() {
@SuppressWarnings("deprecation")
ListPreference listPreference = (ListPreference) findPreference(
getString(R.string.chart_x_axis_key));
String value = PreferencesUtils.getString(
this, R.string.chart_x_axis_key, PreferencesUtils.CHART_X_AXIS_DEFAULT);
String[] values = getResources().getStringArray(R.array.chart_x_axis_values);
String[] options = getResources().getStringArray(R.array.chart_x_axis_options);
configureListPreference(listPreference, options, options, values, value, null);
} }
} }
@@ -140,12 +140,13 @@ public class GoogleSettingsActivity extends AbstractSettingsActivity {
Dialog dialog; Dialog dialog;
switch (id) { switch (id) {
case DIALOG_CONFIRM_SWITCH_ACCOUNT: case DIALOG_CONFIRM_SWITCH_ACCOUNT:
dialog = DialogUtils.createConfirmationDialog( dialog = DialogUtils.createConfirmationDialog(this,
this, R.string.settings_google_account_confirm_message, null); R.string.settings_google_account_confirm_title,
getString(R.string.settings_google_account_confirm_message), null);
break; break;
case DIALOG_CONFIRM_DRIVE_SYNC_ON: case DIALOG_CONFIRM_DRIVE_SYNC_ON:
dialog = DialogUtils.createConfirmationDialog(this, R.string.sync_drive_title, dialog = DialogUtils.createConfirmationDialog(this, R.string.sync_drive_title,
R.string.sync_drive_confirm_message, null, new DialogInterface.OnClickListener() { getString(R.string.sync_drive_confirm_message), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface d, int button) { public void onClick(DialogInterface d, int button) {
final String googleAccount = PreferencesUtils.getString(GoogleSettingsActivity.this, final String googleAccount = PreferencesUtils.getString(GoogleSettingsActivity.this,
@@ -179,7 +180,7 @@ public class GoogleSettingsActivity extends AbstractSettingsActivity {
}); });
thread.start(); thread.start();
} }
}, null); });
break; break;
default: default:
dialog = null; dialog = null;
@@ -64,7 +64,8 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
return null; return null;
} }
return DialogUtils.createConfirmationDialog(this, return DialogUtils.createConfirmationDialog(this,
R.string.settings_sharing_allow_access_confirm_message, R.string.settings_sharing_allow_access_confirm_title,
getString(R.string.settings_sharing_allow_access_confirm_message),
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int button) { public void onClick(DialogInterface dialog, int button) {
@@ -20,7 +20,6 @@ import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.maps.mytracks.R; import com.google.android.maps.mytracks.R;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceChangeListener;
@@ -32,21 +31,30 @@ import android.preference.Preference.OnPreferenceChangeListener;
*/ */
public class StatsSettingsActivity extends AbstractSettingsActivity { public class StatsSettingsActivity extends AbstractSettingsActivity {
private String statsUnits;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
protected void onCreate(Bundle bundle) { protected void onCreate(Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
addPreferencesFromResource(R.xml.stats_settings); addPreferencesFromResource(R.xml.stats_settings);
ListPreference preference = (ListPreference) findPreference( /*
* Note configureUnitsListPreference will trigger
* configureRateListPreference
*/
configUnitsListPreference();
}
/**
* Configures the preferred units list preference.
*/
private void configUnitsListPreference() {
@SuppressWarnings("deprecation")
ListPreference listPreference = (ListPreference) findPreference(
getString(R.string.stats_units_key)); getString(R.string.stats_units_key));
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() { OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference pref, Object newValue) { public boolean onPreferenceChange(Preference pref, Object newValue) {
statsUnits = (String) newValue; configRateListPreference(PreferencesUtils.STATS_UNITS_DEFAULT.equals((String) newValue));
updateUi();
return true; return true;
} }
}; };
@@ -54,27 +62,23 @@ public class StatsSettingsActivity extends AbstractSettingsActivity {
this, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT); this, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT);
String[] values = getResources().getStringArray(R.array.stats_units_values); String[] values = getResources().getStringArray(R.array.stats_units_values);
String[] options = getResources().getStringArray(R.array.stats_units_options); String[] options = getResources().getStringArray(R.array.stats_units_options);
configureListPreference(preference, options, options, values, value, listener); configureListPreference(listPreference, options, options, values, value, listener);
} }
@Override /**
protected void onResume() { * Configures the preferred rate list preference.
super.onResume(); *
statsUnits = PreferencesUtils.getString( * @param metricUnits true if metric units
this, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT); */
updateUi(); private void configRateListPreference(boolean metricUnits) {
} @SuppressWarnings("deprecation")
ListPreference listPreference = (ListPreference) findPreference(
@SuppressWarnings("deprecation") getString(R.string.stats_rate_key));
private void updateUi() { String value = PreferencesUtils.getString(
CheckBoxPreference reportSpeedCheckBoxPreference = (CheckBoxPreference) findPreference( this, R.string.stats_rate_key, PreferencesUtils.STATS_RATE_DEFAULT);
getString(R.string.report_speed_key)); String[] values = getResources().getStringArray(R.array.stats_rate_values);
boolean metricUnits = PreferencesUtils.STATS_UNITS_DEFAULT.equals(statsUnits); String[] options = getResources().getStringArray(
reportSpeedCheckBoxPreference.setSummaryOn( metricUnits ? R.array.stats_rate_metric_options : R.array.stats_rate_imperial_options);
metricUnits ? getString(R.string.description_speed_metric) configureListPreference(listPreference, options, options, values, value, null);
: getString(R.string.description_speed_imperial));
reportSpeedCheckBoxPreference.setSummaryOff(
metricUnits ? getString(R.string.description_pace_metric)
: getString(R.string.description_pace_imperial));
} }
} }
@@ -38,40 +38,26 @@ public class DialogUtils {
* Creates a confirmation dialog. * Creates a confirmation dialog.
* *
* @param context the context * @param context the context
* @param messageId the message id * @param titleId the title
* @param message the message
* @param okListener the listener when OK is clicked * @param okListener the listener when OK is clicked
*/ */
public static Dialog createConfirmationDialog( public static Dialog createConfirmationDialog(
Context context, int messageId, DialogInterface.OnClickListener okListener) { Context context, int titleId, String message, DialogInterface.OnClickListener okListener) {
return createConfirmationDialog( return createConfirmationDialog(context, titleId, message, null, okListener);
context, R.string.generic_confirm_title, messageId, null, okListener, null);
} }
/** /**
* Creates a confirmation dialog. * Creates a confirmation dialog.
* *
* @param context the context * @param context the context
* @param titleId the titleId * @param titleId the title
* @param messageId the messageId
* @param view the view * @param view the view
* @param okListener the listener when OK is clicked * @param okListener the listener when OK is clicked
* @param cancelListener the listener when cancel is clicked
*/ */
public static Dialog createConfirmationDialog(Context context, int titleId, int messageId, public static Dialog createConfirmationDialog(
View view, DialogInterface.OnClickListener okListener, Context context, int titleId, View view, DialogInterface.OnClickListener okListener) {
DialogInterface.OnClickListener cancelListener) { return createConfirmationDialog(context, titleId, null, view, okListener);
AlertDialog.Builder builder = new AlertDialog.Builder(context).setCancelable(true)
.setIcon(android.R.drawable.ic_dialog_alert)
.setNegativeButton(R.string.generic_no, cancelListener)
.setPositiveButton(R.string.generic_yes, okListener).setTitle(titleId);
if (messageId != -1) {
builder.setMessage(messageId);
}
if (view != null) {
builder.setView(view);
}
return builder.create();
} }
/** /**
@@ -99,6 +85,21 @@ public class DialogUtils {
return createProgressDialog(false, context, messageId, onCancelListener, formatArgs); return createProgressDialog(false, context, messageId, onCancelListener, formatArgs);
} }
private static Dialog createConfirmationDialog(Context context, int titleId, String message,
View view, DialogInterface.OnClickListener okListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context).setCancelable(true)
.setIcon(android.R.drawable.ic_dialog_alert).setNegativeButton(R.string.generic_no, null)
.setPositiveButton(R.string.generic_yes, okListener).setTitle(titleId);
if (message != null) {
builder.setMessage(message);
}
if (view != null) {
builder.setView(view);
}
return builder.create();
}
/** /**
* Creates a progress dialog. * Creates a progress dialog.
* *
@@ -94,9 +94,10 @@ public class ListItemUtils {
} else { } else {
photo.setVisibility(View.VISIBLE); photo.setVisibility(View.VISIBLE);
Display defaultDisplay = activity.getWindowManager().getDefaultDisplay(); Display defaultDisplay = activity.getWindowManager().getDefaultDisplay();
// Set the initial width to 35% of the display width // Set the initial width to 33% of the display width.
int width = (int) (defaultDisplay.getWidth() * .35); int width = (int) (defaultDisplay.getWidth() * .33);
PhotoUtils.setImageVew(photo, Uri.parse(photoUrl), width, 0, false); int height = 0;
PhotoUtils.setImageVew(photo, Uri.parse(photoUrl), width, height);
} }
// Set date/time // Set date/time
@@ -109,7 +110,8 @@ public class ListItemUtils {
// Set category/description // Set category/description
TextView descriptionTextView = (TextView) view.findViewById(R.id.list_item_description); TextView descriptionTextView = (TextView) view.findViewById(R.id.list_item_description);
setTextView(descriptionTextView, getDescription(isRecording, category, description)); setTextView(descriptionTextView,
isRecording ? null : StringUtils.getCategoryDescription(category, description));
} }
/** /**
@@ -146,30 +148,6 @@ public class ListItemUtils {
return buffer.toString(); return buffer.toString();
} }
/**
* Gets the description text.
*
* @param isRecording true if recording
* @param category the category
* @param description the description
*/
private static String getDescription(boolean isRecording, String category, String description) {
if (isRecording) {
return null;
}
if (category == null || category.length() == 0) {
return description;
}
StringBuffer buffer = new StringBuffer();
buffer.append("[" + category + "]");
if (description != null && description.length() != 0) {
buffer.append(" " + description);
}
return buffer.toString();
}
/** /**
* Gets the start time text. * Gets the start time text.
* *
@@ -44,11 +44,9 @@ public class PhotoUtils {
* @param uri the image uri * @param uri the image uri
* @param displayWidth the display width * @param displayWidth the display width
* @param displayHeight the display height * @param displayHeight the display height
* @param fitWithIn true to fit within the display area. False to crop and fill
* the display area.
*/ */
public static Bitmap setImageVew( public static Bitmap setImageVew(
ImageView imageView, Uri uri, int displayWidth, int displayHeight, boolean fitWithIn) { ImageView imageView, Uri uri, int displayWidth, int displayHeight) {
// Get the image dimensions // Get the image dimensions
BitmapFactory.Options options = new BitmapFactory.Options(); BitmapFactory.Options options = new BitmapFactory.Options();
@@ -61,7 +59,6 @@ public class PhotoUtils {
int targetHeight = displayHeight; int targetHeight = displayHeight;
if (targetHeight == 0) { if (targetHeight == 0) {
targetHeight = (int) (targetWidth * ((float) options.outHeight / (float) options.outWidth)); targetHeight = (int) (targetWidth * ((float) options.outHeight / (float) options.outWidth));
imageView.getLayoutParams().height = targetHeight;
} }
// Set imageWidth and imageHeight based on image rotation // Set imageWidth and imageHeight based on image rotation
@@ -79,8 +76,7 @@ public class PhotoUtils {
// Get a scaled down version of the image // Get a scaled down version of the image
options.inJustDecodeBounds = false; options.inJustDecodeBounds = false;
options.inSampleSize = getInSampleSize( options.inSampleSize = getInSampleSize(imageWidth, imageHeight, targetWidth, targetHeight);
imageWidth, imageHeight, targetWidth, targetHeight, fitWithIn);
options.inPurgeable = true; options.inPurgeable = true;
Bitmap scaledBitmap = BitmapFactory.decodeFile(uri.getPath(), options); Bitmap scaledBitmap = BitmapFactory.decodeFile(uri.getPath(), options);
@@ -133,11 +129,9 @@ public class PhotoUtils {
* @param imageHeight the image height * @param imageHeight the image height
* @param targetWidth the target width * @param targetWidth the target width
* @param targetHeight the target height * @param targetHeight the target height
* @param fitWithin true to fit within the target area. False to crop and fill
* all target area.
*/ */
private static int getInSampleSize( private static int getInSampleSize(
int imageWidth, int imageHeight, int targetWidth, int targetHeight, boolean fitWithin) { int imageWidth, int imageHeight, int targetWidth, int targetHeight) {
float widthRatio = 1; float widthRatio = 1;
if (imageWidth > targetWidth) { if (imageWidth > targetWidth) {
widthRatio = (float) imageWidth / (float) targetWidth; widthRatio = (float) imageWidth / (float) targetWidth;
@@ -150,11 +144,9 @@ public class PhotoUtils {
/* /*
* To fit within the target area, return the larger sample ratio so the * To fit within the target area, return the larger sample ratio so the
* image will not be larger than the target dimensions. To crop and fill the * image will not be larger than the target dimensions. Use Math.floor to
* target area, return the smaller sample ratio so the image will be greater * not under sample.
* than the target dimensions. Use Math.floor to not under sample.
*/ */
return (int) Math.floor( return (int) Math.floor(Math.max(widthRatio, heightRatio));
fitWithin ? Math.max(widthRatio, heightRatio) : Math.min(widthRatio, heightRatio));
} }
} }
@@ -50,12 +50,12 @@ public class PreferencesUtils {
public static final String BLUETOOTH_SENSOR_DEFAULT = ""; 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_CADENCE_DEFAULT = true;
public static final boolean CHART_SHOW_ELEVATION_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_HEART_RATE_DEFAULT = true;
public static final boolean CHART_SHOW_POWER_DEFAULT = true; public static final boolean CHART_SHOW_POWER_DEFAULT = true;
public static final boolean CHART_SHOW_SPEED_DEFAULT = true; public static final boolean CHART_SHOW_SPEED_DEFAULT = true;
public static final String CHART_X_AXIS_DEFAULT = "DISTANCE";
public static final boolean CONFIRM_PLAY_EARTH_DEFAULT = true; public static final boolean CONFIRM_PLAY_EARTH_DEFAULT = true;
@@ -91,7 +91,6 @@ public class PreferencesUtils {
public static final long RECORDING_TRACK_ID_DEFAULT = -1L; public static final long RECORDING_TRACK_ID_DEFAULT = -1L;
public static final boolean RECORDING_TRACK_PAUSED_DEFAULT = true; public static final boolean RECORDING_TRACK_PAUSED_DEFAULT = true;
public static final boolean REPORT_SPEED_DEFAULT = true;
public static final long SELECTED_TRACK_ID_DEFAULT = -1L; public static final long SELECTED_TRACK_ID_DEFAULT = -1L;
public static final String SENSOR_TYPE_DEFAULT = "NONE"; public static final String SENSOR_TYPE_DEFAULT = "NONE";
@@ -102,6 +101,7 @@ public class PreferencesUtils {
public static final int SPLIT_FREQUENCY_DEFAULT = 0; public static final int SPLIT_FREQUENCY_DEFAULT = 0;
// Stats // Stats
public static final String STATS_RATE_DEFAULT = "SPEED";
public static final boolean STATS_SHOW_COORDINATE_DEFAULT = false; public static final boolean STATS_SHOW_COORDINATE_DEFAULT = false;
public static final boolean STATS_SHOW_GRADE_ELEVATION_DEFAULT = false; public static final boolean STATS_SHOW_GRADE_ELEVATION_DEFAULT = false;
public static final String STATS_UNITS_DEFAULT = "METRIC"; public static final String STATS_UNITS_DEFAULT = "METRIC";
@@ -257,4 +257,25 @@ public class PreferencesUtils {
return PreferencesUtils.STATS_UNITS_DEFAULT.equals( return PreferencesUtils.STATS_UNITS_DEFAULT.equals(
getString(context, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT)); getString(context, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT));
} }
/**
* Returns true if the preferred rate is speed, false if the preferred rate is
* pace.
*
* @param context the context
*/
public static boolean isReportSpeed(Context context) {
return PreferencesUtils.STATS_RATE_DEFAULT.equals(
getString(context, R.string.stats_rate_key, PreferencesUtils.STATS_RATE_DEFAULT));
}
/**
* Returns true if chart x axis is by distance, false if by time.
*
* @param context the context
*/
public static boolean isChartByDistance(Context context) {
return PreferencesUtils.CHART_X_AXIS_DEFAULT.equals(
getString(context, R.string.chart_x_axis_key, PreferencesUtils.CHART_X_AXIS_DEFAULT));
}
} }
@@ -51,8 +51,7 @@ public class StatsUtils {
*/ */
public static void setLocationValues(Activity activity, Location location, boolean isRecording) { public static void setLocationValues(Activity activity, Location location, boolean isRecording) {
boolean metricUnits = PreferencesUtils.isMetricUnits(activity); boolean metricUnits = PreferencesUtils.isMetricUnits(activity);
boolean reportSpeed = PreferencesUtils.getBoolean( boolean reportSpeed = PreferencesUtils.isReportSpeed(activity);
activity, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
// Set speed/pace // Set speed/pace
double speed = isRecording && location != null && location.hasSpeed() ? location.getSpeed() double speed = isRecording && location != null && location.hasSpeed() ? location.getSpeed()
@@ -112,8 +111,7 @@ public class StatsUtils {
*/ */
public static void setTripStatisticsValues(Activity activity, TripStatistics tripStatistics) { public static void setTripStatisticsValues(Activity activity, TripStatistics tripStatistics) {
boolean metricUnits = PreferencesUtils.isMetricUnits(activity); boolean metricUnits = PreferencesUtils.isMetricUnits(activity);
boolean reportSpeed = PreferencesUtils.getBoolean( boolean reportSpeed = PreferencesUtils.isReportSpeed(activity);
activity, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
// Set total distance // Set total distance
double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance(); double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
@@ -228,6 +228,26 @@ public class StringUtils {
return result; return result;
} }
/**
* Gets a string for category and description.
*
* @param category the category
* @param description the description
*/
public static String getCategoryDescription(String category, String description) {
if (category == null || category.length() == 0) {
return description;
}
StringBuffer buffer = new StringBuffer();
buffer.append("[" + category + "]");
if (description != null && description.length() != 0) {
buffer.append(" " + description);
}
return buffer.toString();
}
/** /**
* Formats the given text as a XML CDATA element. This includes adding the * Formats the given text as a XML CDATA element. This includes adding the
* starting and ending CDATA tags. Please notice that this may result in * starting and ending CDATA tags. Please notice that this may result in
@@ -60,8 +60,7 @@ public class TrackWidgetConfigActivity extends Activity {
item3 = (Spinner) findViewById(R.id.track_widget_config_item3); item3 = (Spinner) findViewById(R.id.track_widget_config_item3);
item4 = (Spinner) findViewById(R.id.track_widget_config_item4); item4 = (Spinner) findViewById(R.id.track_widget_config_item4);
boolean reportSpeed = PreferencesUtils.getBoolean( boolean reportSpeed = PreferencesUtils.isReportSpeed(this);
this, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
List<CharSequence> list = new ArrayList<CharSequence>(); List<CharSequence> list = new ArrayList<CharSequence>();
addItem(list, R.string.stats_distance); addItem(list, R.string.stats_distance);
@@ -196,8 +196,7 @@ public class TrackWidgetProvider extends AppWidgetProvider {
boolean isPaused = PreferencesUtils.getBoolean(context, R.string.recording_track_paused_key, boolean isPaused = PreferencesUtils.getBoolean(context, R.string.recording_track_paused_key,
PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT); PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT);
boolean metricUnits = PreferencesUtils.isMetricUnits(context); boolean metricUnits = PreferencesUtils.isMetricUnits(context);
boolean reportSpeed = PreferencesUtils.getBoolean( boolean reportSpeed = PreferencesUtils.isReportSpeed(context);
context, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
int item1 = PreferencesUtils.getInt( int item1 = PreferencesUtils.getInt(
context, R.string.track_widget_item1, PreferencesUtils.TRACK_WIDGET_ITEM1_DEFAULT); context, R.string.track_widget_item1, PreferencesUtils.TRACK_WIDGET_ITEM1_DEFAULT);
int item2 = PreferencesUtils.getInt( int item2 = PreferencesUtils.getInt(
@@ -237,6 +237,15 @@ public interface MyTracksProviderUtils {
*/ */
public long getLastTrackPointId(long trackId); public long getLastTrackPointId(long trackId);
/**
* Gets the track point id of a location.
*
* @param trackId the track id
* @param location the location
* @return track point id if the location is in the track. -1L otherwise.
*/
public long getTrackPointId(long trackId, Location location);
/** /**
* Gets the first valid location for a track. Returns null if it doesn't * Gets the first valid location for a track. Returns null if it doesn't
* exist. * exist.
@@ -795,6 +795,31 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
return -1L; return -1L;
} }
@Override
public long getTrackPointId(long trackId, Location location) {
if (trackId < 0) {
return -1L;
}
Cursor cursor = null;
try {
String selection = TrackPointsColumns._ID + "=(select max(" + TrackPointsColumns._ID
+ ") from " + TrackPointsColumns.TABLE_NAME + " WHERE " + TrackPointsColumns.TRACKID
+ "=? AND " + TrackPointsColumns.TIME + "=?)";
String[] selectionArgs = new String[] {
Long.toString(trackId), Long.toString(location.getTime()) };
cursor = getTrackPointCursor(new String[] { TrackPointsColumns._ID }, selection,
selectionArgs, TrackPointsColumns._ID);
if (cursor != null && cursor.moveToFirst()) {
return cursor.getLong(cursor.getColumnIndexOrThrow(TrackPointsColumns._ID));
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return -1L;
}
@Override @Override
public Location getFirstValidTrackPoint(long trackId) { public Location getFirstValidTrackPoint(long trackId) {
if (trackId < 0) { if (trackId < 0) {
@@ -526,7 +526,8 @@ public class TrackDataHubTest extends AndroidTestCase {
public void testPreferencesChange() throws Exception { public void testPreferencesChange() throws Exception {
// Register two listeners // Register two listeners
PreferencesUtils.setBoolean(context, R.string.report_speed_key, true); PreferencesUtils.setString(
context, R.string.stats_rate_key, PreferencesUtils.STATS_RATE_DEFAULT);
PreferencesUtils.setString( PreferencesUtils.setString(
context, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT); context, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT);
PreferencesUtils.setInt(context, R.string.recording_gps_accuracy_key, PreferencesUtils.setInt(context, R.string.recording_gps_accuracy_key,
@@ -563,10 +564,11 @@ public class TrackDataHubTest extends AndroidTestCase {
expect(trackDataListener2.onReportSpeedChanged(false)).andReturn(false); expect(trackDataListener2.onReportSpeedChanged(false)).andReturn(false);
replay(); replay();
PreferencesUtils.setBoolean(context, R.string.report_speed_key, false); PreferencesUtils.setString(
context, R.string.stats_rate_key, context.getString(R.string.stats_rate_pace));
OnSharedPreferenceChangeListener listener = preferenceChangeListenerCapture.getValue(); OnSharedPreferenceChangeListener listener = preferenceChangeListenerCapture.getValue();
listener.onSharedPreferenceChanged( listener.onSharedPreferenceChanged(
sharedPreferences, PreferencesUtils.getKey(context, R.string.report_speed_key)); sharedPreferences, PreferencesUtils.getKey(context, R.string.stats_rate_key));
verifyAndReset(); verifyAndReset();
// Change metric units to false // Change metric units to false
@@ -785,14 +787,16 @@ public class TrackDataHubTest extends AndroidTestCase {
* the key is R.string.metric_units_key. * the key is R.string.metric_units_key.
*/ */
public void testNotifyPreferenceChanged_reportSpeedNoNotify() { public void testNotifyPreferenceChanged_reportSpeedNoNotify() {
boolean value = false; String value = context.getString(R.string.stats_rate_pace);
PreferencesUtils.setBoolean(context, R.string.report_speed_key, value); PreferencesUtils.setString(context, R.string.stats_rate_key, value);
trackDataHub.notifyPreferenceChanged(PreferencesUtils trackDataHub.notifyPreferenceChanged(PreferencesUtils
.getKey(context, R.string.report_speed_key)); .getKey(context, R.string.stats_rate_key));
assertEquals(value, trackDataHub.isReportSpeed()); assertEquals(false, trackDataHub.isReportSpeed());
PreferencesUtils.setBoolean(context, R.string.report_speed_key, !value);
value = context.getString(R.string.stats_rate_speed);
PreferencesUtils.setString(context, R.string.stats_rate_key, value);
trackDataHub.notifyPreferenceChanged(PreferencesUtils trackDataHub.notifyPreferenceChanged(PreferencesUtils
.getKey(context, R.string.report_speed_key)); .getKey(context, R.string.stats_rate_key));
assertEquals(!value, trackDataHub.isReportSpeed()); assertEquals(true, trackDataHub.isReportSpeed());
} }
} }
@@ -843,7 +843,7 @@ public class EndToEndTestUtils {
findMenuItem(activityMyTracks.getString(R.string.menu_settings), true); findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset)); SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset));
Assert.assertTrue(SOLO.waitForText(activityMyTracks.getString(R.string.settings_reset))); Assert.assertTrue(SOLO.waitForText(activityMyTracks.getString(R.string.settings_reset)));
SOLO.clickOnText(activityMyTracks.getString(R.string.settings_reset_summary)); SOLO.clickOnText(activityMyTracks.getString(R.string.settings_reset));
getButtonOnScreen(activityMytracks.getString(R.string.generic_yes), true, true); getButtonOnScreen(activityMytracks.getString(R.string.generic_yes), true, true);
Assert.assertTrue(SOLO.waitForText(activityMyTracks.getString(R.string.settings_reset_done))); Assert.assertTrue(SOLO.waitForText(activityMyTracks.getString(R.string.settings_reset_done)));
instrumentation.waitForIdleSync(); instrumentation.waitForIdleSync();
@@ -99,7 +99,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
// Reset all settings. // Reset all settings.
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset)); EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset));
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_reset_summary)); EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_reset));
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_yes), true, EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_yes), true,
true); true);
EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.settings_reset_done), 1, EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.settings_reset_done), 1,
@@ -283,7 +283,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
// Write to SD card. // Write to SD card.
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true); EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset)); EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset));
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_now)); EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup));
assertTrue(EndToEndTestUtils.SOLO.waitForText( assertTrue(EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.settings_backup_now_success), 0, activityMyTracks.getString(R.string.settings_backup_now_success), 0,
EndToEndTestUtils.SUPER_LONG_WAIT_TIME)); EndToEndTestUtils.SUPER_LONG_WAIT_TIME));
@@ -298,7 +298,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
// Read from SD card. // Read from SD card.
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true); EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset)); EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_reset));
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup_now)); EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_backup));
EndToEndTestUtils.SOLO EndToEndTestUtils.SOLO
.clickOnText(activityMyTracks.getString(R.string.settings_backup_restore)); .clickOnText(activityMyTracks.getString(R.string.settings_backup_restore));
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_yes), true, EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_yes), true,
@@ -187,11 +187,10 @@ public class SyncTestUtils {
if (EndToEndTestUtils.SOLO.waitForText(accountName, 1, EndToEndTestUtils.SHORT_WAIT_TIME)) { if (EndToEndTestUtils.SOLO.waitForText(accountName, 1, EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.SOLO.clickOnText(accountName); EndToEndTestUtils.SOLO.clickOnText(accountName);
EndToEndTestUtils.instrumentation.waitForIdleSync(); EndToEndTestUtils.instrumentation.waitForIdleSync();
if (EndToEndTestUtils.SOLO.waitForText( if (EndToEndTestUtils.SOLO.waitForText(EndToEndTestUtils.activityMytracks.getString(
EndToEndTestUtils.activityMytracks.getString(R.string.generic_confirm_title), 1, R.string.settings_google_account_confirm_title), 1, EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.SHORT_WAIT_TIME)) { EndToEndTestUtils.SOLO.clickOnText(
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks EndToEndTestUtils.activityMytracks.getString(R.string.generic_yes));
.getString(R.string.generic_yes));
} }
} else { } else {
Assert.fail(); Assert.fail();