18.SnapHelper源码分析-RecyclerView实现ViewPager效果

1.简介

SnapHelper是Android 24.2.0 的support 包中添加的一个类,用于辅助RecyclerView扩展滑动效果。比如,通过这个类可以实现RecyclerView像ViewPager一样的滑动,甚至在此基础上再次扩展。越发的体现了RecyclerView的强大之处。今天从源码的角度看看SnapHelper的实现原理。

SnapHelper是一个抽象类,官方提供了两个子类供我们实现特定功能,LinearSnapHelper和PagerSnapHelper,基本上这两个类已经能满足我们日常百分之八十的需要,我们也可以通过继承SnapHelper实现特有功能。

既然是个抽象类,我们先看看他提供出来哪些接口供子类去实现,这些接口又完成了什么样的功能?

new SnapHelper() {
            @Nullable
            @Override
            public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager, @NonNull View targetView) {
                return new int[0];
            }

            @Nullable
            @Override
            public View findSnapView(RecyclerView.LayoutManager layoutManager) {
                return null;
            }

            @Override
            public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX, int velocityY) {
                return 0;
            }
        };
calculateDistanceToFinalSnap

这个方法用于计算滑动targetView到指定为止所需要在x轴或者y轴上移动的距离,返回的结果是一个int数组,两个元素分别是xy方向上需要移动的距离

findSnapView

用于找到当前情况下需要移动的view,也就是上边的targetView,一般是先找到这个view,然后计算需要移动的距离,然后开始移动

findTargetSnapPosition

提供一个targetView的position

2.源码分析

接下来我们开始分析SnapHelper的源码,从attachToRecyclerView开始入手,我们知道要使用SnapHelper,只需要attach一下即可,那么这个过程中他做了什么

   /**
     * Attaches the {@link SnapHelper} to the provided RecyclerView, by calling
     * {@link RecyclerView#setOnFlingListener(RecyclerView.OnFlingListener)}.
     * You can call this method with {@code null} to detach it from the current RecyclerView.
     *
     * @param recyclerView The RecyclerView instance to which you want to add this helper or
     *                     {@code null} if you want to remove SnapHelper from the current
     *                     RecyclerView.
     *
     * @throws IllegalArgumentException if there is already a {@link RecyclerView.OnFlingListener}
     * attached to the provided {@link RecyclerView}.
     *
     */
    public void attachToRecyclerView(@Nullable RecyclerView recyclerView)
            throws IllegalStateException {
        //判断是否是同一个RecyclerView,如果是直接返回,防止重复attach
        if (mRecyclerView == recyclerView) {
            return; // nothing to do
        }
        //如果是一个新的RecyclerView,先销毁所有的回调接口,这里指的是
        //RecyclerView的scroll监听和fling监听
        if (mRecyclerView != null) {
            destroyCallbacks();
        }
        //保存这个RecyclerView
        mRecyclerView = recyclerView;
        if (mRecyclerView != null) {
            //重新设置监听
            setupCallbacks();
            //初始化一个Scoller,用于滚动RecylerView
            mGravityScroller = new Scroller(mRecyclerView.getContext(),
                    new DecelerateInterpolator());
            //这个方法开始才是进入了主题
            snapToTargetExistingView();
        }
    }

这个方法会在第一次attach的时候和RecyclerView滑动状态改变的时候调用,用于将RecyclerView移动到指定的位置,移动的距离根据当前距离RecyclerView中心点最近的那个itemView获取,获取到这个距离后,调用smoothScrollBy方法移动RecyclerView

   /**
     * Snaps to a target view which currently exists in the attached {@link RecyclerView}. This
     * method is used to snap the view when the {@link RecyclerView} is first attached; when
     * snapping was triggered by a scroll and when the fling is at its final stages.
     */
    void snapToTargetExistingView() {
        if (mRecyclerView == null) {
            return;
        }
        LayoutManager layoutManager = mRecyclerView.getLayoutManager();
        if (layoutManager == null) {
            return;
        }
        //获取到当前需要移动的view,这个View获取的是距离当前RecyclerView
        //中心最近的一个View,可以看PagerSnapHelper和LinearSnapHelper这两
        //个官方提供的类,二者获取的规则是相同的,这个方法是抽象方法,用于
        //提供给调用者,由他指定获取此view的规则
        View snapView = findSnapView(layoutManager);
        if (snapView == null) {
            return;
        }
        //得到这个view之后,计算这个view在x或者y方向上需要移动的距离
        int[] snapDistance = calculateDistanceToFinalSnap(layoutManager, snapView);
        //滑动RecyclerView到计算的位置
        if (snapDistance[0] != 0 || snapDistance[1] != 0) {
            mRecyclerView.smoothScrollBy(snapDistance[0], snapDistance[1]);
        }
    }

接下来以PagerSnapHelper类的findSnapView和calculateDistanceToFinalSnap方法为例,来说明如何获取view和计算滑动距离的。分两种情况考虑,水平滑动还是竖直滑动,不同滑动方向使用不同的OrientationHelper去处理,这个类的功能我们后面会谈

findSnapView

    @Nullable
    @Override
    public View findSnapView(RecyclerView.LayoutManager layoutManager) {
        //判断RecyclerView的滑动方向,这个可以由layoutManager获取
        if (layoutManager.canScrollVertically()) {
            //OrientationHelper是对RecycleView中子View管理的工具类
            return findCenterView(layoutManager, getVerticalHelper(layoutManager));
        } else if (layoutManager.canScrollHorizontally()) {
            return findCenterView(layoutManager, getHorizontalHelper(layoutManager));
        }
        return null;
    }

    /**
     * Return the child view that is currently closest to the center of this parent.
     * 如注释所说,这个方法返回的是一个距离当前parent也就是RecyclerView中心位置最近的一个item
     * @param layoutManager The {@link RecyclerView.LayoutManager} associated with the attached
     *                      {@link RecyclerView}.
     * @param helper The relevant {@link OrientationHelper} for the attached {@link RecyclerView}.
     *
     * @return the child view that is currently closest to the center of this parent.
     */
    @Nullable
    private View findCenterView(RecyclerView.LayoutManager layoutManager,
            OrientationHelper helper) {
        int childCount = layoutManager.getChildCount();
        if (childCount == 0) {
            return null;
        }

        View closestChild = null;
        final int center;
        //clipToPadding是RecyclerView的一个属性,表示在含有padding值的时候
        //会不会裁剪padding位置的view,如果为true,表示裁剪,那么在padding
        //位置滚动的时候是看不到view的
        if (layoutManager.getClipToPadding()) {
            //getStartAfterPadding  获取RecycleView左侧内边距(paddingLeft)
            //getTotalSpace  Recycleview水平内容区大小(宽度,除去左右内边距)
            //这些方法都会在OrientationHelper中具体说明,如果是Horizontal,
            //getStartAfterPadding  得到的是paddingLeft,如果是vertical,那么得到
            //的是paddingTop,自己想象一下
            //含有padding的时候,RecyclerView的中心位置应该是起始位置的padding
            //值加上内容区的宽度的一半,得到的刚好是RecyclerView显示内容的中心
            //位置的值
            center = helper.getStartAfterPadding() + helper.getTotalSpace() / 2;
        } else {
            //没有padding,则中心位置的值直接是宽度的一半
            center = helper.getEnd() / 2;
        }
        int absClosest = Integer.MAX_VALUE;

        //循环的计算所有childView,得到离上边计算到的中心点值最近的一个
        for (int i = 0; i < childCount; i++) {
            final View child = layoutManager.getChildAt(i);
            //getDecoratedStart返回view左边界点(包含左内边距和左外边距)在父View中的位置(以父View的(0,0)点位坐标系)
            //通俗地讲:子View左边界点到父View的(0,0)点的水平间距
            ///getDecoratedMeasurement返回view在水平方向上所占位置的大小(包括view的左右外边距)
            int childCenter = helper.getDecoratedStart(child)
                    + (helper.getDecoratedMeasurement(child) / 2);
            int absDistance = Math.abs(childCenter - center);

            /** if child center is closer than previous closest, set it as closest  **/
            if (absDistance < absClosest) {
                absClosest = absDistance;
                closestChild = child;
            }
        }
        return closestChild;
    }

clipToPadding官方解释是
the ViewGroup will clip its children and resize (but not clip) any EdgeEffect to its padding, if padding is not zero.
意思是padding非空的时候,viewgroup会根据padding值来裁剪子view。默认情况下,clipToPadding为true,表示会裁剪子view并且resize边界效果。实际上是clipToPadding影响的是绘制的时候是否绘制padding里的子view内容。可以这么理解,clipToPadding对measure和layout无影响,只会影响draw阶段。无论clipToPadding是true还是false,滚的时候,都会滚到padding里去,但是clipToPadding为true,就会clip,这样padding里的部分就看不到了。回头看看刚才的问题,滚动前,布局是考虑padding的,所以padding里没有child元素,然后滚动的时候会把child滚动到padding里去,而由于clipToPadding=false,不裁剪,所以我们能看到padding里的child。如果设置clipToPadding=true,那padding里的child就会被裁剪掉,我们就看不到了

       final boolean clipToPadding = (flags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK;
           if (clipToPadding) {
                clipSaveCount = canvas.save();
                canvas.clipRect(mScrollX + mPaddingLeft, mScrollY + mPaddingTop,
                       mScrollX + mRight - mLeft - mPaddingRight,
                       mScrollY + mBottom - mTop - mPaddingBottom);
        }

经过上边的计算,就能得到距离当前RecyclerView中心位置最近的一个itemView,找到view之后,如何计算滑动距离?

calculateDistanceToFinalSnap
这个方法相对简单,仍然是根据RecyclerView不同的orientation获取不同方向滑动的距离。也许你会觉得下边的计算方式在上边不是做了一次了吗,何必重复操作,其实在上边计算中心view的时候就已经得到这个距离了。但是为了将获取距离的方法暴露给调用者,所以多做了这个方法,而且,下边这个计算方式也只是PagerSnapHelper使用的方式,你还可以使用别的计算方法,所以这里并不算重复代码。
PagerSnapHelper

    @Nullable
    @Override
    public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager,
            @NonNull View targetView) {
        int[] out = new int[2];
        //判断方向,获取方向上移动的值,保存在数组中返回
        if (layoutManager.canScrollHorizontally()) {
            out[0] = distanceToCenter(layoutManager, targetView,
                    getHorizontalHelper(layoutManager));
        } else {
            out[0] = 0;
        }

        if (layoutManager.canScrollVertically()) {
            out[1] = distanceToCenter(layoutManager, targetView,
                    getVerticalHelper(layoutManager));
        } else {
            out[1] = 0;
        }
        return out;
    }

    private int distanceToCenter(@NonNull RecyclerView.LayoutManager layoutManager,
            @NonNull View targetView, OrientationHelper helper) {
        //getDecoratedStart 返回view左边界点(包含左内边距和左外边距)在父View中的位置(以父View的(0,0)点位坐标系)
            //通俗地讲:子View左边界点到父View的(0,0)点的水平间距
        final int childCenter = helper.getDecoratedStart(targetView)
                + (helper.getDecoratedMeasurement(targetView) / 2);
        final int containerCenter;
        if (layoutManager.getClipToPadding()) {
            //获取RecycleView左侧内边距(paddingLeft)
            //再次计算RecyclerView中心位置
            containerCenter = helper.getStartAfterPadding() + helper.getTotalSpace() / 2;
        } else {
            containerCenter = helper.getEnd() / 2;
        }
        //用itemView的中心位置减去RecyclerView的中心位置,得到的就是
        //将要移动的距离
        return childCenter - containerCenter;
    }

PagerSnapHelper的移动规则是每次滑动将距离中心位置最近的item移动到中心位置,如果你需要指定其他效果,就需要你自己实现这个方法,比如移动到左边距,移动到右边距等等。
然后就是调用mRecyclerView.smoothScrollBy(snapDistance[0], snapDistance[1])移动RecyclerView了,这是所有attachToRecyclerView后做的操作,相当于初始化一下显示位置。

接下来要说的是滑动时的处理

我们刚才也看到了,在attachToRecyclerView方法调用时,给RecyclerView设置了两个监听方法,分别是对滑动事件和fling事件的监听,我们看看回调中执行了什么

    /**
     * Called when an instance of a {@link RecyclerView} is attached.
     */
    private void setupCallbacks() throws IllegalStateException {
        if (mRecyclerView.getOnFlingListener() != null) {
            throw new IllegalStateException("An instance of OnFlingListener already set.");
        }
        mRecyclerView.addOnScrollListener(mScrollListener);
        mRecyclerView.setOnFlingListener(this);
    }

onScroll
可以看到,在RecyclerView滑动然后停下的状态会调用snapToTargetExistingView方法,正是上边讲到的逻辑。滑动停止之后,会执行一次摆放view的操作,按照我们设定好的方式移动RecyclerView到指定的位置

    // Handles the snap on scroll case.
    private final RecyclerView.OnScrollListener mScrollListener =
            new RecyclerView.OnScrollListener() {
                boolean mScrolled = false;

                @Override
                public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                    super.onScrollStateChanged(recyclerView, newState);
                    if (newState == RecyclerView.SCROLL_STATE_IDLE && mScrolled) {
                        mScrolled = false;
                        snapToTargetExistingView();
                    }
                }

                @Override
                public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                    if (dx != 0 || dy != 0) {
                        mScrolled = true;
                    }
                }
            };

然后看fling事件

    @Override
    public boolean onFling(int velocityX, int velocityY) {
        LayoutManager layoutManager = mRecyclerView.getLayoutManager();
        if (layoutManager == null) {
            return false;
        }
        RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
        if (adapter == null) {
            return false;
        }
        //获取出发RecyclerView fling的最小速度,这是一个定义好的常量值
        int minFlingVelocity = mRecyclerView.getMinFlingVelocity();
        //当滑动速度满足条件时,执行snapFromFling方法
        return (Math.abs(velocityY) > minFlingVelocity || Math.abs(velocityX) > minFlingVelocity)
                && snapFromFling(layoutManager, velocityX, velocityY);
    }

layoutManager必须满足是ScrollVectorProvider的子类,LinearLayoutManager GridLayoutManager和StaggeredGridLayoutManager都实现了这个接口,所以,都是满足的,那为何还要做这个判断,你自己想

    /**
     * Helper method to facilitate for snapping triggered by a fling.
     *
     * @param layoutManager The {@link LayoutManager} associated with the attached
     *                      {@link RecyclerView}.
     * @param velocityX     Fling velocity on the horizontal axis.
     * @param velocityY     Fling velocity on the vertical axis.
     *
     * @return true if it is handled, false otherwise.
     */
    private boolean snapFromFling(@NonNull LayoutManager layoutManager, int velocityX,
            int velocityY) {
        if (!(layoutManager instanceof ScrollVectorProvider)) {
            return false;
        }
        //创建Scroller用于执行滑动事件
        RecyclerView.SmoothScroller smoothScroller = createSnapScroller(layoutManager);
        if (smoothScroller == null) {
            return false;
        }
        //这是第三个抽象方法,下面看在PagerSnapHelper中是如何实现的
        int targetPosition = findTargetSnapPosition(layoutManager, velocityX, velocityY);
        if (targetPosition == RecyclerView.NO_POSITION) {
            return false;
        }
        //找到position后滚动到这个位置        
        smoothScroller.setTargetPosition(targetPosition);
        layoutManager.startSmoothScroll(smoothScroller);
        return true;
    }

LinearSmoothScroller 这个类,在下一篇博客再看吧,调用mRecyclerView.smoothScrollToPosition 时候,RecyclerView实际调用的是LayoutManager中的代码,而layoutManager中也是使用LinearSmoothScoller滑动的。现在只需要知道他是控制RecyclerView滑动速度的即可。

    /**
     * Creates a scroller to be used in the snapping implementation.
     *
     * @param layoutManager     The {@link RecyclerView.LayoutManager} associated with the attached
     *                          {@link RecyclerView}.
     *
     * @return a {@link LinearSmoothScroller} which will handle the scrolling.
     */
    @Nullable
    protected LinearSmoothScroller createSnapScroller(LayoutManager layoutManager) {
        if (!(layoutManager instanceof ScrollVectorProvider)) {
            return null;
        }
        return new LinearSmoothScroller(mRecyclerView.getContext()) {
            @Override
            protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
                int[] snapDistances = calculateDistanceToFinalSnap(mRecyclerView.getLayoutManager(),
                        targetView);
                final int dx = snapDistances[0];
                final int dy = snapDistances[1];
                final int time = calculateTimeForDeceleration(Math.max(Math.abs(dx), Math.abs(dy)));
                if (time > 0) {
                    action.update(dx, dy, time, mDecelerateInterpolator);
                }
            }

            @Override
            protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
                return MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
            }
        };
    }

    /**
     * <p>Calculates the time for deceleration so that transition from LinearInterpolator to
     * DecelerateInterpolator looks smooth.</p>
     *
     * @param dx Distance to scroll
     * @return Time for DecelerateInterpolator to smoothly traverse the distance when transitioning
     * from LinearInterpolation
     */
    protected int calculateTimeForDeceleration(int dx) {
        // we want to cover same area with the linear interpolator for the first 10% of the
        // interpolation. After that, deceleration will take control.
        // area under curve (1-(1-x)^2) can be calculated as (1 - x/3) * x * x
        // which gives 0.100028 when x = .3356
        // this is why we divide linear scrolling time with .3356
        return  (int) Math.ceil(calculateTimeForScrolling(dx) / .3356);
    }

findTargetSnapPosition
以PagerSnapHelper实现为例

    @Override
    public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX,
            int velocityY) {
        final int itemCount = layoutManager.getItemCount();
        if (itemCount == 0) {
            return RecyclerView.NO_POSITION;
        }

        View mStartMostChildView = null;
        if (layoutManager.canScrollVertically()) {
            //findStartView获取的就是距离RecyclerView中心点最近的view,同上
            mStartMostChildView = findStartView(layoutManager, getVerticalHelper(layoutManager));
        } else if (layoutManager.canScrollHorizontally()) {
            mStartMostChildView = findStartView(layoutManager, getHorizontalHelper(layoutManager));
        }

        if (mStartMostChildView == null) {
            return RecyclerView.NO_POSITION;
        }

        //获取startView的position                        
        final int centerPosition = layoutManager.getPosition(mStartMostChildView);
        if (centerPosition == RecyclerView.NO_POSITION) {
            return RecyclerView.NO_POSITION;
        } 
        //只要速度大于0就是满足的        
        final boolean forwardDirection;
        if (layoutManager.canScrollHorizontally()) {
            forwardDirection = velocityX > 0;
        } else {
            forwardDirection = velocityY > 0;
        }
        boolean reverseLayout = false;
        if ((layoutManager instanceof RecyclerView.SmoothScroller.ScrollVectorProvider)) {
            RecyclerView.SmoothScroller.ScrollVectorProvider vectorProvider =
                    (RecyclerView.SmoothScroller.ScrollVectorProvider) layoutManager;
            //这里会调用layoutManager中的computeScrollVectorForPosition,用于判断是否reverseLayout
            PointF vectorForEnd = vectorProvider.computeScrollVectorForPosition(itemCount - 1);
            if (vectorForEnd != null) {
                reverseLayout = vectorForEnd.x < 0 || vectorForEnd.y < 0;
            }
        }
        return reverseLayout
                ? (forwardDirection ? centerPosition - 1 : centerPosition)
                : (forwardDirection ? centerPosition + 1 : centerPosition);
    }
    
    //LinearLayoutManager中实现的    
    @Override
    public PointF computeScrollVectorForPosition(int targetPosition) {
        if (getChildCount() == 0) {
            return null;
        }
        final int firstChildPos = getPosition(getChildAt(0));
        final int direction = targetPosition < firstChildPos != mShouldReverseLayout ? -1 : 1;
        if (mOrientation == HORIZONTAL) {
            return new PointF(direction, 0);
        } else {
            return new PointF(0, direction);
        }
    }
总结一下

总的来说,SnapHelper是通过计算当前距离RecyclerView中心位置最近的view与中心位置的距离来滑动RecyclerView,通过对scroll事件和fling事件的监听,实现需要的效果。这个过程中涉及到两个比较重要的类,OrientationHelper和LinearSmoothScrolloer,一个用于测量RecyclerView和其item,一个用于滑动RecyclerView。不出意外我会在后边的文章中去写这两个类的分析,除非忘了。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,242评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,769评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,484评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,133评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,007评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,080评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,496评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,190评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,464评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,549评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,330评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,205评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,567评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,889评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,160评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,475评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,650评论 2 335

推荐阅读更多精彩内容