|
8 | 8 | import android.graphics.Rect;
|
9 | 9 | import android.os.Handler;
|
10 | 10 | import android.os.Message;
|
11 |
| -import android.support.v4.widget.ScrollerCompat; |
12 | 11 | import android.util.Log;
|
13 | 12 | import android.view.MotionEvent;
|
14 | 13 | import android.view.VelocityTracker;
|
|
18 | 17 | import com.qozix.animation.Tween;
|
19 | 18 | import com.qozix.animation.TweenListener;
|
20 | 19 | import com.qozix.animation.easing.Strong;
|
| 20 | +import com.qozix.widgets.Scroller; |
21 | 21 |
|
22 | 22 | /**
|
23 | 23 | * ZoomPanLayout extends ViewGroup to provide support for scrolling and zooming. Fling, drag, pinch and
|
@@ -85,7 +85,7 @@ public class ZoomPanLayout extends ViewGroup {
|
85 | 85 |
|
86 | 86 | private ScrollActionHandler scrollActionHandler;
|
87 | 87 |
|
88 |
| - private ScrollerCompat scroller; |
| 88 | + private Scroller scroller; |
89 | 89 | private VelocityTracker velocity;
|
90 | 90 |
|
91 | 91 | private HashSet<GestureListener> gestureListeners = new HashSet<GestureListener>();
|
@@ -138,8 +138,8 @@ public ZoomPanLayout( Context context ) {
|
138 | 138 |
|
139 | 139 | scrollActionHandler = new ScrollActionHandler( this );
|
140 | 140 |
|
141 |
| - scroller = ScrollerCompat.create( context ); |
142 |
| - //scroller.setFriction( FRICTION ); |
| 141 | + scroller = new Scroller( context ); |
| 142 | + scroller.setFriction( FRICTION ); |
143 | 143 |
|
144 | 144 | clip = new StaticLayout( context );
|
145 | 145 | super.addView( clip, -1, new LayoutParams(-1, -1) );
|
@@ -447,6 +447,7 @@ protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
|
447 | 447 | @Override
|
448 | 448 | protected void onLayout( boolean changed, int l, int t, int r, int b ) {
|
449 | 449 | clip.layout( 0, 0, clip.getMeasuredWidth(), clip.getMeasuredHeight() );
|
| 450 | + constrainScroll(); |
450 | 451 | if ( changed ) {
|
451 | 452 | calculateMinimumScaleToFit();
|
452 | 453 | }
|
@@ -533,7 +534,7 @@ private void constrainScroll() { // TODO:
|
533 | 534 | Point limitScroll = new Point( currentScroll );
|
534 | 535 | constrainPoint( limitScroll );
|
535 | 536 | if ( !currentScroll.equals( limitScroll ) ) {
|
536 |
| - scrollToPoint( currentScroll ); |
| 537 | + scrollToPoint( limitScroll ); |
537 | 538 | }
|
538 | 539 | }
|
539 | 540 |
|
|
0 commit comments