com.esri.android.map
Class LocationService.LocationServiceInner

java.lang.Object
  extended by android.view.View
      extended by com.esri.android.map.LayerView<LayerModel>
          extended by com.esri.android.map.LocationService.LocationServiceInner
All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback
Enclosing class:
LocationService

protected class LocationService.LocationServiceInner
extends LayerView<LayerModel>


Nested Class Summary
 
Nested classes/interfaces inherited from class android.view.View
android.view.View.BaseSavedState, android.view.View.MeasureSpec, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnFocusChangeListener, android.view.View.OnKeyListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
 
Field Summary
protected static int START_MSG
           
protected static int STOP_MSG
           
 
Fields inherited from class com.esri.android.map.LayerView
canvasOffsetX, canvasOffsetY, mapView, model
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
LocationService.LocationServiceInner(MapView map)
           
 
Method Summary
 android.location.Location getLocation()
          Returns the current location in the spatial reference WGS1984 (WKID=4326).
 android.location.LocationListener getLocationListener()
           
 OnSingleTapListener getOnSingleTapListener()
          Returns the current listener for the single tap event on the LocationService symbol.
 Point getPoint()
          Returns the current coordinates in the map's spatial reference.
 Symbol getSymbol()
           
protected  LayerModel initModel()
          This method will instantiate the LayerModel object.
 boolean isAccuracyCircleOn()
           
 boolean isAllowNetworkLocation()
           
 boolean isAutoPan()
           
 boolean isBearingOn()
           
protected  boolean isBetterLocation(android.location.Location location, android.location.Location currentBestLocation)
          Determines whether one Location reading is better than the current Location fix
 boolean isStarted()
           
protected  void onDetachedFromWindow()
           
protected  void onDraw(android.graphics.Canvas canvas)
           
 void setAccuracyCircleOn(boolean accuracyCircleOn)
           
 void setAllowNetworkLocation(boolean allowNetworkLocation)
          Allow/disallow the usage of the network (cellular network and WiFi if available) to determine the current location
 void setAutoPan(boolean autoPan)
          activate/deactivate the autoPan
 void setBearing(boolean bearing)
          activate/deactivate the bearing representation.
 void setLocationListener(android.location.LocationListener locationListener)
           
 void setOnSingleTapListener(OnSingleTapListener onSingleTapListener)
          Sets a listener overriding the default behavior of a single tap on the LocationService symbol.
 void setSymbol(Symbol symbol)
           
 void start()
          Starts the LocationService.
 void stop()
          Stops the LocationService
 void uiStart()
           
 void uiStop()
           
protected  void update()
          Updates the MapView with images that are retrieved from the LayerView's associated LayerModel object.
protected  boolean verifyDrawable(android.graphics.drawable.Drawable who)
           
 
Methods inherited from class com.esri.android.map.LayerView
cancelPendingTasks, clearCache, getCenter, getDefaultSpatialReference, getExtent, getFullExtent, getModel, getOffset, getOnStatusChangedListener, getResolution, getSpatialReference, getUrl, getUrlHashCode, initLayer, isInitialized, isLongLifeCache, onAnimationEnd, onAnimationStart, onSizeChanged, setLongLifeCache, setOffset, setOnStatusChangedListener, setUrl, toMapPoint, toMapPoint, toScreenPoint, toScreenPoint
 
Methods inherited from class android.view.View
addFocusables, addFocusables, addTouchables, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, clearFocus, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, destroyDrawingCache, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDraw, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, draw, drawableStateChanged, findFocus, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasFocus, hasFocusable, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onDisplayHint, onDrawScrollBars, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onMeasure, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPadding, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START_MSG

protected static final int START_MSG
See Also:
Constant Field Values

STOP_MSG

protected static final int STOP_MSG
See Also:
Constant Field Values
Constructor Detail

LocationService.LocationServiceInner

public LocationService.LocationServiceInner(MapView map)
Parameters:
map - the MapView the location will be displayed on.
Method Detail

start

public void start()
Starts the LocationService.


uiStart

public void uiStart()

stop

public void stop()
Stops the LocationService


uiStop

public void uiStop()

getLocation

public android.location.Location getLocation()
Returns the current location in the spatial reference WGS1984 (WKID=4326). Other information are available. see Location.

Returns:
the current location

getPoint

public Point getPoint()
Returns the current coordinates in the map's spatial reference.

Returns:
the Point containing the coordinates.

isAccuracyCircleOn

public boolean isAccuracyCircleOn()
Returns:
the accuracyCircleOn

setAccuracyCircleOn

public void setAccuracyCircleOn(boolean accuracyCircleOn)
Parameters:
accuracyCircleOn - the accuracyCircleOn to set

isBetterLocation

protected boolean isBetterLocation(android.location.Location location,
                                   android.location.Location currentBestLocation)
Determines whether one Location reading is better than the current Location fix

Parameters:
location - The new Location that you want to evaluate
currentBestLocation - The current Location fix, to which you want to compare the new one

getSymbol

public Symbol getSymbol()
Returns:
the symbol used to represent the current location.

isBearingOn

public boolean isBearingOn()
Returns:
whether the bearing (direction of travel) is taken into account.

isStarted

public boolean isStarted()
Returns:
if the LocationService is activated.

isAutoPan

public boolean isAutoPan()
Returns:
whether the autoPan is activated or not.

getLocationListener

public android.location.LocationListener getLocationListener()
Returns:
the locationListener

setLocationListener

public void setLocationListener(android.location.LocationListener locationListener)
Parameters:
locationListener - the locationListener to set

setAutoPan

public void setAutoPan(boolean autoPan)
activate/deactivate the autoPan

Parameters:
autoPan - the flag for the autoPan (default: true)

setBearing

public void setBearing(boolean bearing)
activate/deactivate the bearing representation.

Parameters:
bearing - flag for the bearing (default: true)

setSymbol

public void setSymbol(Symbol symbol)
Parameters:
symbol - the symbol to set

isAllowNetworkLocation

public boolean isAllowNetworkLocation()
Returns:
whether the network (cellular network and WiFi if available) should be used to determine the current location

setAllowNetworkLocation

public void setAllowNetworkLocation(boolean allowNetworkLocation)
Allow/disallow the usage of the network (cellular network and WiFi if available) to determine the current location

Parameters:
allowNetworkLocation - the flag for the usage of the network (default: true)

onDraw

protected void onDraw(android.graphics.Canvas canvas)
Overrides:
onDraw in class LayerView<LayerModel>

verifyDrawable

protected boolean verifyDrawable(android.graphics.drawable.Drawable who)
Overrides:
verifyDrawable in class android.view.View

onDetachedFromWindow

protected void onDetachedFromWindow()
Overrides:
onDetachedFromWindow in class android.view.View

setOnSingleTapListener

public void setOnSingleTapListener(OnSingleTapListener onSingleTapListener)
Sets a listener overriding the default behavior of a single tap on the LocationService symbol.

Parameters:
onSingleTapListener - the onSingleTapListener to set

getOnSingleTapListener

public OnSingleTapListener getOnSingleTapListener()
Returns the current listener for the single tap event on the LocationService symbol.

Returns:
the onSingleTapListener

initModel

protected LayerModel initModel()
                        throws Exception
Description copied from class: LayerView
This method will instantiate the LayerModel object.

In a Model-View-Controller architecture, the LayerView represents the View and handles the image rendering related functionality. Each View has an associated Model object that handles fetching map images, calculating map bounds, and so on.

Any class that extends the LayerView class should provide an implementation of a LayerModel class and instantiate that model in this method.

Specified by:
initModel in class LayerView<LayerModel>
Returns:
the LayerModel instance associated with this LayerView.
Throws:
Exception

update

protected void update()
Description copied from class: LayerView
Updates the MapView with images that are retrieved from the LayerView's associated LayerModel object. This method is called when the MapView's extent is changed.

Any class that extends the LayerView class should provide an implementation of this method to retrieve updated an updated map from the map service. The TiledLayer and DynamicLayer subclasses provide default implementation for cached and dynamic map services. If you DO NOT need to support other types of map services, then you should not override this default functionality (it will save you a lot of unnecessary development effort).

Specified by:
update in class LayerView<LayerModel>


Copyright © 2010. All Rights Reserved.