Browse Source

Use/check recycler view adapter position

main
M66B 6 years ago
parent
commit
959bfdf9df
5 changed files with 24 additions and 6 deletions
  1. +4
    -1
      app/src/main/java/eu/faircode/email/AdapterAccount.java
  2. +4
    -1
      app/src/main/java/eu/faircode/email/AdapterAttachment.java
  3. +8
    -2
      app/src/main/java/eu/faircode/email/AdapterFolder.java
  4. +4
    -1
      app/src/main/java/eu/faircode/email/AdapterIdentity.java
  5. +4
    -1
      app/src/main/java/eu/faircode/email/AdapterMessage.java

+ 4
- 1
app/src/main/java/eu/faircode/email/AdapterAccount.java View File

@ -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(


+ 4
- 1
app/src/main/java/eu/faircode/email/AdapterAttachment.java View File

@ -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


+ 8
- 2
app/src/main/java/eu/faircode/email/AdapterFolder.java View File

@ -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);


+ 4
- 1
app/src/main/java/eu/faircode/email/AdapterIdentity.java View File

@ -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(


+ 4
- 1
app/src/main/java/eu/faircode/email/AdapterMessage.java View File

@ -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