@@ -1756,7 +1756,7 @@ protected void moveSpinnerInfinitely(float spinner) {
17561756 final double M = maxDragHeight - mHeaderHeight ;
17571757 final double H = Math .max (mScreenHeightPixels * 4 / 3 , thisView .getHeight ()) - mHeaderHeight ;
17581758 final double x = Math .max (0 , (spinner - mHeaderHeight ) * mDragRate );
1759- final double y = M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H )));// 公式 y = M(1-100^(-x/H))
1759+ final double y = Math . min ( M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H ))), x );// 公式 y = M(1-100^(-x/H))
17601760 mKernel .moveSpinner ((int ) y + mHeaderHeight , true );
17611761 }
17621762 } else if (spinner < 0 && (mState == RefreshState .Loading
@@ -1769,20 +1769,20 @@ protected void moveSpinnerInfinitely(float spinner) {
17691769 final double M = maxDragHeight - mFooterHeight ;
17701770 final double H = Math .max (mScreenHeightPixels * 4 / 3 , thisView .getHeight ()) - mFooterHeight ;
17711771 final double x = -Math .min (0 , (spinner + mFooterHeight ) * mDragRate );
1772- final double y = -M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H )));// 公式 y = M(1-100^(-x/H))
1772+ final double y = -Math . min ( M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H ))), x );// 公式 y = M(1-100^(-x/H))
17731773 mKernel .moveSpinner ((int ) y - mFooterHeight , true );
17741774 }
17751775 } else if (spinner >= 0 ) {
17761776 final double M = mHeaderMaxDragRate < 10 ? mHeaderHeight * mHeaderMaxDragRate : mHeaderMaxDragRate ;
17771777 final double H = Math .max (mScreenHeightPixels / 2 , thisView .getHeight ());
17781778 final double x = Math .max (0 , spinner * mDragRate );
1779- final double y = M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H )));// 公式 y = M(1-100^(-x/H))
1779+ final double y = Math . min ( M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H ))), x );// 公式 y = M(1-100^(-x/H))
17801780 mKernel .moveSpinner ((int ) y , true );
17811781 } else {
17821782 final double M = mFooterMaxDragRate < 10 ? mFooterHeight * mFooterMaxDragRate : mFooterMaxDragRate ;
17831783 final double H = Math .max (mScreenHeightPixels / 2 , thisView .getHeight ());
17841784 final double x = -Math .min (0 , spinner * mDragRate );
1785- final double y = -M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H )));// 公式 y = M(1-100^(-x/H))
1785+ final double y = -Math . min ( M * (1 - Math .pow (100 , -x / (H == 0 ? 1 : H ))), x );// 公式 y = M(1-100^(-x/H))
17861786 mKernel .moveSpinner ((int ) y , true );
17871787 }
17881788 if (mEnableAutoLoadMore && !mFooterNoMoreData && isEnableRefreshOrLoadMore (mEnableLoadMore ) && spinner < 0
@@ -1811,55 +1811,6 @@ protected void moveSpinnerInfinitely(float spinner) {
18111811 }
18121812 }
18131813
1814- /**
1815- * 感谢 jamgudev <826630153@qq.com> 2022-03-22 贡献的代码 (贡献原始函数:reverseCompute)
1816- * 给出阻尼计算的距离,计算原始滑动距离
1817- * 与 moveSpinnerInfinitely 函数为反向计算
1818- * @param spinnerConvergence 阻尼计算过后的距离
1819- * @return 原始滑动距离
1820- */
1821- protected int reverseInfinitely (float spinnerConvergence ) {
1822- final View thisView = this ;
1823- double originSpinner ;
1824- if (mState == RefreshState .TwoLevel && spinnerConvergence > 0 ) {
1825- originSpinner = spinnerConvergence ;
1826- } else if (mState == RefreshState .Refreshing && spinnerConvergence >= 0 ) {
1827- if (spinnerConvergence < mHeaderHeight ) {
1828- originSpinner = spinnerConvergence ;
1829- } else {
1830- final float maxDragHeight = mHeaderMaxDragRate < 10 ? mHeaderHeight * mHeaderMaxDragRate : mHeaderMaxDragRate ;
1831- final double M = maxDragHeight - mHeaderHeight ;
1832- final double H = Math .max (mScreenHeightPixels * 4 / 3 , thisView .getHeight ()) - mHeaderHeight ;
1833- final double y = spinnerConvergence * 1 ;
1834- originSpinner = ((-H * (Math .log (1 - y / M ) / Math .log (100f ))) + mHeaderHeight ) / mDragRate ;
1835- }
1836- } else if (spinnerConvergence < 0 && (mState == RefreshState .Loading
1837- || (mEnableFooterFollowWhenNoMoreData && mFooterNoMoreData && mFooterNoMoreDataEffective && isEnableRefreshOrLoadMore (mEnableLoadMore ))
1838- || (mEnableAutoLoadMore && !mFooterNoMoreData && isEnableRefreshOrLoadMore (mEnableLoadMore )))) {
1839- if (spinnerConvergence > -mFooterHeight ) {
1840- originSpinner = spinnerConvergence ;
1841- } else {
1842- final float maxDragHeight = mFooterMaxDragRate < 10 ? mFooterHeight * mFooterMaxDragRate : mFooterMaxDragRate ;
1843- final double M = maxDragHeight - mFooterHeight ;
1844- final double H = Math .max (mScreenHeightPixels * 4 / 3 , thisView .getHeight ()) - mFooterHeight ;
1845- final double y = -spinnerConvergence ;
1846- originSpinner = -((-H * (Math .log (1 - y / M ) / Math .log (100f ))) - mFooterHeight ) / mDragRate ;
1847- }
1848- } else if (spinnerConvergence >= 0 ) {
1849- final double M = mHeaderMaxDragRate < 10 ? mHeaderHeight * mHeaderMaxDragRate : mHeaderMaxDragRate ;
1850- final double H = Math .max (mScreenHeightPixels / 2 , thisView .getHeight ());
1851- final double y = spinnerConvergence * 1 ;
1852- originSpinner = (-H * (Math .log (1 - y / M ) / Math .log (100f ))) / mDragRate ;
1853- } else {
1854- final double M = mFooterMaxDragRate < 10 ? mFooterHeight * mFooterMaxDragRate : mFooterMaxDragRate ;
1855- final double H = Math .max (mScreenHeightPixels / 2 , thisView .getHeight ());
1856- final double y = -spinnerConvergence * 1 ;
1857- originSpinner = -((-H * (Math .log (1 - y / M ) / Math .log (100f ))) - mFooterHeight ) / mDragRate ;
1858- }
1859-
1860- return Math .round ((float )originSpinner );
1861- }
1862-
18631814 //</editor-fold>
18641815
18651816 //<editor-fold desc="布局参数 LayoutParams">
@@ -1936,7 +1887,7 @@ public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, in
19361887 // Dispatch up to the nested parent
19371888 mNestedChild .startNestedScroll (axes & ViewCompat .SCROLL_AXIS_VERTICAL );
19381889
1939- mTotalUnconsumed = reverseInfinitely ( mSpinner ) ;
1890+ mTotalUnconsumed = mSpinner ;
19401891 mNestedInProgress = true ;
19411892
19421893 interceptAnimatorByAction (MotionEvent .ACTION_DOWN );
0 commit comments