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

Provide onMapIdle callback #214

Merged
merged 1 commit into from
Feb 15, 2020
Merged

Conversation

n8han
Copy link
Collaborator

@n8han n8han commented Feb 3, 2020

Corresponding to mapViewDidBecomeIdle in the iOS SDK, this informs the
application "that the map view is entering an idle state, and no more
drawing will be necessary until new data is loaded or there is some
interaction with the map."

https://docs.mapbox.com/ios/api/maps/5.6.1/Protocols/MGLMapViewDelegate.html#/c:objc(pl)MGLMapViewDelegate(im)mapViewDidBecomeIdle:

I have not provided an Android implementation as I am not set up to test
one yet. I would do this later if it's still missing.

Corresponding to `mapViewDidBecomeIdle` in the iOS SDK, this informs the
application "that the map view is entering an idle state, and no more
drawing will be necessary until new data is loaded or there is some
interaction with the map."

https://docs.mapbox.com/ios/api/maps/5.6.1/Protocols/MGLMapViewDelegate.html#/c:objc(pl)MGLMapViewDelegate(im)mapViewDidBecomeIdle:

I have not provided an Android implementation as I am not set up to test
one yet. I would do this later if it's still missing.
@tobrun
Copy link
Collaborator

tobrun commented Feb 15, 2020

Awesome contribution @n8han! We will need the android equivalent of OnIdleListener for parity.

@tobrun tobrun merged commit c378a30 into flutter-mapbox-gl:master Feb 15, 2020
@tobrun tobrun mentioned this pull request Feb 15, 2020
Lobankovanastia pushed a commit to Lobankovanastia/flutter-mapbox-gl that referenced this pull request Feb 15, 2020
Corresponding to `mapViewDidBecomeIdle` in the iOS SDK, this informs the
application "that the map view is entering an idle state, and no more
drawing will be necessary until new data is loaded or there is some
interaction with the map."

https://docs.mapbox.com/ios/api/maps/5.6.1/Protocols/MGLMapViewDelegate.html#/c:objc(pl)MGLMapViewDelegate(im)mapViewDidBecomeIdle:

I have not provided an Android implementation as I am not set up to test
one yet. I would do this later if it's still missing.
@n8han n8han deleted the OnMapIdle branch February 17, 2020 17:48
andrea689 added a commit to andrea689/flutter-mapbox-gl that referenced this pull request Mar 13, 2020
* master:
  Support setting map's content insets (flutter-mapbox-gl#215)
  Provide `onMapIdle` callback (flutter-mapbox-gl#214)
  [example] add full page map example (flutter-mapbox-gl#201)
  Fix missing location indicator on iOS (flutter-mapbox-gl#176)
  Returned a nil result so the future completes. (flutter-mapbox-gl#216)
  Update README: Access Tokens for self-hosted tiles (flutter-mapbox-gl#217)
  Change annotation priority (flutter-mapbox-gl#222)
@xing-zheng
Copy link

highly appreciated if the same feature can be provided on android. @n8han @tobrun

@m0nac0
Copy link
Collaborator

m0nac0 commented May 15, 2020

@xing-zheng I just tried to implement this for Android, however the onMapIdle callback is called continuously about 5 times per second the entire time the map is visible on the screen. The listener stops firing when the display is off and immediately starts again after the display turns on.

@tobrun Do you have an idea what's going on there? Reading the docs I think this is not the intended behavior for MapView.OnDidBecomeIdleListener, is it?

@leeprobert
Copy link

What branch is this in so I can test? I need this functionality for my Symbol updates on Zoom.

@tobrun
Copy link
Collaborator

tobrun commented Jun 23, 2021

@m0nac0

I just tried to implement this for Android, however the onMapIdle callback is called continuously about 5 times per second the entire time the map is visible on the screen. The listener stops firing when the display is off and immediately starts again after the display turns on.

That shouldn't be happening :) it can happen that onMapIdle is called for invalidation of tiles and that isn't visually seen be you but what you are describing seems to be a different bug.

@leeprobert
Copy link

Does seem weird. I have been able to get onMapIdle to work on iOS but not Android (I use onCameraIdle). @m0nac0 - could this be that your Build method is being called continuously?

n8han added a commit that referenced this pull request Oct 30, 2021
This is the android piece of PR #214. The listener
`MapView.OnDidBecomeIdleListener` is less well documented than its iOS
counterpart. We just have this to go on:

> Interface definition for a callback to be invoked when the map has
> entered the idle state.
https://docs.mapbox.com/android/maps/api/9.6.1/com/mapbox/mapboxsdk/maps/MapView.OnDidBecomeIdleListener.html

Fr the iOS framework method we have more detailed information:

> Tells the delegate that the map view is entering an idle state, and no
> more drawing will be necessary until new data is loaded or there is
> some interaction with the map.

> * No camera transitions are in progress
> * All currently requested tiles have loaded
> * All fade/transition animations have completed
https://docs.mapbox.com/archive/ios/maps/api/5.6.1/Protocols/MGLMapViewDelegate.html#/c:objc(pl)MGLMapViewDelegate(im)mapViewDidBecomeIdle:

After testing with these changes, it does seem to be the case that it is
only invoked after the tiles are loaded. So I think this is the correct
analogue for the iOS listener.
felix-ht pushed a commit that referenced this pull request Nov 2, 2021
This is the android piece of PR #214. The listener
`MapView.OnDidBecomeIdleListener` is less well documented than its iOS
counterpart. We just have this to go on:

> Interface definition for a callback to be invoked when the map has
> entered the idle state.
https://docs.mapbox.com/android/maps/api/9.6.1/com/mapbox/mapboxsdk/maps/MapView.OnDidBecomeIdleListener.html

Fr the iOS framework method we have more detailed information:

> Tells the delegate that the map view is entering an idle state, and no
> more drawing will be necessary until new data is loaded or there is
> some interaction with the map.

> * No camera transitions are in progress
> * All currently requested tiles have loaded
> * All fade/transition animations have completed
https://docs.mapbox.com/archive/ios/maps/api/5.6.1/Protocols/MGLMapViewDelegate.html#/c:objc(pl)MGLMapViewDelegate(im)mapViewDidBecomeIdle:

After testing with these changes, it does seem to be the case that it is
only invoked after the tiles are loaded. So I think this is the correct
analogue for the iOS listener.
n8han added a commit that referenced this pull request Nov 8, 2021
This is the android piece of PR #214. The listener
`MapView.OnDidBecomeIdleListener` is less well documented than its iOS
counterpart. We just have this to go on:

> Interface definition for a callback to be invoked when the map has
> entered the idle state.
https://docs.mapbox.com/android/maps/api/9.6.1/com/mapbox/mapboxsdk/maps/MapView.OnDidBecomeIdleListener.html

Fr the iOS framework method we have more detailed information:

> Tells the delegate that the map view is entering an idle state, and no
> more drawing will be necessary until new data is loaded or there is
> some interaction with the map.

> * No camera transitions are in progress
> * All currently requested tiles have loaded
> * All fade/transition animations have completed
https://docs.mapbox.com/archive/ios/maps/api/5.6.1/Protocols/MGLMapViewDelegate.html#/c:objc(pl)MGLMapViewDelegate(im)mapViewDidBecomeIdle:

After testing with these changes, it does seem to be the case that it is
only invoked after the tiles are loaded. So I think this is the correct
analogue for the iOS listener.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants