Merge heads

This commit is contained in:
youtaol
2012-06-25 11:08:12 +08:00
parent b337da3719
commit 1c20addf6d
122 changed files with 854 additions and 1252 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ limitations under the License.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="44" android:versionCode="45"
android:versionName="2.0" android:versionName="2.0"
package="com.google.android.maps.mytracks" > package="com.google.android.maps.mytracks" >
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

@@ -39,13 +39,15 @@ limitations under the License.
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:maxLines="2" android:maxLines="2"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:textAppearance="?android:attr/textAppearanceListItemSmall" /> android:textAppearance="?android:attr/textAppearanceListItemSmall"
style="@style/TextChooseActivity" />
<TextView <TextView
android:id="@+id/choose_activity_list_item_text2" android:id="@+id/choose_activity_list_item_text2"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:maxLines="2" android:maxLines="2"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceListItemSmall"
style="@style/TextChooseActivity" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
+1 -1
View File
@@ -57,7 +57,7 @@ limitations under the License.
android:hint="@string/marker_edit_marker_type_hint" android:hint="@string/marker_edit_marker_type_hint"
android:id="@+id/marker_edit_waypoint_marker_type" android:id="@+id/marker_edit_waypoint_marker_type"
android:imeOptions="actionNext" android:imeOptions="actionNext"
style="@style/EditCategoryMarker" /> style="@style/EditCategory" />
<TextView <TextView
android:text="@string/generic_description" android:text="@string/generic_description"
style="@style/EditLabel.WithPaddingTop" /> style="@style/EditLabel.WithPaddingTop" />
+3 -2
View File
@@ -33,13 +33,14 @@ limitations under the License.
android:imeOptions="actionNext" android:imeOptions="actionNext"
style="@style/EditNameTrack" /> style="@style/EditNameTrack" />
<TextView <TextView
android:id="@+id/track_edit_activity_type_label"
android:text="@string/track_edit_activity_type" android:text="@string/track_edit_activity_type"
style="@style/EditLabel.WithPaddingTop" /> style="@style/EditLabel.WithIcon.WithPaddingTop" />
<AutoCompleteTextView <AutoCompleteTextView
android:hint="@string/track_edit_activity_type_hint" android:hint="@string/track_edit_activity_type_hint"
android:id="@+id/track_edit_activity_type" android:id="@+id/track_edit_activity_type"
android:imeOptions="actionNext" android:imeOptions="actionNext"
style="@style/EditCategoryTrack" /> style="@style/EditCategory" />
<TextView <TextView
android:text="@string/generic_description" android:text="@string/generic_description"
style="@style/EditLabel.WithPaddingTop" /> style="@style/EditLabel.WithPaddingTop" />
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4 -1
View File
@@ -15,6 +15,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<resources> <resources>
<!-- The style for choose activity text -->
<style name="TextChooseActivity">
</style>
<!-- The style for large size text --> <!-- The style for large size text -->
<style name="TextLarge" parent="@android:style/TextAppearance.DeviceDefault.Large"> <style name="TextLarge" parent="@android:style/TextAppearance.DeviceDefault.Large">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
@@ -25,7 +28,7 @@ limitations under the License.
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
</style> </style>
<!-- The style for large size text --> <!-- The style for small size text -->
<style name="TextSmall" parent="@android:style/TextAppearance.DeviceDefault.Small"> <style name="TextSmall" parent="@android:style/TextAppearance.DeviceDefault.Small">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+92 -38
View File
@@ -960,9 +960,9 @@ limitations under the License.
Marker type: %1$s Marker type: %1$s
</string> </string>
<string name="marker_edit_marker_type" <string name="marker_edit_marker_type"
translation_description="In the marker edit page, the label for the marker type, including some translation_description="In the marker edit page, the label for the marker type, including an
examples."> example.">
Marker type (e.g. building, waterfall...) Marker type (e.g. waterfall)
</string> </string>
<string name="marker_edit_marker_type_hint" <string name="marker_edit_marker_type_hint"
translation_description="In the marker edit page, the hint in the marker type text field when it translation_description="In the marker edit page, the hint in the marker type text field when it
@@ -1002,106 +1002,153 @@ limitations under the License.
<!-- Menu Items --> <!-- Menu Items -->
<string name="menu_aggregated_statistics" <string name="menu_aggregated_statistics"
translation_description="In the menu, to go to the aggregated statistics page."> translation_description="In the menu, to go to the aggregated statistics page.
Aggregated statistics
Character limit: ~21 (1 line)">
Aggregated stats
</string> </string>
<string name="menu_delete" <string name="menu_delete"
translation_description="In the menu, to delete a track or a marker."> translation_description="In the menu, to delete a track or a marker.
Character limit: ~21 (1 line)">
Delete Delete
</string> </string>
<string name="menu_delete_all" <string name="menu_delete_all"
translation_description="In the menu, to delete all the tracks."> translation_description="In the menu, to delete all the tracks.
Character limit: ~21 (1 line)">
Delete all Delete all
</string> </string>
<string name="menu_edit" <string name="menu_edit"
translation_description="In the menu, to edit a track or a marker."> translation_description="In the menu, to edit a track or a marker.
Character limit: ~21 (1 line)">
Edit Edit
</string> </string>
<string name="menu_help" <string name="menu_help"
translation_description="In the menu, to go to the help page."> translation_description="In the menu, to go to the help page.
Character limit: ~21 (1 line)">
Help Help
</string> </string>
<string name="menu_import" <string name="menu_import"
translation_description="In the menu, to import tracks from the SD card."> translation_description="In the menu, to import tracks from the SD card.
Character limit: ~21 (1 line)">
Import from SD card Import from SD card
</string> </string>
<string name="menu_insert_marker" <string name="menu_insert_marker"
translation_description="In the menu, to insert a marker."> translation_description="In the menu, to insert a marker.
Character limit: ~21 (1 line)">
Insert marker Insert marker
</string> </string>
<string name="menu_map_mode" <string name="menu_map_mode"
translation_description="In the menu, to switch the display to the map mode."> translation_description="In the menu, to switch the display to the map mode.
Character limit: ~21 (1 line)">
Map mode Map mode
</string> </string>
<string name="menu_markers" <string name="menu_markers"
translation_description="In the menu, to show a list of markers for the current track."> translation_description="In the menu, to show a list of markers for the current track.
Character limit: ~21 (1 line)">
Markers Markers
</string> </string>
<string name="menu_play" <string name="menu_play"
translation_description="In the menu, to play a track."> translation_description="In the menu, to play a track.
Character limit: ~21 (1 line)">
Play Play
</string> </string>
<string name="menu_record_track" <string name="menu_record_track"
translation_description="In the menu, to start recording a track."> translation_description="In the menu, to start recording a track.
Character limit: ~21 (1 line)">
Record track Record track
</string> </string>
<string name="menu_satellite_mode" <string name="menu_satellite_mode"
translation_description="In the menu, to switch the display to the satellite mode."> translation_description="In the menu, to switch the display to the satellite mode.
Character limit: ~21 (1 line)">
Satellite mode Satellite mode
</string> </string>
<string name="menu_save" <string name="menu_save"
translation_description="In the menu, to save a track to the SD card. This menu item has a translation_description="In the menu, to save a track to the SD card. This menu item has a
submenu."> submenu.
Save to SD card...
Character limit: ~21 (1 line)">
Save to SD card
</string> </string>
<string name="menu_save_all" <string name="menu_save_all"
translation_description="In the menu, to save all the tracks to the SD card. This menu item has translation_description="In the menu, to save all the tracks to the SD card. This menu item has
a submenu."> a submenu.
Save all to SD card...
Character limit: ~21 (1 line)">
Save all to SD card
</string> </string>
<string name="menu_save_format" <string name="menu_save_format"
translation_description="Under the save to SD card menu option, the option to save a track as a translation_description="Under the save to SD card menu option, the option to save a track as a
certain file format. certain file format.
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'."> %1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.
Character limit: ~21 (1 line)">
Save as %1$s Save as %1$s
</string> </string>
<string name="menu_search" <string name="menu_search"
translation_description="In the menu, to start a textual search for tracks or markers."> translation_description="In the menu, to start a textual search for tracks or markers.
Character limit: ~21 (1 line)">
Search Search
</string> </string>
<string name="menu_send_google" <string name="menu_send_google"
translation_description="In the menu, to send a track to Google."> translation_description="In the menu, to send a track to Google.
Send to Google...
Character limit: ~21 (1 line)">
Send to Google
</string> </string>
<string name="menu_sensor_state" <string name="menu_sensor_state"
translation_description="In the menu, to go to the sensor state page."> translation_description="In the menu, to go to the sensor state page.
Character limit: ~21 (1 line)">
Sensor state Sensor state
</string> </string>
<string name="menu_settings" <string name="menu_settings"
translation_description="In the menu, to go to the settings page."> translation_description="In the menu, to go to the settings page.
Character limit: ~21 (1 line)">
Settings Settings
</string> </string>
<string name="menu_share" <string name="menu_share"
translation_description="In the menu, to share a track."> translation_description="In the menu, to share a track.
Character limit: ~21 (1 line)">
Share Share
</string> </string>
<string name="menu_show_on_map" <string name="menu_show_on_map"
translation_description="In the menu, to show a track or a marker on the map."> translation_description="In the menu, to show a track or a marker on the map.
Character limit: ~21 (1 line)">
Show on map Show on map
</string> </string>
<string name="menu_split_frequency" <string name="menu_split_frequency"
translation_description="In the menu, to configure the split frequency, how frequent to insert a translation_description="In the menu, to configure the split frequency, how frequent to insert a
split marker."> split marker.
Character limit: ~21 (1 line)">
Split frequency Split frequency
</string> </string>
<string name="menu_stop_recording" <string name="menu_stop_recording"
translation_description="In the menu, to stop recording a track."> translation_description="In the menu, to stop recording a track.
Character limit: ~21 (1 line)">
Stop recording Stop recording
</string> </string>
<string name="menu_voice_frequency" <string name="menu_voice_frequency"
translation_description="In the menu, to configure the voice frequency, how frequent to announce translation_description="In the menu, to configure the voice frequency, how frequent to announce
status."> status.
Character limit: ~21 (1 line)">
Voice frequency Voice frequency
</string> </string>
@@ -1312,6 +1359,11 @@ limitations under the License.
found."> found.">
No account found No account found
</string> </string>
<string name="send_google_no_account_permission"
translation_description="When sending to Google, the message when not able to get account
permission.">
Not able to get account permission. Make sure network is available.
</string>
<string name="send_google_no_service_selected" <string name="send_google_no_service_selected"
translation_description="When sending a track to Google, a message indicating that the user has translation_description="When sending a track to Google, a message indicating that the user has
not selected any Google service and no data is sent."> not selected any Google service and no data is sent.">
@@ -2148,6 +2200,11 @@ limitations under the License.
Play Store."> Play Store.">
You need Google Earth to play the track. Do you want to install from the Play Store? You need Google Earth to play the track. Do you want to install from the Play Store?
</string> </string>
<string name="track_detail_install_earth_error"
translation_description="Message informing the user not able to install Google Earth from the
Play Store.">
Unalbe to install Google Earth from the Play Store.
</string>
<string name="track_detail_map_tab" <string name="track_detail_map_tab"
translation_description="In the track detail page, the title of the tab showing the map."> translation_description="In the track detail page, the title of the tab showing the map.">
Map Map
@@ -2162,8 +2219,8 @@ limitations under the License.
</string> </string>
<string name="track_edit_activity_type" <string name="track_edit_activity_type"
translation_description="In the page to edit a track, the label for the text field to edit the translation_description="In the page to edit a track, the label for the text field to edit the
activity type, including some examples of activity types."> activity type, including an example.">
Activity type (e.g. hiking, cycling...) Activity type (e.g. hiking)
</string> </string>
<string name="track_edit_activity_type_hint" <string name="track_edit_activity_type_hint"
translation_description="In the page to edit a track, the hint in the 'Activity type' text field translation_description="In the page to edit a track, the hint in the 'Activity type' text field
@@ -2925,11 +2982,8 @@ limitations under the License.
<!-- Welcome --> <!-- Welcome -->
<string name="welcome_message" <string name="welcome_message"
translation_description="The message of the welcome dialog."> translation_description="The message of the welcome dialog.">
Use My Tracks while you walk, run, bike, or do anything else outdoors to record your path. While Welcome to My Tracks. Use this app to record your GPS tracks, aggregate your stats over time,
recording, you can visualize your track and watch live statistics. You can also add markers, and share your paths with friends.\n\nHappy Exploring,\nThe My Tracks Team
have split markers inserted periodically, or hear periodic announcements of your progress.
For recorded tracks, you can play them on Google Earth, share with friends, or upload to Google
Maps, Google Fusion Tables, or Google Docs.
</string> </string>
<string name="welcome_title" <string name="welcome_title"
translation_description="The title of the welcome dialog."> translation_description="The title of the welcome dialog.">
+18 -11
View File
@@ -44,14 +44,8 @@ limitations under the License.
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
</style> </style>
<!-- The style for the editing marker category --> <!-- The style for the editing category -->
<style name="EditCategoryMarker" parent="@style/TextMedium"> <style name="EditCategory" parent="@style/TextMedium">
<item name="android:layout_width">fill_parent</item>
<item name="android:selectAllOnFocus">true</item>
<item name="android:singleLine">true</item>
</style>
<!-- The style for the editing track category -->
<style name="EditCategoryTrack" parent="@style/TextMedium.WithIcon">
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>
<item name="android:selectAllOnFocus">true</item> <item name="android:selectAllOnFocus">true</item>
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
@@ -65,7 +59,17 @@ limitations under the License.
<item name="android:singleLine">false</item> <item name="android:singleLine">false</item>
</style> </style>
<!-- The style for the edit label --> <!-- The style for the edit label -->
<style name="EditLabel" parent="@style/TextMedium" /> <style name="EditLabel" parent="@style/TextMedium">
<item name="android:layout_width">fill_parent</item>
</style>
<!-- The style for the edit label with icon -->
<style name="EditLabel.WithIcon" parent="@style/TextMedium.WithIcon">
<item name="android:layout_width">fill_parent</item>
</style>
<!-- The style for the edit label with icon and with padding top -->
<style name="EditLabel.WithIcon.WithPaddingTop">
<item name="android:paddingTop">16dp</item>
</style>
<!-- The style for the edit lable with padding top --> <!-- The style for the edit lable with padding top -->
<style name="EditLabel.WithPaddingTop"> <style name="EditLabel.WithPaddingTop">
<item name="android:paddingTop">16dp</item> <item name="android:paddingTop">16dp</item>
@@ -143,6 +147,10 @@ limitations under the License.
<item name="android:paddingRight">8dp</item> <item name="android:paddingRight">8dp</item>
<item name="android:textColor">@android:color/primary_text_light</item> <item name="android:textColor">@android:color/primary_text_light</item>
</style> </style>
<!-- The style for choose activity text -->
<style name="TextChooseActivity">
<item name="android:textSize">18sp</item>
</style>
<!-- The style for large size text --> <!-- The style for large size text -->
<style name="TextLarge"> <style name="TextLarge">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
@@ -164,11 +172,10 @@ limitations under the License.
<item name="android:drawablePadding">8dp</item> <item name="android:drawablePadding">8dp</item>
<item name="android:gravity">center_vertical</item> <item name="android:gravity">center_vertical</item>
</style> </style>
<!-- The style for large size text --> <!-- The style for small size text -->
<style name="TextSmall"> <style name="TextSmall">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="android:textSize">14sp</item> <item name="android:textSize">14sp</item>
</style> </style>
<!-- Theme selector --> <!-- Theme selector -->
@@ -142,7 +142,7 @@ public class ChartView extends View {
series[SPEED_SERIES] = new ChartValueSeries(context, series[SPEED_SERIES] = new ChartValueSeries(context,
0, 0,
Integer.MAX_VALUE, Integer.MAX_VALUE,
new int[] {1, 5, 10, 20, 50 }, new int[] {1, 5, 10, 20, 50, 100 },
R.string.description_speed_metric, R.string.description_speed_metric,
R.string.description_speed_imperial, R.string.description_speed_imperial,
R.color.speed_fill, R.color.speed_fill,
@@ -789,7 +789,7 @@ public class ChartView extends View {
break; break;
} }
} }
if (index != -1) { if (index != -1 && chartData.size() > 0) {
int dx = getX(maxX) - pointer.getIntrinsicWidth() / 2; int dx = getX(maxX) - pointer.getIntrinsicWidth() / 2;
int dy = getY(series[index], chartData.get(chartData.size() - 1)[index + 1]) int dy = getY(series[index], chartData.get(chartData.size() - 1)[index + 1])
- pointer.getIntrinsicHeight(); - pointer.getIntrinsicHeight();
@@ -139,8 +139,10 @@ public class TrackDetailActivity extends AbstractMyTracksActivity implements Del
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null); trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
trackDataHub = ((MyTracksApplication) getApplication()).getTrackDataHub(); trackDataHub = ((MyTracksApplication) getApplication()).getTrackDataHub();
trackDataHub.loadTrack(trackId); trackDataHub.loadTrack(trackId);
mapViewContainer = getLayoutInflater().inflate(R.layout.map, null); mapViewContainer = getLayoutInflater().inflate(R.layout.map, null);
ApiAdapterFactory.getApiAdapter().disableHardwareAccelerated(mapViewContainer);
tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost.setup(); tabHost.setup();
tabManager = new TabManager(this, tabHost, R.id.realtabcontent); tabManager = new TabManager(this, tabHost, R.id.realtabcontent);
@@ -30,6 +30,7 @@ import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
/** /**
* An activity that let's the user see and edit the user editable track meta * An activity that let's the user see and edit the user editable track meta
@@ -49,6 +50,7 @@ public class TrackEditActivity extends AbstractMyTracksActivity {
private Track track; private Track track;
private EditText name; private EditText name;
private TextView activityTypeLabel;
private AutoCompleteTextView activityType; private AutoCompleteTextView activityType;
private EditText description; private EditText description;
@@ -77,6 +79,8 @@ public class TrackEditActivity extends AbstractMyTracksActivity {
activityType = (AutoCompleteTextView) findViewById(R.id.track_edit_activity_type); activityType = (AutoCompleteTextView) findViewById(R.id.track_edit_activity_type);
activityType.setText(track.getCategory()); activityType.setText(track.getCategory());
activityTypeLabel = (TextView) findViewById(R.id.track_edit_activity_type_label);
setActivityTypeIcon(track.getIcon()); setActivityTypeIcon(track.getIcon());
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.activity_types, android.R.layout.simple_dropdown_item_1line); this, R.array.activity_types, android.R.layout.simple_dropdown_item_1line);
@@ -145,7 +149,7 @@ public class TrackEditActivity extends AbstractMyTracksActivity {
* @param iconValue the icon value * @param iconValue the icon value
*/ */
private void setActivityTypeIcon(String iconValue) { private void setActivityTypeIcon(String iconValue) {
activityType.setCompoundDrawablesWithIntrinsicBounds( activityTypeLabel.setCompoundDrawablesWithIntrinsicBounds(
TrackIconUtils.getIconDrawable(iconValue), 0, 0, 0); TrackIconUtils.getIconDrawable(iconValue), 0, 0, 0);
} }
} }
@@ -21,11 +21,13 @@ import com.google.android.maps.mytracks.R;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.widget.Toast;
/** /**
* A DialogFragment to install Google Earth. * A DialogFragment to install Google Earth.
@@ -45,7 +47,13 @@ public class InstallEarthDialogFragment extends DialogFragment {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent().setData(Uri.parse(SaveActivity.GOOGLE_EARTH_MARKET_URL)); Intent intent = new Intent().setData(Uri.parse(SaveActivity.GOOGLE_EARTH_MARKET_URL));
startActivity(intent); try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(
getActivity(), R.string.track_detail_install_earth_error, Toast.LENGTH_LONG)
.show();
}
} }
}) })
.create(); .create();
@@ -27,6 +27,7 @@ import com.google.android.apps.mytracks.content.TrackDataHub.ListenerDataType;
import com.google.android.apps.mytracks.content.TrackDataListener; import com.google.android.apps.mytracks.content.TrackDataListener;
import com.google.android.apps.mytracks.content.Waypoint; import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.stats.TripStatistics; import com.google.android.apps.mytracks.stats.TripStatistics;
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
import com.google.android.apps.mytracks.util.GeoRect; import com.google.android.apps.mytracks.util.GeoRect;
import com.google.android.apps.mytracks.util.LocationUtils; import com.google.android.apps.mytracks.util.LocationUtils;
import com.google.android.maps.GeoPoint; import com.google.android.maps.GeoPoint;
@@ -120,6 +121,7 @@ public class MapFragment extends Fragment
}); });
messageTextView = (TextView) mapViewContainer.findViewById(R.id.map_message); messageTextView = (TextView) mapViewContainer.findViewById(R.id.map_message);
ApiAdapterFactory.getApiAdapter().invalidMenu(getActivity());
return mapViewContainer; return mapViewContainer;
} }
@@ -118,9 +118,9 @@ public class StatsFragment extends Fragment implements TrackDataListener {
@Override @Override
public void onProviderStateChange(ProviderState state) { public void onProviderStateChange(ProviderState state) {
if (state == ProviderState.DISABLED || state == ProviderState.NO_FIX) { if (isResumed() && (state == ProviderState.DISABLED || state == ProviderState.NO_FIX)) {
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
lastLocation = null; lastLocation = null;
StatsUtils.setLocationValues(getActivity(), lastLocation, true); StatsUtils.setLocationValues(getActivity(), lastLocation, true);
@@ -131,7 +131,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
@Override @Override
public void onCurrentLocationChanged(final Location location) { public void onCurrentLocationChanged(final Location location) {
if (isRecording()) { if (isResumed() && isRecording()) {
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -149,35 +149,39 @@ public class StatsFragment extends Fragment implements TrackDataListener {
@Override @Override
public void onSelectedTrackChanged(Track track, boolean isRecording) { public void onSelectedTrackChanged(Track track, boolean isRecording) {
if (uiUpdateThread == null && isRecording) { if (isResumed()) {
uiUpdateThread = new UiUpdateThread(); if (uiUpdateThread == null && isRecording) {
uiUpdateThread.start(); uiUpdateThread = new UiUpdateThread();
} else if (uiUpdateThread != null && !isRecording) { uiUpdateThread.start();
uiUpdateThread.interrupt(); } else if (uiUpdateThread != null && !isRecording) {
uiUpdateThread = null; uiUpdateThread.interrupt();
uiUpdateThread = null;
}
} }
} }
@Override @Override
public void onTrackUpdated(final Track track) { public void onTrackUpdated(final Track track) {
getActivity().runOnUiThread(new Runnable() { if (isResumed()) {
@Override getActivity().runOnUiThread(new Runnable() {
public void run() { @Override
if (track == null || track.getTripStatistics() == null) { public void run() {
lastLocation = null; if (track == null || track.getTripStatistics() == null) {
lastTripStatistics = null; lastLocation = null;
lastTripStatistics = null;
updateUi();
return;
}
lastTripStatistics = track.getTripStatistics();
startTime = track.getTripStatistics().getStartTime();
if (!isRecording()) {
lastLocation = null;
}
updateUi(); updateUi();
return;
} }
lastTripStatistics = track.getTripStatistics(); });
}
startTime = track.getTripStatistics().getStartTime();
if (!isRecording()) {
lastLocation = null;
}
updateUi();
}
});
} }
@Override @Override
@@ -222,23 +226,27 @@ public class StatsFragment extends Fragment implements TrackDataListener {
@Override @Override
public boolean onUnitsChanged(final boolean metric) { public boolean onUnitsChanged(final boolean metric) {
getActivity().runOnUiThread(new Runnable() { if (isResumed()) {
@Override getActivity().runOnUiThread(new Runnable() {
public void run() { @Override
updateUi(); public void run() {
} updateUi();
}); }
});
}
return true; return true;
} }
@Override @Override
public boolean onReportSpeedChanged(final boolean speed) { public boolean onReportSpeedChanged(final boolean speed) {
getActivity().runOnUiThread(new Runnable() { if (isResumed()) {
@Override getActivity().runOnUiThread(new Runnable() {
public void run() { @Override
updateUi(); public void run() {
} updateUi();
}); }
});
}
return true; return true;
} }
@@ -56,14 +56,20 @@ public class SendFusionTablesUtils {
Log.e(TAG, "Invalid track"); Log.e(TAG, "Invalid track");
return null; return null;
} }
double latE6;
// TODO(jshih): Determine the correct bounding box and zoom level that double lonE6;
// will show the entire track. int z;
TripStatistics stats = track.getTripStatistics(); if (track.getNumberOfPoints() < 2) {
double latE6 = stats.getBottom() + (stats.getTop() - stats.getBottom()) / 2; // Use Google's latitude and longitude
double lonE6 = stats.getLeft() + (stats.getRight() - stats.getLeft()) / 2; latE6 = 37.423 * 1.E6;
int z = 15; lonE6 = -122.084 * 1.E6;
z = 2;
} else {
TripStatistics stats = track.getTripStatistics();
latE6 = stats.getBottom() + (stats.getTop() - stats.getBottom()) / 2;
lonE6 = stats.getLeft() + (stats.getRight() - stats.getLeft()) / 2;
z = 15;
}
// We explicitly format with Locale.US because we need the latitude and // We explicitly format with Locale.US because we need the latitude and
// longitude to be formatted in a locale-independent manner. Specifically, // longitude to be formatted in a locale-independent manner. Specifically,
// we need the decimal separator to be a period rather than a comma. // we need the decimal separator to be a period rather than a comma.

Some files were not shown because too many files have changed in this diff Show More