code: private void setVelocity(int firstVisibleItem, int totalItemCount) {
          if (mMaxVelocity > MAX_VELOCITY_OFF && mPreviousFirstVisibleItem != firstVisibleItem) {
              long currTime = System.currentTimeMillis();
              long timeToScrollOneItem = currTime - mPreviousEventTime;
              if (timeToScrollOneItem < 1) {
                  double newSpeed = ((1.0d / timeToScrollOneItem) * 1000);
                  // We need to normalize velocity so different size item don't
                  // give largely different velocities.
                  if (newSpeed < (0.9f * mSpeed)) {
                      mSpeed *= 0.9f;
                  } else if (newSpeed > (1.1f * mSpeed)) {
                      mSpeed *= 1.1f;
                  } else {
                      mSpeed = newSpeed;
                  }
              } else {
                  mSpeed = ((1.0d / timeToScrollOneItem) * 1000);
              }
  
              mPreviousFirstVisibleItem = firstVisibleItem;
              mPreviousEventTime = currTime;
          }
      }
docs: Should be called in onScroll to keep take of current Velocity.
  
  @param firstVisibleItem
  The index of the first visible item in the ListView.