diff --git a/LocationLib/bin/locationlib.jar b/LocationLib/bin/locationlib.jar index 0cd7568..c5e6421 100644 Binary files a/LocationLib/bin/locationlib.jar and b/LocationLib/bin/locationlib.jar differ diff --git a/LocationLib/bin/res/drawable/compass.png b/LocationLib/bin/res/drawable/compass.png deleted file mode 100644 index 87848e5..0000000 Binary files a/LocationLib/bin/res/drawable/compass.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/compass_lrg.png b/LocationLib/bin/res/drawable/compass_lrg.png deleted file mode 100644 index 7fce2d5..0000000 Binary files a/LocationLib/bin/res/drawable/compass_lrg.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/compass_med.png b/LocationLib/bin/res/drawable/compass_med.png deleted file mode 100644 index d847df4..0000000 Binary files a/LocationLib/bin/res/drawable/compass_med.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/compass_sm.png b/LocationLib/bin/res/drawable/compass_sm.png deleted file mode 100644 index 54ce936..0000000 Binary files a/LocationLib/bin/res/drawable/compass_sm.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/logoidea3.png b/LocationLib/bin/res/drawable/logoidea3.png deleted file mode 100644 index fdc73c3..0000000 Binary files a/LocationLib/bin/res/drawable/logoidea3.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/needle.png b/LocationLib/bin/res/drawable/needle.png deleted file mode 100644 index 93fad78..0000000 Binary files a/LocationLib/bin/res/drawable/needle.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/needle_lrg.png b/LocationLib/bin/res/drawable/needle_lrg.png deleted file mode 100644 index ba5f535..0000000 Binary files a/LocationLib/bin/res/drawable/needle_lrg.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/needle_med.png b/LocationLib/bin/res/drawable/needle_med.png deleted file mode 100644 index bcd8a6d..0000000 Binary files a/LocationLib/bin/res/drawable/needle_med.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/needle_sm.png b/LocationLib/bin/res/drawable/needle_sm.png deleted file mode 100644 index 258bc24..0000000 Binary files a/LocationLib/bin/res/drawable/needle_sm.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/skyhook_logo_alpha.png b/LocationLib/bin/res/drawable/skyhook_logo_alpha.png deleted file mode 100644 index d5ce291..0000000 Binary files a/LocationLib/bin/res/drawable/skyhook_logo_alpha.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/skyhook_logo_alpha_small.png b/LocationLib/bin/res/drawable/skyhook_logo_alpha_small.png deleted file mode 100644 index 8058c19..0000000 Binary files a/LocationLib/bin/res/drawable/skyhook_logo_alpha_small.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/tc_logo_complete.png b/LocationLib/bin/res/drawable/tc_logo_complete.png deleted file mode 100644 index 073970c..0000000 Binary files a/LocationLib/bin/res/drawable/tc_logo_complete.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/user.png b/LocationLib/bin/res/drawable/user.png deleted file mode 100644 index 579f876..0000000 Binary files a/LocationLib/bin/res/drawable/user.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/user_arrow_animation_1.png b/LocationLib/bin/res/drawable/user_arrow_animation_1.png deleted file mode 100644 index 9c6778e..0000000 Binary files a/LocationLib/bin/res/drawable/user_arrow_animation_1.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/user_arrow_animation_2.png b/LocationLib/bin/res/drawable/user_arrow_animation_2.png deleted file mode 100644 index 630fd72..0000000 Binary files a/LocationLib/bin/res/drawable/user_arrow_animation_2.png and /dev/null differ diff --git a/LocationLib/bin/res/drawable/user_arrow_animation_3.png b/LocationLib/bin/res/drawable/user_arrow_animation_3.png deleted file mode 100644 index c1448f7..0000000 Binary files a/LocationLib/bin/res/drawable/user_arrow_animation_3.png and /dev/null differ diff --git a/LocationLib/gen/com/TwentyCodes/android/SkyHook/R.java b/LocationLib/gen/com/TwentyCodes/android/SkyHook/R.java index e18c37d..9ad9103 100644 --- a/LocationLib/gen/com/TwentyCodes/android/SkyHook/R.java +++ b/LocationLib/gen/com/TwentyCodes/android/SkyHook/R.java @@ -16,19 +16,23 @@ public final class R { public static int compass_med=0x7f020002; public static int compass_sm=0x7f020003; public static int logoidea3=0x7f020004; - public static int needle=0x7f020005; - public static int needle_lrg=0x7f020006; - public static int needle_med=0x7f020007; - public static int needle_sm=0x7f020008; - public static int skyhook_logo=0x7f020009; - public static int skyhook_logo_alpha=0x7f02000a; - public static int skyhook_logo_alpha_small=0x7f02000b; - public static int tc_logo_complete=0x7f02000c; - public static int user=0x7f02000d; - public static int user_arrow_animation_1=0x7f02000e; - public static int user_arrow_animation_2=0x7f02000f; - public static int user_arrow_animation_3=0x7f020010; - public static int userarrow=0x7f020011; + public static int map_action_bar=0x7f020005; + public static int map_mode_action_bar=0x7f020006; + public static int mark_my_location_action_bar=0x7f020007; + public static int my_location_action_bar=0x7f020008; + public static int nav_action_bar=0x7f020009; + public static int needle=0x7f02000a; + public static int needle_lrg=0x7f02000b; + public static int needle_med=0x7f02000c; + public static int needle_sm=0x7f02000d; + public static int skyhook_logo=0x7f02000e; + public static int skyhook_logo_alpha=0x7f02000f; + public static int skyhook_logo_alpha_small=0x7f020010; + public static int tc_logo_complete=0x7f020011; + public static int user=0x7f020012; + public static int user_arrow_animation_1=0x7f020013; + public static int user_arrow_animation_2=0x7f020014; + public static int user_arrow_animation_3=0x7f020015; } public static final class id { public static int skyhook_img=0x7f050000; diff --git a/LocationLib/res/drawable-hdpi/.directory b/LocationLib/res/drawable-hdpi/.directory new file mode 100644 index 0000000..ddba58a --- /dev/null +++ b/LocationLib/res/drawable-hdpi/.directory @@ -0,0 +1,4 @@ +[Dolphin] +ShowPreview=true +Timestamp=2011,12,8,10,59,54 +Version=2 diff --git a/LocationLib/res/drawable-hdpi/map_action_bar.png b/LocationLib/res/drawable-hdpi/map_action_bar.png new file mode 100644 index 0000000..d5cd304 Binary files /dev/null and b/LocationLib/res/drawable-hdpi/map_action_bar.png differ diff --git a/LocationLib/res/drawable-hdpi/map_mode_action_bar.png b/LocationLib/res/drawable-hdpi/map_mode_action_bar.png new file mode 100644 index 0000000..9194a02 Binary files /dev/null and b/LocationLib/res/drawable-hdpi/map_mode_action_bar.png differ diff --git a/LocationLib/res/drawable-hdpi/mark_my_location_action_bar.png b/LocationLib/res/drawable-hdpi/mark_my_location_action_bar.png new file mode 100644 index 0000000..8d0e397 Binary files /dev/null and b/LocationLib/res/drawable-hdpi/mark_my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-hdpi/my_location_action_bar.png b/LocationLib/res/drawable-hdpi/my_location_action_bar.png new file mode 100644 index 0000000..63c1860 Binary files /dev/null and b/LocationLib/res/drawable-hdpi/my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-hdpi/nav_action_bar.png b/LocationLib/res/drawable-hdpi/nav_action_bar.png new file mode 100644 index 0000000..e1fdb22 Binary files /dev/null and b/LocationLib/res/drawable-hdpi/nav_action_bar.png differ diff --git a/LocationLib/res/drawable-ldpi/.directory b/LocationLib/res/drawable-ldpi/.directory new file mode 100644 index 0000000..c02c1e4 --- /dev/null +++ b/LocationLib/res/drawable-ldpi/.directory @@ -0,0 +1,4 @@ +[Dolphin] +ShowPreview=true +Timestamp=2011,12,8,10,59,27 +Version=2 diff --git a/LocationLib/res/drawable-ldpi/map_action_bar.png b/LocationLib/res/drawable-ldpi/map_action_bar.png new file mode 100644 index 0000000..4049096 Binary files /dev/null and b/LocationLib/res/drawable-ldpi/map_action_bar.png differ diff --git a/LocationLib/res/drawable-ldpi/map_mode_action_bar.png b/LocationLib/res/drawable-ldpi/map_mode_action_bar.png new file mode 100644 index 0000000..58cfecb Binary files /dev/null and b/LocationLib/res/drawable-ldpi/map_mode_action_bar.png differ diff --git a/LocationLib/res/drawable-ldpi/mark_my_location_action_bar.png b/LocationLib/res/drawable-ldpi/mark_my_location_action_bar.png new file mode 100644 index 0000000..525faa0 Binary files /dev/null and b/LocationLib/res/drawable-ldpi/mark_my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-ldpi/my_location_action_bar.png b/LocationLib/res/drawable-ldpi/my_location_action_bar.png new file mode 100644 index 0000000..39efc7d Binary files /dev/null and b/LocationLib/res/drawable-ldpi/my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-ldpi/nav_action_bar.png b/LocationLib/res/drawable-ldpi/nav_action_bar.png new file mode 100644 index 0000000..7bdc995 Binary files /dev/null and b/LocationLib/res/drawable-ldpi/nav_action_bar.png differ diff --git a/LocationLib/res/drawable-mdpi/.directory b/LocationLib/res/drawable-mdpi/.directory new file mode 100644 index 0000000..15dd448 --- /dev/null +++ b/LocationLib/res/drawable-mdpi/.directory @@ -0,0 +1,4 @@ +[Dolphin] +ShowPreview=true +Timestamp=2011,12,8,10,59,43 +Version=2 diff --git a/LocationLib/res/drawable-mdpi/map_action_bar.png b/LocationLib/res/drawable-mdpi/map_action_bar.png new file mode 100644 index 0000000..f54562a Binary files /dev/null and b/LocationLib/res/drawable-mdpi/map_action_bar.png differ diff --git a/LocationLib/res/drawable-mdpi/map_mode_action_bar.png b/LocationLib/res/drawable-mdpi/map_mode_action_bar.png new file mode 100644 index 0000000..accc22b Binary files /dev/null and b/LocationLib/res/drawable-mdpi/map_mode_action_bar.png differ diff --git a/LocationLib/res/drawable-mdpi/mark_my_location_action_bar.png b/LocationLib/res/drawable-mdpi/mark_my_location_action_bar.png new file mode 100644 index 0000000..a26ae48 Binary files /dev/null and b/LocationLib/res/drawable-mdpi/mark_my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-mdpi/my_location_action_bar.png b/LocationLib/res/drawable-mdpi/my_location_action_bar.png new file mode 100644 index 0000000..4bc4ca1 Binary files /dev/null and b/LocationLib/res/drawable-mdpi/my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-mdpi/nav_action_bar.png b/LocationLib/res/drawable-mdpi/nav_action_bar.png new file mode 100644 index 0000000..bb9ed67 Binary files /dev/null and b/LocationLib/res/drawable-mdpi/nav_action_bar.png differ diff --git a/LocationLib/res/drawable-xhdpi/.directory b/LocationLib/res/drawable-xhdpi/.directory new file mode 100644 index 0000000..29795f2 --- /dev/null +++ b/LocationLib/res/drawable-xhdpi/.directory @@ -0,0 +1,4 @@ +[Dolphin] +ShowPreview=true +Timestamp=2011,12,8,11,0,5 +Version=2 diff --git a/LocationLib/res/drawable-xhdpi/map_action_bar.png b/LocationLib/res/drawable-xhdpi/map_action_bar.png new file mode 100644 index 0000000..23baf6d Binary files /dev/null and b/LocationLib/res/drawable-xhdpi/map_action_bar.png differ diff --git a/LocationLib/res/drawable-xhdpi/map_mode_action_bar.png b/LocationLib/res/drawable-xhdpi/map_mode_action_bar.png new file mode 100644 index 0000000..abc3b04 Binary files /dev/null and b/LocationLib/res/drawable-xhdpi/map_mode_action_bar.png differ diff --git a/LocationLib/res/drawable-xhdpi/mark_my_location_action_bar.png b/LocationLib/res/drawable-xhdpi/mark_my_location_action_bar.png new file mode 100644 index 0000000..2265d52 Binary files /dev/null and b/LocationLib/res/drawable-xhdpi/mark_my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-xhdpi/my_location_action_bar.png b/LocationLib/res/drawable-xhdpi/my_location_action_bar.png new file mode 100644 index 0000000..6825e46 Binary files /dev/null and b/LocationLib/res/drawable-xhdpi/my_location_action_bar.png differ diff --git a/LocationLib/res/drawable-xhdpi/nav_action_bar.png b/LocationLib/res/drawable-xhdpi/nav_action_bar.png new file mode 100644 index 0000000..435f599 Binary files /dev/null and b/LocationLib/res/drawable-xhdpi/nav_action_bar.png differ diff --git a/LocationLib/res/drawable/userarrow.xml b/LocationLib/res/drawable/userarrow.xml deleted file mode 100644 index 6b7045e..0000000 --- a/LocationLib/res/drawable/userarrow.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/LocationLib/src/com/TwentyCodes/android/location/CompasOverlay.java b/LocationLib/src/com/TwentyCodes/android/location/CompasOverlay.java index 6781c21..de69c22 100644 --- a/LocationLib/src/com/TwentyCodes/android/location/CompasOverlay.java +++ b/LocationLib/src/com/TwentyCodes/android/location/CompasOverlay.java @@ -91,22 +91,6 @@ public class CompasOverlay extends Overlay implements CompassListener { this(context, null, needleResId, backgroundResId, x, y); } - /** - * Calculated the bearing from the current location to the current destination, or returns the bearing for north if there is no destination - * @return bearing - * @author ricky barrette - */ - private float calculateBearing() { - if( (mLocation == null) || (mDestination == null) ) - return mBearing; - - float bearing = mBearing - GeoUtils.bearing(mLocation, mDestination).floatValue(); - if (bearing != 0) - bearing = 360 - bearing; - - return bearing; - } - /** * Converts dip to px * @param dip @@ -152,7 +136,7 @@ public class CompasOverlay extends Overlay implements CompassListener { //draw the compass needle Bitmap arrowBitmap = BitmapFactory.decodeResource( mContext.getResources(), mNeedleResId); Matrix matrix = new Matrix(); - matrix.postRotate(calculateBearing()); + matrix.postRotate(GeoUtils.calculateBearing(mLocation, mDestination, mBearing)); Bitmap rotatedBmp = Bitmap.createBitmap( arrowBitmap, 0, 0, diff --git a/LocationLib/src/com/TwentyCodes/android/location/GeoUtils.java b/LocationLib/src/com/TwentyCodes/android/location/GeoUtils.java index d14576d..380fe7b 100644 --- a/LocationLib/src/com/TwentyCodes/android/location/GeoUtils.java +++ b/LocationLib/src/com/TwentyCodes/android/location/GeoUtils.java @@ -37,6 +37,30 @@ public class GeoUtils { public static final int EARTH_RADIUS_KM = 6371; public static final double MILLION = 1000000; + + /** + * 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. + * @param user location + * @param dest location + * @param bearing Degrees East from compass + * @return Degrees East of dest location + * @author ricky barrette + */ + public static float calculateBearing(GeoPoint user, GeoPoint dest, float bearing) { + + if( (user == null) || (dest == null) ) + return bearing; + + float heading = bearing(user, dest).floatValue(); + + bearing = (360 - heading) + bearing; + + if (bearing > 360) + return bearing - 360; + + return bearing; + } /** * computes the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East @@ -44,7 +68,7 @@ public class GeoUtils { * @param lon1 source lon * @param lat2 destination lat * @param lon2 destination lon - * @return the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East + * @return the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East of true north * @author Google Inc. */ public static double bearing(double lat1, double lon1, double lat2, double lon2) { @@ -57,7 +81,7 @@ public class GeoUtils { } /** - * computes the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East + * computes the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East of true north * @param p1 source geopoint * @param p2 destination geopoint * @return the bearing of p2 in relationship from p1 in degrees East diff --git a/LocationLib/src/com/TwentyCodes/android/location/UserOverlay.java b/LocationLib/src/com/TwentyCodes/android/location/UserOverlay.java index bd4c2ee..7f664f0 100644 --- a/LocationLib/src/com/TwentyCodes/android/location/UserOverlay.java +++ b/LocationLib/src/com/TwentyCodes/android/location/UserOverlay.java @@ -52,6 +52,7 @@ public class UserOverlay extends Overlay implements GeoPointLocationListener, Co private CompasOverlay mCompass; private boolean isCompassEnabled; private boolean isGPSDialogEnabled; + private CompassListener mCompassListener; /** * Construct a new SkyHookUserOverlaymFollowUser @@ -262,20 +263,21 @@ public class UserOverlay extends Overlay implements GeoPointLocationListener, Co new Handler().postAtTime(new Runnable() { @Override public void run() { - if (mGPSprogress.isShowing()) { - mGPSprogress.cancel(); - AlertDialog.Builder builder = new AlertDialog.Builder(mContext); - builder.setMessage( - mContext.getText(R.string.sorry_theres_trouble)) - .setCancelable(false) - .setPositiveButton(mContext.getText(android.R.string.ok), - new DialogInterface.OnClickListener() { - public void onClick( DialogInterface dialog, int id) { - dialog.cancel(); - } - }); - builder.show(); - } + if(mGPSprogress != null) + if (mGPSprogress.isShowing()) { + mGPSprogress.cancel(); + AlertDialog.Builder builder = new AlertDialog.Builder(mContext); + builder.setMessage( + mContext.getText(R.string.sorry_theres_trouble)) + .setCancelable(false) + .setPositiveButton(mContext.getText(android.R.string.ok), + new DialogInterface.OnClickListener() { + public void onClick( DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + builder.show(); + } } }, SystemClock.uptimeMillis()+90000L); } @@ -313,6 +315,8 @@ public class UserOverlay extends Overlay implements GeoPointLocationListener, Co public void onCompassUpdate(float bearing) { if(Debug.DEBUG) Log.v(TAG, "onCompassUpdate()"); + if(mCompassListener != null) + mCompassListener.onCompassUpdate(bearing); mBearing = bearing; mMapView.invalidate(); } @@ -420,6 +424,14 @@ public class UserOverlay extends Overlay implements GeoPointLocationListener, Co mCompass.setDrawables(needleResId, backgroundResId, x, y); } + /** + * Sets the CompassListener + * @param listener + * @author ricky barrette + */ + public void setCompassListener(CompassListener listener){ + mCompassListener = listener; + } /** * This thread is responsible for animating the user icon