diff --git a/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/LocationService.java b/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/LocationService.java index 1220dfa..665da76 100644 --- a/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/LocationService.java +++ b/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/LocationService.java @@ -42,8 +42,7 @@ public class LocationService extends com.TwentyCodes.android.location.LocationSe * @author ricky barrette */ public static Intent getSingleShotServiceIntent(final Context context) { - return new Intent(context, LocationService.class).putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Constraints.ACCURACY).setAction( - LocationLibraryConstants.INTENT_ACTION_UPDATE); + return new Intent(context, LocationService.class).putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Constraints.ACCURACY).setAction( LocationLibraryConstants.INTENT_ACTION_UPDATE); } /** diff --git a/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/fragments/LocationInformationFragment.java b/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/fragments/LocationInformationFragment.java index 0de71b4..748a6b9 100644 --- a/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/fragments/LocationInformationFragment.java +++ b/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/fragments/LocationInformationFragment.java @@ -145,17 +145,37 @@ public class LocationInformationFragment extends Fragment implements LatLngListe mProgress = (ProgressBar) view.findViewById(R.id.map_progress); + if (mInfo.get(RingerDatabase.KEY_RADIUS) != null) { + mRadius.setProgress(mInfo.getAsInteger(RingerDatabase.KEY_RADIUS)); + } + if (mInfo.get(RingerDatabase.KEY_LOCATION) != null) { final String[] point = mInfo.getAsString(RingerDatabase.KEY_LOCATION).split(","); final LatLng location = new LatLng(Double.parseDouble(point[0]), Double.parseDouble(point[1])); mCircle.setCenter(location); mMarker.setPosition(location); - mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 14)); - } - if (mInfo.get(RingerDatabase.KEY_RADIUS) != null) { - mRadius.setProgress(mInfo.getAsInteger(RingerDatabase.KEY_RADIUS)); + mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { + @Override + public void onMapLoaded() { + if(Constraints.DEBUG) + Log.d(TAG,"onMapLoaded()"); + final LatLngBounds.Builder builder = LatLngBounds.builder(); + builder.include(location); + builder.include(GeoUtils.distanceFrom(location, mRadius.getProgress(), 90)); + mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(),25, 25, 5)); +// mMap.moveCamera(CameraUpdateFactory.newLatLng(location)); + if(Constraints.DEBUG){ + final MarkerOptions marker = new MarkerOptions(); + marker.position(location); + marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_CYAN)); + mMap.addMarker(marker); + } + + } + }); + } view.findViewById(R.id.my_location).setOnClickListener(this);