Code example for VelocityTracker

Methods: recycle

0
 
    @MediumTest 
    public void testInitialCondiditions() { 
        VelocityTracker vt = VelocityTracker.obtain();
        assertNotNull(vt);
        vt.recycle();
    } 
 
    /** 
     * Test that {@link android.view.VelocityTracker}.clear() clears 
     * the previous values after a call to computeCurrentVelocity() 
     */ 
    @MediumTest 
    public void testClear() { 
        long t = System.currentTimeMillis();
        VelocityTracker vt = VelocityTracker.obtain();
        drag(vt, 100, 200, 100, 200, 10, t, 300);
        vt.computeCurrentVelocity(1);
        assertFalse("Velocity should not be null", vt.getXVelocity() == 0.0f);
        assertFalse("Velocity should not be null", vt.getYVelocity() == 0.0f);
        vt.clear();