private void handleClick() {
        if (mOnItemClickListener != null && getItemCount() > 0) {
            int periodLength = getPeriodLength(getWidth());
            int page = getScrollX() / periodLength;
            if (getScrollX() % periodLength > periodLength / 2) {
                page++;
            } else if (getScrollX() % periodLength < -periodLength / 2){
                page--;
            }
            mOnItemClickListener.click(this, getLoopIndex(page));
        }
    }
A banner view that can automatically or manually scroll in a loop
Created by Marksss on 2019/8/12.
imitate/src/main/java/com/engineer/imitate/ui/widget/opensource/InfiniteBannerView.java