@@ -897,10 +897,10 @@ public int computeVerticalScrollExtent(RecyclerView.State state) {
897897 return 0 ;
898898 }
899899// if (!smoothScrollbarEnabled) {
900- // return Math.abs(lm. getPosition(startChild) - lm. getPosition(endChild)) + 1;
900+ return Math .abs (getPosition (startChild ) - getPosition (endChild )) + 1 ;
901901// }
902- final int extend = getDecoratedRight (endChild ) - getDecoratedLeft (startChild );
903- return Math .min (getTotalSpace (), extend );
902+ // final int extend = getDecoratedRight(endChild) - getDecoratedLeft(startChild);
903+ // return Math.min(getTotalSpace(), extend);
904904
905905 }
906906
@@ -924,11 +924,13 @@ public int computeVerticalScrollOffset(RecyclerView.State state) {
924924 final int maxPosition = Math .max (getPosition (startChild ), getPosition (endChild ));
925925 final int itemsBefore = Math .max (0 , minPosition );
926926
927- final int laidOutArea = Math .abs (getDecoratedBottom (endChild ) - getDecoratedTop (startChild ));
928- final int itemRange = Math .abs (getPosition (startChild ) - getPosition (endChild )) + 1 ;
929- final float avgSizePerRow = (float ) laidOutArea / itemRange ;
927+ return itemsBefore ;
930928
931- return Math .round (itemsBefore * avgSizePerRow + (getPaddingTop () - getDecoratedTop (startChild )));
929+ // final int laidOutArea = Math.abs(getDecoratedBottom(endChild) - getDecoratedTop(startChild));
930+ // final int itemRange = Math.abs(getPosition(startChild) - getPosition(endChild)) + 1;
931+ // final float avgSizePerRow = (float) laidOutArea / itemRange;
932+ //
933+ // return Math.round(itemsBefore * avgSizePerRow + (getPaddingTop() - getDecoratedTop(startChild)));
932934 }
933935
934936 @ Override
@@ -937,16 +939,19 @@ public int computeVerticalScrollRange(RecyclerView.State state) {
937939 return 0 ;
938940 }
939941
940- View firstChild = getChildAt (0 );
941- View lastChild = getChildAt (getChildCount () - 1 );
942+ // View firstChild = getChildAt(0);
943+ // View lastChild = getChildAt(getChildCount() - 1);
942944
943- if (state .getItemCount () == 0 || firstChild == null || lastChild == null ) {
944- return 0 ;
945- }
946- final int laidOutArea = getDecoratedBottom (lastChild ) - getDecoratedTop (firstChild );
947- final int laidOutRange = Math .abs (getPosition (firstChild ) - getPosition (lastChild )) + 1 ;
948- // estimate a size for full list.
949- return (int ) ((float ) laidOutArea / laidOutRange * state .getItemCount ());
945+ // if (state.getItemCount() == 0 || firstChild == null || lastChild == null) {
946+ // return 0;
947+ // }
948+
949+ return state .getItemCount ();
950+
951+ // final int laidOutArea = getDecoratedBottom(lastChild) - getDecoratedTop(firstChild);
952+ // final int laidOutRange = Math.abs(getPosition(firstChild) - getPosition(lastChild)) + 1;
953+ // estimate a size for full list.
954+ // return (int) ((float) laidOutArea / laidOutRange * state.getItemCount());
950955
951956// return super.computeVerticalScrollRange(state);
952957 }
0 commit comments