Code example for OverScroller

Methods: getCurrVelocity, isFinished

0
 
    @SmallTest 
    @Feature({"AndroidWebView"}) 
    public void testFlingScroll() { 
        TestScrollOffsetManagerDelegate delegate = new TestScrollOffsetManagerDelegate();
        OverScroller scroller = new OverScroller(getInstrumentation().getContext());
        AwScrollOffsetManager offsetManager = new AwScrollOffsetManager(delegate, scroller);
 
        offsetManager.flingScroll(0, 101);
        assertTrue(!scroller.isFinished());
        assertTrue(delegate.getInvalidateCount() == 1);
        assertEquals(101, (int) scroller.getCurrVelocity());
 
        offsetManager.flingScroll(111, 0);
        assertTrue(!scroller.isFinished());
        assertTrue(delegate.getInvalidateCount() == 2);
        assertEquals(111, (int) scroller.getCurrVelocity());
    } 
 
    @SmallTest 
    @Feature({"AndroidWebView"}) 
    public void testRequestChildRectangleOnScreenDontScrollIfAlreadyThere() {