From d1e0859c6b1a6676072a429aa61899d5d1d79438 Mon Sep 17 00:00:00 2001 From: moagrius Date: Sat, 31 Aug 2013 19:51:35 -0500 Subject: [PATCH] updating slideTo... methods some devices require invalidate to be called immediately following a scroller.startScroll *and* in computeScroll. --- src/com/qozix/layouts/ZoomPanLayout.java | 5 +++-- src/com/qozix/tileview/TileView.java | 16 ++++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/com/qozix/layouts/ZoomPanLayout.java b/src/com/qozix/layouts/ZoomPanLayout.java index b6d19137..2b9a1f88 100644 --- a/src/com/qozix/layouts/ZoomPanLayout.java +++ b/src/com/qozix/layouts/ZoomPanLayout.java @@ -351,6 +351,7 @@ public void slideToPoint( Point point ) { // TODO: int dx = point.x - startX; int dy = point.y - startY; scroller.startScroll( startX, startY, dx, dy, SLIDE_DURATION ); + invalidate(); // we're posting invalidate in computeScroll, yet both are required } /** @@ -490,8 +491,8 @@ public void computeScroll() { if ( scroller.computeScrollOffset() ) { Point destination = new Point( scroller.getCurrX(), scroller.getCurrY() ); scrollToPoint( destination ); - postInvalidate(); // should not be necessary but is... dispatchScrollActionNotification(); + postInvalidate(); // should not be necessary but is... } } @@ -852,4 +853,4 @@ public static interface GestureListener { public void onFlingComplete( Point point ); } -} +} \ No newline at end of file diff --git a/src/com/qozix/tileview/TileView.java b/src/com/qozix/tileview/TileView.java index 39c4cc77..2083b9ce 100644 --- a/src/com/qozix/tileview/TileView.java +++ b/src/com/qozix/tileview/TileView.java @@ -381,9 +381,7 @@ public double unscale( double value ) { * @param y (double) the relative y position to move to */ public void moveTo( double x, double y ) { - Point point = positionManager.translate( x, y ); - point.x *= getScale(); - point.y *= getScale(); + Point point = positionManager.translate( x, y, getScale() ); scrollToPoint( point ); } @@ -393,9 +391,7 @@ public void moveTo( double x, double y ) { * @param y (double) the relative y position to move to */ public void moveToAndCenter( double x, double y ) { - Point point = positionManager.translate( x, y ); - point.x *= getScale(); - point.y *= getScale(); + Point point = positionManager.translate( x, y, getScale() ); scrollToAndCenter( point ); } @@ -405,9 +401,7 @@ public void moveToAndCenter( double x, double y ) { * @param y (double) the relative y position to move to */ public void slideTo( double x, double y ) { - Point point = positionManager.translate( x, y ); - point.x *= getScale(); - point.y *= getScale(); + Point point = positionManager.translate( x, y, getScale() ); slideToPoint( point ); } @@ -417,9 +411,7 @@ public void slideTo( double x, double y ) { * @param y (double) the relative y position to move to */ public void slideToAndCenter( double x, double y ) { - Point point = positionManager.translate( x, y ); - point.x *= getScale(); - point.y *= getScale(); + Point point = positionManager.translate( x, y, getScale() ); slideToAndCenter( point ); }