Class UiSettings

java.lang.Object
com.trimblemaps.mapsdk.maps.UiSettings

public final class UiSettings extends Object
Settings for the user interface of a TrimbleMapsMap. To obtain this interface, call getUiSettings().
  • Method Details

    • getFlingAnimationBaseTime

      public long getFlingAnimationBaseTime()
    • getFlingThreshold

      public long getFlingThreshold()
    • setFlingAnimationBaseTime

      public void setFlingAnimationBaseTime(long t)
    • setFlingThreshold

      public void setFlingThreshold(long t)
    • setCompassEnabled

      public void setCompassEnabled(boolean compassEnabled)

      Enables or disables the compass. The compass is an icon on the map that indicates the direction of north on the map. When a user clicks the compass, the camera orients itself to its default orientation and fades away shortly after. If disabled, the compass will never be displayed.

      By default, the compass is enabled.
      Parameters:
      compassEnabled - True to enable the compass; false to disable the compass.
    • isCompassEnabled

      public boolean isCompassEnabled()
      Returns whether the compass is enabled.
      Returns:
      True if the compass is enabled; false if the compass is disabled.
    • setCompassGravity

      @UiThread public void setCompassGravity(int gravity)

      Sets the gravity of the compass view. Use this to change the corner of the map view that the compass is displayed in.

      By default, the compass is in the top right corner.
      Parameters:
      gravity - Android SDK Gravity.
    • setCompassFadeFacingNorth

      public void setCompassFadeFacingNorth(boolean compassFadeFacingNorth)
      Enables or disables fading of the compass when facing north.

      By default this feature is enabled

      Parameters:
      compassFadeFacingNorth - True to enable the fading animation; false to disable it
    • setCompassImage

      public void setCompassImage(@NonNull android.graphics.drawable.Drawable compass)
      Specifies the CompassView image.

      By default this value is R.drawable.trimblemaps_compass_icon.

      Parameters:
      compass - the drawable to show as image compass
    • isCompassFadeWhenFacingNorth

      public boolean isCompassFadeWhenFacingNorth()
      Returns whether the compass performs a fading animation out when facing north.
      Returns:
      True if the compass will fade, false if it remains visible
    • getCompassGravity

      public int getCompassGravity()
      Returns the gravity value of the CompassView
      Returns:
      The gravity
    • setCompassMargins

      @UiThread public void setCompassMargins(@Px int left, @Px int top, @Px int right, @Px int bottom)
      Sets the margins of the compass view in pixels. Use this to change the distance of the compass from the map view edge.
      Parameters:
      left - The left margin in pixels.
      top - The top margin in pixels.
      right - The right margin in pixels.
      bottom - The bottom margin in pixels.
    • getCompassMarginLeft

      @Px public int getCompassMarginLeft()
      Returns the left side margin of CompassView in pixels.
      Returns:
      The left margin in pixels
    • getCompassMarginTop

      @Px public int getCompassMarginTop()
      Returns the top side margin of CompassView in pixels.
      Returns:
      The top margin in pixels
    • getCompassMarginRight

      @Px public int getCompassMarginRight()
      Returns the right side margin of CompassView in pixels.
      Returns:
      The right margin in pixels
    • getCompassMarginBottom

      @Px public int getCompassMarginBottom()
      Returns the bottom side margin of CompassView in pixels.
      Returns:
      The bottom margin in pixels
    • getCompassImage

      @Nullable public android.graphics.drawable.Drawable getCompassImage()
      Get the current configured CompassView image.
      Returns:
      the drawable used as compass image
    • setLogoEnabled

      public void setLogoEnabled(boolean enabled)

      Enables or disables the TrimbleMaps logo.

      By default, the logo is enabled.
      Parameters:
      enabled - True to enable the logo; false to disable the logo.
    • isLogoEnabled

      public boolean isLogoEnabled()
      Returns whether the logo is enabled.
      Returns:
      True if the logo is enabled; false if the logo is disabled.
    • setLogoGravity

      public void setLogoGravity(int gravity)

      Sets the gravity of the logo view. Use this to change the corner of the map view that the TrimbleMaps logo is displayed in.

      By default, the logo is in the bottom left corner.
      Parameters:
      gravity - Android SDK Gravity.
    • getLogoGravity

      public int getLogoGravity()
      Returns the gravity value of the logo
      Returns:
      The gravity
    • setLogoMargins

      public void setLogoMargins(@Px int left, @Px int top, @Px int right, @Px int bottom)
      Sets the margins of the logo view in pixels. Use this to change the distance of the TrimbleMaps logo from the map view edge.
      Parameters:
      left - The left margin in pixels.
      top - The top margin in pixels.
      right - The right margin in pixels.
      bottom - The bottom margin in pixels.
    • getLogoMarginLeft

      @Px public int getLogoMarginLeft()
      Returns the left side margin of the logo in pixels.
      Returns:
      The left margin in pixels
    • getLogoMarginTop

      @Px public int getLogoMarginTop()
      Returns the top side margin of the logo in pixels.
      Returns:
      The top margin in pixels
    • getLogoMarginRight

      @Px public int getLogoMarginRight()
      Returns the right side margin of the logo in pixels.
      Returns:
      The right margin in pixels
    • getLogoMarginBottom

      @Px public int getLogoMarginBottom()
      Returns the bottom side margin of the logo in pixels.
      Returns:
      The bottom margin in pixels
    • setAttributionEnabled

      public void setAttributionEnabled(boolean enabled)

      Enables or disables the attribution.

      By default, the attribution is enabled.
      Parameters:
      enabled - True to enable the attribution; false to disable the attribution.
    • isAttributionEnabled

      public boolean isAttributionEnabled()
      Returns whether the attribution is enabled.
      Returns:
      True if the attribution is enabled; false if the attribution is disabled.
    • setAttributionDialogManager

      public void setAttributionDialogManager(@NonNull AttributionDialogManager attributionDialogManager)
      Set a custom attribution dialog manager.

      Set to null to reset to default behaviour.

      Parameters:
      attributionDialogManager - the manager class used for showing attribution
    • getAttributionDialogManager

      @Nullable public AttributionDialogManager getAttributionDialogManager()
      Get the custom attribution dialog manager.
      Returns:
      the active manager class used for showing attribution
    • setAttributionGravity

      public void setAttributionGravity(int gravity)

      Sets the gravity of the attribution.

      By default, the attribution is in the bottom left corner next to the TrimbleMaps logo.
      Parameters:
      gravity - Android SDK Gravity.
    • getAttributionGravity

      public int getAttributionGravity()
      Returns the gravity value of the logo
      Returns:
      The gravity
    • setAttributionMargins

      public void setAttributionMargins(@Px int left, @Px int top, @Px int right, @Px int bottom)
      Sets the margins of the attribution view in pixels.
      Parameters:
      left - The left margin in pixels.
      top - The top margin in pixels.
      right - The right margin in pixels.
      bottom - The bottom margin in pixels.
    • setAttributionTintColor

      public void setAttributionTintColor(@ColorInt int tintColor)

      Sets the tint of the attribution view. Use this to change the color of the attribution.

      Parameters:
      tintColor - Color to tint the attribution.
    • getAttributionMarginLeft

      @Px public int getAttributionMarginLeft()
      Returns the left side margin of the attribution view in pixels.
      Returns:
      The left margin in pixels
    • getAttributionMarginTop

      @Px public int getAttributionMarginTop()
      Returns the top side margin of the attribution view in pixels.
      Returns:
      The top margin in pixels
    • getAttributionMarginRight

      @Px public int getAttributionMarginRight()
      Returns the right side margin of the attribution view in pixels.
      Returns:
      The right margin in pixels
    • getAttributionMarginBottom

      @Px public int getAttributionMarginBottom()
      Returns the bottom side margin of the logo in pixels.
      Returns:
      The bottom margin in pixels
    • setRotateGesturesEnabled

      public void setRotateGesturesEnabled(boolean rotateGesturesEnabled)

      Changes whether the user may rotate the map.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      rotateGesturesEnabled - If true, rotating is enabled.
    • isRotateGesturesEnabled

      public boolean isRotateGesturesEnabled()
      Returns whether the user may rotate the map.
      Returns:
      If true, rotating is enabled.
    • setTiltGesturesEnabled

      public void setTiltGesturesEnabled(boolean tiltGesturesEnabled)

      Changes whether the user may tilt the map.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      tiltGesturesEnabled - If true, tilting is enabled.
    • isTiltGesturesEnabled

      public boolean isTiltGesturesEnabled()
      Returns whether the user may tilt the map.
      Returns:
      If true, tilting is enabled.
    • setZoomGesturesEnabled

      public void setZoomGesturesEnabled(boolean zoomGesturesEnabled)

      Changes whether the user may zoom the map.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      zoomGesturesEnabled - If true, zooming is enabled.
    • isZoomGesturesEnabled

      public boolean isZoomGesturesEnabled()
      Returns whether the user may zoom the map.
      Returns:
      If true, zooming is enabled.
    • setDoubleTapGesturesEnabled

      public void setDoubleTapGesturesEnabled(boolean doubleTapGesturesEnabled)

      Changes whether the user may zoom the map with a double tap.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      doubleTapGesturesEnabled - If true, zooming with a double tap is enabled.
    • isDoubleTapGesturesEnabled

      public boolean isDoubleTapGesturesEnabled()
      Returns whether the user may zoom the map with a double tap.
      Returns:
      If true, zooming with a double tap is enabled.
    • isQuickZoomGesturesEnabled

      public boolean isQuickZoomGesturesEnabled()
      Returns whether the user may zoom the map by tapping twice, holding and moving the pointer up and down.
      Returns:
      If true, zooming by tapping twice and holding is enabled.
    • setQuickZoomGesturesEnabled

      public void setQuickZoomGesturesEnabled(boolean quickZoomGesturesEnabled)
      Changes whether the user may zoom the map by tapping twice, holding and moving the pointer up and down.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      quickZoomGesturesEnabled - If true, zooming by tapping twice and holding is enabled.
    • getZoomRate

      public float getZoomRate()
      Returns zoom gesture rate, including pinch to zoom and quick scale.
      Returns:
      The zoom rate.
    • setZoomRate

      public void setZoomRate(@FloatRange(from=0.0) float zoomRate)
      Sets zoom gesture rate, including pinch to zoom and quick scale.

      Default value is 1.0f.

      Parameters:
      zoomRate - The zoom rate.
    • isDeselectMarkersOnTap

      public boolean isDeselectMarkersOnTap()
      Gets whether the markers are automatically deselected (and therefore, their infowindows closed) when a map tap is detected.
      Returns:
      If true, markers are deselected on a map tap.
    • setDeselectMarkersOnTap

      public void setDeselectMarkersOnTap(boolean deselectMarkersOnTap)
      Sets whether the markers are automatically deselected (and therefore, their infowindows closed) when a map tap is detected.
      Parameters:
      deselectMarkersOnTap - determines if markers should be deslected on tap
    • setScrollGesturesEnabled

      public void setScrollGesturesEnabled(boolean scrollGesturesEnabled)

      Changes whether the user may scroll around the map.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      scrollGesturesEnabled - If true, scrolling is enabled.
    • isScrollGesturesEnabled

      public boolean isScrollGesturesEnabled()
      Returns whether the user may scroll around the map.
      Returns:
      If true, scrolling is enabled.
    • setHorizontalScrollGesturesEnabled

      public void setHorizontalScrollGesturesEnabled(boolean horizontalScrollGesturesEnabled)

      Changes whether the user may scroll horizontally around the map.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      horizontalScrollGesturesEnabled - If true, scrolling horizontally is enabled.
    • isHorizontalScrollGesturesEnabled

      public boolean isHorizontalScrollGesturesEnabled()
      Returns whether the user may scroll horizontally around the map.
      Returns:
      If true, scrolling horizontally is enabled.
    • isScaleVelocityAnimationEnabled

      public boolean isScaleVelocityAnimationEnabled()
      Returns whether scale velocity animation should execute after users finishes a gesture.
      Returns:
      If true, scale velocity animation is enabled.
    • setScaleVelocityAnimationEnabled

      public void setScaleVelocityAnimationEnabled(boolean scaleVelocityAnimationEnabled)
      Set whether scale velocity animation should execute after users finishes a gesture. True by default.
      Parameters:
      scaleVelocityAnimationEnabled - If true, scale velocity animation will be enabled.
    • isRotateVelocityAnimationEnabled

      public boolean isRotateVelocityAnimationEnabled()
      Returns whether rotate velocity animation should execute after users finishes a gesture.
      Returns:
      If true, rotate velocity animation is enabled.
    • setRotateVelocityAnimationEnabled

      public void setRotateVelocityAnimationEnabled(boolean rotateVelocityAnimationEnabled)
      Set whether rotate velocity animation should execute after users finishes a gesture. True by default.
      Parameters:
      rotateVelocityAnimationEnabled - If true, rotate velocity animation will be enabled.
    • isFlingVelocityAnimationEnabled

      public boolean isFlingVelocityAnimationEnabled()
      Returns whether fling velocity animation should execute after users finishes a gesture.
      Returns:
      If true, fling velocity animation is enabled.
    • setFlingVelocityAnimationEnabled

      public void setFlingVelocityAnimationEnabled(boolean flingVelocityAnimationEnabled)
      Set whether fling velocity animation should execute after users finishes a gesture. True by default.
      Parameters:
      flingVelocityAnimationEnabled - If true, fling velocity animation will be enabled.
    • setAllVelocityAnimationsEnabled

      public void setAllVelocityAnimationsEnabled(boolean allVelocityAnimationsEnabled)
      Set whether all velocity animations should execute after users finishes a gesture.
      Parameters:
      allVelocityAnimationsEnabled - If true, all velocity animations will be enabled.
    • isIncreaseRotateThresholdWhenScaling

      @Deprecated public boolean isIncreaseRotateThresholdWhenScaling()
      Deprecated.
      unused, see isDisableRotateWhenScaling() instead
      Returns whether rotation threshold should be increase whenever scale is detected.
      Returns:
      If true, rotation threshold will be increased.
    • setIncreaseRotateThresholdWhenScaling

      @Deprecated public void setIncreaseRotateThresholdWhenScaling(boolean increaseRotateThresholdWhenScaling)
      Deprecated.
      Set whether rotation threshold should be increase whenever scale is detected.
      Parameters:
      increaseRotateThresholdWhenScaling - If true, rotation threshold will be increased.
    • isDisableRotateWhenScaling

      public boolean isDisableRotateWhenScaling()
      Returns whether rotation gesture detector is disabled when scale is detected first.
      Returns:
      If true, rotation gesture detector will be disabled when scale is detected first.
    • setDisableRotateWhenScaling

      public void setDisableRotateWhenScaling(boolean disableRotateWhenScaling)
      Set whether rotation gesture detector should be disabled when scale is detected first.
      Parameters:
      disableRotateWhenScaling - If true, rotation gesture detector will be disabled when scale is detected first.
    • isIncreaseScaleThresholdWhenRotating

      public boolean isIncreaseScaleThresholdWhenRotating()
      Returns whether scale threshold should be increase whenever rotation is detected.
      Returns:
      If true, scale threshold will be increased.
    • setIncreaseScaleThresholdWhenRotating

      public void setIncreaseScaleThresholdWhenRotating(boolean increaseScaleThresholdWhenRotating)
      set whether scale threshold should be increase whenever rotation is detected.
      Parameters:
      increaseScaleThresholdWhenRotating - If true, scale threshold will be increased.
    • setAllGesturesEnabled

      public void setAllGesturesEnabled(boolean enabled)

      Sets the preference for whether all gestures should be enabled or disabled.

      This setting controls only user interactions with the map. If you set the value to false, you may still change the map location programmatically.

      The default value is true.
      Parameters:
      enabled - If true, all gestures are available; otherwise, all gestures are disabled.
      See Also:
    • areAllGesturesEnabled

      public boolean areAllGesturesEnabled()

      Retrieves the current status of whether all gestures are enabled.

      Returns:
      If true, all gestures are enabled.
    • setFocalPoint

      public void setFocalPoint(@Nullable android.graphics.PointF focalPoint)
      Sets the focal point used as center for a gesture
      Parameters:
      focalPoint - the focal point to be used.
    • getFocalPoint

      @Nullable public android.graphics.PointF getFocalPoint()
      Returns the gesture focal point
      Returns:
      The focal point
    • getHeight

      public float getHeight()
      Returns the measured height of the MapView
      Returns:
      height in pixels
    • getWidth

      public float getWidth()
      Returns the measured width of the MapView
      Returns:
      widht in pixels
    • invalidate

      public void invalidate()
      Invalidates the ViewSettings instances shown on top of the MapView