Repository navigation
adds location layer options class - #267
Conversation
tobrun
left a comment
There was a problem hiding this comment.
Starting to shape up nicely, just a couple of nits
| onLocationStaleListeners.clear(); | ||
| return; | ||
| } | ||
| onLocationStaleListeners.remove(onLocationStaleListener); |
There was a problem hiding this comment.
this method doesn't do what is expected from its name when a null is passed.
| */ | ||
| @SuppressWarnings( {"MissingPermission"}) | ||
| private void setLastLocation() { | ||
| private void setLastLocation(int locationLayerMode) { |
There was a problem hiding this comment.
why does the end developer need to pass in the mode? isn't this part of the state managed by the plugin itself?
There was a problem hiding this comment.
This method isn't exposed to the end dev, it's purpose is to attempt at getting a location value immediately when a mode is set.
There was a problem hiding this comment.
Thanks for clarifying, I'm still a bit confused why you aren't moving this line to the top of the method and just checking against this.locationLayerMode instead. Would this break any business logic?
There was a problem hiding this comment.
Good point, initially testing and not seeing any issues with this approach.
| @OnLifecycleEvent(Lifecycle.Event.ON_STOP) | ||
| public void onStop() { | ||
| StaleStateRunnable.getInstance().removeOnLocationStaleListener(null); | ||
| StaleStateRunnable.getInstance().onStop(); |
There was a problem hiding this comment.
Calling getInstance twice while one time is sufficient, either assign result/reuse or refactor StateStateRunnable to encapsulate behaviour into one method. If removeOnLocationStaleListener is only used in this code path the latter suggestion would make most sense.
| import com.google.auto.value.AutoValue; | ||
|
|
||
| @AutoValue | ||
| public abstract class LocationLayerOptions implements Parcelable { |
There was a problem hiding this comment.
missing javadoc on public API from this class.
| } | ||
| } | ||
|
|
||
| static Bitmap setShadow(Drawable drawable, float elevation) { |
| @Test | ||
| public void whenModeChanged_remainsUsingStaleIcons() throws Exception { | ||
|
|
||
| } |
| private MapboxMap mapboxMap; | ||
| private LocationLayerPlugin locationLayerPlugin; | ||
|
|
||
| Location location; |
fd805ce to
7899442
Compare
| */ | ||
| @RequiresPermission(anyOf = {ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION}) | ||
| public void setLocationLayerEnabled(@LocationLayerMode.Mode int locationLayerMode) { | ||
| this.locationLayerMode = locationLayerMode; |
There was a problem hiding this comment.
this change allows to also remove the param in toggleCameraListener?
* Initial stale logic added * adds location layer options class (#267) * adds location layer options class * Fixed memory leak in manual location update activity * Remove stale state listener in onStop * add elevation attribute * fix accuracy showing during nav mode * added documentation to location options * added some test for the class * fixed test * set locationlayermode at beginning of method * remove toggleCameraListener param * remove stale state singleton * resolved timber planting itself 3 times
Closes #183
Allows you to set style dynamically using the
LocationLayerOptionsclass. Also adds all the necessary attributes that were settable in the now deprecatedMyLocationViewSettings.