Skip to content

Commit

Permalink
Remove unnecessary methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rubengees committed Aug 8, 2017
1 parent 273e70f commit d28af1b
Showing 1 changed file with 7 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int pos

@Override
public int getItemCount() {
return innerAdapter.getItemCount() + (hasHeader() ? 1 : 0) + (hasFooter() ? 1 : 0);
return innerAdapter.getItemCount() + (header != null ? 1 : 0) + (footer != null ? 1 : 0);
}

@Override
Expand All @@ -175,26 +175,6 @@ public long getItemId(final int position) {
}
}

/**
* Returns if a header is currently set.
*
* @return True if a header is set.
*/
@SuppressWarnings("WeakerAccess")
public boolean hasHeader() {
return header != null;
}

/**
* Returns if a footer is currently set.
*
* @return True if a footer is set.
*/
@SuppressWarnings("WeakerAccess")
public boolean hasFooter() {
return footer != null;
}

/**
* Returns if a header is at the specified position.
*
Expand Down Expand Up @@ -222,6 +202,7 @@ public boolean isFooter(final int position) {
*
* @return The header.
*/
@SuppressWarnings("unused")
@Nullable
public View getHeader() {
return header;
Expand Down Expand Up @@ -259,6 +240,7 @@ public void setHeader(@Nullable final View header) {
*
* @return The footer.
*/
@SuppressWarnings("unused")
@Nullable
public View getFooter() {
return footer;
Expand Down Expand Up @@ -294,6 +276,7 @@ public void setFooter(@Nullable final View footer) {
*
* @return The inner adapter.
*/
@SuppressWarnings("unused")
public RecyclerView.Adapter getInnerAdapter() {
return innerAdapter;
}
Expand All @@ -305,15 +288,15 @@ public RecyclerView.Adapter getInnerAdapter() {
* @return The real position.
*/
public int getRealPosition(final int position) {
return position - (hasHeader() ? 1 : 0);
return position - (header != null ? 1 : 0);
}

private int getDelegatedPosition(final int position) {
return position + (hasHeader() ? 1 : 0);
return position + (header != null ? 1 : 0);
}

private int getFooterPosition() {
return innerAdapter.getItemCount() + (hasHeader() ? 1 : 0);
return innerAdapter.getItemCount() + (header != null ? 1 : 0);
}

private void initLayoutManager(final RecyclerView.LayoutManager layoutManager) {
Expand Down

0 comments on commit d28af1b

Please sign in to comment.