Browse Source

Show if attachments in message list item

main
M66B 6 years ago
parent
commit
14efe62e91
45 changed files with 31 additions and 2 deletions
  1. +4
    -0
      app/src/main/java/eu/faircode/email/AdapterMessage.java
  2. +4
    -0
      app/src/main/java/eu/faircode/email/DaoMessage.java
  3. +3
    -1
      app/src/main/java/eu/faircode/email/TupleMessageEx.java
  4. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_black_18.png
  5. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_black_24.png
  6. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_black_36.png
  7. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_black_48.png
  8. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_white_18.png
  9. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_white_24.png
  10. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_white_36.png
  11. BIN
      app/src/main/res/drawable-hdpi/baseline_attachment_white_48.png
  12. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_black_18.png
  13. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_black_24.png
  14. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_black_36.png
  15. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_black_48.png
  16. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_white_18.png
  17. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_white_24.png
  18. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_white_36.png
  19. BIN
      app/src/main/res/drawable-mdpi/baseline_attachment_white_48.png
  20. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_black_18.png
  21. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_black_24.png
  22. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_black_36.png
  23. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_black_48.png
  24. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_white_18.png
  25. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_white_24.png
  26. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_white_36.png
  27. BIN
      app/src/main/res/drawable-xhdpi/baseline_attachment_white_48.png
  28. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_black_18.png
  29. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_black_24.png
  30. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_black_36.png
  31. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_black_48.png
  32. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_white_18.png
  33. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_white_24.png
  34. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_white_36.png
  35. BIN
      app/src/main/res/drawable-xxhdpi/baseline_attachment_white_48.png
  36. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_18.png
  37. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_24.png
  38. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_36.png
  39. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_48.png
  40. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_18.png
  41. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_24.png
  42. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_36.png
  43. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_48.png
  44. +10
    -0
      app/src/main/res/drawable/baseline_attachment_24.xml
  45. +10
    -1
      app/src/main/res/layout/item_message.xml

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

@ -32,6 +32,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
@ -58,6 +59,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
View itemView;
TextView tvFrom;
TextView tvTime;
ImageView ivAttachments;
TextView tvSubject;
TextView tvCount;
@ -67,6 +69,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.itemView = itemView;
tvFrom = itemView.findViewById(R.id.tvFrom);
tvTime = itemView.findViewById(R.id.tvTime);
ivAttachments = itemView.findViewById(R.id.ivAttachments);
tvSubject = itemView.findViewById(R.id.tvSubject);
tvCount = itemView.findViewById(R.id.tvCount);
}
@ -238,6 +241,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int visibility = (unseen ? Typeface.BOLD : Typeface.NORMAL);
holder.tvFrom.setTypeface(null, visibility);
holder.tvTime.setTypeface(null, visibility);
holder.ivAttachments.setVisibility(message.attachments > 0 ? View.VISIBLE : View.GONE);
holder.tvSubject.setTypeface(null, visibility);
holder.tvCount.setTypeface(null, visibility);


+ 4
- 0
app/src/main/java/eu/faircode/email/DaoMessage.java View File

@ -33,6 +33,7 @@ public interface DaoMessage {
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
" FROM folder" +
" JOIN message ON folder = folder.id" +
" WHERE folder.type = '" + EntityFolder.TYPE_INBOX + "'" +
@ -45,6 +46,7 @@ public interface DaoMessage {
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
" FROM folder" +
" JOIN message ON folder = folder.id" +
" WHERE folder.id = :folder" +
@ -56,6 +58,7 @@ public interface DaoMessage {
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
" FROM message" +
" JOIN folder ON folder.id = message.folder" +
" JOIN message m1 ON m1.id = :msgid AND m1.account = message.account AND m1.thread = message.thread" +
@ -71,6 +74,7 @@ public interface DaoMessage {
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
" FROM message" +
" JOIN folder ON folder.id = message.folder" +
" WHERE message.id = :id")


+ 3
- 1
app/src/main/java/eu/faircode/email/TupleMessageEx.java View File

@ -24,6 +24,7 @@ public class TupleMessageEx extends EntityMessage {
public String folderType;
public int count;
public int unseen;
public int attachments;
@Override
public boolean equals(Object obj) {
@ -32,7 +33,8 @@ public class TupleMessageEx extends EntityMessage {
return (super.equals(obj) &&
this.folderType.equals(other.folderType) &&
this.count == other.count &&
this.unseen == other.unseen);
this.unseen == other.unseen &&
this.attachments == other.attachments);
}
return super.equals(obj);
}


BIN
app/src/main/res/drawable-hdpi/baseline_attachment_black_18.png View File

Before After
Width: 27  |  Height: 27  |  Size: 264 B

BIN
app/src/main/res/drawable-hdpi/baseline_attachment_black_24.png View File

Before After
Width: 36  |  Height: 36  |  Size: 302 B

BIN
app/src/main/res/drawable-hdpi/baseline_attachment_black_36.png View File

Before After
Width: 54  |  Height: 54  |  Size: 408 B

BIN
app/src/main/res/drawable-hdpi/baseline_attachment_black_48.png View File

Before After
Width: 72  |  Height: 72  |  Size: 516 B

BIN
app/src/main/res/drawable-hdpi/baseline_attachment_white_18.png View File

Before After
Width: 27  |  Height: 27  |  Size: 274 B

BIN
app/src/main/res/drawable-hdpi/baseline_attachment_white_24.png View File

Before After
Width: 36  |  Height: 36  |  Size: 298 B

BIN
app/src/main/res/drawable-hdpi/baseline_attachment_white_36.png View File

Before After
Width: 54  |  Height: 54  |  Size: 397 B

BIN
app/src/main/res/drawable-hdpi/baseline_attachment_white_48.png View File

Before After
Width: 72  |  Height: 72  |  Size: 509 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_black_18.png View File

Before After
Width: 18  |  Height: 18  |  Size: 166 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_black_24.png View File

Before After
Width: 24  |  Height: 24  |  Size: 205 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_black_36.png View File

Before After
Width: 36  |  Height: 36  |  Size: 302 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_black_48.png View File

Before After
Width: 48  |  Height: 48  |  Size: 389 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_white_18.png View File

Before After
Width: 18  |  Height: 18  |  Size: 171 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_white_24.png View File

Before After
Width: 24  |  Height: 24  |  Size: 209 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_white_36.png View File

Before After
Width: 36  |  Height: 36  |  Size: 298 B

BIN
app/src/main/res/drawable-mdpi/baseline_attachment_white_48.png View File

Before After
Width: 48  |  Height: 48  |  Size: 374 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_black_18.png View File

Before After
Width: 36  |  Height: 36  |  Size: 302 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_black_24.png View File

Before After
Width: 48  |  Height: 48  |  Size: 389 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_black_36.png View File

Before After
Width: 72  |  Height: 72  |  Size: 516 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_black_48.png View File

Before After
Width: 96  |  Height: 96  |  Size: 718 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_white_18.png View File

Before After
Width: 36  |  Height: 36  |  Size: 298 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_white_24.png View File

Before After
Width: 48  |  Height: 48  |  Size: 374 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_white_36.png View File

Before After
Width: 72  |  Height: 72  |  Size: 509 B

BIN
app/src/main/res/drawable-xhdpi/baseline_attachment_white_48.png View File

Before After
Width: 96  |  Height: 96  |  Size: 710 B

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_black_18.png View File

Before After
Width: 54  |  Height: 54  |  Size: 408 B

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_black_24.png View File

Before After
Width: 72  |  Height: 72  |  Size: 516 B

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_black_36.png View File

Before After
Width: 108  |  Height: 108  |  Size: 808 B

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_black_48.png View File

Before After
Width: 144  |  Height: 144  |  Size: 1.0 KiB

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_white_18.png View File

Before After
Width: 54  |  Height: 54  |  Size: 397 B

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_white_24.png View File

Before After
Width: 72  |  Height: 72  |  Size: 509 B

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_white_36.png View File

Before After
Width: 108  |  Height: 108  |  Size: 797 B

BIN
app/src/main/res/drawable-xxhdpi/baseline_attachment_white_48.png View File

Before After
Width: 144  |  Height: 144  |  Size: 1.0 KiB

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_18.png View File

Before After
Width: 72  |  Height: 72  |  Size: 516 B

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_24.png View File

Before After
Width: 96  |  Height: 96  |  Size: 718 B

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_36.png View File

Before After
Width: 144  |  Height: 144  |  Size: 1.0 KiB

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_black_48.png View File

Before After
Width: 192  |  Height: 192  |  Size: 1.3 KiB

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_18.png View File

Before After
Width: 72  |  Height: 72  |  Size: 509 B

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_24.png View File

Before After
Width: 96  |  Height: 96  |  Size: 710 B

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_36.png View File

Before After
Width: 144  |  Height: 144  |  Size: 1.0 KiB

BIN
app/src/main/res/drawable-xxxhdpi/baseline_attachment_white_48.png View File

Before After
Width: 192  |  Height: 192  |  Size: 1.3 KiB

+ 10
- 0
app/src/main/res/drawable/baseline_attachment_24.xml View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M2,12.5C2,9.46 4.46,7 7.5,7H18c2.21,0 4,1.79 4,4s-1.79,4 -4,4H9.5C8.12,15 7,13.88 7,12.5S8.12,10 9.5,10H17v2H9.41c-0.55,0 -0.55,1 0,1H18c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H7.5C5.57,9 4,10.57 4,12.5S5.57,16 7.5,16H17v2H7.5C4.46,18 2,15.54 2,12.5z"/>
</vector>

+ 10
- 1
app/src/main/res/layout/item_message.xml View File

@ -29,6 +29,15 @@
app:layout_constraintBottom_toBottomOf="@id/tvFrom"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/ivAttachments"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="6dp"
android:src="@drawable/baseline_attachment_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<TextView
android:id="@+id/tvSubject"
android:layout_width="0dp"
@ -39,7 +48,7 @@
android:text="Subject"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toStartOf="@+id/tvCount"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@id/ivAttachments"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<TextView


Loading…
Cancel
Save