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:
2012-03-08 09:59:32 -05:00
parent c4a4938e2b
commit 9e244ee772
13 changed files with 129 additions and 137 deletions

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}