Added some convenice methods to BaseMapFragment
Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
@@ -49,6 +49,25 @@ public abstract class BaseMapFragment extends Fragment {
|
|||||||
mMapView.setSatellite(!mMapView.isSatellite());
|
mMapView.setSatellite(!mMapView.isSatellite());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mapview
|
* @return mapview
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
@@ -57,6 +76,30 @@ public abstract class BaseMapFragment extends Fragment {
|
|||||||
return mMapView;
|
return mMapView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forces the map to redraw
|
||||||
|
* @author ricky barrette
|
||||||
|
*/
|
||||||
|
public void invalidate(){
|
||||||
|
mMapView.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the GPS progress is showing
|
||||||
|
* @author ricky barrette
|
||||||
|
*/
|
||||||
|
public boolean isGPSProgessShowing(){
|
||||||
|
return isGPSDialogEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the map is in satellite mode
|
||||||
|
* @author ricky barrette
|
||||||
|
*/
|
||||||
|
public boolean isSatellite(){
|
||||||
|
return mMapView.isSatellite();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the fragment view is first created
|
* Called when the fragment view is first created
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
@@ -75,15 +118,15 @@ public abstract class BaseMapFragment extends Fragment {
|
|||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the mapview has been initialized. here you want to init and add your custom overlays
|
* Called when the mapview has been initialized. here you want to init and add your custom overlays
|
||||||
* @param map
|
* @param map
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public abstract void onMapViewCreate(MapView map);
|
public abstract void onMapViewCreate(MapView map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an overlay from the mapview
|
* Removes an overlay from the mapview
|
||||||
* @param overlay
|
* @param overlay
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
@@ -91,8 +134,35 @@ public abstract class BaseMapFragment extends Fragment {
|
|||||||
public void removeOverlay(Object overlay){
|
public void removeOverlay(Object overlay){
|
||||||
mMapView.getOverlays().remove(overlay);
|
mMapView.getOverlays().remove(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Enables or disables the built in zoom controls
|
||||||
|
* @param isShowing
|
||||||
|
* @author ricky barrette
|
||||||
|
*/
|
||||||
|
public void setBuiltInZoomControls(boolean isShowing){
|
||||||
|
mMapView.setBuiltInZoomControls(isShowing);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets where or not the map view is interactive
|
||||||
|
* @param isClickable
|
||||||
|
* @author ricky barrette
|
||||||
|
*/
|
||||||
|
public void setClickable(boolean isClickable){
|
||||||
|
mMapView.setClickable(isClickable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets double tap zoom
|
||||||
|
* @param isDoubleTapZoonEnabled
|
||||||
|
* @author ricky barrette
|
||||||
|
*/
|
||||||
|
public void setDoubleTapZoonEnabled(boolean isDoubleTapZoonEnabled){
|
||||||
|
mMapView.setDoubleTapZoonEnabled(isDoubleTapZoonEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Sets the center of the map to the provided point
|
* Sets the center of the map to the provided point
|
||||||
* @param point
|
* @param point
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
@@ -103,27 +173,22 @@ public abstract class BaseMapFragment extends Fragment {
|
|||||||
mMapView.getController().setCenter(point);
|
mMapView.getController().setCenter(point);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the Acquiring GPS dialog
|
* Sets the view of the map. true is sat, false is map
|
||||||
|
* @param isSat
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public void disableGPSProgess(){
|
public void setSatellite(boolean isSat){
|
||||||
isGPSDialogEnabled = false;
|
mMapView.setSatellite(isSat);
|
||||||
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;
|
* Sets the zoom level of the map
|
||||||
|
* @param zoom
|
||||||
|
* @author ricky barrette
|
||||||
|
*/
|
||||||
|
public void setZoom(int zoom){
|
||||||
|
mMapView.getController().setZoom(zoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user