Skip to content

Commit 13c4f97

Browse files
committed
1.公开获取是否有Header和Footer的方法
1 parent a257990 commit 13c4f97

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

commonadapter/src/main/java/com/github/zeng1990java/commonadapter/CommonRecyclerAdapter.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,30 @@ private boolean isLoadMore(int position){
385385
return hasLoadMoreView() && (position == getHeaderViewItemCount() + getDataItemCount() + getFooterViewItemCount());
386386
}
387387

388-
public int getHeaderViewItemCount(){
388+
/**
389+
* 有Header返回1,没有返回0
390+
* @return
391+
*/
392+
protected int getHeaderViewItemCount(){
389393
return hasHeaderView() ? 1 : 0;
390394
}
391395

392-
public int getFooterViewItemCount(){
396+
/**
397+
* 有Footer返回1,没有返回0
398+
* @return
399+
*/
400+
protected int getFooterViewItemCount(){
393401
return hasFooterView() ? 1 : 0;
394402
}
395403

396-
public int getLoadMoreViewItemCount(){
404+
protected int getLoadMoreViewItemCount(){
397405
return hasLoadMoreView() ? 1 : 0;
398406
}
399407

408+
/**
409+
* 是否添加了Header
410+
* @return
411+
*/
400412
public boolean hasHeaderView(){
401413
if (mHeaderLayout == null){
402414
return false;
@@ -405,6 +417,10 @@ public boolean hasHeaderView(){
405417
return mHeaderLayout.getChildCount() > 0;
406418
}
407419

420+
/**
421+
* 是否添加了Footer
422+
* @return
423+
*/
408424
public boolean hasFooterView(){
409425
if(mFooterLayout == null){
410426
return false;

0 commit comments

Comments
 (0)