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.1.2 版本 · peive/SmartRefreshLayout@c54bc67

File tree

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

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License](https://img.shields.io/badge/License%20-Apache%202-337ab7.svg)](https://www.apache.org/licenses/LICENSE-2.0)
44
[![Arsenal](https://img.shields.io/badge/Arsenal%20-%20SmartRefresh-4cae4c.svg)](https://android-arsenal.com/details/1/6001)
5-
[![JCenter](https://img.shields.io/badge/%20JCenter%20-1.1.0-5bc0de.svg)](https://bintray.com/scwang90/maven/SmartRefreshLayout/_latestVersion)
5+
[![JCenter](https://img.shields.io/badge/%20JCenter%20-1.1.2-5bc0de.svg)](https://bintray.com/scwang90/maven/SmartRefreshLayout/_latestVersion)
66
[![MinSdk](https://img.shields.io/badge/%20MinSdk%20-%2012%2B%20-f0ad4e.svg)](https://android-arsenal.com/api?level=12)
77
[![Methods](https://img.shields.io/badge/Methods%20%7C%20Size%20-%20784%20%7C%20121%20KB-d9534f.svg)](http://www.methodscount.com/?lib=com.scwang.smartrefresh%3ASmartRefreshLayout%3A1.0.4)
88

@@ -122,8 +122,8 @@ SmartRefreshLayout以打造一个强大,稳定,成熟的下拉刷新框架
122122
[【V2.0.0】](https://github.com/scwang90/SmartRefreshLayout/tree/master#%E7%AE%80%E5%8D%95%E7%94%A8%E4%BE%8B) 版本已经在开发,主要是对各个功能类进行分包,比如不用二级刷新就不依赖,避免代码冗余,欢迎大家来体验
123123

124124
```
125-
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.1' //1.0.5及以前版本的老用户升级需谨慎,API改动过大
126-
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.1' //没有使用特殊Header,可以不加这行
125+
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.2' //1.0.5及以前版本的老用户升级需谨慎,API改动过大
126+
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.2' //没有使用特殊Header,可以不加这行
127127
128128
```
129129
如果使用 AndroidX 在 gradle.properties 中添加
Collapse file

‎README_EN.md‎

Copy file name to clipboardExpand all lines: README_EN.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License](https://img.shields.io/badge/License%20-Apache%202-337ab7.svg)](https://www.apache.org/licenses/LICENSE-2.0)
44
[![Arsenal](https://img.shields.io/badge/Arsenal%20-%20SmartRefresh-4cae4c.svg)](https://android-arsenal.com/details/1/6001)
5-
[![JCenter](https://img.shields.io/badge/%20Jcenter%20-1.1.0-5bc0de.svg)](https://bintray.com/scwang90/maven/SmartRefreshLayout/_latestVersion)
5+
[![JCenter](https://img.shields.io/badge/%20Jcenter%20-1.1.2-5bc0de.svg)](https://bintray.com/scwang90/maven/SmartRefreshLayout/_latestVersion)
66
[![MinSdk](https://img.shields.io/badge/%20MinSdk%20-%2012%2B%20-f0ad4e.svg)](https://android-arsenal.com/api?level=12)
77
[![Methods](https://img.shields.io/badge/Methods%20%7C%20Size%20-%20784%20%7C%20122%20KB-d9534f.svg)](http://www.methodscount.com/?lib=com.scwang.smartrefresh%3ASmartRefreshLayout%3A1.1.0)
88

@@ -104,8 +104,8 @@ main change is to subcontract SmartRefreshLayout to reduce unnecessary dependenc
104104
welcome to experience.
105105

106106
```
107-
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
108-
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0' //If you use the special Header
107+
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.2'
108+
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.2' //If you use the special Header
109109
```
110110
If you use AndroidX, add it to gradle.properties
111111

Collapse file

‎app/build.gradle‎

Copy file name to clipboardExpand all lines: app/build.gradle
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ dependencies {
6565
implementation project(':refresh-footer')
6666
implementation project(':refresh-header')
6767
implementation project(':refresh-layout')
68-
// implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
69-
// implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0'
68+
// implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.1'
69+
// implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.1'
7070

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

‎app/src/main/java/com/scwang/refreshlayout/App.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/scwang/refreshlayout/App.java
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class App extends Application {
2626
layout.setEnableLoadMoreWhenContentNotFull(true);
2727
layout.setEnableScrollContentWhenRefreshed(true);
2828
layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white);
29+
layout.getLayout().setTag("close egg");
2930
});
3031
SmartRefreshLayout.setDefaultRefreshHeaderCreator((context, layout) -> {
3132
//全局设置主题颜色(优先级第二低,可以覆盖 DefaultRefreshInitializer 的配置,与下面的ClassicsHeader绑定)
Collapse file

‎refresh-header/build.gradle‎

Copy file name to clipboardExpand all lines: refresh-header/build.gradle
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ publish {
4545
userOrg = 'scwang90'
4646
groupId = 'com.scwang.smartrefresh'
4747
artifactId = 'SmartRefreshHeader'
48-
publishVersion = '1.1.1'
48+
publishVersion = '1.1.2'
4949
desc = 'Some delicate headers of SmartRefreshLayout'
5050
website = "https://github.com/scwang90/${rootProject.name}"
5151
}
Collapse file

‎refresh-layout/build.gradle‎

Copy file name to clipboardExpand all lines: refresh-layout/build.gradle
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ publish {
4949
userOrg = 'scwang90'
5050
groupId = 'com.scwang.smartrefresh'
5151
artifactId = 'SmartRefreshLayout'
52-
publishVersion = '1.1.1'
52+
publishVersion = '1.1.2'
5353
desc = 'An intelligent refresh layout'
5454
website = "https://github.com/scwang90/${rootProject.name}"
5555
}
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
+47-16Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,8 +1138,8 @@ protected boolean startFlingIfNeed(float flingVelocity) {
11381138
protected boolean interceptAnimatorByAction(int action) {
11391139
if (action == MotionEvent.ACTION_DOWN) {
11401140
if (reboundAnimator != null) {
1141-
if (mState.isFinishing || mState == RefreshState.TwoLevelReleased) {
1142-
return true;
1141+
if (mState.isFinishing || mState == RefreshState.TwoLevelReleased || mState == RefreshState.RefreshReleased || mState == RefreshState.LoadReleased) {
1142+
return true;//完成动画和打开动画不能被打断
11431143
}
11441144
if (mState == RefreshState.PullDownCanceled) {
11451145
mKernel.setState(RefreshState.PullDownToRefresh);
@@ -1515,7 +1515,6 @@ protected ValueAnimator animSpinner(int endSpinner, int startDelay, Interpolator
15151515
reboundAnimator.setDuration(duration);
15161516
reboundAnimator.setInterpolator(interpolator);
15171517
reboundAnimator.addListener(new AnimatorListenerAdapter() {
1518-
private Animator Animator = reboundAnimator;
15191518
@Override
15201519
public void onAnimationEnd(Animator animation) {
15211520
if (animation != null && animation.getDuration() == 0) {
@@ -1642,7 +1641,7 @@ protected void moveSpinnerInfinitely(float spinner) {
16421641
* 如果彩蛋影响了您的APP,可以通过以下三种方法关闭
16431642
*
16441643
* 1.全局关闭(推荐)
1645-
* SmartRefreshLayout.setDefaultRefreshInitializer(new DefaultRefreshInitializer() {
1644+
* SmartRefreshLayout.setDefaultRefreshInitializer(new DefaultRefreshInitializer() {
16461645
* @Override
16471646
* public void initialize(@NonNull Context context, @NonNull RefreshLayout layout) {
16481647
* layout.getLayout().setTag("close egg");
@@ -2433,7 +2432,7 @@ public RefreshLayout setDisableContentWhenLoading(boolean disable) {
24332432
*/
24342433
@Override
24352434
public RefreshLayout setRefreshHeader(@NonNull RefreshHeader header) {
2436-
return setRefreshHeader(header, MATCH_PARENT, WRAP_CONTENT);
2435+
return setRefreshHeader(header, 0, 0);
24372436
}
24382437

24392438
/**
@@ -2455,16 +2454,26 @@ public RefreshLayout setRefreshHeader(@NonNull RefreshHeader header, int width,
24552454
this.mHeaderBackgroundColor = 0;
24562455
this.mHeaderNeedTouchEventWhenRefreshing = false;
24572456
this.mHeaderHeightStatus = mHeaderHeightStatus.unNotify();
2457+
/*
2458+
* 2019-12-24 修复 DefaultRefreshHeaderCreator 返回 null 时出现空指针
2459+
* 不过 DefaultRefreshHeaderCreator 是定义为不允许返回空的
2460+
*/
24582461
if (mRefreshHeader != null) {
24592462
/*
2460-
* 2019-12-24 修复 DefaultRefreshHeaderCreator 返回 null 时出现空指针
2461-
* 不过 DefaultRefreshHeaderCreator 是定义为不允许返回空的
2463+
* 2020-3-16 修复 header 中自带 LayoutParams 丢失问题
24622464
*/
2465+
width = width == 0 ? MATCH_PARENT : width;
2466+
height = height == 0 ? WRAP_CONTENT : height;
2467+
LayoutParams lp = new LayoutParams(width, height);
2468+
Object olp = header.getView().getLayoutParams();
2469+
if (olp instanceof LayoutParams) {
2470+
lp = ((LayoutParams) olp);
2471+
}
24632472
if (mRefreshHeader.getSpinnerStyle().front) {
24642473
final ViewGroup thisGroup = this;
2465-
super.addView(mRefreshHeader.getView(), thisGroup.getChildCount(), new LayoutParams(width, height));
2474+
super.addView(mRefreshHeader.getView(), thisGroup.getChildCount(), lp);
24662475
} else {
2467-
super.addView(mRefreshHeader.getView(), 0, new LayoutParams(width, height));
2476+
super.addView(mRefreshHeader.getView(), 0, lp);
24682477
}
24692478
if (mPrimaryColors != null && mRefreshHeader != null) {
24702479
mRefreshHeader.setPrimaryColors(mPrimaryColors);
@@ -2481,7 +2490,7 @@ public RefreshLayout setRefreshHeader(@NonNull RefreshHeader header, int width,
24812490
*/
24822491
@Override
24832492
public RefreshLayout setRefreshFooter(@NonNull RefreshFooter footer) {
2484-
return setRefreshFooter(footer, MATCH_PARENT, WRAP_CONTENT);
2493+
return setRefreshFooter(footer, 0, 0);
24852494
}
24862495

24872496
/**
@@ -2506,16 +2515,26 @@ public RefreshLayout setRefreshFooter(@NonNull RefreshFooter footer, int width,
25062515
this.mFooterNeedTouchEventWhenLoading = false;
25072516
this.mFooterHeightStatus = mFooterHeightStatus.unNotify();
25082517
this.mEnableLoadMore = !mManualLoadMore || mEnableLoadMore;
2518+
/*
2519+
* 2019-12-24 修复 DefaultRefreshFooterCreator 返回 null 时出现空指针
2520+
* 不过 DefaultRefreshFooterCreator 是定义为不允许返回空的
2521+
*/
25092522
if (mRefreshFooter != null) {
25102523
/*
2511-
* 2019-12-24 修复 DefaultRefreshFooterCreator 返回 null 时出现空指针
2512-
* 不过 DefaultRefreshFooterCreator 是定义为不允许返回空的
2524+
* 2020-3-16 修复 header 中自带 LayoutParams 丢失问题
25132525
*/
2526+
width = width == 0 ? MATCH_PARENT : width;
2527+
height = height == 0 ? WRAP_CONTENT : height;
2528+
LayoutParams lp = new LayoutParams(width, height);
2529+
Object olp = footer.getView().getLayoutParams();
2530+
if (olp instanceof LayoutParams) {
2531+
lp = ((LayoutParams) olp);
2532+
}
25142533
if (mRefreshFooter.getSpinnerStyle().front) {
25152534
final ViewGroup thisGroup = this;
2516-
super.addView(mRefreshFooter.getView(), thisGroup.getChildCount(), new LayoutParams(width, height));
2535+
super.addView(mRefreshFooter.getView(), thisGroup.getChildCount(), lp);
25172536
} else {
2518-
super.addView(mRefreshFooter.getView(), 0, new LayoutParams(width, height));
2537+
super.addView(mRefreshFooter.getView(), 0, lp);
25192538
}
25202539
if (mPrimaryColors != null && mRefreshFooter != null) {
25212540
mRefreshFooter.setPrimaryColors(mPrimaryColors);
@@ -2532,7 +2551,7 @@ public RefreshLayout setRefreshFooter(@NonNull RefreshFooter footer, int width,
25322551
*/
25332552
@Override
25342553
public RefreshLayout setRefreshContent(@NonNull View content) {
2535-
return setRefreshContent(content, MATCH_PARENT, MATCH_PARENT);
2554+
return setRefreshContent(content, 0, 0);
25362555
}
25372556

25382557
/**
@@ -2552,7 +2571,19 @@ public RefreshLayout setRefreshContent(@NonNull View content, int width, int hei
25522571
super.removeView(mRefreshContent.getView());
25532572
}
25542573
final ViewGroup thisGroup = this;
2555-
super.addView(content, thisGroup.getChildCount(), new LayoutParams(width, height));
2574+
2575+
/*
2576+
* 2020-3-16 修复 content 中自带 LayoutParams 丢失问题
2577+
*/
2578+
width = width == 0 ? MATCH_PARENT : width;
2579+
height = height == 0 ? MATCH_PARENT : height;
2580+
LayoutParams lp = new LayoutParams(width, height);
2581+
Object olp = content.getLayoutParams();
2582+
if (olp instanceof LayoutParams) {
2583+
lp = ((LayoutParams) olp);
2584+
}
2585+
2586+
super.addView(content, thisGroup.getChildCount(), lp);
25562587

25572588
mRefreshContent = new RefreshContentWrapper(content);
25582589
if (mAttachedToWindow) {
Collapse file

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

Copy file name to clipboardExpand all lines: refresh-layout/src/main/java/com/scwang/smartrefresh/layout/header/TwoLevelHeader.java
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,26 @@ public TwoLevelHeader setRefreshHeader(RefreshHeader header) {
268268
public TwoLevelHeader setRefreshHeader(RefreshHeader header, int width, int height) {
269269
final ViewGroup thisGroup = this;
270270
if (header != null) {
271+
/*
272+
* 2020-3-16 修复 header 中自带 LayoutParams 丢失问题
273+
*/
274+
width = width == 0 ? MATCH_PARENT : width;
275+
height = height == 0 ? WRAP_CONTENT : height;
276+
LayoutParams lp = new LayoutParams(width, height);
277+
Object olp = header.getView().getLayoutParams();
278+
if (olp instanceof LayoutParams) {
279+
lp = ((LayoutParams) olp);
280+
}
281+
271282
RefreshInternal refreshHeader = mRefreshHeader;
272283
if (refreshHeader != null) {
273284
thisGroup.removeView(refreshHeader.getView());
274285
}
275286
refreshHeader = header;
276287
if (refreshHeader.getSpinnerStyle() == SpinnerStyle.FixedBehind) {
277-
thisGroup.addView(refreshHeader.getView(), 0, new LayoutParams(width, height));
288+
thisGroup.addView(refreshHeader.getView(), 0, lp);
278289
} else {
279-
thisGroup.addView(refreshHeader.getView(), thisGroup.getChildCount(), new LayoutParams(width, height));
290+
thisGroup.addView(refreshHeader.getView(), thisGroup.getChildCount(), lp);
280291
}
281292
this.mRefreshHeader = header;
282293
this.mWrappedInternal = header;

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.