@@ -588,7 +588,6 @@ public void onItemsAdded(RecyclerView recyclerView, int positionStart, int itemC
588588 updateDirtyPosition (positionStart );
589589 }
590590
591-
592591 @ Override
593592 public void onItemsUpdated (RecyclerView recyclerView , int positionStart , int itemCount ,
594593 Object payload ) {
@@ -819,7 +818,6 @@ private void updateFlexLines(int childCount) {
819818 int widthMeasureSpec = View .MeasureSpec .makeMeasureSpec (getWidth (), getWidthMode ());
820819 //noinspection ResourceType
821820 int heightMeasureSpec = View .MeasureSpec .makeMeasureSpec (getHeight (), getHeightMode ());
822- FlexboxHelper .FlexLinesResult flexLinesResult ;
823821 int width = getWidth ();
824822 int height = getHeight ();
825823 boolean isMainSizeChanged ;
@@ -1482,7 +1480,6 @@ private int layoutFlexLineMainAxisVertical(FlexLine flexLine, LayoutState layout
14821480 int paddingBottom = getPaddingBottom ();
14831481 int parentHeight = getHeight ();
14841482
1485- // Either childLeft or childRight is used depending on the layoutState.mLayoutDirection
14861483 int childLeft = layoutState .mOffset ;
14871484 if (layoutState .mLayoutDirection == LayoutState .LAYOUT_START ) {
14881485 childLeft = childLeft - flexLine .mCrossSize ;
@@ -1859,13 +1856,27 @@ private int handleScrollingMainAxis(int delta) {
18591856 boolean isMainAxisHorizontal = isMainAxisDirectionHorizontal ();
18601857 int parentLength = isMainAxisHorizontal ? mParent .getWidth () : mParent .getHeight ();
18611858 int mainAxisLength = isMainAxisHorizontal ? getWidth () : getHeight ();
1862- if (delta > 0 ) {
1863- delta = Math .min (mainAxisLength
1864- - mAnchorInfo .mPerpendicularCoordinate
1865- - parentLength , delta );
1859+
1860+ boolean layoutRtl = getLayoutDirection () == ViewCompat .LAYOUT_DIRECTION_RTL ;
1861+ if (layoutRtl ) {
1862+ int absDelta = Math .abs (delta );
1863+ if (delta < 0 ) {
1864+ delta = Math .min (mainAxisLength
1865+ + mAnchorInfo .mPerpendicularCoordinate - parentLength , absDelta );
1866+ delta = -delta ;
1867+ } else {
1868+ delta = mAnchorInfo .mPerpendicularCoordinate + delta > 0
1869+ ? -mAnchorInfo .mPerpendicularCoordinate
1870+ : delta ;
1871+ }
18661872 } else {
1867- delta = mAnchorInfo .mPerpendicularCoordinate + delta >= 0 ? delta :
1868- -mAnchorInfo .mPerpendicularCoordinate ;
1873+ if (delta > 0 ) {
1874+ delta = Math .min (mainAxisLength
1875+ - mAnchorInfo .mPerpendicularCoordinate - parentLength , delta );
1876+ } else {
1877+ delta = mAnchorInfo .mPerpendicularCoordinate + delta >= 0 ? delta :
1878+ -mAnchorInfo .mPerpendicularCoordinate ;
1879+ }
18691880 }
18701881 return delta ;
18711882 }
@@ -1880,7 +1891,6 @@ private int handleScrollingMainAxis(int delta) {
18801891 */
18811892 private void updateLayoutState (int layoutDirection , int absDelta ) {
18821893 assert mFlexboxHelper .mIndexToFlexLine != null ;
1883- // TODO: Consider updating LayoutState#mExtra to support better smooth scrolling
18841894 mLayoutState .mLayoutDirection = layoutDirection ;
18851895 boolean mainAxisHorizontal = isMainAxisDirectionHorizontal ();
18861896
0 commit comments