Skip to content

Commit c5f5351

Browse files
author
wsc
committed
完成 1.0.2 版本
1 parent 8c3667f commit c5f5351

5 files changed

Lines changed: 15 additions & 17 deletions

File tree

refresh-footer/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ dependencies {
3232
exclude group: 'com.android.support', module: 'support-annotations'
3333
})
3434
testCompile 'junit:junit:4.12'
35-
// provided 'com.android.support:support-annotations:25.3.1'
36-
// provided 'com.android.support:support-v4:25.3.1'
35+
provided 'com.android.support:support-compat:25.3.1'
3736
provided project(':refresh-layout')
3837
}
3938

refresh-header/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ dependencies {
3232
exclude group: 'com.android.support', module: 'support-annotations'
3333
})
3434
testCompile 'junit:junit:4.12'
35-
// provided 'com.android.support:support-annotations:25.3.1'
3635
provided 'com.android.support:support-compat:25.3.1'
3736
provided project(':refresh-layout')
3837
}

refresh-layout/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ dependencies {
3232
exclude group: 'com.android.support', module: 'support-annotations'
3333
})
3434
testCompile 'junit:junit:4.12'
35-
// provided 'com.android.support:support-annotations:25.3.1'
36-
// provided 'com.android.support:support-v4:25.3.1'
37-
// provided 'com.android.support:support-compat:25.3.1'
38-
// provided 'com.android.support:recyclerview-v7:25.3.1'
3935
provided 'com.android.support:design:25.3.1'
4036
}
4137

refresh-layout/src/main/java/com/scwang/smartrefresh/layout/footer/ClassicsFooter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.content.res.TypedArray;
55
import android.graphics.drawable.Drawable;
66
import android.support.annotation.NonNull;
7-
import android.support.v7.widget.AppCompatTextView;
87
import android.util.AttributeSet;
98
import android.view.Gravity;
109
import android.view.View;
@@ -72,7 +71,7 @@ private void initView(Context context, AttributeSet attrs, int defStyleAttr) {
7271
lpPathView.rightMargin = density.dip2px(10);
7372
addView(mProgressView, lpPathView);
7473

75-
mBottomText = new AppCompatTextView(context, attrs, defStyleAttr);
74+
mBottomText = new TextView(context, attrs, defStyleAttr);
7675
mBottomText.setTextColor(0xff666666);
7776
mBottomText.setTextSize(16);
7877
mBottomText.setText(REFRESH_FOOTER_PULLUP);

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,21 @@ private void initView(Context context, AttributeSet attrs, int defStyleAttr) {
143143

144144
ta.recycle();
145145

146-
if (context instanceof FragmentActivity) {
147-
FragmentManager manager = ((FragmentActivity) context).getSupportFragmentManager();
148-
if (manager != null) {
149-
List<Fragment> fragments = manager.getFragments();
150-
if (fragments != null && fragments.size() > 0) {
151-
setLastUpdateTime(new Date());
152-
return;
146+
try {//try 不能删除-否则会出现兼容性问题
147+
if (context instanceof FragmentActivity) {
148+
FragmentManager manager = ((FragmentActivity) context).getSupportFragmentManager();
149+
if (manager != null) {
150+
List<Fragment> fragments = manager.getFragments();
151+
if (fragments != null && fragments.size() > 0) {
152+
setLastUpdateTime(new Date());
153+
return;
154+
}
153155
}
154156
}
157+
} catch (Throwable e) {
158+
e.printStackTrace();
155159
}
160+
156161
KEY_LAST_UPDATE_TIME += context.getClass().getName();
157162
mShared = context.getSharedPreferences("ClassicsHeader", Context.MODE_PRIVATE);
158163
setLastUpdateTime(new Date(mShared.getLong(KEY_LAST_UPDATE_TIME, System.currentTimeMillis())));
@@ -282,7 +287,7 @@ public void run() {
282287
public ClassicsHeader setLastUpdateTime(Date time) {
283288
mLastTime = time;
284289
mLastUpdateText.setText(mFormat.format(time));
285-
if (mShared != null) {
290+
if (mShared != null && !isInEditMode()) {
286291
mShared.edit().putLong(KEY_LAST_UPDATE_TIME, time.getTime()).apply();
287292
}
288293
return this;

0 commit comments

Comments
 (0)