Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChadCym committed Jul 27, 2016
2 parents 3e319fe + ca4bc59 commit 85413f4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
然后在dependencies添加:
```
dependencies {
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.9.3'
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.9.7'
}
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ allprojects {
Add the dependency
```groovy
dependencies {
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.9.3'
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.9.7'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class PullToRefreshUseActivity extends Activity implements BaseQuickAdapt
private QuickAdapter mQuickAdapter;
private SwipeRefreshLayout mSwipeRefreshLayout;

private View notLoadingView;

private static final int TOTAL_COUNTER = 18;

private static final int PAGE_SIZE = 6;
Expand Down Expand Up @@ -67,8 +69,10 @@ public void onLoadMoreRequested() {
public void run() {
if (mCurrentCounter >= TOTAL_COUNTER) {
mQuickAdapter.notifyDataChangedAfterLoadMore(false);
View view = getLayoutInflater().inflate(R.layout.not_loading, (ViewGroup) mRecyclerView.getParent(), false);
mQuickAdapter.addFooterView(view);
if (notLoadingView == null) {
notLoadingView = getLayoutInflater().inflate(R.layout.not_loading, (ViewGroup) mRecyclerView.getParent(), false);
}
mQuickAdapter.addFooterView(notLoadingView);
} else {
new Handler().postDelayed(new Runnable() {
@Override
Expand All @@ -80,18 +84,17 @@ public void run() {
}
}


});
}


@Override
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mQuickAdapter.setNewData(DataServer.getSampleData(PAGE_SIZE));
mQuickAdapter.openLoadMore(PAGE_SIZE, true);
mQuickAdapter.removeAllFooterView();
mCurrentCounter = PAGE_SIZE;
mSwipeRefreshLayout.setRefreshing(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public void setNewData(List<T> data) {
this.mData = data;
if (mRequestLoadMoreListener != null) {
mNextLoadEnable = true;
mFooterLayout = null;
// mFooterLayout = null;
}
mLastPosition = -1;
notifyDataSetChanged();
Expand Down Expand Up @@ -520,6 +520,8 @@ else if ((!mFootAndEmptyEnable || !mHeadAndEmptyEnable) && position == 1 && mFoo
return LOADING_VIEW;
else
return FOOTER_VIEW;
} else if (position > mData.size() + getHeaderLayoutCount()) {
return FOOTER_VIEW;
}
return getDefItemViewType(position - getHeaderLayoutCount());
}
Expand Down Expand Up @@ -775,7 +777,7 @@ public void removeFooterView(View footer) {
* remove all header view from mHeaderLayout and set null to mHeaderLayout
*/
public void removeAllHeaderView() {
if (mFooterLayout == null) return;
if (mHeaderLayout == null) return;

mHeaderLayout.removeAllViews();
mHeaderLayout = null;
Expand Down

0 comments on commit 85413f4

Please sign in to comment.