Merge heads
@@ -16,7 +16,7 @@ limitations under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:installLocation="auto"
|
||||
android:versionCode="44"
|
||||
android:versionCode="45"
|
||||
android:versionName="2.0"
|
||||
package="com.google.android.maps.mytracks" >
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 741 B |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
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:maxLines="2"
|
||||
android:paddingLeft="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
style="@style/TextChooseActivity" />
|
||||
<TextView
|
||||
android:id="@+id/choose_activity_list_item_text2"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:paddingLeft="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
style="@style/TextChooseActivity" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -57,7 +57,7 @@ limitations under the License.
|
||||
android:hint="@string/marker_edit_marker_type_hint"
|
||||
android:id="@+id/marker_edit_waypoint_marker_type"
|
||||
android:imeOptions="actionNext"
|
||||
style="@style/EditCategoryMarker" />
|
||||
style="@style/EditCategory" />
|
||||
<TextView
|
||||
android:text="@string/generic_description"
|
||||
style="@style/EditLabel.WithPaddingTop" />
|
||||
|
||||
@@ -33,13 +33,14 @@ limitations under the License.
|
||||
android:imeOptions="actionNext"
|
||||
style="@style/EditNameTrack" />
|
||||
<TextView
|
||||
android:id="@+id/track_edit_activity_type_label"
|
||||
android:text="@string/track_edit_activity_type"
|
||||
style="@style/EditLabel.WithPaddingTop" />
|
||||
style="@style/EditLabel.WithIcon.WithPaddingTop" />
|
||||
<AutoCompleteTextView
|
||||
android:hint="@string/track_edit_activity_type_hint"
|
||||
android:id="@+id/track_edit_activity_type"
|
||||
android:imeOptions="actionNext"
|
||||
style="@style/EditCategoryTrack" />
|
||||
style="@style/EditCategory" />
|
||||
<TextView
|
||||
android:text="@string/generic_description"
|
||||
style="@style/EditLabel.WithPaddingTop" />
|
||||
|
||||
@@ -15,6 +15,9 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- The style for choose activity text -->
|
||||
<style name="TextChooseActivity">
|
||||
</style>
|
||||
<!-- The style for large size text -->
|
||||
<style name="TextLarge" parent="@android:style/TextAppearance.DeviceDefault.Large">
|
||||
<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_width">wrap_content</item>
|
||||
</style>
|
||||
<!-- The style for large size text -->
|
||||
<!-- The style for small size text -->
|
||||
<style name="TextSmall" parent="@android:style/TextAppearance.DeviceDefault.Small">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
|
||||
@@ -960,9 +960,9 @@ limitations under the License.
|
||||
Marker type: %1$s
|
||||
</string>
|
||||
<string name="marker_edit_marker_type"
|
||||
translation_description="In the marker edit page, the label for the marker type, including some
|
||||
examples.">
|
||||
Marker type (e.g. building, waterfall...)
|
||||
translation_description="In the marker edit page, the label for the marker type, including an
|
||||
example.">
|
||||
Marker type (e.g. waterfall)
|
||||
</string>
|
||||
<string name="marker_edit_marker_type_hint"
|
||||
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 -->
|
||||
<string name="menu_aggregated_statistics"
|
||||
translation_description="In the menu, to go to the aggregated statistics page.">
|
||||
Aggregated statistics
|
||||
translation_description="In the menu, to go to the aggregated statistics page.
|
||||
|
||||
Character limit: ~21 (1 line)">
|
||||
Aggregated stats
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<string name="menu_save"
|
||||
translation_description="In the menu, to save a track to the SD card. This menu item has a
|
||||
submenu.">
|
||||
Save to SD card...
|
||||
submenu.
|
||||
|
||||
Character limit: ~21 (1 line)">
|
||||
Save to SD card
|
||||
</string>
|
||||
<string name="menu_save_all"
|
||||
translation_description="In the menu, to save all the tracks to the SD card. This menu item has
|
||||
a submenu.">
|
||||
Save all to SD card...
|
||||
a submenu.
|
||||
|
||||
Character limit: ~21 (1 line)">
|
||||
Save all to SD card
|
||||
</string>
|
||||
<string name="menu_save_format"
|
||||
translation_description="Under the save to SD card menu option, the option to save a track as a
|
||||
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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<string name="menu_send_google"
|
||||
translation_description="In the menu, to send a track to Google.">
|
||||
Send to Google...
|
||||
translation_description="In the menu, to send a track to Google.
|
||||
|
||||
Character limit: ~21 (1 line)">
|
||||
Send to Google
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<string name="menu_split_frequency"
|
||||
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
|
||||
</string>
|
||||
<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
|
||||
</string>
|
||||
<string name="menu_voice_frequency"
|
||||
translation_description="In the menu, to configure the voice frequency, how frequent to announce
|
||||
status.">
|
||||
status.
|
||||
|
||||
Character limit: ~21 (1 line)">
|
||||
Voice frequency
|
||||
</string>
|
||||
|
||||
@@ -1312,6 +1359,11 @@ limitations under the License.
|
||||
found.">
|
||||
No account found
|
||||
</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"
|
||||
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.">
|
||||
@@ -2148,6 +2200,11 @@ limitations under the License.
|
||||
Play Store.">
|
||||
You need Google Earth to play the track. Do you want to install from the Play Store?
|
||||
</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"
|
||||
translation_description="In the track detail page, the title of the tab showing the map.">
|
||||
Map
|
||||
@@ -2162,8 +2219,8 @@ limitations under the License.
|
||||
</string>
|
||||
<string name="track_edit_activity_type"
|
||||
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 (e.g. hiking, cycling...)
|
||||
activity type, including an example.">
|
||||
Activity type (e.g. hiking)
|
||||
</string>
|
||||
<string name="track_edit_activity_type_hint"
|
||||
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 -->
|
||||
<string name="welcome_message"
|
||||
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
|
||||
recording, you can visualize your track and watch live statistics. You can also add markers,
|
||||
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.
|
||||
Welcome to My Tracks. Use this app to record your GPS tracks, aggregate your stats over time,
|
||||
and share your paths with friends.\n\nHappy Exploring,\nThe My Tracks Team
|
||||
</string>
|
||||
<string name="welcome_title"
|
||||
translation_description="The title of the welcome dialog.">
|
||||
|
||||
@@ -44,14 +44,8 @@ limitations under the License.
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
</style>
|
||||
<!-- The style for the editing marker category -->
|
||||
<style name="EditCategoryMarker" 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">
|
||||
<!-- The style for the editing category -->
|
||||
<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>
|
||||
@@ -65,7 +59,17 @@ limitations under the License.
|
||||
<item name="android:singleLine">false</item>
|
||||
</style>
|
||||
<!-- 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 -->
|
||||
<style name="EditLabel.WithPaddingTop">
|
||||
<item name="android:paddingTop">16dp</item>
|
||||
@@ -143,6 +147,10 @@ limitations under the License.
|
||||
<item name="android:paddingRight">8dp</item>
|
||||
<item name="android:textColor">@android:color/primary_text_light</item>
|
||||
</style>
|
||||
<!-- The style for choose activity text -->
|
||||
<style name="TextChooseActivity">
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
<!-- The style for large size text -->
|
||||
<style name="TextLarge">
|
||||
<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:gravity">center_vertical</item>
|
||||
</style>
|
||||
<!-- The style for large size text -->
|
||||
<!-- The style for small size text -->
|
||||
<style name="TextSmall">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:textColor">?android:textColorSecondary</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
<!-- Theme selector -->
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ChartView extends View {
|
||||
series[SPEED_SERIES] = new ChartValueSeries(context,
|
||||
0,
|
||||
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_imperial,
|
||||
R.color.speed_fill,
|
||||
@@ -789,7 +789,7 @@ public class ChartView extends View {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index != -1) {
|
||||
if (index != -1 && chartData.size() > 0) {
|
||||
int dx = getX(maxX) - pointer.getIntrinsicWidth() / 2;
|
||||
int dy = getY(series[index], chartData.get(chartData.size() - 1)[index + 1])
|
||||
- pointer.getIntrinsicHeight();
|
||||
|
||||
@@ -139,8 +139,10 @@ public class TrackDetailActivity extends AbstractMyTracksActivity implements Del
|
||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
||||
trackDataHub = ((MyTracksApplication) getApplication()).getTrackDataHub();
|
||||
trackDataHub.loadTrack(trackId);
|
||||
|
||||
|
||||
mapViewContainer = getLayoutInflater().inflate(R.layout.map, null);
|
||||
ApiAdapterFactory.getApiAdapter().disableHardwareAccelerated(mapViewContainer);
|
||||
|
||||
tabHost = (TabHost) findViewById(android.R.id.tabhost);
|
||||
tabHost.setup();
|
||||
tabManager = new TabManager(this, tabHost, R.id.realtabcontent);
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* 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 EditText name;
|
||||
private TextView activityTypeLabel;
|
||||
private AutoCompleteTextView activityType;
|
||||
private EditText description;
|
||||
|
||||
@@ -77,6 +79,8 @@ public class TrackEditActivity extends AbstractMyTracksActivity {
|
||||
|
||||
activityType = (AutoCompleteTextView) findViewById(R.id.track_edit_activity_type);
|
||||
activityType.setText(track.getCategory());
|
||||
|
||||
activityTypeLabel = (TextView) findViewById(R.id.track_edit_activity_type_label);
|
||||
setActivityTypeIcon(track.getIcon());
|
||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
|
||||
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
|
||||
*/
|
||||
private void setActivityTypeIcon(String iconValue) {
|
||||
activityType.setCompoundDrawablesWithIntrinsicBounds(
|
||||
activityTypeLabel.setCompoundDrawablesWithIntrinsicBounds(
|
||||
TrackIconUtils.getIconDrawable(iconValue), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,13 @@ import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* A DialogFragment to install Google Earth.
|
||||
@@ -45,7 +47,13 @@ public class InstallEarthDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
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();
|
||||
|
||||
@@ -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.Waypoint;
|
||||
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.LocationUtils;
|
||||
import com.google.android.maps.GeoPoint;
|
||||
@@ -120,6 +121,7 @@ public class MapFragment extends Fragment
|
||||
});
|
||||
messageTextView = (TextView) mapViewContainer.findViewById(R.id.map_message);
|
||||
|
||||
ApiAdapterFactory.getApiAdapter().invalidMenu(getActivity());
|
||||
return mapViewContainer;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,9 +118,9 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
||||
|
||||
@Override
|
||||
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() {
|
||||
@Override
|
||||
@Override
|
||||
public void run() {
|
||||
lastLocation = null;
|
||||
StatsUtils.setLocationValues(getActivity(), lastLocation, true);
|
||||
@@ -131,7 +131,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
||||
|
||||
@Override
|
||||
public void onCurrentLocationChanged(final Location location) {
|
||||
if (isRecording()) {
|
||||
if (isResumed() && isRecording()) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -149,35 +149,39 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
||||
|
||||
@Override
|
||||
public void onSelectedTrackChanged(Track track, boolean isRecording) {
|
||||
if (uiUpdateThread == null && isRecording) {
|
||||
uiUpdateThread = new UiUpdateThread();
|
||||
uiUpdateThread.start();
|
||||
} else if (uiUpdateThread != null && !isRecording) {
|
||||
uiUpdateThread.interrupt();
|
||||
uiUpdateThread = null;
|
||||
if (isResumed()) {
|
||||
if (uiUpdateThread == null && isRecording) {
|
||||
uiUpdateThread = new UiUpdateThread();
|
||||
uiUpdateThread.start();
|
||||
} else if (uiUpdateThread != null && !isRecording) {
|
||||
uiUpdateThread.interrupt();
|
||||
uiUpdateThread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackUpdated(final Track track) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (track == null || track.getTripStatistics() == null) {
|
||||
lastLocation = null;
|
||||
lastTripStatistics = null;
|
||||
if (isResumed()) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (track == null || track.getTripStatistics() == null) {
|
||||
lastLocation = null;
|
||||
lastTripStatistics = null;
|
||||
updateUi();
|
||||
return;
|
||||
}
|
||||
lastTripStatistics = track.getTripStatistics();
|
||||
|
||||
startTime = track.getTripStatistics().getStartTime();
|
||||
if (!isRecording()) {
|
||||
lastLocation = null;
|
||||
}
|
||||
updateUi();
|
||||
return;
|
||||
}
|
||||
lastTripStatistics = track.getTripStatistics();
|
||||
|
||||
startTime = track.getTripStatistics().getStartTime();
|
||||
if (!isRecording()) {
|
||||
lastLocation = null;
|
||||
}
|
||||
updateUi();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,23 +226,27 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
||||
|
||||
@Override
|
||||
public boolean onUnitsChanged(final boolean metric) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateUi();
|
||||
}
|
||||
});
|
||||
if (isResumed()) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateUi();
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onReportSpeedChanged(final boolean speed) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateUi();
|
||||
}
|
||||
});
|
||||
if (isResumed()) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateUi();
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,14 +56,20 @@ public class SendFusionTablesUtils {
|
||||
Log.e(TAG, "Invalid track");
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO(jshih): Determine the correct bounding box and zoom level that
|
||||
// will show the entire track.
|
||||
TripStatistics stats = track.getTripStatistics();
|
||||
double latE6 = stats.getBottom() + (stats.getTop() - stats.getBottom()) / 2;
|
||||
double lonE6 = stats.getLeft() + (stats.getRight() - stats.getLeft()) / 2;
|
||||
int z = 15;
|
||||
|
||||
double latE6;
|
||||
double lonE6;
|
||||
int z;
|
||||
if (track.getNumberOfPoints() < 2) {
|
||||
// Use Google's latitude and longitude
|
||||
latE6 = 37.423 * 1.E6;
|
||||
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
|
||||
// longitude to be formatted in a locale-independent manner. Specifically,
|
||||
// we need the decimal separator to be a period rather than a comma.
|
||||
|
||||