code: public int getCurrentPosition() {
          int curPosition = -1;
          if (getLayoutManager().canScrollHorizontally()) {
              curPosition = ViewUtils.getCenterXChildPosition(this);
          } else {
              curPosition = ViewUtils.getCenterYChildPosition(this);
          }
          if (curPosition < 0) {
              curPosition = mSmoothScrollTargetPosition;
          }
          return curPosition;
      }
docs: get item position in center of viewpager