Updated database to save locations as on row entry, rather than 2
closes #86 Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
@@ -58,14 +58,18 @@ public class RingerDatabase {
|
|||||||
/*
|
/*
|
||||||
* Database keys
|
* Database keys
|
||||||
*/
|
*/
|
||||||
public final static String KEY_RADIUS = "radius";
|
@Deprecated
|
||||||
public final static String KEY_LOCATION_LAT = "location_lat";
|
public final static String KEY_LOCATION_LAT = "location_lat";
|
||||||
|
@Deprecated
|
||||||
public final static String KEY_LOCATION_LON = "location_lon";
|
public final static String KEY_LOCATION_LON = "location_lon";
|
||||||
public final static String KEY_RINGER_NAME = "ringer_name";
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final static String KEY_RINGTONE = "home_ringtone";
|
public final static String KEY_RINGTONE = "home_ringtone";
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final static String KEY_NOTIFICATION_RINGTONE = "notification_ringtone";
|
public final static String KEY_NOTIFICATION_RINGTONE = "notification_ringtone";
|
||||||
|
|
||||||
|
public final static String KEY_RADIUS = "radius";
|
||||||
|
public final static String KEY_RINGER_NAME = "ringer_name";
|
||||||
|
public final static String KEY_LOCATION = "location";
|
||||||
public final static String KEY_RINGTONE_IS_SILENT = "ringtone_is_silent";
|
public final static String KEY_RINGTONE_IS_SILENT = "ringtone_is_silent";
|
||||||
public final static String KEY_NOTIFICATION_IS_SILENT = "notification_is_silent";
|
public final static String KEY_NOTIFICATION_IS_SILENT = "notification_is_silent";
|
||||||
public final static String KEY_IS_ENABLED = "is_enabled";
|
public final static String KEY_IS_ENABLED = "is_enabled";
|
||||||
|
|||||||
@@ -330,8 +330,9 @@ public class RingerProcessingService extends Service {
|
|||||||
|
|
||||||
if(RingerDatabase.parseBoolean(c.getString(1))){
|
if(RingerDatabase.parseBoolean(c.getString(1))){
|
||||||
ContentValues info = this.mDb.getRingerInfo(c.getString(0));
|
ContentValues info = this.mDb.getRingerInfo(c.getString(0));
|
||||||
if(info.containsKey(RingerDatabase.KEY_LOCATION_LAT) && info.containsKey(RingerDatabase.KEY_LOCATION_LON) && info.containsKey(RingerDatabase.KEY_RADIUS))
|
if(info.containsKey(RingerDatabase.KEY_LOCATION) && info.containsKey(RingerDatabase.KEY_RADIUS)){
|
||||||
if(GeoUtils.isIntersecting(point, new Float(mLocation.getAccuracy()) / 1000, new GeoPoint(info.getAsInteger(RingerDatabase.KEY_LOCATION_LAT), info.getAsInteger(RingerDatabase.KEY_LOCATION_LON)), new Float(info.getAsInteger(RingerDatabase.KEY_RADIUS)) / 1000, Debug.FUDGE_FACTOR)){
|
final String[] pointInfo = info.getAsString(RingerDatabase.KEY_LOCATION).split(",");
|
||||||
|
if(GeoUtils.isIntersecting(point, new Float(mLocation.getAccuracy()) / 1000, new GeoPoint(Integer.parseInt(pointInfo[0]), Integer.parseInt(pointInfo[1])), new Float(info.getAsInteger(RingerDatabase.KEY_RADIUS)) / 1000, Debug.FUDGE_FACTOR)){
|
||||||
c.close();
|
c.close();
|
||||||
getRinger(ringer, index);
|
getRinger(ringer, index);
|
||||||
isDeafult = false;
|
isDeafult = false;
|
||||||
@@ -339,6 +340,7 @@ public class RingerProcessingService extends Service {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
index++;
|
index++;
|
||||||
} while (c.moveToNext());
|
} while (c.moveToNext());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,8 +151,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
|
|||||||
|
|
||||||
if(this.mListener != null){
|
if(this.mListener != null){
|
||||||
ContentValues info = new ContentValues();
|
ContentValues info = new ContentValues();
|
||||||
info.put(RingerDatabase.KEY_LOCATION_LAT, point.getLatitudeE6());
|
info.put(RingerDatabase.KEY_LOCATION, point.toString());
|
||||||
info.put(RingerDatabase.KEY_LOCATION_LON, point.getLongitudeE6());
|
|
||||||
this.mListener.onInfoContentChanged(info);
|
this.mListener.onInfoContentChanged(info);
|
||||||
}
|
}
|
||||||
} else if(Debug.DEBUG)
|
} else if(Debug.DEBUG)
|
||||||
@@ -198,8 +197,9 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
|
|||||||
this.mMap.addOverlay(mRadiusOverlay);
|
this.mMap.addOverlay(mRadiusOverlay);
|
||||||
this.mRadius.setEnabled(false);
|
this.mRadius.setEnabled(false);
|
||||||
|
|
||||||
if (this.mInfo.get(RingerDatabase.KEY_LOCATION_LAT) != null && this.mInfo.get(RingerDatabase.KEY_LOCATION_LON) != null){
|
if (this.mInfo.get(RingerDatabase.KEY_LOCATION) != null){
|
||||||
this.mRadiusOverlay.setLocation(new GeoPoint(this.mInfo.getAsInteger(RingerDatabase.KEY_LOCATION_LAT), this.mInfo.getAsInteger(RingerDatabase.KEY_LOCATION_LON)));
|
final String[] point = this.mInfo.getAsString(RingerDatabase.KEY_LOCATION).split(",");
|
||||||
|
this.mRadiusOverlay.setLocation(new GeoPoint(Integer.parseInt(point[0]), Integer.parseInt(point[1])));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mInfo.get(RingerDatabase.KEY_RADIUS) != null){
|
if (this.mInfo.get(RingerDatabase.KEY_RADIUS) != null){
|
||||||
|
|||||||
Reference in New Issue
Block a user