Avoid nudging transitions if a gesture is in progress

We're now using nudgeTransitions() to tell the Map view that we want to
update it. However, if we're on a gesture movement, the update() call
can get called too fast and causing general slowdown. This check ensures
we only call for nudgeTransitions() after all gesture events are
finished. Fixes the issue pointed out by #1548 on Android.
This commit is contained in:
Bruno de Oliveira Abinader
2015-07-23 17:43:01 +03:00
parent 7b47fa8dab
commit 3512da9609
5 changed files with 14 additions and 10 deletions

View File

@@ -1268,7 +1268,8 @@ public class MapView extends SurfaceView {
post(new Runnable() {
@Override
public void run() {
mNativeMapView.invalidate();
boolean inProgress = mRotateGestureDetector.isInProgress() || mScaleGestureDetector.isInProgress();
mNativeMapView.invalidate(inProgress);
}
});
}

View File

@@ -88,8 +88,8 @@ class NativeMapView {
nativeUpdate(mNativeMapViewPtr);
}
public void invalidate() {
nativeOnInvalidate(mNativeMapViewPtr);
public void invalidate(boolean inProgress) {
nativeOnInvalidate(mNativeMapViewPtr, inProgress);
}
public void resizeView(int width, int height) {
@@ -438,7 +438,7 @@ class NativeMapView {
private native void nativeUpdate(long nativeMapViewPtr);
private native void nativeOnInvalidate(long nativeMapViewPtr);
private native void nativeOnInvalidate(long nativeMapViewPtr, boolean inProgress);
private native void nativeViewResize(long nativeMapViewPtr, int width, int height);