diff --git a/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/RingerProcessingService.java b/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/RingerProcessingService.java index d6ecabf..dc786bc 100644 --- a/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/RingerProcessingService.java +++ b/LocationRinger/src/org/RickBarrette/android/LocationRinger/services/RingerProcessingService.java @@ -6,15 +6,6 @@ */ package org.RickBarrette.android.LocationRinger.services; -import java.util.Map.Entry; - -import org.RickBarrette.android.LocationRinger.Constraints; -import org.RickBarrette.android.LocationRinger.Log; -import org.RickBarrette.android.LocationRinger.db.RingerDatabase; -import org.RickBarrette.android.LocationRinger.receivers.BluetoothReceiver; -import org.RickBarrette.android.LocationRinger.receivers.GetLocationWidget; -import org.RickBarrette.android.LocationRinger.ui.SettingsActivity; - import android.app.Service; import android.bluetooth.BluetoothAdapter; import android.content.ContentValues; @@ -33,11 +24,18 @@ import android.os.IBinder; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.provider.Settings; - import com.TwentyCodes.android.debug.LocationLibraryConstants; import com.TwentyCodes.android.exception.ExceptionHandler; import com.TwentyCodes.android.location.GeoUtils; -import com.google.android.maps.GeoPoint; +import com.google.android.gms.maps.model.LatLng; +import org.RickBarrette.android.LocationRinger.Constraints; +import org.RickBarrette.android.LocationRinger.Log; +import org.RickBarrette.android.LocationRinger.db.RingerDatabase; +import org.RickBarrette.android.LocationRinger.receivers.BluetoothReceiver; +import org.RickBarrette.android.LocationRinger.receivers.GetLocationWidget; +import org.RickBarrette.android.LocationRinger.ui.SettingsActivity; + +import java.util.Map.Entry; /** * This service will handle processing the users location and the ringers @@ -59,7 +57,7 @@ public class RingerProcessingService extends Service { /** * Applies a ringers options to the current system settings * - * @param id + * @param values * @author ricky barrette */ private void applyRinger(final ContentValues values) { @@ -151,12 +149,8 @@ public class RingerProcessingService extends Service { /** * Apply the ring tone * - * @param stream - * audio stream to apply to - * @param isSilent - * true if silent - * @param uri - * of ringtone, if null silent will be applied + * @param type audio stream to apply to + * @param uri of ringtone, if null silent will be applied * @return string uri of applied ringtone, null if silent was applied * @author ricky barrette */ @@ -282,7 +276,7 @@ public class RingerProcessingService extends Service { */ final ContentValues ringer = getRinger(1); - final GeoPoint point = new GeoPoint((int) (mLocation.getLatitude() * 1E6), (int) (mLocation.getLongitude() * 1E6)); + final LatLng point = new LatLng(mLocation.getLatitude(), mLocation.getLongitude()); Log.d(TAG, "Processing ringers"); Log.d(TAG, "Current location " + (int) (mLocation.getLatitude() * 1E6) + ", " + (int) (mLocation.getLongitude() * 1E6) + " @ " @@ -299,7 +293,7 @@ public class RingerProcessingService extends Service { if (info.containsKey(RingerDatabase.KEY_LOCATION) && info.containsKey(RingerDatabase.KEY_RADIUS)) { final String[] pointInfo = info.getAsString(RingerDatabase.KEY_LOCATION).split(","); if (GeoUtils.isIntersecting(point, Float.valueOf(mLocation.getAccuracy()) / 1000, - new GeoPoint(Integer.parseInt(pointInfo[0]), Integer.parseInt(pointInfo[1])), + new LatLng(Double.parseDouble(pointInfo[0]), Double.parseDouble(pointInfo[1])), Float.valueOf(info.getAsInteger(RingerDatabase.KEY_RADIUS)) / 1000, Constraints.FUDGE_FACTOR)) { c.close(); getRinger(ringer, index); diff --git a/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/SearchDialog.java b/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/SearchDialog.java index b6fb70e..c29ebf0 100644 --- a/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/SearchDialog.java +++ b/LocationRinger/src/org/RickBarrette/android/LocationRinger/ui/SearchDialog.java @@ -6,14 +6,6 @@ */ package org.RickBarrette.android.LocationRinger.ui; -import java.io.IOException; -import java.util.ArrayList; - -import org.RickBarrette.android.LocationRinger.Log; -import org.RickBarrette.android.LocationRinger.R; -import org.json.JSONArray; -import org.json.JSONException; - import android.app.Dialog; import android.content.Context; import android.os.Handler; @@ -21,18 +13,19 @@ import android.view.KeyEvent; import android.view.View; import android.view.WindowManager.LayoutParams; import android.view.inputmethod.InputMethodManager; -import android.widget.AdapterView; +import android.widget.*; import android.widget.AdapterView.OnItemClickListener; -import android.widget.ArrayAdapter; -import android.widget.EditText; -import android.widget.ListView; -import android.widget.ProgressBar; -import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; - import com.TwentyCodes.android.location.OnLocationSelectedListener; import com.TwentyCodes.android.location.ReverseGeocoder; -import com.google.android.maps.GeoPoint; +import com.google.android.gms.maps.model.LatLng; +import org.RickBarrette.android.LocationRinger.Log; +import org.RickBarrette.android.LocationRinger.R; +import org.json.JSONArray; +import org.json.JSONException; + +import java.io.IOException; +import java.util.ArrayList; /** * This dialog will be used to get users input for the address that they want to @@ -100,12 +93,11 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis * @return GeoPoint of the place * @author ricky barrette */ - private GeoPoint getCoords(final int index) { + private LatLng getCoords(final int index) { Log.d(TAG, "getCoords()"); try { final JSONArray coords = mResults.getJSONObject(index).getJSONObject("Point").getJSONArray("coordinates"); - Log.d(TAG, "creating geopoint: " + new GeoPoint((int) (coords.getDouble(1) * 1E6), (int) (coords.getDouble(0) * 1E6)).toString()); - return new GeoPoint((int) (coords.getDouble(1) * 1E6), (int) (coords.getDouble(0) * 1E6)); + return new LatLng(coords.getDouble(1), coords.getDouble(0)); } catch (final JSONException e) { e.printStackTrace(); } diff --git a/location_library b/location_library index 3ca7f80..91970d0 160000 --- a/location_library +++ b/location_library @@ -1 +1 @@ -Subproject commit 3ca7f800a6aadfd5b4836ddb4b6e54a7abd4f8cb +Subproject commit 91970d0b975b116b2a8b4d524e16a9a4b6311612