Skip to content

Enable Customisation for Location Layer Plugin #183

Closed

Description

@nikiizvorski
@RequiresPermission(anyOf = {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION})
  public void setLocationLayerEnabled(@LocationLayerMode.Mode int locationLayerMode) {
    if (locationLayerMode != LocationLayerMode.NONE) {
      locationLayer.setLayerVisibility(true);

      // Set an initial location if one is available and the locationEngines not null
      if (locationEngine != null) {
        setLastLocation();
        locationEngine.addLocationEngineListener(this);
      }

      if (locationLayerMode == LocationLayerMode.COMPASS) {
        setLinearAnimation(false);
        setNavigationEnabled(false);
        setMyBearingEnabled(true);
      } else if (locationLayerMode == LocationLayerMode.NAVIGATION) {
        setMyBearingEnabled(false);
        setNavigationEnabled(true);
      } else if (locationLayerMode == LocationLayerMode.TRACKING) {
        setLinearAnimation(false);
        setMyBearingEnabled(false);
        setNavigationEnabled(false);
      }
    } else {
      // Check that the mode isn't already none
      if (this.locationLayerMode != LocationLayerMode.NONE) {
        disableLocationLayerPlugin();
      }
    }
    this.locationLayerMode = locationLayerMode;
  }

Please enable any customisation on these methods since you depricated everything should be the time to update everything.... There is currently no good way to update user location icon.

Solution: some methods that we can do that and enable the structure of the code

Solution2: Requested seems like there is something wrong with that plugin and there is no location tracking what so ever. On never devices and old one is depricated

Activity

  1. added
    location-layer-plugin
    on Dec 1, 2017
  2. added this to the location-layer-0.4.0 milestone on Dec 22, 2017
  3. cammace commented on Dec 22, 2017

    @cammace

    You can apply new styles to your location layer icons using a custom style and using the LocationLayerPlugin.applyStyle. The custom style would look like so:

    <style name="CustomLocationLayer" parent="LocationLayer">
        <item name="backgroundDrawable">@drawable/custom_user_stroke_icon</item>
        <item name="foregroundDrawable">@drawable/custom_user_icon</item>
    
        <item name="bearingDrawable">@drawable/custom_user_arrow</item>
        <item name="navigationDrawable">@drawable/custom_user_puck_icon</item>
    
        <item name="accuracyAlpha">0.15</item>
        <item name="accuracyColor">#FF82C6</item>
      </style>
    

    Does this fit your needs or is there something missing. Note, this method didn't work properly in 0.2.0 but has been fixed since and will be in the 0.3.0 release.

  4. DejanRistic commented on Jan 10, 2018

    @DejanRistic

    @cammace I'm not sure it addresses everything, like allowing a custom image loaded after the app starts to be used as the user location annotation. The style approach assumes the image you want is already in your project and can be used through a style.

    I mention this in the issue that was closed:
    #178

    I think its important because the now deprecated MyLocationViewSettings supported this, doesn't make sense to deprecate something and replace it with something new if it doesn't at least support what you had before for applications that were relying on it. A little weird it was marked deprecated before its replacement is at least at a stable 1.0.

  5. cammace commented on Feb 14, 2018

    @cammace

    #267 added all the location layer options previously available inside the MyLocationViewSettings class and more.

  6. DejanRistic commented on May 7, 2018

    @DejanRistic

    @cammace Thanks for all the hard work on this so far.

    I'm still not seeing a way for me to set the background/foreground drawables directly using bitmaps loaded at runtime. The location layer options just let you set int values that have to be pulled from existing resources in the project.

    I do see the layer itself does create a drawable, transforms it into a bitmap, and then adds the bitmap directly to the layer. Can we expose this on the location layer plugin or the options? Just so we can use a bitmap loaded from our server vs needing to rely on resources in our drawable folders.

    A simple addition to allow something like this would be helpful and I wouldn't have to clone the entire plugin just to expose setting bitmaps directly:

     return LocationLayerOptions.builder(context)
                .backgroundImage(myBackgroundBitmap) // Why not support drawable, bitmap, or res. 
                .foregroundImage(myForegroundBitmap) // Why not support drawable, bitmap, or res. 
                .build();
    

    Thanks!

  7. cammace commented on May 7, 2018

    @cammace

    I like this idea. I've opened #486 to track progress on this. What I'm thinking is to have an overloaded method that also allows passing in a String (the bitmap id) and if that's used, just go ahead and use those images. Thanks for the feedback :)

  8. DejanRistic commented on May 7, 2018

    @DejanRistic

    🙇 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    location-layer-plugin

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions