Can't find ViewAnnotationManager in Mapbox's annotation plugin - Android - android

I couldn't find ViewAnnotationPlugin and PointAnnotationPlugin classes after implementing Mapbox annotation plugin in my project.
I'm trying to implement custom views on top of Mapbox map using Java to look like a map pin but customized.
Views could be an image or a custom Android layout.
In this Mapbox documentation they're referring to use ViewAnnotationPlugin and PointAnnotationPlugin, but I couldn't find these classes after implementing Mapbox annotation plugin in my project.
Here's what I've implemented:
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0'
Here's the mapbox documentation I'm referring to:
https://docs.mapbox.com/android/maps/examples/view-annotation-with-point-annotation/
Is this the correct way for showing custom views on specific coordinates using Mapbox, while keeping in mind the map camera changes should not affect the custom views added on the map?

Related

How does jetpack compose work under the hood

The new Jetpack compose component added to Arch component is like Flutter Ui making.
How does it make the Ui though?
Does it use a native code engine like Skia, or it still follows the ViewGroup way like before?
Compose creates one view currently named AndroidComposeView, which inherits ViewGroup, and it draws the widget tree on its canvas. It also processes motion/keyboard events for this view.
There may be more helper views added to this view due to implementation details, but basically for the "widgets" of Compose, you won't see classical Views in view hierarchy. Layout inspector currently doesn't help for Compose - you can try it but you'll won't see your widgets.
Developers are promised to be able to create own customized widgets, which can directly paint on Canvas, set layout for itself or children, or process input events.
However, the Canvas and lots of other classes used here are not standard framework classes. For example, Canvas for Compose is redefined in Kotlin. Similar way there is new Paint, Shape, and other new classes. They internally use framework classes for their work, but that's implementation detail. When drawing, you'd use these new classes.
Since Compose is a library, and not present natively on Android devices, the library is included in each app that uses Compose.
Also there is no native code involved here, all is done in Kotlin and becomes part of your app's dexed code. By using Compose, your app won't contain any additional native library (probably, if creators don't change mind).
No, It doesn't use anything from the old UI Toolkit actually they are building it to overcome old UIToolkit's problems.
Compose is not views, It's a new set of Jetpack UI Widget, Basically, it's a Kotlin compiler plugin which renders the Android Canvas (I suppose there's no documentation for this yet) with full compatibility of existing android's view system, the last Dev summit there was a talk covers how it works internally, I/O had another talk too

How can I add markers on navigationlauncher of mapbox?

I'm using mapbox for map navigation.. is it possible to add markers on navigation view on mapbox like the waze app? when you start navigating markers are still shown on navigation
The NavigationView allows access to the MapboxMap via NavigationView#retrieveMap(). Once initialized, you should be able to use this to create your own SymbolManager using the annotation plugin. You can then use the plugin as your normally would to add / remove custom markers to the map.

Android Mapbox Marker Labels

I'm trying to figure out how to make a dynamically generated list of markers display a dynamic text label on the map (not in the infoWindow). I know it's possible because I've used this feature in Mapbox Studio - I just can't figure out how to do it on Android! I considered creating a static Bitmap icon with the text incorporated, but that doesn't seem very flexible compared to the Mapbox Studio version, so I'd like to avoid it if I can! Any suggestions?
You're trying to do what's called data-driven styling
You should use a SymbolLayer to show text on a map. If the text you want to show is based on GeoJSON Features in your data set, then use the get expression in the textField property of a SymbolLayer.
FeatureCollection featureCollection = FeatureCollection.fromFeatures();
GeoJsonSource geoJsonSource = new GeoJsonSource("source-id", featureCollection);
mapboxMap.addSource(geoJsonSource);
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id")
.withProperties(PropertyFactory.textField(Expression.get("FEATURE-PROPERTY-KEY")));
mapboxMap.addLayer(symbolLayer);
The Annotation Plugin simplifies some of this. Also for reference to see how SymbolLayers are used, there is the Mapbox Android demo app.

Creating a line slider on a graph in android

I have created a graph with a series of data. Now I'm trying to add a slider / line marker to the chart like the one below.
I created the graph/charts using the MPAndroidChart library provided here https://github.com/PhilJay/MPAndroidChart.
The graph seems to be working fine and good but i need a line slider like below so that when i touch on the graph the line slides and provides the values of the line intersecting the graph.
Could anyone help me figure out this problem or do i have to use a different library to achieve this.
This feature just became available: https://github.com/PhilJay/MPAndroidChart/commits/master
However, it is not available as a release yet, so you cannot get it via gradle or maven, only via cloning the repository.
It will be in the next release v2.1.0 which will be available within the next week.

Android Map Extensions on zoom cluster transition

I was implementig maps extensions in my solution, and i cant figure out how to activate the cluster transition animation. There is a class called ClusterAnimator but is not used in the example.
So the question is, how can activate the cluster transitions in android map extensions implementation using the default clustering strategy?.
I want to get the same transition than the original maps library does on zoom in and out with the markers and clusters.
Have you set your clustermanager as the mapview's OnMapCameraChangeListener ?
Take a look at the BigClusteringDemoActivity demo-application, which does the following:
getMap().setOnCameraChangeListener(mClusterManager);
EDIT I wrongly assumed that the question was about Google Maps Android API utility library and its ClusterManager, which it wasn't.

Categories

Resources