Refactored and updated omst variables to final
UserOverlay base is now BaseUserOverlay MapFragmentBase is now BaseMapFragment Change-Id: Icbe234964f9b8ad511f17f6d22bca1a677d4189b Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
Binary file not shown.
@@ -37,12 +37,12 @@ public class SkyHook implements GeoPointLocationListener{
|
|||||||
private GeoPointLocationListener mListener;
|
private GeoPointLocationListener mListener;
|
||||||
private long mPeriod = 0l; //period is in milliseconds for periodic updates
|
private long mPeriod = 0l; //period is in milliseconds for periodic updates
|
||||||
private int mIterations = 0;
|
private int mIterations = 0;
|
||||||
private XPS mXps;
|
private final XPS mXps;
|
||||||
private WPSAuthentication mWPSAuthentication;
|
private WPSAuthentication mWPSAuthentication;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
private final XPScallback mXPScallback = new XPScallback();
|
private final XPScallback mXPScallback = new XPScallback();
|
||||||
private boolean isPeriodicEnabled;
|
private boolean isPeriodicEnabled;
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
private boolean hasLocation;
|
private boolean hasLocation;
|
||||||
protected AndroidGPS mSkyHookFallback = null;
|
protected AndroidGPS mSkyHookFallback = null;
|
||||||
protected long mFallBackDelay = 5000l;
|
protected long mFallBackDelay = 5000l;
|
||||||
@@ -248,7 +248,7 @@ public class SkyHook implements GeoPointLocationListener{
|
|||||||
if (isUnauthorized){
|
if (isUnauthorized){
|
||||||
isPeriodicEnabled = false;
|
isPeriodicEnabled = false;
|
||||||
mXps.abort();
|
mXps.abort();
|
||||||
mXps = null;
|
// mXps = null;
|
||||||
}
|
}
|
||||||
isUnauthorized = true;
|
isUnauthorized = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import com.skyhookwireless.wps.XPS;
|
|||||||
*/
|
*/
|
||||||
public class SkyHookRegistration{
|
public class SkyHookRegistration{
|
||||||
|
|
||||||
private XPS mXps;
|
private final XPS mXps;
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
public SkyHookRegistration(Context context){
|
public SkyHookRegistration(Context context){
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -35,9 +35,9 @@ public class SkyHookRegistration{
|
|||||||
* @param listener for call back methods
|
* @param listener for call back methods
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public void registerNewUser(RegistrationCallback listener){
|
public void registerNewUser(final RegistrationCallback listener){
|
||||||
if(mXps != null){
|
if(mXps != null){
|
||||||
TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
final TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
if(tm == null)
|
if(tm == null)
|
||||||
Log.v(SkyHook.TAG, "TelephonyManager is null");
|
Log.v(SkyHook.TAG, "TelephonyManager is null");
|
||||||
String newUser = tm.getLine1Number();
|
String newUser = tm.getLine1Number();
|
||||||
@@ -58,7 +58,7 @@ public class SkyHookRegistration{
|
|||||||
* @return
|
* @return
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static String getUserName(Context context){
|
public static String getUserName(final Context context){
|
||||||
|
|
||||||
switch(Debug.DEFAULT_REGISTRATION_BEHAVIOR){
|
switch(Debug.DEFAULT_REGISTRATION_BEHAVIOR){
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.google.android.maps.Overlay;
|
|||||||
*
|
*
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public abstract class MapFragmentBase extends Fragment {
|
public abstract class BaseMapFragment extends Fragment {
|
||||||
|
|
||||||
private MapView mMapView;
|
private MapView mMapView;
|
||||||
private boolean isGPSDialogEnabled;
|
private boolean isGPSDialogEnabled;
|
||||||
@@ -33,7 +33,7 @@ public abstract class MapFragmentBase extends Fragment {
|
|||||||
* Creates a new MapFragment
|
* Creates a new MapFragment
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public MapFragmentBase() {
|
public BaseMapFragment() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public abstract class MapFragmentBase extends Fragment {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.map_fragment, container, false);
|
View view = inflater.inflate(R.layout.base_map_fragment, container, false);
|
||||||
|
|
||||||
mMapView = (MapView) view.findViewById(R.id.mapview);
|
mMapView = (MapView) view.findViewById(R.id.mapview);
|
||||||
mMapView.setClickable(true);
|
mMapView.setClickable(true);
|
||||||
@@ -22,8 +22,8 @@ import com.TwentyCodes.android.overlays.DirectionsOverlay;
|
|||||||
*/
|
*/
|
||||||
public class DirectionsAdapter extends BaseAdapter {
|
public class DirectionsAdapter extends BaseAdapter {
|
||||||
|
|
||||||
private LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
private DirectionsOverlay mDirections;
|
private final DirectionsOverlay mDirections;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,8 +80,8 @@ public class DirectionsAdapter extends BaseAdapter {
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, final ViewGroup parent) {
|
||||||
ViewHolder holder;
|
final ViewHolder holder;
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = mInflater.inflate(R.layout.list_row, null);
|
convertView = mInflater.inflate(R.layout.list_row, null);
|
||||||
holder = new ViewHolder();
|
holder = new ViewHolder();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import com.google.android.maps.GeoPoint;
|
|||||||
* TODO acquiring gps dialog
|
* TODO acquiring gps dialog
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements GeoPointLocationListener, CompassListener{
|
public class SkyHoookUserOverlayMapFragment extends BaseMapFragment implements GeoPointLocationListener, CompassListener{
|
||||||
|
|
||||||
private SkyHookUserOverlay mUserOverlay;
|
private SkyHookUserOverlay mUserOverlay;
|
||||||
private GeoPointLocationListener mGeoPointLocationListener;
|
private GeoPointLocationListener mGeoPointLocationListener;
|
||||||
@@ -86,7 +86,7 @@ public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements G
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.fragments.MapFragmentBase#onMapViewCreate(com.TwentyCodes.android.location.MapView)
|
* @see com.TwentyCodes.android.fragments.BaseMapFragment#onMapViewCreate(com.TwentyCodes.android.location.MapView)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onMapViewCreate(MapView map) {
|
public void onMapViewCreate(MapView map) {
|
||||||
@@ -101,7 +101,7 @@ public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements G
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.fragments.MapFragmentBase#onPause()
|
* @see com.TwentyCodes.android.fragments.BaseMapFragment#onPause()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
@@ -112,7 +112,7 @@ public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements G
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.fragments.MapFragmentBase#onResume()
|
* @see com.TwentyCodes.android.fragments.BaseMapFragment#onResume()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import com.google.android.maps.GeoPoint;
|
|||||||
* TODO acquiring gps dialog
|
* TODO acquiring gps dialog
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointLocationListener, CompassListener{
|
public class UserOverlayMapFragment extends BaseMapFragment implements GeoPointLocationListener, CompassListener{
|
||||||
|
|
||||||
private UserOverlay mUserOverlay;
|
private UserOverlay mUserOverlay;
|
||||||
private GeoPointLocationListener mGeoPointLocationListener;
|
private GeoPointLocationListener mGeoPointLocationListener;
|
||||||
@@ -86,7 +86,7 @@ public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointL
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.fragments.MapFragmentBase#onMapViewCreate(com.TwentyCodes.android.location.MapView)
|
* @see com.TwentyCodes.android.fragments.BaseMapFragment#onMapViewCreate(com.TwentyCodes.android.location.MapView)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onMapViewCreate(MapView map) {
|
public void onMapViewCreate(MapView map) {
|
||||||
@@ -101,7 +101,7 @@ public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointL
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.fragments.MapFragmentBase#onPause()
|
* @see com.TwentyCodes.android.fragments.BaseMapFragment#onPause()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
@@ -112,7 +112,7 @@ public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointL
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.fragments.MapFragmentBase#onResume()
|
* @see com.TwentyCodes.android.fragments.BaseMapFragment#onResume()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.google.android.maps.GeoPoint;
|
|||||||
public class AndroidGPS implements LocationListener {
|
public class AndroidGPS implements LocationListener {
|
||||||
|
|
||||||
private static final String TAG = "AndroidGPS";
|
private static final String TAG = "AndroidGPS";
|
||||||
private LocationManager mLocationManager;
|
private final LocationManager mLocationManager;
|
||||||
private GeoPointLocationListener mListener;
|
private GeoPointLocationListener mListener;
|
||||||
private LocationListener mLocationListener;
|
private LocationListener mLocationListener;
|
||||||
|
|
||||||
@@ -131,8 +131,6 @@ public class AndroidGPS implements LocationListener {
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private void requestUpdates() {
|
private void requestUpdates() {
|
||||||
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
|
|
||||||
mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
|
|
||||||
try {
|
try {
|
||||||
mLocationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, this);
|
mLocationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, this);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@@ -141,6 +139,8 @@ public class AndroidGPS implements LocationListener {
|
|||||||
* to function we can ignore it.
|
* to function we can ignore it.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
|
||||||
|
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ import android.hardware.SensorManager;
|
|||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.TwentyCodes.android.debug.Debug;
|
import com.TwentyCodes.android.debug.Debug;
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ public class CompassSensor{
|
|||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private float mDelination = 0;
|
private float mDelination = 0;
|
||||||
|
public static final String TAG = "CompassSensor";
|
||||||
|
|
||||||
private final SensorEventListener mCallBack = new SensorEventListener() {
|
private final SensorEventListener mCallBack = new SensorEventListener() {
|
||||||
|
|
||||||
@@ -45,7 +47,25 @@ public class CompassSensor{
|
|||||||
double mRoll = 0;
|
double mRoll = 0;
|
||||||
private float mInclination;
|
private float mInclination;
|
||||||
|
|
||||||
public void onSensorChanged(SensorEvent sensorEvent) {
|
public void onSensorChanged(final SensorEvent sensorEvent) {
|
||||||
|
if(Debug.DEBUG){
|
||||||
|
switch (sensorEvent.accuracy){
|
||||||
|
case SensorManager.SENSOR_STATUS_UNRELIABLE:
|
||||||
|
Log.v(TAG , "UNRELIABLE");
|
||||||
|
break;
|
||||||
|
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
|
||||||
|
Log.v(TAG , "LOW");
|
||||||
|
break;
|
||||||
|
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
|
||||||
|
Log.v(TAG , "MEDIUM");
|
||||||
|
break;
|
||||||
|
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
|
||||||
|
Log.v(TAG , "HIGH");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the sensor data is unreliable return
|
// If the sensor data is unreliable return
|
||||||
if (sensorEvent.accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE)
|
if (sensorEvent.accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE)
|
||||||
return;
|
return;
|
||||||
@@ -70,6 +90,10 @@ public class CompassSensor{
|
|||||||
/*
|
/*
|
||||||
* TODO remap cords due to Display.getRotation()
|
* TODO remap cords due to Display.getRotation()
|
||||||
*/
|
*/
|
||||||
|
// Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||||
|
// switch (display.getOrientation()){
|
||||||
|
// }
|
||||||
|
|
||||||
// SensorManager.remapCoordinateSystem(mR, SensorManager.AXIS_MINUS_Y, SensorManager.AXIS_X, mR);
|
// SensorManager.remapCoordinateSystem(mR, SensorManager.AXIS_MINUS_Y, SensorManager.AXIS_X, mR);
|
||||||
SensorManager.getOrientation(mR, mOrientVals);
|
SensorManager.getOrientation(mR, mOrientVals);
|
||||||
mInclination = SensorManager.getInclination(mI);
|
mInclination = SensorManager.getInclination(mI);
|
||||||
@@ -163,10 +187,9 @@ public class CompassSensor{
|
|||||||
* @param location last known (lat,lon,altitude), null will reset
|
* @param location last known (lat,lon,altitude), null will reset
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public void setDeclination(Location location){
|
public void setDeclination(final Location location){
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
GeomagneticField geomagneticField;
|
final GeomagneticField geomagneticField = new GeomagneticField(new Double(location.getLatitude()).floatValue(),
|
||||||
geomagneticField = new GeomagneticField(new Double(location.getLatitude()).floatValue(),
|
|
||||||
new Double(location.getLongitude()).floatValue(),
|
new Double(location.getLongitude()).floatValue(),
|
||||||
new Double(location.getAltitude()).floatValue(),
|
new Double(location.getAltitude()).floatValue(),
|
||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ public class GeoUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the bearing from the user location to the destination location, or returns the bearing for north if there is no destination.
|
* Calculates the bearing from the user location to the destination location, or returns the bearing for north if there is no destination.
|
||||||
* This method is awesome for make a compass point toward the destination rather than North.
|
* This method is awesome for making a compass point toward the destination rather than North.
|
||||||
* @param user location
|
* @param user location
|
||||||
* @param dest location
|
* @param dest location
|
||||||
* @param bearing Degrees East from compass
|
* @param bearing Degrees East from compass
|
||||||
* @return Degrees East of dest location
|
* @return Degrees East of dest location
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static float calculateBearing(GeoPoint user, GeoPoint dest, float bearing) {
|
public static float calculateBearing(final GeoPoint user, final GeoPoint dest, float bearing) {
|
||||||
|
|
||||||
if( (user == null) || (dest == null) )
|
if( (user == null) || (dest == null) )
|
||||||
return bearing;
|
return bearing;
|
||||||
@@ -72,7 +72,7 @@ public class GeoUtils {
|
|||||||
* @return the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East of true north
|
* @return the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East of true north
|
||||||
* @author Google Inc.
|
* @author Google Inc.
|
||||||
*/
|
*/
|
||||||
public static double bearing(double lat1, double lon1, double lat2, double lon2) {
|
public static double bearing(final double lat1, final double lon1, final double lat2, final double lon2) {
|
||||||
double lat1Rad = Math.toRadians(lat1);
|
double lat1Rad = Math.toRadians(lat1);
|
||||||
double lat2Rad = Math.toRadians(lat2);
|
double lat2Rad = Math.toRadians(lat2);
|
||||||
double deltaLonRad = Math.toRadians(lon2 - lon1);
|
double deltaLonRad = Math.toRadians(lon2 - lon1);
|
||||||
@@ -88,7 +88,7 @@ public class GeoUtils {
|
|||||||
* @return the bearing of p2 in relationship from p1 in degrees East
|
* @return the bearing of p2 in relationship from p1 in degrees East
|
||||||
* @author Google Inc.
|
* @author Google Inc.
|
||||||
*/
|
*/
|
||||||
public static Double bearing(GeoPoint p1, GeoPoint p2) {
|
public static Double bearing(final GeoPoint p1, final GeoPoint p2) {
|
||||||
double lat1 = p1.getLatitudeE6() / MILLION;
|
double lat1 = p1.getLatitudeE6() / MILLION;
|
||||||
double lon1 = p1.getLongitudeE6() / MILLION;
|
double lon1 = p1.getLongitudeE6() / MILLION;
|
||||||
double lat2 = p2.getLatitudeE6() / MILLION;
|
double lat2 = p2.getLatitudeE6() / MILLION;
|
||||||
@@ -105,7 +105,7 @@ public class GeoUtils {
|
|||||||
* @return geopoint that is x meters away from the geopoint supplied
|
* @return geopoint that is x meters away from the geopoint supplied
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static GeoPoint distanceFrom(GeoPoint point, double distance){
|
public static GeoPoint distanceFrom(final GeoPoint point, double distance){
|
||||||
//convert meters into kilometers
|
//convert meters into kilometers
|
||||||
distance = distance / 1000;
|
distance = distance / 1000;
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ public class GeoUtils {
|
|||||||
* @return the distance between to lat1/lon1 and lat2/lon2
|
* @return the distance between to lat1/lon1 and lat2/lon2
|
||||||
* @author Google Inc.
|
* @author Google Inc.
|
||||||
*/
|
*/
|
||||||
public static double distanceKm(double lat1, double lon1, double lat2, double lon2) {
|
public static double distanceKm(final double lat1, final double lon1, final double lat2, final double lon2) {
|
||||||
double lat1Rad = Math.toRadians(lat1);
|
double lat1Rad = Math.toRadians(lat1);
|
||||||
double lat2Rad = Math.toRadians(lat2);
|
double lat2Rad = Math.toRadians(lat2);
|
||||||
double deltaLonRad = Math.toRadians(lon2 - lon1);
|
double deltaLonRad = Math.toRadians(lon2 - lon1);
|
||||||
@@ -159,7 +159,7 @@ public class GeoUtils {
|
|||||||
* @return string distance
|
* @return string distance
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static String distanceToString(double distance, boolean returnMetric) {
|
public static String distanceToString(double distance, final boolean returnMetric) {
|
||||||
DecimalFormat threeDForm = new DecimalFormat("#.###");
|
DecimalFormat threeDForm = new DecimalFormat("#.###");
|
||||||
DecimalFormat twoDForm = new DecimalFormat("#.##");
|
DecimalFormat twoDForm = new DecimalFormat("#.##");
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ public class GeoUtils {
|
|||||||
* @return true if the circles intersect
|
* @return true if the circles intersect
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static boolean isIntersecting(GeoPoint userPoint, float accuracyRadius, GeoPoint locationPoint, float locationRadius, float fudgeFactor){
|
public static boolean isIntersecting(final GeoPoint userPoint, final float accuracyRadius, final GeoPoint locationPoint, final float locationRadius, final float fudgeFactor){
|
||||||
if(((accuracyRadius + locationRadius) - fudgeFactor) > distanceKm(locationPoint, userPoint))
|
if(((accuracyRadius + locationRadius) - fudgeFactor) > distanceKm(locationPoint, userPoint))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -203,7 +203,7 @@ public class GeoUtils {
|
|||||||
* @return the distance between to p1 and p2
|
* @return the distance between to p1 and p2
|
||||||
* @author Google Inc.
|
* @author Google Inc.
|
||||||
*/
|
*/
|
||||||
public static double distanceKm(GeoPoint p1, GeoPoint p2) {
|
public static double distanceKm(final GeoPoint p1, final GeoPoint p2) {
|
||||||
//if we are handed a null, return -1 so we don't break
|
//if we are handed a null, return -1 so we don't break
|
||||||
if(p1 == null || p2 == null)
|
if(p1 == null || p2 == null)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -221,7 +221,7 @@ public class GeoUtils {
|
|||||||
* @return true is the point is off the map
|
* @return true is the point is off the map
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static boolean isPointOffMap(MapView map , GeoPoint point){
|
public static boolean isPointOffMap(final MapView map , final GeoPoint point){
|
||||||
if(map == null)
|
if(map == null)
|
||||||
return false;
|
return false;
|
||||||
if (point == null)
|
if (point == null)
|
||||||
@@ -243,7 +243,7 @@ public class GeoUtils {
|
|||||||
* @return a MidPoint object
|
* @return a MidPoint object
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static MidPoint midPoint(GeoPoint p1, GeoPoint p2) {
|
public static MidPoint midPoint(final GeoPoint p1, final GeoPoint p2) {
|
||||||
int minLatitude = (int)(+81 * 1E6);
|
int minLatitude = (int)(+81 * 1E6);
|
||||||
int maxLatitude = (int)(-81 * 1E6);
|
int maxLatitude = (int)(-81 * 1E6);
|
||||||
int minLongitude = (int)(+181 * 1E6);
|
int minLongitude = (int)(+181 * 1E6);
|
||||||
@@ -277,7 +277,7 @@ public class GeoUtils {
|
|||||||
* @return bearing
|
* @return bearing
|
||||||
* @author Google Inc.
|
* @author Google Inc.
|
||||||
*/
|
*/
|
||||||
public static double radToBearing(double rad) {
|
public static double radToBearing(final double rad) {
|
||||||
return (Math.toDegrees(rad) + 360) % 360;
|
return (Math.toDegrees(rad) + 360) % 360;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ public abstract class LocationReceiver extends BroadcastReceiver {
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(final Context context, final Intent intent) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
if(intent.getParcelableExtra(INTENT_EXTRA_LOCATION_PARCEL) != null){
|
if(intent.getParcelableExtra(INTENT_EXTRA_LOCATION_PARCEL) != null){
|
||||||
Location location = intent.getParcelableExtra(INTENT_EXTRA_LOCATION_PARCEL);
|
Location location = intent.getParcelableExtra(INTENT_EXTRA_LOCATION_PARCEL);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.google.android.maps.GeoPoint;
|
|||||||
* This MidPoint object will hold the information form the calculations performed by GeoUtils.midPoint().
|
* This MidPoint object will hold the information form the calculations performed by GeoUtils.midPoint().
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public final class MidPoint {
|
public class MidPoint {
|
||||||
|
|
||||||
private final int mMinLatitude;
|
private final int mMinLatitude;
|
||||||
private final int mMaxLatitude;
|
private final int mMaxLatitude;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ReverseGeocoder {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
*/
|
*/
|
||||||
public static JSONArray getFromLocation(Location location) throws IOException, JSONException {
|
public static JSONArray getFromLocation(final Location location) throws IOException, JSONException {
|
||||||
String urlStr = "http://maps.google.com/maps/geo?q=" + location.getLatitude() + "," + location.getLongitude() + "&output=json&sensor=false";
|
String urlStr = "http://maps.google.com/maps/geo?q=" + location.getLatitude() + "," + location.getLongitude() + "&output=json&sensor=false";
|
||||||
StringBuffer response = new StringBuffer();
|
StringBuffer response = new StringBuffer();
|
||||||
HttpClient client = new DefaultHttpClient();
|
HttpClient client = new DefaultHttpClient();
|
||||||
@@ -72,7 +72,7 @@ public class ReverseGeocoder {
|
|||||||
* @return string address, or lat, lon if search fails
|
* @return string address, or lat, lon if search fails
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static String getAddressFromLocation(Location location) {
|
public static String getAddressFromLocation(final Location location) {
|
||||||
String urlStr = "http://maps.google.com/maps/geo?q=" + location.getLatitude() + "," + location.getLongitude() + "&output=json&sensor=false";
|
String urlStr = "http://maps.google.com/maps/geo?q=" + location.getLatitude() + "," + location.getLongitude() + "&output=json&sensor=false";
|
||||||
StringBuffer response = new StringBuffer();
|
StringBuffer response = new StringBuffer();
|
||||||
HttpClient client = new DefaultHttpClient();
|
HttpClient client = new DefaultHttpClient();
|
||||||
@@ -124,7 +124,7 @@ public class ReverseGeocoder {
|
|||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public static JSONArray addressSearch(String address) throws IOException, JSONException {
|
public static JSONArray addressSearch(final String address) throws IOException, JSONException {
|
||||||
String urlStr = "http://maps.google.com/maps/geo?q=" + address + "&output=json&sensor=false";
|
String urlStr = "http://maps.google.com/maps/geo?q=" + address + "&output=json&sensor=false";
|
||||||
urlStr = urlStr.replace(' ', '+');
|
urlStr = urlStr.replace(' ', '+');
|
||||||
StringBuffer response = new StringBuffer();
|
StringBuffer response = new StringBuffer();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import android.graphics.Matrix;
|
|||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
|
import android.graphics.RectF;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.TwentyCodes.android.debug.Debug;
|
import com.TwentyCodes.android.debug.Debug;
|
||||||
@@ -31,7 +32,7 @@ import com.google.android.maps.Projection;
|
|||||||
* This class will be used to build user overlays
|
* This class will be used to build user overlays
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public abstract class UserOverlayBase extends Overlay implements GeoPointLocationListener, CompassListener {
|
public abstract class BaseUserOverlay extends Overlay implements GeoPointLocationListener, CompassListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This thread is responsible for animating the user icon
|
* This thread is responsible for animating the user icon
|
||||||
@@ -126,7 +127,7 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
* @param context
|
* @param context
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public UserOverlayBase(MapView mapView, Context context) {
|
public BaseUserOverlay(MapView mapView, Context context) {
|
||||||
super();
|
super();
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mMapView = mapView;
|
mMapView = mapView;
|
||||||
@@ -141,7 +142,7 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
* @param followUser
|
* @param followUser
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public UserOverlayBase(MapView mapView, Context context, boolean followUser) {
|
public BaseUserOverlay(MapView mapView, Context context, boolean followUser) {
|
||||||
this(mapView, context);
|
this(mapView, context);
|
||||||
isFollowingUser = followUser;
|
isFollowingUser = followUser;
|
||||||
}
|
}
|
||||||
@@ -192,7 +193,8 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
/*
|
/*
|
||||||
* the following log is used to demonstrate if the leftGeo point is the correct
|
* the following log is used to demonstrate if the leftGeo point is the correct
|
||||||
*/
|
*/
|
||||||
// Log.d(TAG, (GeoUtils.distanceKm(mPoint, leftGeo) * 1000)+"m");
|
if(Debug.DEBUG)
|
||||||
|
Log.d(TAG, (GeoUtils.distanceKm(mPoint, leftGeo) * 1000)+"m");
|
||||||
}
|
}
|
||||||
super.draw(canvas, mapView, shadow);
|
super.draw(canvas, mapView, shadow);
|
||||||
}
|
}
|
||||||
@@ -234,9 +236,11 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
* for testing
|
* for testing
|
||||||
* draw a dot over the left geopoint
|
* draw a dot over the left geopoint
|
||||||
*/
|
*/
|
||||||
// paint.setColor(Color.RED);
|
if(Debug.DEBUG){
|
||||||
// RectF oval = new RectF(left.x - 1, left.y - 1, left.x + 1, left.y + 1);
|
paint.setColor(Color.RED);
|
||||||
// canvas.drawOval(oval, paint);
|
RectF oval = new RectF(left.x - 1, left.y - 1, left.x + 1, left.y + 1);
|
||||||
|
canvas.drawOval(oval, paint);
|
||||||
|
}
|
||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
}
|
}
|
||||||
@@ -286,6 +290,7 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public void enableMyLocation(){
|
public void enableMyLocation(){
|
||||||
|
if(Debug.DEBUG)
|
||||||
Log.d(TAG,"enableMyLocation()");
|
Log.d(TAG,"enableMyLocation()");
|
||||||
if (! isEnabled) {
|
if (! isEnabled) {
|
||||||
|
|
||||||
@@ -307,6 +312,7 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public void followUser(boolean followUser){
|
public void followUser(boolean followUser){
|
||||||
|
if(Debug.DEBUG)
|
||||||
Log.d(TAG,"followUser()");
|
Log.d(TAG,"followUser()");
|
||||||
isFollowingUser = followUser;
|
isFollowingUser = followUser;
|
||||||
}
|
}
|
||||||
@@ -339,8 +345,6 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCompassUpdate(float bearing) {
|
public void onCompassUpdate(float bearing) {
|
||||||
if(Debug.DEBUG)
|
|
||||||
Log.v(TAG, "onCompassUpdate()");
|
|
||||||
if(mCompassListener != null)
|
if(mCompassListener != null)
|
||||||
mCompassListener.onCompassUpdate(bearing);
|
mCompassListener.onCompassUpdate(bearing);
|
||||||
mBearing = bearing;
|
mBearing = bearing;
|
||||||
@@ -467,7 +471,6 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
|||||||
* @author Ricky Barrette
|
* @author Ricky Barrette
|
||||||
*/
|
*/
|
||||||
public void unRegisterListener(){
|
public void unRegisterListener(){
|
||||||
Log.d(TAG,"unRegisterListener()");
|
|
||||||
mListener = null;
|
mListener = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,11 +30,11 @@ import com.google.android.maps.Overlay;
|
|||||||
public class CompasOverlay extends Overlay implements CompassListener {
|
public class CompasOverlay extends Overlay implements CompassListener {
|
||||||
|
|
||||||
private float mBearing;
|
private float mBearing;
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
private GeoPoint mDestination;
|
private GeoPoint mDestination;
|
||||||
private GeoPoint mLocation;
|
private GeoPoint mLocation;
|
||||||
private boolean isEnabled;
|
private boolean isEnabled;
|
||||||
private CompassSensor mCompassSensor;
|
private final CompassSensor mCompassSensor;
|
||||||
private int mNeedleResId = R.drawable.needle_sm;
|
private int mNeedleResId = R.drawable.needle_sm;
|
||||||
private int mBackgroundResId = R.drawable.compass_sm;
|
private int mBackgroundResId = R.drawable.compass_sm;
|
||||||
private int mX;
|
private int mX;
|
||||||
@@ -121,7 +121,7 @@ public class CompasOverlay extends Overlay implements CompassListener {
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
|
public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) {
|
||||||
|
|
||||||
if(isEnabled){
|
if(isEnabled){
|
||||||
//set the center of the compass in the top left corner of the screen
|
//set the center of the compass in the top left corner of the screen
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ public class DirectionsOverlay {
|
|||||||
private static final String TAG = "DirectionsOverlay";
|
private static final String TAG = "DirectionsOverlay";
|
||||||
private ArrayList<PathOverlay> mPath;
|
private ArrayList<PathOverlay> mPath;
|
||||||
private ArrayList<String> mDirections;
|
private ArrayList<String> mDirections;
|
||||||
private MapView mMapView;
|
private final MapView mMapView;
|
||||||
private OnDirectionsCompleteListener mListener;
|
private final OnDirectionsCompleteListener mListener;
|
||||||
private String mCopyRights;
|
private String mCopyRights;
|
||||||
private ArrayList<GeoPoint> mPoints;
|
private ArrayList<GeoPoint> mPoints;
|
||||||
private ArrayList<String> mDistance;
|
private ArrayList<String> mDistance;
|
||||||
@@ -59,7 +59,7 @@ public class DirectionsOverlay {
|
|||||||
* @throws IllegalStateException
|
* @throws IllegalStateException
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
*/
|
*/
|
||||||
public DirectionsOverlay(MapView map, GeoPoint origin, GeoPoint destination, OnDirectionsCompleteListener listener) throws IllegalStateException, ClientProtocolException, IOException, JSONException {
|
public DirectionsOverlay(final MapView map, final GeoPoint origin, final GeoPoint destination, final OnDirectionsCompleteListener listener) throws IllegalStateException, ClientProtocolException, IOException, JSONException {
|
||||||
mMapView = map;
|
mMapView = map;
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
String json = downloadJSON(generateUrl(origin, destination));
|
String json = downloadJSON(generateUrl(origin, destination));
|
||||||
@@ -72,7 +72,7 @@ public class DirectionsOverlay {
|
|||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public DirectionsOverlay(MapView map, String json, OnDirectionsCompleteListener listener) throws JSONException{
|
public DirectionsOverlay(final MapView map, final String json, final OnDirectionsCompleteListener listener) throws JSONException{
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mMapView = map;
|
mMapView = map;
|
||||||
drawPath(json);
|
drawPath(json);
|
||||||
@@ -86,7 +86,7 @@ public class DirectionsOverlay {
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
*/
|
*/
|
||||||
private void decodePoly(JSONObject step) throws JSONException {
|
private void decodePoly(final JSONObject step) throws JSONException {
|
||||||
if(Debug.DEBUG)
|
if(Debug.DEBUG)
|
||||||
Log.d(TAG, "decodePoly");
|
Log.d(TAG, "decodePoly");
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ public class DirectionsOverlay {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private String downloadJSON(String url) throws IllegalStateException, ClientProtocolException, IOException {
|
private String downloadJSON(final String url) throws IllegalStateException, ClientProtocolException, IOException {
|
||||||
if(Debug.DEBUG)
|
if(Debug.DEBUG)
|
||||||
Log.d(TAG, url);
|
Log.d(TAG, url);
|
||||||
if(url == null)
|
if(url == null)
|
||||||
@@ -164,7 +164,7 @@ public class DirectionsOverlay {
|
|||||||
* @return
|
* @return
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
*/
|
*/
|
||||||
public void drawPath(String json) throws JSONException{
|
public void drawPath(final String json) throws JSONException{
|
||||||
if(Debug.DEBUG){
|
if(Debug.DEBUG){
|
||||||
Log.d(TAG, "drawPath");
|
Log.d(TAG, "drawPath");
|
||||||
Log.d(TAG, json);
|
Log.d(TAG, json);
|
||||||
@@ -245,7 +245,7 @@ public class DirectionsOverlay {
|
|||||||
* @return The Google API url for our directions
|
* @return The Google API url for our directions
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private String generateUrl(GeoPoint origin, GeoPoint destination){
|
private String generateUrl(final GeoPoint origin, final GeoPoint destination){
|
||||||
return "http://maps.googleapis.com/maps/api/directions/json?&origin="+
|
return "http://maps.googleapis.com/maps/api/directions/json?&origin="+
|
||||||
Double.toString(origin.getLatitudeE6() / 1.0E6)+
|
Double.toString(origin.getLatitudeE6() / 1.0E6)+
|
||||||
","+
|
","+
|
||||||
@@ -279,7 +279,7 @@ public class DirectionsOverlay {
|
|||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private String getDistance(JSONObject step) throws JSONException{
|
private String getDistance(final JSONObject step) throws JSONException{
|
||||||
return step.getJSONObject("distance").getString("text");
|
return step.getJSONObject("distance").getString("text");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ public class DirectionsOverlay {
|
|||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private String getDuration(JSONObject step) throws JSONException{
|
private String getDuration(final JSONObject step) throws JSONException{
|
||||||
return step.getJSONObject("duration").getString("text");
|
return step.getJSONObject("duration").getString("text");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ public class DirectionsOverlay {
|
|||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private GeoPoint getGeoPoint(JSONObject point) throws JSONException{
|
private GeoPoint getGeoPoint(final JSONObject point) throws JSONException{
|
||||||
return new GeoPoint((int) (point.getDouble("lat")*1E6), (int) (point.getDouble("lng")*1E6));
|
return new GeoPoint((int) (point.getDouble("lat")*1E6), (int) (point.getDouble("lng")*1E6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public final class PathOverlay extends Overlay {
|
|||||||
* Creates a new PathOverlay in path mode
|
* Creates a new PathOverlay in path mode
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public PathOverlay(GeoPoint start, GeoPoint end, int color) {
|
public PathOverlay(final GeoPoint start, final GeoPoint end, final int color) {
|
||||||
mStart = start;
|
mStart = start;
|
||||||
mEnd = end;
|
mEnd = end;
|
||||||
mColor = color;
|
mColor = color;
|
||||||
@@ -49,7 +49,7 @@ public final class PathOverlay extends Overlay {
|
|||||||
* @param color
|
* @param color
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public PathOverlay(GeoPoint point, int radius, int color){
|
public PathOverlay(final GeoPoint point, final int radius, final int color){
|
||||||
mMode = POINT;
|
mMode = POINT;
|
||||||
mRadius = radius;
|
mRadius = radius;
|
||||||
mStart = point;
|
mStart = point;
|
||||||
@@ -66,8 +66,8 @@ public final class PathOverlay extends Overlay {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
|
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
|
||||||
Projection projection = mapView.getProjection();
|
final Projection projection = mapView.getProjection();
|
||||||
Paint paint = new Paint();
|
final Paint paint = new Paint();
|
||||||
paint.setColor(mColor);
|
paint.setColor(mColor);
|
||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
Point point = new Point();
|
Point point = new Point();
|
||||||
|
|||||||
@@ -62,12 +62,12 @@ public class RadiusOverlay extends Overlay{
|
|||||||
* @param when
|
* @param when
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas, MapView mapView, boolean shadow){
|
public void draw(final Canvas canvas, final MapView mapView, final boolean shadow){
|
||||||
if(mPoint != null){
|
if(mPoint != null){
|
||||||
Paint paint = new Paint();
|
final Paint paint = new Paint();
|
||||||
Point center = new Point();
|
final Point center = new Point();
|
||||||
Point left = new Point();
|
final Point left = new Point();
|
||||||
Projection projection = mapView.getProjection();
|
final Projection projection = mapView.getProjection();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate a geopoint that is "radius" meters away from geopoint point and
|
* Calculate a geopoint that is "radius" meters away from geopoint point and
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import com.google.android.maps.MapView;
|
|||||||
* this class will be used to display the users location on the map using skyhook's call back methods
|
* this class will be used to display the users location on the map using skyhook's call back methods
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public class SkyHookUserOverlay extends UserOverlayBase{
|
public class SkyHookUserOverlay extends BaseUserOverlay{
|
||||||
|
|
||||||
private SkyHook mSkyHook;
|
private final SkyHook mSkyHook;
|
||||||
|
|
||||||
public SkyHookUserOverlay(MapView mapView, Context context) {
|
public SkyHookUserOverlay(MapView mapView, Context context) {
|
||||||
super(mapView, context);
|
super(mapView, context);
|
||||||
@@ -38,7 +38,7 @@ public class SkyHookUserOverlay extends UserOverlayBase{
|
|||||||
/**
|
/**
|
||||||
* Called when the location provider needs to be disabled
|
* Called when the location provider needs to be disabled
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.overlays.UserOverlayBase#onMyLocationDisabled()
|
* @see com.TwentyCodes.android.overlays.BaseUserOverlay#onMyLocationDisabled()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onMyLocationDisabled() {
|
public void onMyLocationDisabled() {
|
||||||
@@ -48,7 +48,7 @@ public class SkyHookUserOverlay extends UserOverlayBase{
|
|||||||
/**
|
/**
|
||||||
* Called when the location provider needs to be enabled
|
* Called when the location provider needs to be enabled
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.TwentyCodes.android.overlays.UserOverlayBase#onMyLocationEnabled()
|
* @see com.TwentyCodes.android.overlays.BaseUserOverlay#onMyLocationEnabled()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onMyLocationEnabled() {
|
public void onMyLocationEnabled() {
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import com.google.android.maps.MapView;
|
|||||||
* This is the standard version of the UserOverlay.
|
* This is the standard version of the UserOverlay.
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public class UserOverlay extends UserOverlayBase{
|
public class UserOverlay extends BaseUserOverlay{
|
||||||
|
|
||||||
private AndroidGPS mAndroidGPS;
|
private final AndroidGPS mAndroidGPS;
|
||||||
|
|
||||||
public UserOverlay(MapView mapView, Context context) {
|
public UserOverlay(MapView mapView, Context context) {
|
||||||
super(mapView, context);
|
super(mapView, context);
|
||||||
|
|||||||
Reference in New Issue
Block a user