start render early

This commit is contained in:
Hannes Janetzek
2013-02-01 04:31:39 +01:00
parent a8c2f72a35
commit 019c39d8b8
10 changed files with 58 additions and 35 deletions

View File

@@ -30,7 +30,7 @@ public class Compass {
if (mMapView != null) {
mMapView.getMapPosition().setRotation(-mAngle);
mMapView.redrawMap();
mMapView.redrawMap(true);
}
}
}

View File

@@ -274,11 +274,15 @@ public class MapView extends RelativeLayout {
/**
* Calculates all necessary tiles and adds jobs accordingly.
* @param changedPos TODO
*/
public void redrawMap() {
public void redrawMap(boolean changedPos) {
if (mPausing || this.getWidth() == 0 || this.getHeight() == 0)
return;
if (changedPos)
render();
if (AndroidUtils.currentThreadIsUiThread()) {
boolean changed = mMapViewPosition.getMapPosition(mMapPosition, null);
@@ -583,7 +587,7 @@ public class MapView extends RelativeLayout {
+ " lat: " + mapPosition.lat
+ " lon: " + mapPosition.lon);
mMapViewPosition.setMapCenter(mapPosition);
redrawMap();
redrawMap(true);
}
/**

View File

@@ -48,7 +48,7 @@ public class MapViewPosition {
public final static int MAX_ZOOMLEVEL = 17;
public final static int MIN_ZOOMLEVEL = 2;
private final static float MAX_ANGLE = 50;
private final static float MAX_ANGLE = 55;
private final MapView mMapView;
@@ -697,12 +697,12 @@ public class MapViewPosition {
double mx = (mStartX + (mEndX - mStartX) * (1.0 - adv));
double my = (mStartY + (mEndY - mStartY) * (1.0 - adv));
setMapPosition(mx, my);
mMapView.redrawMap();
mMapView.redrawMap(true);
}
void onFinish() {
setMapPosition(mEndX, mEndY);
mMapView.redrawMap();
mMapView.redrawMap(true);
}
static class AnimationHandler extends Handler {

View File

@@ -161,7 +161,7 @@ public class MapZoomControls {
}
mapViewPosition.setZoomLevel((byte) z);
mMapView.redrawMap();
mMapView.redrawMap(true);
return true;
}

View File

@@ -174,7 +174,7 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
// double-tap + hold
if (mLongPress) {
mMapPosition.scaleMap(1 - moveY / 100, 0, 0);
mMapView.redrawMap();
mMapView.redrawMap(true);
return true;
}
@@ -198,10 +198,10 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
if (!mBeginRotate && !mBeginScale) {
/* our naive gesture detector for rotation and tilt.. */
if (Math.abs(rad) < 0.25 || Math.abs(rad) > Math.PI - 0.25) {
if (Math.abs(rad) < 0.30 || Math.abs(rad) > Math.PI - 0.30) {
mBeginTilt = true;
if (mMapPosition.tilt(moveY / 4)) {
mMapView.redrawMap();
mMapView.redrawMap(true);
}
return true;
@@ -229,7 +229,7 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
mMapPosition.rotateMap((float) Math.toDegrees(rad - mAngle), x, y);
mAngle = rad;
mMapView.redrawMap();
mMapView.redrawMap(true);
}
return true;
@@ -338,7 +338,7 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
if (moveX >= 1 || moveY >= 1 || moveX <= -1 || moveY <= -1) {
mMapPosition.moveMap(moveX, moveY);
mMapView.redrawMap();
mMapView.redrawMap(true);
mScrollX = mScroller.getCurrX();
mScrollY = mScroller.getCurrY();
}
@@ -358,7 +358,7 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
if (mMulti == 0) {
mMapPosition.moveMap(-distanceX, -distanceY);
mMapView.redrawMap();
mMapView.redrawMap(true);
}
return true;
@@ -447,7 +447,7 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
if (scale > 1) {
mMapPosition.scaleMap(scale, mScrollX / adv, mScrollY / adv);
mMapView.redrawMap();
mMapView.redrawMap(true);
}
return true;
@@ -505,7 +505,7 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
}
if (mBeginScale && mMapPosition.scaleMap(scale, mFocusX, mFocusY))
mMapView.redrawMap();
mMapView.redrawMap(true);
return true;
}
@@ -581,7 +581,7 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
mMapPosition.scaleMap(1 + scale, mFocusX, mFocusY);
}
mMapView.redrawMap();
mMapView.redrawMap(true);
if (tick == 0)
mTimer = null;