Skip to content

Commit

Permalink
removeHeaderView()、removeFooterView() =》 addHeaderView(null)、addFoote…
Browse files Browse the repository at this point in the history
…rView(null)
  • Loading branch information
ChadCym committed May 25, 2016
1 parent e8dce08 commit 16949a7
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,18 +408,12 @@ protected BaseViewHolder createBaseViewHolder(ViewGroup parent, int layoutResId)


public void addHeaderView(View header) {
if (header == null) {
throw new RuntimeException("header is null");
}
this.mHeaderView = header;
this.notifyDataSetChanged();
}

public void addFooterView(View footer) {
mNextLoadEnable = false;
if (footer == null) {
throw new RuntimeException("footer is null");
}
this.mFooterView = footer;
this.notifyDataSetChanged();
}
Expand Down Expand Up @@ -510,14 +504,18 @@ private void addAnimation(RecyclerView.ViewHolder holder) {
animation = mSelectAnimation;
}
for (Animator anim : animation.getAnimators(holder.itemView)) {
anim.setDuration(mDuration).start();
anim.setInterpolator(mInterpolator);
startAnim(anim, holder.getLayoutPosition());
}
mLastPosition = holder.getLayoutPosition();
}
}
}

protected void startAnim(Animator anim, int index) {
anim.setDuration(mDuration).start();
anim.setInterpolator(mInterpolator);
}

private boolean isLoadMore() {
return mNextLoadEnable && pageSize != -1 && !mLoadingMoreEnable && mRequestLoadMoreListener != null && mData.size() >= pageSize;
}
Expand Down

0 comments on commit 16949a7

Please sign in to comment.