Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Android NativeMapView and move creation to the ModuleProvider #3040

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mwilsnd
Copy link
Collaborator

@mwilsnd mwilsnd commented Nov 22, 2024

This PR exposes the NativeMapView implementation and delegates construction to the ModuleProvider via a new factory method. This allows an external library to implement a custom NativeMapView and replace it at runtime by implementing the ModuleProvider interface. This enables a much cleaner method of working with the native core layer of MapLibre in Android projects.

For existing users, nothing will change. Advanced users which already implement their own ModuleProvider will need to implement the new createNativeMapView method. The implementation of this method can be copied from the included ModuleProviderImpl.java file.

@mwilsnd mwilsnd self-assigned this Nov 22, 2024
@@ -44,7 +44,7 @@
import java.util.List;

// Class that wraps the native methods for convenience
final class NativeMapView implements NativeMap {
public final class NativeMapView implements NativeMap {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we drop the final so it's easier to create a custom NativeMap with inheritance?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me do some testing, I'm currently uncertain if the JNI bindings will work as expected with a derived class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants