Cleaned up more errors

This commit is contained in:
2014-08-30 11:50:39 -04:00
parent bf157e9008
commit 2f851f5043
3 changed files with 26 additions and 40 deletions

View File

@@ -6,15 +6,6 @@
*/ */
package org.RickBarrette.android.LocationRinger.services; 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.app.Service;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.content.ContentValues; import android.content.ContentValues;
@@ -33,11 +24,18 @@ import android.os.IBinder;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.PowerManager.WakeLock; import android.os.PowerManager.WakeLock;
import android.provider.Settings; import android.provider.Settings;
import com.TwentyCodes.android.debug.LocationLibraryConstants; import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.exception.ExceptionHandler; import com.TwentyCodes.android.exception.ExceptionHandler;
import com.TwentyCodes.android.location.GeoUtils; 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 * 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 * Applies a ringers options to the current system settings
* *
* @param id * @param values
* @author ricky barrette * @author ricky barrette
*/ */
private void applyRinger(final ContentValues values) { private void applyRinger(final ContentValues values) {
@@ -151,12 +149,8 @@ public class RingerProcessingService extends Service {
/** /**
* Apply the ring tone * Apply the ring tone
* *
* @param stream * @param type audio stream to apply to
* audio stream to apply to * @param uri of ringtone, if null silent will be applied
* @param isSilent
* true if silent
* @param uri
* of ringtone, if null silent will be applied
* @return string uri of applied ringtone, null if silent was applied * @return string uri of applied ringtone, null if silent was applied
* @author ricky barrette * @author ricky barrette
*/ */
@@ -282,7 +276,7 @@ public class RingerProcessingService extends Service {
*/ */
final ContentValues ringer = getRinger(1); 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, "Processing ringers");
Log.d(TAG, Log.d(TAG,
"Current location " + (int) (mLocation.getLatitude() * 1E6) + ", " + (int) (mLocation.getLongitude() * 1E6) + " @ " "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)) { if (info.containsKey(RingerDatabase.KEY_LOCATION) && info.containsKey(RingerDatabase.KEY_RADIUS)) {
final String[] pointInfo = info.getAsString(RingerDatabase.KEY_LOCATION).split(","); final String[] pointInfo = info.getAsString(RingerDatabase.KEY_LOCATION).split(",");
if (GeoUtils.isIntersecting(point, Float.valueOf(mLocation.getAccuracy()) / 1000, 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)) { Float.valueOf(info.getAsInteger(RingerDatabase.KEY_RADIUS)) / 1000, Constraints.FUDGE_FACTOR)) {
c.close(); c.close();
getRinger(ringer, index); getRinger(ringer, index);

View File

@@ -6,14 +6,6 @@
*/ */
package org.RickBarrette.android.LocationRinger.ui; 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.app.Dialog;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
@@ -21,18 +13,19 @@ import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView; import android.widget.*;
import android.widget.AdapterView.OnItemClickListener; 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 android.widget.TextView.OnEditorActionListener;
import com.TwentyCodes.android.location.OnLocationSelectedListener; import com.TwentyCodes.android.location.OnLocationSelectedListener;
import com.TwentyCodes.android.location.ReverseGeocoder; 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 * 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 * @return GeoPoint of the place
* @author ricky barrette * @author ricky barrette
*/ */
private GeoPoint getCoords(final int index) { private LatLng getCoords(final int index) {
Log.d(TAG, "getCoords()"); Log.d(TAG, "getCoords()");
try { try {
final JSONArray coords = mResults.getJSONObject(index).getJSONObject("Point").getJSONArray("coordinates"); 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 LatLng(coords.getDouble(1), coords.getDouble(0));
return new GeoPoint((int) (coords.getDouble(1) * 1E6), (int) (coords.getDouble(0) * 1E6));
} catch (final JSONException e) { } catch (final JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }