Skip to content

Commit d2d5fce

Browse files
committed
[fix]:解决主动刷新,RefreshView不可见的bug
1 parent 29db56c commit d2d5fce

File tree

6 files changed

+16
-5
lines changed

6 files changed

+16
-5
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ android {
2121

2222
dependencies {
2323
implementation fileTree(dir: 'libs', include: ['*.jar'])
24-
implementation 'com.android.support:support-v4:28.0.0-rc01'
24+
implementation 'com.android.support:support-v4:28.0.0'
2525
testImplementation 'junit:junit:4.12'
2626
androidTestImplementation 'com.android.support.test:runner:1.0.2'
2727
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

library/src/main/java/com/github/kilnn/refreshloadlayout/RefreshLoadLayout.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,10 @@ private void refreshAnimate(@AnimationType int type) {
724724
mRefreshAnimation.setInterpolator(getAnimationInterpolator(mRefreshAnimationType));
725725
mRefreshAnimation.setAnimationListener(mRefreshAnimationListener);
726726
clearAnimation();
727+
//如果是调用方法刷新,而不是由下拉手势刷新,那么mRefreshView之前都是GONE状态,所以setVisibility(View.VISIBLE);
728+
if (type != TYPE_NONE && mRefreshView.getVisibility() != View.VISIBLE) {
729+
mRefreshView.setVisibility(View.VISIBLE);
730+
}
727731
startAnimation(mRefreshAnimation);
728732
}
729733

sample/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ android {
2121
dependencies {
2222
implementation fileTree(dir: 'libs', include: ['*.jar'])
2323
implementation project(path: ':library')
24-
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
25-
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
26-
implementation 'com.android.support:recyclerview-v7:28.0.0-rc01'
24+
implementation 'com.android.support:appcompat-v7:28.0.0'
25+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
26+
implementation 'com.android.support:recyclerview-v7:28.0.0'
2727
testImplementation 'junit:junit:4.12'
2828
androidTestImplementation 'com.android.support.test:runner:1.0.2'
2929
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

sample/src/main/java/com/github/kilnn/refreshloadlayout/sample/MainActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ public void run() {
3636

3737
}
3838
});
39+
40+
new Handler().postDelayed(new Runnable() {
41+
@Override
42+
public void run() {
43+
mRefreshLoadLayout.setRefreshing(true);
44+
}
45+
}, 3000);
3946
}
4047

4148
}

0 commit comments

Comments
 (0)