-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[android] - move camera logic to dedicated transform class #6919
Conversation
@tobrun, thanks for your PR! By analyzing the history of the files in this pull request, we identified @clydebarrow, @cammace and @vkurchatkin to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Only some JavaDoc on the new class/methods
Been looking into
In a normal case, we would refactor those items into constructor and replace references. For this case, I'm thinking about just leaving MapboxMap and have these dependencies resolved from that object instead. The relation between CameraUpdateFactoy and MapboxMap is a bit too complex to extract and simplify. |
7369e3f
to
c9e9990
Compare
Side note: I had to remove the unit tests related to camera. This is because we aren't able to mock out |
aa8fc81
to
9cced7f
Compare
f4fdb76
to
5336ebb
Compare
5336ebb
to
f0e0cdf
Compare
2 more changes have been introduced:
|
7c1c939
to
508973b
Compare
nativeMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { | ||
@Override | ||
public void onMapChanged(@MapView.MapChange int change) { | ||
if (change == MapView.DID_FINISH_RENDERING_FRAME_FULLY_RENDERED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should batch this so that we do only one invalidate per render instead of one per marker added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with 07ae553
9e96312
to
2330870
Compare
post camera updates to the message queue, this makes calling an new camera update in the on finish of another update possible. Simplify transform.java implementation.
2330870
to
5af75a7
Compare
onCameraChangeListener.onCameraChange(this.cameraPosition); | ||
} | ||
public final void moveCamera(final CameraUpdate update, final MapboxMap.CancelableCallback callback) { | ||
mapView.post(new Runnable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobrun this breaks the existing contract that the new camera position will be query-able immediately and might have weird consequences in regards to "when this event occurs relative to activity lifecycle" because of the way the main thread works (lifecycle events are posted as items in the main thread handler).
Do you have a recommended strategy then for monitoring when this camera move event has been completed?
WIP - closes #6532 - This PR moves camera logic to a dedicated java class.
Todo
After this we can look into integrating #4746
Review @ivovandongen.