Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
Update DefaultRvAdapter.java
Browse files Browse the repository at this point in the history
Fixes issue #1262
  • Loading branch information
ankitagrawal2411 committed Jan 16, 2017
1 parent 9efee58 commit 6d7ebb6
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -174,7 +174,7 @@ static class DefaultVH extends RecyclerView.ViewHolder implements View.OnClickLi

@Override
public void onClick(View view) {
if (adapter.callback != null) {
if (adapter.callback != null && getAdapterPosition()!=RecyclerView.NO_POSITION) {
CharSequence text = null;
if (adapter.dialog.builder.items != null && getAdapterPosition() < adapter.dialog.builder.items.size())
text = adapter.dialog.builder.items.get(getAdapterPosition());
Expand All @@ -184,7 +184,7 @@ public void onClick(View view) {

@Override
public boolean onLongClick(View view) {
if (adapter.callback != null) {
if (adapter.callback != null && getAdapterPosition()!=RecyclerView.NO_POSITION) {
CharSequence text = null;
if (adapter.dialog.builder.items != null && getAdapterPosition() < adapter.dialog.builder.items.size())
text = adapter.dialog.builder.items.get(getAdapterPosition());
Expand All @@ -193,4 +193,4 @@ public boolean onLongClick(View view) {
return false;
}
}
}
}

0 comments on commit 6d7ebb6

Please sign in to comment.