Use/check recycler view adapter position

pull/12/merge
M66B 6 years ago
parent b1cc40bb47
commit 959bfdf9df

@ -75,7 +75,10 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
@Override
public void onClick(View view) {
EntityAccount account = filtered.get(getLayoutPosition());
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return;
EntityAccount account = filtered.get(pos);
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(

@ -82,7 +82,10 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
@Override
public void onClick(View view) {
final TupleAttachment attachment = filtered.get(getLayoutPosition());
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return;
final TupleAttachment attachment = filtered.get(pos);
if (attachment != null)
if (attachment.content) {
// Build file name

@ -81,7 +81,10 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
@Override
public void onClick(View view) {
TupleFolderEx folder = filtered.get(getLayoutPosition());
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return;
TupleFolderEx folder = filtered.get(pos);
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
@ -91,7 +94,10 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
@Override
public boolean onLongClick(View view) {
TupleFolderEx folder = filtered.get(getLayoutPosition());
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return false;
TupleFolderEx folder = filtered.get(pos);
if (!EntityFolder.TYPE_OUTBOX.equals(folder.type)) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);

@ -75,7 +75,10 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
@Override
public void onClick(View view) {
EntityIdentity identity = filtered.get(getLayoutPosition());
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return;
EntityIdentity identity = filtered.get(pos);
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(

@ -84,7 +84,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
public void onClick(View view) {
final TupleMessageEx message = filtered.get(getLayoutPosition());
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return;
final TupleMessageEx message = filtered.get(pos);
executor.submit(new Runnable() {
@Override

Loading…
Cancel
Save