GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 1.修复 API 27 聊天页面没有惯性加载问题 · PMonkeyCoding/SmartRefreshLayout@9a48a8a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • README_EN.md
  • app
    • build.gradle
  • refresh-layout/src/main/java/com/scwang/smartrefresh/layout
    • SmartRefreshLayout.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-30'//没有使
123123
compile 'com.android.support:appcompat-v7:25.3.1'//版本 23以上(必须)
124124
125125
//1.1.0 androidx 版本
126-
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-13'
127-
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-13'
126+
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-14'
127+
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-14'
128128
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
129129
130130
Collapse file

‎README_EN.md‎

Copy file name to clipboardExpand all lines: README_EN.md
+4-4Lines changed: 4 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ Please rest assured that I have divided it into three packages, when used to ref
9898
## Usage
9999
#### 1.Add a gradle dependency.
100100
```
101-
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-28'
102-
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-28'//If you use the special Header
101+
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-30'
102+
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-30'//If you use the special Header
103103
implementation 'com.android.support:appcompat-v7:25.3.1'
104104
105105
//androidx version
106-
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-11'
107-
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-11'
106+
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-14'
107+
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-14'
108108
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
109109
110110
```
Collapse file

‎app/build.gradle‎

Copy file name to clipboardExpand all lines: app/build.gradle
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ dependencies {
6161
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
6262
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
6363

64-
// implementation project(':refresh-footer')
65-
// implementation project(':refresh-header')
66-
// implementation project(':refresh-layout')
67-
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-30'
68-
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-30'
64+
implementation project(':refresh-footer')
65+
implementation project(':refresh-header')
66+
implementation project(':refresh-layout')
67+
// implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-30'
68+
// implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-30'
6969

7070
// //noinspection GradleDependency,GradleCompatible
7171
// implementation ('com.android.support:support-v4:22.1.0') {
Collapse file

‎refresh-layout/src/main/java/com/scwang/smartrefresh/layout/SmartRefreshLayout.java‎

Copy file name to clipboardExpand all lines: refresh-layout/src/main/java/com/scwang/smartrefresh/layout/SmartRefreshLayout.java
+18-5Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,18 @@ public boolean dispatchTouchEvent(MotionEvent e) {
11091109
* @return true 可以拦截 嵌套滚动的 Fling
11101110
*/
11111111
protected boolean startFlingIfNeed(float flingVelocity) {
1112-
final float velocity = flingVelocity == 0 ? mCurrentVelocity : flingVelocity;
1112+
float velocity = flingVelocity == 0 ? mCurrentVelocity : flingVelocity;
1113+
if (Build.VERSION.SDK_INT > 27 && mRefreshContent != null) {
1114+
/*
1115+
* 修复 API 27 以上【上下颠倒模式】没有回弹效果的bug
1116+
*/
1117+
float scaleY = getScaleY();
1118+
final View thisView = this;
1119+
final View contentView = mRefreshContent.getView();
1120+
if (thisView.getScaleY() == -1 && contentView.getScaleY() == -1) {
1121+
velocity = -velocity;
1122+
}
1123+
}
11131124
if (Math.abs(velocity) > mMinimumVelocity) {
11141125
if (velocity * mSpinner < 0) {
11151126
/*
@@ -2841,14 +2852,15 @@ public RefreshLayout finishRefresh(int delayed, final boolean success, final Boo
28412852
// resetStatus();
28422853
mKernel.setState(RefreshState.None);
28432854
return this;
2844-
} else if (mState != RefreshState.Refreshing) {
2855+
} else if (mState != RefreshState.Refreshing || mRefreshHeader == null || mRefreshContent == null) {
28452856
return this;
28462857
}
2858+
//提前设置 状态为 RefreshFinish 防止 postDelayed 导致 finishRefresh 过后,外部判断 state 还是 Refreshing
28472859
notifyStateChanged(RefreshState.RefreshFinish);
28482860
mHandler.postDelayed(new Runnable() {
28492861
@Override
28502862
public void run() {
2851-
if (mState == RefreshState.Refreshing && mRefreshHeader != null && mRefreshContent != null) {
2863+
if (mState == RefreshState.RefreshFinish && mRefreshHeader != null && mRefreshContent != null) {
28522864
if (noMoreData != null) {
28532865
setNoMoreData(noMoreData == Boolean.TRUE);
28542866
}
@@ -2966,14 +2978,15 @@ public RefreshLayout finishLoadMore(int delayed, final boolean success, final bo
29662978
// resetStatus();
29672979
mKernel.setState(RefreshState.None);
29682980
return this;
2969-
} else if (mState != RefreshState.Loading) {
2981+
} else if (mState != RefreshState.Loading || mRefreshFooter == null || mRefreshContent == null) {
29702982
return this;
29712983
}
2984+
//提前设置 状态为 LoadFinish 防止 postDelayed 导致 finishLoadMore 过后,外部判断 state 还是 Loading
29722985
notifyStateChanged(RefreshState.LoadFinish);
29732986
mHandler.postDelayed(new Runnable() {
29742987
@Override
29752988
public void run() {
2976-
if (mState == RefreshState.Loading && mRefreshFooter != null && mRefreshContent != null) {
2989+
if (mState == RefreshState.LoadFinish && mRefreshFooter != null && mRefreshContent != null) {
29772990
// notifyStateChanged(RefreshState.LoadFinish);
29782991
final int startDelay = mRefreshFooter.onFinish(SmartRefreshLayout.this, success);
29792992
if (mOnMultiPurposeListener != null && mRefreshFooter instanceof RefreshFooter) {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.