/**
   * Same as {@linkplain #scrollToPosition(int)} but it scrolls to the position not only make the
   * position visible.
   *
   * <p>It depends on {@code LayoutManager} how {@linkplain #scrollToPosition(int)} works, and
   * currently we know that {@linkplain LinearLayoutManager#scrollToPosition(int)} just make the
   * position visible.
   *
   * <p>In LinearLayoutManager, scrollToPositionWithOffset() is provided for scrolling to the
   * position. This method checks which LayoutManager is set, and handles which method should be
   * called for scrolling.
   *
   * <p>Other know classes (StaggeredGridLayoutManager and GridLayoutManager) are not tested.
   *
   * @param position position to scroll
   */
  public void scrollVerticallyToPosition(int position) {
    LayoutManager lm = getLayoutManager();

    if (lm != null && lm instanceof LinearLayoutManager) {
      ((LinearLayoutManager) lm).scrollToPositionWithOffset(position, 0);
    } else {
      scrollToPosition(position);
    }
  }