Added a progress circle to the mapfragment
the progress circle will be used to indicate that there is work being done in the background Change-Id: Id2929f5be68fce0d223e18d8dd07babfcdb37a34 Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
@@ -9,5 +9,6 @@
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/app/android-sdk-linux_86/extras/android-support-v4-r6-googlemaps.jar"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -4,32 +4,6 @@
|
||||
android:versionCode="11"
|
||||
android:versionName="0.1.1" >
|
||||
|
||||
<application android:label="@string/app_name" >
|
||||
<service
|
||||
android:name="SkyHookService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":locationservice" >
|
||||
</service>
|
||||
|
||||
<receiver
|
||||
android:name="com.TwentyCodes.android.location.ServiceWakeUpReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":startinglocationservice" >
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="com.TwentyCodes.android.location.LocationService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":locationservice" >
|
||||
</service>
|
||||
|
||||
<activity android:name="Splash" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
@@ -41,4 +15,24 @@
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" >
|
||||
</uses-permission>
|
||||
|
||||
<application android:label="@string/app_name" >
|
||||
<service
|
||||
android:name="SkyHookService"
|
||||
android:process=":locationservice" >
|
||||
</service>
|
||||
|
||||
<receiver
|
||||
android:name="com.TwentyCodes.android.location.ServiceWakeUpReceiver"
|
||||
android:process=":startinglocationservice" >
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="com.TwentyCodes.android.location.LocationService"
|
||||
android:process=":locationservice" >
|
||||
</service>
|
||||
|
||||
<activity android:name="Splash" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
Binary file not shown.
@@ -1,11 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<!--
|
||||
ricky beta release 0rKmsWMM0D-IRAEgcSZEqwZCs_8AUwxjYjj0bnA
|
||||
ricky 0rKmsWMM0D-LWOndcfwrmW-S0OXlnQl2SJCMeTg
|
||||
TWENTYCODES 0rKmsWMM0D-K15bEM_kwabPbNhsn4dp4rcq2q5Q
|
||||
-->
|
||||
<com.TwentyCodes.android.location.MapView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/mapview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:apiKey="0rKmsWMM0D-K15bEM_kwabPbNhsn4dp4rcq2q5Q" />
|
||||
-->
|
||||
|
||||
<com.TwentyCodes.android.location.MapView
|
||||
android:id="@+id/mapview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:apiKey="0rKmsWMM0D-LWOndcfwrmW-S0OXlnQl2SJCMeTg" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/mapProgressBar"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -289,4 +289,9 @@ public class SkyHook implements GeoPointLocationListener{
|
||||
if(mListener != null)
|
||||
mListener.onLocationChanged(point, accuracy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstFix(boolean isFistFix) {
|
||||
// unused
|
||||
}
|
||||
}
|
||||
@@ -235,19 +235,25 @@ public class SkyHookService extends Service implements GeoPointLocationListener,
|
||||
|
||||
@Override
|
||||
public void done() {
|
||||
// TODO Auto-generated method stub
|
||||
// unused
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WPSContinuation handleError(WPSReturnCode arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
// unused
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
// TODO Auto-generated method stub
|
||||
// unused
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstFix(boolean isFistFix) {
|
||||
// unused
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.TwentyCodes.android.location.MapView;
|
||||
import com.TwentyCodes.android.location.R;
|
||||
@@ -25,6 +26,8 @@ import com.google.android.maps.Overlay;
|
||||
public abstract class MapFragmentBase extends Fragment {
|
||||
|
||||
private MapView mMapView;
|
||||
private boolean isGPSDialogEnabled;
|
||||
private ProgressBar mProgress;
|
||||
|
||||
/**
|
||||
* Creates a new MapFragment
|
||||
@@ -65,6 +68,8 @@ public abstract class MapFragmentBase extends Fragment {
|
||||
|
||||
mMapView = (MapView) view.findViewById(R.id.mapview);
|
||||
mMapView.setClickable(true);
|
||||
|
||||
mProgress = (ProgressBar) view.findViewById(R.id.mapProgressBar);
|
||||
|
||||
onMapViewCreate(mMapView);
|
||||
|
||||
@@ -98,4 +103,27 @@ public abstract class MapFragmentBase extends Fragment {
|
||||
mMapView.getController().setCenter(point);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the Acquiring GPS dialog
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void disableGPSProgess(){
|
||||
isGPSDialogEnabled = false;
|
||||
mProgress.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the Acquiring GPS dialog if the location has not been acquired
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void enableGPSProgess(){
|
||||
isGPSDialogEnabled = true;
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public boolean isGPSProgessShowing(){
|
||||
return isGPSDialogEnabled;
|
||||
}
|
||||
}
|
||||
@@ -31,22 +31,6 @@ public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements G
|
||||
public SkyHoookUserOverlayMapFragment() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* disables the GPS dialog
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void disableGPSDialog(){
|
||||
mUserOverlay.disableGPSDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* enables the GPS dialog
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void enableGPSDialog(){
|
||||
mUserOverlay.enableGPSDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the useroverlay to pan the map to follow the user
|
||||
@@ -96,7 +80,6 @@ public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements G
|
||||
mUserOverlay.registerListener(this);
|
||||
mUserOverlay.setCompassListener(this);
|
||||
mUserOverlay.enableCompass();
|
||||
mUserOverlay.disableGPSDialog();
|
||||
mUserOverlay.followUser(true);
|
||||
|
||||
map.getOverlays().add(mUserOverlay);
|
||||
@@ -120,8 +103,10 @@ public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements G
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if(mUserOverlay != null)
|
||||
if(mUserOverlay != null) {
|
||||
mUserOverlay.enableMyLocation();
|
||||
addOverlay(mUserOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,4 +154,9 @@ public class SkyHoookUserOverlayMapFragment extends MapFragmentBase implements G
|
||||
mGeoPointLocationListener = listener;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onFirstFix(boolean isFistFix) {
|
||||
if(mGeoPointLocationListener != null)
|
||||
mGeoPointLocationListener.onFirstFix(isFistFix);
|
||||
}
|
||||
}
|
||||
@@ -32,22 +32,6 @@ public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointL
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* disables the GPS dialog
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void disableGPSDialog(){
|
||||
mUserOverlay.disableGPSDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* enables the GPS dialog
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void enableGPSDialog(){
|
||||
mUserOverlay.enableGPSDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the useroverlay to pan the map to follow the user
|
||||
* @param followUser
|
||||
@@ -96,7 +80,6 @@ public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointL
|
||||
mUserOverlay.registerListener(this);
|
||||
mUserOverlay.setCompassListener(this);
|
||||
mUserOverlay.enableCompass();
|
||||
mUserOverlay.disableGPSDialog();
|
||||
mUserOverlay.followUser(true);
|
||||
|
||||
map.getOverlays().add(mUserOverlay);
|
||||
@@ -120,8 +103,10 @@ public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointL
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if(mUserOverlay != null)
|
||||
if(mUserOverlay != null) {
|
||||
mUserOverlay.enableMyLocation();
|
||||
addOverlay(mUserOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,4 +153,10 @@ public class UserOverlayMapFragment extends MapFragmentBase implements GeoPointL
|
||||
public void setGeoPointLocationListener(GeoPointLocationListener listener){
|
||||
mGeoPointLocationListener = listener;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstFix(boolean isFistFix) {
|
||||
if(mGeoPointLocationListener != null)
|
||||
mGeoPointLocationListener.onFirstFix(isFistFix);
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,11 @@ public interface GeoPointLocationListener {
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void onLocationChanged(GeoPoint point, int accuracy);
|
||||
|
||||
/**
|
||||
* Called when first fix is aquired
|
||||
* @param isFirstFix
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void onFirstFix(boolean isFirstFix);
|
||||
}
|
||||
|
||||
@@ -56,4 +56,9 @@ public class SkyHookUserOverlay extends UserOverlayBase{
|
||||
mSkyHook.getUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstFix(boolean isFistFix) {
|
||||
// unused
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,5 +37,10 @@ public class UserOverlay extends UserOverlayBase{
|
||||
public void onMyLocationEnabled() {
|
||||
mAndroidGPS.enableLocationUpdates(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstFix(boolean isFistFix) {
|
||||
// unused
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,10 +6,7 @@
|
||||
*/
|
||||
package com.TwentyCodes.android.overlays;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
@@ -18,8 +15,6 @@ import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Point;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import com.TwentyCodes.android.debug.Debug;
|
||||
@@ -117,13 +112,11 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
||||
private GeoPoint mPoint;
|
||||
private Context mContext;
|
||||
private MapView mMapView;
|
||||
private ProgressDialog mGPSprogress;
|
||||
private boolean isFistFix = true;
|
||||
private GeoPointLocationListener mListener;
|
||||
public boolean isFollowingUser = true;
|
||||
private CompasOverlay mCompass;
|
||||
private boolean isCompassEnabled;
|
||||
private boolean isGPSDialogEnabled;
|
||||
|
||||
private CompassListener mCompassListener;
|
||||
|
||||
@@ -162,16 +155,6 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
||||
mMapView.getOverlays().remove(mCompass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the Acquiring GPS dialog
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void disableGPSDialog(){
|
||||
isGPSDialogEnabled = false;
|
||||
if(mGPSprogress != null)
|
||||
mGPSprogress.dismiss();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops location updates and removes the overlay from view
|
||||
* @author ricky barrette
|
||||
@@ -181,8 +164,8 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
||||
onMyLocationDisabled();
|
||||
isEnabled = false;
|
||||
mCompass.disable();
|
||||
if(mGPSprogress != null)
|
||||
mGPSprogress.cancel();
|
||||
if(mListener != null)
|
||||
mListener.onFirstFix(false);
|
||||
mAnimationThread.abort();
|
||||
}
|
||||
|
||||
@@ -298,22 +281,6 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the Acquiring GPS dialog if the location has not been acquired
|
||||
*
|
||||
* TODO fix funtion currently generates bad window token
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void enableGPSDialog(){
|
||||
isGPSDialogEnabled = true;
|
||||
if(isFistFix)
|
||||
if(mGPSprogress != null){
|
||||
if(! mGPSprogress.isShowing())
|
||||
mGPSprogress = ProgressDialog.show(mContext, "", mContext.getText(R.string.gps_fix), true, true);
|
||||
} else
|
||||
mGPSprogress = ProgressDialog.show(mContext, "", mContext.getText(R.string.gps_fix), true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to enable MyLocation, registering for updates from provider
|
||||
* @author ricky barrette
|
||||
@@ -329,32 +296,8 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
||||
isEnabled = true;
|
||||
mCompass.enable(this);
|
||||
isFistFix = true;
|
||||
if(isGPSDialogEnabled)
|
||||
enableGPSDialog();
|
||||
|
||||
/**
|
||||
* this is a message that tells the user that we are having trouble getting an GPS signal
|
||||
*/
|
||||
new Handler().postAtTime(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
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);
|
||||
if(mListener != null)
|
||||
mListener.onFirstFix(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,8 +360,8 @@ public abstract class UserOverlayBase extends Overlay implements GeoPointLocatio
|
||||
if(point != null && isFistFix){
|
||||
mMapView.getController().setCenter(point);
|
||||
mMapView.getController().setZoom( (mMapView.getMaxZoomLevel() - 2) );
|
||||
if(mGPSprogress != null)
|
||||
mGPSprogress.dismiss();
|
||||
if(mListener != null)
|
||||
mListener.onFirstFix(true);
|
||||
isFistFix = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user