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 — 优化 ClassicsHeader · tao2java/SmartRefreshLayout@e064523

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • README_EN.md
  • app
    • build.gradle
  • build.gradle
  • refresh-layout/src/main/java/com/scwang/smartrefresh/layout/header
    • ClassicsHeader.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
@@ -4,7 +4,7 @@
44
[![Arsenal](https://img.shields.io/badge/%20Arsenal%20-%20SmartRefresh%20-4cae4c.svg?style=flat)](https://android-arsenal.com/details/1/6001)
55
[![Jcenter](https://img.shields.io/badge/%20Jcenter%20-1.0.3-5bc0de.svg) ](https://bintray.com/scwang90/maven/SmartRefreshLayout/_latestVersion)
66
[![MinSdk](https://img.shields.io/badge/%20MinSdk%20-%2012%2B%20-f0ad4e.svg?style=flat)](https://android-arsenal.com/api?level=12)
7-
[![Methods](https://img.shields.io/badge/%20Methods%20%7C%20Size%20-%201251%20%7C%20129%20KB-d9534f.svg)](http://www.methodscount.com/?lib=com.scwang.smartrefresh%3ASmartRefreshLayout%3A1.0.3)
7+
[![Methods](https://img.shields.io/badge/%20Methods%20%7C%20Size%20-%201382%20%7C%20143%20KB-d9534f.svg)](http://www.methodscount.com/?lib=com.scwang.smartrefresh%3ASmartRefreshLayout%3A1.0.3)
88

99
<!-- [![Platform](https://img.shields.io/badge/Platform-Android-f0ad4e.svg)](https://www.android.com) -->
1010
<!-- [![Author](https://img.shields.io/badge/Author-scwang90-11bbff.svg)](https://github.com/scwang90) -->
@@ -103,8 +103,8 @@ SmartRefreshLayout的目标是打造一个强大,稳定,成熟的下拉刷
103103
#### 1.在 buld.gradle 中添加依赖
104104
```
105105
//新版本预览版-发现bug请加群提出,并切换 1.0.3 版本
106-
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-alpha-8'
107-
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-alpha-8'//没有使用特殊Header,可以不加这行
106+
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-alpha-9'
107+
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-alpha-9'//没有使用特殊Header,可以不加这行
108108
109109
compile 'com.android.support:appcompat-v7:25.3.1'//版本随意(必须)
110110
compile 'com.android.support:design:25.3.1'//版本随意(非必须,引用可以解决无法预览问题)
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
@@ -4,7 +4,7 @@
44
[![Arsenal](https://img.shields.io/badge/%20Arsenal%20-%20SmartRefresh%20-4cae4c.svg?style=flat)](https://android-arsenal.com/details/1/6001)
55
[![Jcenter](https://img.shields.io/badge/%20Jcenter%20-1.0.3-5bc0de.svg) ](https://bintray.com/scwang90/maven/SmartRefreshLayout/_latestVersion)
66
[![MinSdk](https://img.shields.io/badge/%20MinSdk%20-%2012%2B%20-f0ad4e.svg?style=flat)](https://android-arsenal.com/api?level=12)
7-
[![Methods](https://img.shields.io/badge/%20Methods%20%7C%20Size%20-%201251%20%7C%20129%20KB-d9534f.svg)](http://www.methodscount.com/?lib=com.scwang.smartrefresh%3ASmartRefreshLayout%3A1.0.3)
7+
[![Methods](https://img.shields.io/badge/%20Methods%20%7C%20Size%20-%201382%20%7C%20143%20KB-d9534f.svg)](http://www.methodscount.com/?lib=com.scwang.smartrefresh%3ASmartRefreshLayout%3A1.0.3)
88

99
<!-- [![Platform](https://img.shields.io/badge/Platform-Android-f0ad4e.svg)](https://www.android.com) -->
1010
<!-- [![Author](https://img.shields.io/badge/Author-scwang90-11bbff.svg)](https://github.com/scwang90) -->
@@ -109,8 +109,8 @@ compile 'com.android.support:appcompat-v7:25.3.1'
109109
compile 'com.android.support:design:25.3.1'//(Not necessary,Can solve problems that cannot be previewed)
110110
111111
//alpha-version
112-
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-alpha-8'
113-
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-alpha-8'
112+
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-alpha-9'
113+
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-alpha-9'
114114
```
115115

116116
#### 2.Add SmartRefreshLayout in the layout xml.
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
@@ -53,9 +53,9 @@ dependencies {
5353
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
5454
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
5555

56-
// compile project(':refresh-footer')
57-
// compile project(':refresh-header')
58-
// compile project(':refresh-layout')
56+
compile project(':refresh-footer')
57+
compile project(':refresh-header')
58+
compile project(':refresh-layout')
5959

6060
compile 'com.android.support:design:25.3.1'
6161
compile 'com.android.support:cardview-v7:25.3.1'
@@ -70,8 +70,8 @@ dependencies {
7070
compile 'de.hdodenhof:circleimageview:2.1.0'
7171
compile 'jp.wasabeef:recyclerview-animators:2.2.6'
7272
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
73-
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-alpha-8'
74-
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-alpha-8'
73+
// compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-alpha-9'
74+
// compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-alpha-9'
7575
testCompile 'junit:junit:4.12'
7676

7777
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
Collapse file

‎build.gradle‎

Copy file name to clipboardExpand all lines: build.gradle
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
buildscript {
44
repositories {
5-
// google()
5+
google()
66
jcenter()
77
}
88
dependencies {
@@ -15,7 +15,7 @@ buildscript {
1515

1616
allprojects {
1717
repositories {
18-
// google()
18+
google()
1919
jcenter()
2020
}
2121
tasks.withType(Javadoc) {
Collapse file

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

Copy file name to clipboardExpand all lines: refresh-layout/src/main/java/com/scwang/smartrefresh/layout/header/ClassicsHeader.java
+8-34Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.scwang.smartrefresh.layout.header;
22

3+
import android.annotation.SuppressLint;
34
import android.content.Context;
45
import android.content.SharedPreferences;
56
import android.content.res.TypedArray;
@@ -51,7 +52,7 @@
5152
* 经典下拉头部
5253
* Created by SCWANG on 2017/5/28.
5354
*/
54-
@SuppressWarnings("unused")
55+
@SuppressWarnings({"unused", "UnusedReturnValue"})
5556
public class ClassicsHeader extends RelativeLayout implements RefreshHeader {
5657

5758
public static String REFRESH_HEADER_PULLDOWN = "下拉可以刷新";
@@ -196,16 +197,11 @@ private void initView(Context context, AttributeSet attrs) {
196197
mLastUpdateText.setTextSize(12);
197198
}
198199

199-
int primaryColor = ta.getColor(R.styleable.ClassicsHeader_srlPrimaryColor, 0);
200-
int accentColor = ta.getColor(R.styleable.ClassicsHeader_srlAccentColor, 0);
201-
if (primaryColor != 0) {
202-
if (accentColor != 0) {
203-
setPrimaryColors(primaryColor, accentColor);
204-
} else {
205-
setPrimaryColors(primaryColor);
206-
}
207-
} else if (accentColor != 0) {
208-
setPrimaryColors(0, accentColor);
200+
if (ta.hasValue(R.styleable.ClassicsHeader_srlPrimaryColor)) {
201+
setPrimaryColor(ta.getColor(R.styleable.ClassicsHeader_srlPrimaryColor, 0));
202+
}
203+
if (ta.hasValue(R.styleable.ClassicsHeader_srlAccentColor)) {
204+
setAccentColor(ta.getColor(R.styleable.ClassicsHeader_srlAccentColor, 0));
209205
}
210206

211207
ta.recycle();
@@ -229,6 +225,7 @@ private void initView(Context context, AttributeSet attrs) {
229225
if (context instanceof FragmentActivity) {
230226
FragmentManager manager = ((FragmentActivity) context).getSupportFragmentManager();
231227
if (manager != null) {
228+
@SuppressLint("RestrictedApi")
232229
List<Fragment> fragments = manager.getFragments();
233230
if (fragments != null && fragments.size() > 0) {
234231
setLastUpdateTime(new Date());
@@ -383,29 +380,6 @@ public void onStateChanged(RefreshLayout refreshLayout, RefreshState oldState, R
383380
}
384381
//</editor-fold>
385382

386-
//<editor-fold desc="background">
387-
// private Runnable restoreRunable;
388-
// private void restoreRefreshLayoutBackground() {
389-
// if (restoreRunable != null) {
390-
// restoreRunable.run();
391-
// restoreRunable = null;
392-
// }
393-
// }
394-
//
395-
// private void replaceRefreshLayoutBackground(final RefreshLayout refreshLayout) {
396-
// if (restoreRunable == null && mSpinnerStyle == SpinnerStyle.FixedBehind) {
397-
// restoreRunable = new Runnable() {
398-
// Drawable drawable = refreshLayout.getLayout().getBackground();
399-
// @Override
400-
// public void run() {
401-
// refreshLayout.getLayout().setBackgroundDrawable(drawable);
402-
// }
403-
// };
404-
// refreshLayout.getLayout().setBackgroundDrawable(getBackground());
405-
// }
406-
// }
407-
//</editor-fold>
408-
409383
//<editor-fold desc="API">
410384
public ClassicsHeader setProgressBitmap(Bitmap bitmap) {
411385
mProgressDrawable = null;

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.