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