update to new google play services

This commit is contained in:
Jimmy Shih
2012-11-02 12:43:31 -07:00
parent c70e374219
commit 4b09254789
7 changed files with 41 additions and 52 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
android:versionCode="59"
android:versionCode="60"
android:versionName="2.0.3"
package="com.google.android.maps.mytracks" >
<!-- Permission to initialize services -->
@@ -25,10 +25,9 @@ import com.google.android.apps.mytracks.util.LocationUtils;
import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.apps.mytracks.util.UnitConversions;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.BitmapDescriptors;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.Model;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.maps.mytracks.R;
@@ -242,10 +241,10 @@ public class MapOverlay {
for (int i = locations.size() - 1; i >= 0; i--) {
CachedLocation cachedLocation = locations.get(i);
if (cachedLocation.valid) {
Marker.Options options = Model.newMarkerOptions().position(cachedLocation.getLatLng())
MarkerOptions markerOptions = new MarkerOptions().position(cachedLocation.getLatLng())
.anchor(MARKER_X_ANCHOR, MARKER_Y_ANCHOR).draggable(false).visible(true)
.icon(BitmapDescriptors.fromResource(R.drawable.red_dot));
googleMap.addMarker(options);
.icon(BitmapDescriptorFactory.fromResource(R.drawable.red_dot));
googleMap.addMarker(markerOptions);
break;
}
}
@@ -255,10 +254,10 @@ public class MapOverlay {
for (int i = 0; i < locations.size(); i++) {
CachedLocation cachedLocation = locations.get(i);
if (cachedLocation.valid) {
Marker.Options options = Model.newMarkerOptions().position(cachedLocation.getLatLng())
MarkerOptions markerOptions = new MarkerOptions().position(cachedLocation.getLatLng())
.anchor(MARKER_X_ANCHOR, MARKER_Y_ANCHOR).draggable(false).visible(true)
.icon(BitmapDescriptors.fromResource(R.drawable.green_dot));
googleMap.addMarker(options);
.icon(BitmapDescriptorFactory.fromResource(R.drawable.green_dot));
googleMap.addMarker(markerOptions);
break;
}
}
@@ -276,11 +275,11 @@ public class MapOverlay {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
int drawableId = waypoint.getType() == Waypoint.TYPE_STATISTICS ? R.drawable.yellow_pushpin
: R.drawable.blue_pushpin;
Marker.Options options = Model.newMarkerOptions().position(latLng)
MarkerOptions markerOptions = new MarkerOptions().position(latLng)
.anchor(WAYPOINT_X_ANCHOR, WAYPOINT_Y_ANCHOR).draggable(false).visible(true)
.icon(BitmapDescriptors.fromResource(drawableId))
.icon(BitmapDescriptorFactory.fromResource(drawableId))
.title(String.valueOf(waypoint.getId()));
googleMap.addMarker(options);
googleMap.addMarker(markerOptions);
}
}
}
@@ -32,17 +32,17 @@ import com.google.android.apps.mytracks.util.GoogleLocationUtils;
import com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.apps.mytracks.util.LocationUtils;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdates;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnCameraChangeListener;
import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener;
import com.google.android.gms.maps.LocationSource;
import com.google.android.gms.maps.LocationSource.OnLocationChangedListener;
import com.google.android.gms.maps.OnMapInitializeListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.Model;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.maps.mytracks.R;
@@ -72,8 +72,7 @@ import java.util.EnumSet;
* @author Leif Hendrik Wilden
* @author Rodrigo Damazio
*/
public class MyTracksMapFragment extends SupportMapFragment
implements OnMapInitializeListener, TrackDataListener {
public class MyTracksMapFragment extends SupportMapFragment implements TrackDataListener {
public static final String MAP_FRAGMENT_TAG = "mapFragment";
@@ -127,7 +126,6 @@ public class MyTracksMapFragment extends SupportMapFragment
setHasOptionsMenu(true);
ApiAdapterFactory.getApiAdapter().invalidMenu(getActivity());
mapOverlay = new MapOverlay(getActivity());
setOnMapInitializeListener(this);
}
@Override
@@ -149,11 +147,12 @@ public class MyTracksMapFragment extends SupportMapFragment
}
});
messageTextView = (TextView) layout.findViewById(R.id.map_message);
onMapInitialize(getMap());
return layout;
}
@Override
public void onMapInitialize(GoogleMap map) {
private void onMapInitialize(GoogleMap map) {
googleMap = map;
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(false);
@@ -198,13 +197,8 @@ public class MyTracksMapFragment extends SupportMapFragment
}
}
});
LatLng latLng = getDefaultLatLng();
if (latLng != null) {
googleMap.moveCamera(CameraUpdates.newLatLngZoom(latLng, googleMap.getMinZoomLevel()));
}
if (isResumed()) {
resetTrackDataHub();
}
googleMap.moveCamera(
CameraUpdateFactory.newLatLngZoom(getDefaultLatLng(), googleMap.getMinZoomLevel()));
}
@Override
@@ -271,16 +265,16 @@ public class MyTracksMapFragment extends SupportMapFragment
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int type = MAP_TYPE_NORMAL;
int type = GoogleMap.MAP_TYPE_NORMAL;
switch (menuItem.getItemId()) {
case R.id.menu_map:
type = MAP_TYPE_NORMAL;
type = GoogleMap.MAP_TYPE_NORMAL;
break;
case R.id.menu_satellite:
type = MAP_TYPE_SATELLITE;
type = GoogleMap.MAP_TYPE_SATELLITE;
break;
case R.id.menu_terrain:
type = MAP_TYPE_TERRAIN;
type = GoogleMap.MAP_TYPE_TERRAIN;
break;
default:
return super.onOptionsItemSelected(menuItem);
@@ -522,15 +516,6 @@ public class MyTracksMapFragment extends SupportMapFragment
trackDataHub = null;
}
/**
* Resets the trackDataHub. Needs to be synchronized because the trackDataHub
* can be accessed by multiple threads.
*/
private synchronized void resetTrackDataHub() {
pauseTrackDataHub();
resumeTrackDataHub();
}
/**
* Returns true if the selected track is recording. Needs to be synchronized
* because the trackDataHub can be accessed by multiple threads.
@@ -563,7 +548,7 @@ public class MyTracksMapFragment extends SupportMapFragment
if (zoomToCurrentLocation
|| (keepCurrentLocationVisible && !isLocationVisible(currentLocation))) {
LatLng latLng = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude());
googleMap.animateCamera(CameraUpdates.newLatLngZoom(latLng, DEFAULT_ZOOM_LEVEL));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, DEFAULT_ZOOM_LEVEL));
zoomToCurrentLocation = false;
}
};
@@ -595,8 +580,9 @@ public class MyTracksMapFragment extends SupportMapFragment
tripStatistics.getBottomDegrees(), tripStatistics.getLeftDegrees());
LatLng northEast = new LatLng(
tripStatistics.getTopDegrees(), tripStatistics.getRightDegrees());
LatLngBounds bounds = Model.newLatLngBounds(southWest, northEast);
CameraUpdate cameraUpdate = CameraUpdates.newLatLngBounds(
LatLngBounds bounds = LatLngBounds.builder()
.include(southWest).include(northEast).build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(
bounds, mapView.getWidth(), mapView.getHeight(), MAP_VIEW_PADDING);
googleMap.moveCamera(cameraUpdate);
}
@@ -623,7 +609,7 @@ public class MyTracksMapFragment extends SupportMapFragment
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
keepCurrentLocationVisible = false;
zoomToCurrentLocation = false;
CameraUpdate cameraUpdate = CameraUpdates.newLatLngZoom(latLng, DEFAULT_ZOOM_LEVEL);
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, DEFAULT_ZOOM_LEVEL);
googleMap.moveCamera(cameraUpdate);
}
}
@@ -653,6 +639,6 @@ public class MyTracksMapFragment extends SupportMapFragment
return false;
}
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
return googleMap.getProjection().getVisibleRegion().getLatLngBounds().contains(latLng);
return googleMap.getProjection().getVisibleRegion().latLngBounds.contains(latLng);
}
}
@@ -18,8 +18,8 @@ package com.google.android.apps.mytracks.maps;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Model;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import java.util.ArrayList;
@@ -54,9 +54,8 @@ public class TrackPathUtils {
pathPoints.addAll(points);
lastPolyline.setPoints(pathPoints);
} else {
Polyline.Options options = Model.newPolylineOptions()
.addAll(points).width(5).color(color);
Polyline polyline = googleMap.addPolyline(options);
PolylineOptions polylineOptions = new PolylineOptions().addAll(points).width(5).color(color);
Polyline polyline = googleMap.addPolyline(polylineOptions);
paths.add(polyline);
}
points.clear();
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms"
android:versionCode="2000000"
android:versionName="2.0.00-000" >
android:versionCode="2002110"
android:versionName="2.0.02 (521584-10)" >
<uses-sdk android:minSdkVersion="8"/>
@@ -41,6 +41,11 @@
<string name="common_google_play_services_update_text">This app won\'t run unless you
update Google Play services.</string>
<!-- Message in confirmation dialog informing user there is an unknow issue in Google Player
services [CHAR LIMIT=NONE] -->
<string name="common_google_play_services_unknown_issue">Unknown issue with Google Play
services.</string>
<!-- Button in confirmation dialog for updating Google Play services [CHAR LIMIT=20] -->
<string name="common_google_play_services_update_button">Update</string>