GeezerVison is showing github.com — 完成 1.0.2 版本 · lyman86/SmartRefreshLayout@c5f5351
File treeExpand file treeCollapse file tree Open diff view settings src/main/java/com/scwang/smartrefresh/layout
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: refresh-footer/build.gradle +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,8 +32,7 @@ dependencies { | 32 | 32 | exclude group: 'com.android.support', module: 'support-annotations' | 33 | 33 | }) | 34 | 34 | 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' | 37 | 36 | provided project(':refresh-layout') | 38 | 37 | } | 39 | 38 |
| |
Collapse file Copy file name to clipboardExpand all lines: refresh-header/build.gradle -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,6 @@ dependencies { | 32 | 32 | exclude group: 'com.android.support', module: 'support-annotations' | 33 | 33 | }) | 34 | 34 | testCompile 'junit:junit:4.12' | 35 | | -// provided 'com.android.support:support-annotations:25.3.1' | 36 | 35 | provided 'com.android.support:support-compat:25.3.1' | 37 | 36 | provided project(':refresh-layout') | 38 | 37 | } | |
Collapse file Copy file name to clipboardExpand all lines: refresh-layout/build.gradle -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,10 +32,6 @@ dependencies { | 32 | 32 | exclude group: 'com.android.support', module: 'support-annotations' | 33 | 33 | }) | 34 | 34 | 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' | 39 | 35 | provided 'com.android.support:design:25.3.1' | 40 | 36 | } | 41 | 37 |
| |
Collapse file Copy file name to clipboardExpand all lines: refresh-layout/src/main/java/com/scwang/smartrefresh/layout/footer/ClassicsFooter.java +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | import android.content.res.TypedArray; | 5 | 5 | import android.graphics.drawable.Drawable; | 6 | 6 | import android.support.annotation.NonNull; | 7 | | -import android.support.v7.widget.AppCompatTextView; | 8 | 7 | import android.util.AttributeSet; | 9 | 8 | import android.view.Gravity; | 10 | 9 | import android.view.View; | @@ -72,7 +71,7 @@ private void initView(Context context, AttributeSet attrs, int defStyleAttr) { | 72 | 71 | lpPathView.rightMargin = density.dip2px(10); | 73 | 72 | addView(mProgressView, lpPathView); | 74 | 73 |
| 75 | | - mBottomText = new AppCompatTextView(context, attrs, defStyleAttr); | | 74 | + mBottomText = new TextView(context, attrs, defStyleAttr); | 76 | 75 | mBottomText.setTextColor(0xff666666); | 77 | 76 | mBottomText.setTextSize(16); | 78 | 77 | mBottomText.setText(REFRESH_FOOTER_PULLUP); | |
Collapse file Copy file name to clipboardExpand all lines: refresh-layout/src/main/java/com/scwang/smartrefresh/layout/header/ClassicsHeader.java +13-8Lines changed: 13 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -143,16 +143,21 @@ private void initView(Context context, AttributeSet attrs, int defStyleAttr) { | 143 | 143 |
| 144 | 144 | ta.recycle(); | 145 | 145 |
| 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 | + } | 153 | 155 | } | 154 | 156 | } | | 157 | + } catch (Throwable e) { | | 158 | + e.printStackTrace(); | 155 | 159 | } | | 160 | + | 156 | 161 | KEY_LAST_UPDATE_TIME += context.getClass().getName(); | 157 | 162 | mShared = context.getSharedPreferences("ClassicsHeader", Context.MODE_PRIVATE); | 158 | 163 | setLastUpdateTime(new Date(mShared.getLong(KEY_LAST_UPDATE_TIME, System.currentTimeMillis()))); | @@ -282,7 +287,7 @@ public void run() { | 282 | 287 | public ClassicsHeader setLastUpdateTime(Date time) { | 283 | 288 | mLastTime = time; | 284 | 289 | mLastUpdateText.setText(mFormat.format(time)); | 285 | | - if (mShared != null) { | | 290 | + if (mShared != null && !isInEditMode()) { | 286 | 291 | mShared.edit().putLong(KEY_LAST_UPDATE_TIME, time.getTime()).apply(); | 287 | 292 | } | 288 | 293 | return this; | |
|