Browse Source

Attachment download

main
M66B 6 years ago
parent
commit
70e0913331
50 changed files with 202 additions and 109 deletions
  1. +1
    -0
      FAQ.md
  2. +24
    -7
      app/src/main/java/eu/faircode/email/AdapterAttachment.java
  3. +7
    -0
      app/src/main/java/eu/faircode/email/DaoAttachment.java
  4. +6
    -0
      app/src/main/java/eu/faircode/email/EntityAttachment.java
  5. +1
    -0
      app/src/main/java/eu/faircode/email/EntityOperation.java
  6. +8
    -0
      app/src/main/java/eu/faircode/email/Helper.java
  7. +1
    -0
      app/src/main/java/eu/faircode/email/MessageHelper.java
  8. +125
    -96
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java
  9. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_black_18.png
  10. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_black_24.png
  11. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_black_36.png
  12. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_black_48.png
  13. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_white_18.png
  14. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_white_24.png
  15. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_white_36.png
  16. BIN
      app/src/main/res/drawable-hdpi/baseline_get_app_white_48.png
  17. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_black_18.png
  18. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_black_24.png
  19. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_black_36.png
  20. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_black_48.png
  21. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_white_18.png
  22. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_white_24.png
  23. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_white_36.png
  24. BIN
      app/src/main/res/drawable-mdpi/baseline_get_app_white_48.png
  25. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_black_18.png
  26. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_black_24.png
  27. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_black_36.png
  28. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_black_48.png
  29. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_white_18.png
  30. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_white_24.png
  31. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_white_36.png
  32. BIN
      app/src/main/res/drawable-xhdpi/baseline_get_app_white_48.png
  33. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_black_18.png
  34. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_black_24.png
  35. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_black_36.png
  36. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_black_48.png
  37. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_white_18.png
  38. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_white_24.png
  39. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_white_36.png
  40. BIN
      app/src/main/res/drawable-xxhdpi/baseline_get_app_white_48.png
  41. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_black_18.png
  42. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_black_24.png
  43. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_black_36.png
  44. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_black_48.png
  45. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_white_18.png
  46. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_white_24.png
  47. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_white_36.png
  48. BIN
      app/src/main/res/drawable-xxxhdpi/baseline_get_app_white_48.png
  49. +10
    -0
      app/src/main/res/drawable/baseline_get_app_24.xml
  50. +19
    -6
      app/src/main/res/layout/item_attachment.xml

+ 1
- 0
FAQ.md View File

@ -21,6 +21,7 @@ The low priority status bar notification shows the number of pending operations,
* Move message to another remote folder
* Delete message from remote folder
* Send message
* Download attachment
<a name="FAQ3"></a>
**(3) What is a valid security certificate?**


+ 24
- 7
app/src/main/java/eu/faircode/email/AdapterAttachment.java View File

@ -28,15 +28,19 @@ 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;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.ViewHolder> {
private Context context;
private ExecutorService executor = Executors.newCachedThreadPool();
private List<EntityAttachment> all = new ArrayList<>();
private List<EntityAttachment> filtered = new ArrayList<>();
@ -45,30 +49,39 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
implements View.OnClickListener {
View itemView;
TextView tvName;
TextView tvType;
TextView tvSize;
ImageView ivDownload;
ViewHolder(View itemView) {
super(itemView);
this.itemView = itemView;
tvName = itemView.findViewById(R.id.tvName);
tvType = itemView.findViewById(R.id.tvType);
tvSize = itemView.findViewById(R.id.tvSize);
ivDownload = itemView.findViewById(R.id.ivDownload);
}
private void wire() {
itemView.setOnClickListener(this);
ivDownload.setOnClickListener(this);
}
private void unwire() {
itemView.setOnClickListener(null);
ivDownload.setOnClickListener(null);
}
@Override
public void onClick(View view) {
EntityAttachment attachment = filtered.get(getLayoutPosition());
if (attachment.content == null) {
}
final EntityAttachment attachment = filtered.get(getLayoutPosition());
if (attachment != null && attachment.content == null)
executor.submit(new Runnable() {
@Override
public void run() {
EntityMessage message = DB.getInstance(context).message().getMessage(attachment.message);
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.sequence);
}
});
}
}
@ -175,7 +188,11 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
EntityAttachment attachment = filtered.get(position);
holder.tvName.setText(attachment.name);
holder.tvType.setText(attachment.type);
holder.tvSize.setVisibility((attachment.content == null ? View.GONE : View.VISIBLE));
holder.ivDownload.setVisibility((attachment.content == null ? View.VISIBLE : View.GONE));
if (attachment.content != null)
holder.tvSize.setText(Helper.humanReadableByteCount(attachment.content.length, false));
holder.wire();
}


+ 7
- 0
app/src/main/java/eu/faircode/email/DaoAttachment.java View File

@ -24,6 +24,7 @@ import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;
import java.util.List;
@ -32,6 +33,12 @@ public interface DaoAttachment {
@Query("SELECT * FROM attachment WHERE message = :message")
LiveData<List<EntityAttachment>> liveAttachments(long message);
@Query("SELECT * FROM attachment WHERE message = :message AND sequence = :sequence")
EntityAttachment getAttachment(long message, int sequence);
@Insert(onConflict = OnConflictStrategy.REPLACE)
long insertAttachment(EntityAttachment attachment);
@Update
void updateAttachment(EntityAttachment attachment);
}

+ 6
- 0
app/src/main/java/eu/faircode/email/EntityAttachment.java View File

@ -21,10 +21,13 @@ package eu.faircode.email;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.ForeignKey;
import android.arch.persistence.room.Ignore;
import android.arch.persistence.room.Index;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
import javax.mail.BodyPart;
import static android.arch.persistence.room.ForeignKey.CASCADE;
@Entity(
@ -50,4 +53,7 @@ public class EntityAttachment {
@NonNull
public String type;
public byte[] content;
@Ignore
BodyPart part;
}

+ 1
- 0
app/src/main/java/eu/faircode/email/EntityOperation.java View File

@ -58,6 +58,7 @@ public class EntityOperation {
public static final String MOVE = "move";
public static final String DELETE = "delete";
public static final String SEND = "send";
public static final String ATTACHMENT = "attachment";
static void queue(Context context, EntityMessage message, String name) {
JSONArray jsonArray = new JSONArray();


+ 8
- 0
app/src/main/java/eu/faircode/email/Helper.java View File

@ -67,6 +67,14 @@ public class Helper {
return sb.toString();
}
static String humanReadableByteCount(long bytes, boolean si) {
int unit = si ? 1000 : 1024;
if (bytes < unit) return bytes + " B";
int exp = (int) (Math.log(bytes) / Math.log(unit));
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
}
static StringBuilder getDebugInfo() {
StringBuilder sb = new StringBuilder();


+ 1
- 0
app/src/main/java/eu/faircode/email/MessageHelper.java View File

@ -313,6 +313,7 @@ public class MessageHelper {
attachment.sequence = result.size() + 1;
attachment.name = part.getFileName();
attachment.type = ct.getBaseType();
attachment.part = part;
result.add(attachment);
}
} else if (content instanceof Multipart) {


+ 125
- 96
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -50,7 +50,9 @@ import com.sun.mail.imap.protocol.IMAPProtocol;
import org.json.JSONArray;
import org.json.JSONException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -566,124 +568,151 @@ public class ServiceSynchronize extends LifecycleService {
}
}
private void processOperations(EntityFolder folder, IMAPStore istore, IMAPFolder ifolder) throws MessagingException, JSONException {
private void processOperations(EntityFolder folder, IMAPStore istore, IMAPFolder ifolder) throws MessagingException, JSONException, IOException {
try {
Log.i(Helper.TAG, folder.name + " start process");
DB db = DB.getInstance(this);
DaoOperation operation = db.operation();
DaoMessage message = db.message();
for (TupleOperationEx op : operation.getOperations(folder.id)) {
Log.i(Helper.TAG, folder.name +
" Process op=" + op.id + "/" + op.name +
" args=" + op.args +
" msg=" + op.message);
JSONArray jargs = new JSONArray(op.args);
for (TupleOperationEx op : operation.getOperations(folder.id))
try {
if (EntityOperation.SEEN.equals(op.name)) {
// Mark message (un)seen
Message imessage = ifolder.getMessageByUID(op.uid);
if (imessage == null)
throw new MessageRemovedException();
imessage.setFlag(Flags.Flag.SEEN, jargs.getBoolean(0));
} else if (EntityOperation.ADD.equals(op.name)) {
if (!folder.synchronize) {
// Local drafts
Log.w(Helper.TAG, "Folder synchronization disabled");
return;
}
Log.i(Helper.TAG, folder.name +
" start op=" + op.id + "/" + op.name +
" args=" + op.args +
" msg=" + op.message);
JSONArray jargs = new JSONArray(op.args);
try {
if (EntityOperation.SEEN.equals(op.name)) {
// Mark message (un)seen
Message imessage = ifolder.getMessageByUID(op.uid);
if (imessage == null)
throw new MessageRemovedException();
imessage.setFlag(Flags.Flag.SEEN, jargs.getBoolean(0));
} else if (EntityOperation.ADD.equals(op.name)) {
if (!folder.synchronize) {
// Local drafts
Log.w(Helper.TAG, "Folder synchronization disabled");
return;
}
// Append message
EntityMessage msg = message.getMessage(op.message);
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
MimeMessage imessage = MessageHelper.from(msg, isession);
ifolder.appendMessages(new Message[]{imessage});
// Append message
EntityMessage msg = message.getMessage(op.message);
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
MimeMessage imessage = MessageHelper.from(msg, isession);
ifolder.appendMessages(new Message[]{imessage});
// Drafts can be appended multiple times
try {
if (msg.uid != null) {
Message previously = ifolder.getMessageByUID(msg.uid);
previously.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();
// Drafts can be appended multiple times
try {
if (msg.uid != null) {
Message previously = ifolder.getMessageByUID(msg.uid);
previously.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();
}
} finally {
// Remote will report appended
message.deleteMessage(op.message);
}
} finally {
// Remote will report appended
} else if (EntityOperation.MOVE.equals(op.name)) {
// Move message
EntityFolder archive = db.folder().getFolder(jargs.getLong(0));
Message imessage = ifolder.getMessageByUID(op.uid);
Folder target = istore.getFolder(archive.name);
ifolder.moveMessages(new Message[]{imessage}, target);
message.deleteMessage(op.message);
}
} else if (EntityOperation.MOVE.equals(op.name)) {
// Move message
EntityFolder archive = db.folder().getFolder(jargs.getLong(0));
Message imessage = ifolder.getMessageByUID(op.uid);
Folder target = istore.getFolder(archive.name);
ifolder.moveMessages(new Message[]{imessage}, target);
message.deleteMessage(op.message);
} else if (EntityOperation.DELETE.equals(op.name)) {
// Delete message
Message imessage = ifolder.getMessageByUID(op.uid);
if (imessage == null)
throw new MessageRemovedException();
imessage.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();
message.deleteMessage(op.message);
} else if (EntityOperation.SEND.equals(op.name)) {
// Send message
EntityMessage msg = message.getMessage(op.message);
EntityMessage reply = (msg.replying == null ? null : message.getMessage(msg.replying));
EntityIdentity ident = db.identity().getIdentity(msg.identity);
if (!ident.synchronize) {
// Message will remain in outbox
return;
}
} else if (EntityOperation.DELETE.equals(op.name)) {
// Delete message
Message imessage = ifolder.getMessageByUID(op.uid);
if (imessage == null)
throw new MessageRemovedException();
imessage.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
message.deleteMessage(op.message);
MimeMessage imessage;
if (reply == null)
imessage = MessageHelper.from(msg, isession);
else
imessage = MessageHelper.from(msg, reply, isession);
if (ident.replyto != null)
imessage.setReplyTo(new Address[]{new InternetAddress(ident.replyto)});
} else if (EntityOperation.SEND.equals(op.name)) {
// Send message
EntityMessage msg = message.getMessage(op.message);
EntityMessage reply = (msg.replying == null ? null : message.getMessage(msg.replying));
EntityIdentity ident = db.identity().getIdentity(msg.identity);
Transport itransport = isession.getTransport(ident.starttls ? "smtp" : "smtps");
try {
itransport.connect(ident.host, ident.port, ident.user, ident.password);
if (!ident.synchronize) {
// Message will remain in outbox
return;
}
Address[] to = imessage.getAllRecipients();
itransport.sendMessage(imessage, to);
Log.i(Helper.TAG, "Sent via " + ident.host + "/" + ident.user +
" to " + TextUtils.join(", ", to));
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
// Make sure the message is sent only once
operation.deleteOperation(op.id);
message.deleteMessage(op.message);
} finally {
itransport.close();
}
MimeMessage imessage;
if (reply == null)
imessage = MessageHelper.from(msg, isession);
else
imessage = MessageHelper.from(msg, reply, isession);
if (ident.replyto != null)
imessage.setReplyTo(new Address[]{new InternetAddress(ident.replyto)});
} else
throw new MessagingException("Unknown operation name=" + op.name);
Transport itransport = isession.getTransport(ident.starttls ? "smtp" : "smtps");
try {
itransport.connect(ident.host, ident.port, ident.user, ident.password);
Address[] to = imessage.getAllRecipients();
itransport.sendMessage(imessage, to);
Log.i(Helper.TAG, "Sent via " + ident.host + "/" + ident.user +
" to " + TextUtils.join(", ", to));
// Make sure the message is sent only once
operation.deleteOperation(op.id);
message.deleteMessage(op.message);
} finally {
itransport.close();
}
// Operation succeeded
operation.deleteOperation(op.id);
} else if (EntityOperation.ATTACHMENT.equals(op.name)) {
int sequence = jargs.getInt(0);
EntityAttachment attachment = db.attachment().getAttachment(op.message, sequence);
} catch (MessageRemovedException ex) {
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
Message imessage = ifolder.getMessageByUID(op.uid);
if (imessage == null)
throw new MessageRemovedException();
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
MessageHelper helper = new MessageHelper((MimeMessage) imessage);
EntityAttachment a = helper.getAttachments().get(sequence - 1);
InputStream is = a.part.getInputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
for (int len = is.read(buffer); len != -1; len = is.read(buffer))
os.write(buffer, 0, len);
// There is no use in repeating
operation.deleteOperation(op.id);
attachment.content = os.toByteArray();
db.attachment().updateAttachment(attachment);
Log.i(Helper.TAG, "Downloaded bytes=" + attachment.content.length);
} else
throw new MessagingException("Unknown operation name=" + op.name);
// Operation succeeded
operation.deleteOperation(op.id);
} catch (MessageRemovedException ex) {
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
// There is no use in repeating
operation.deleteOperation(op.id);
}
} finally {
Log.i(Helper.TAG, folder.name + " end op=" + op.id + "/" + op.name);
}
}
} finally {
Log.i(Helper.TAG, folder.name + " end process");
}


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Before After
Width: 144  |  Height: 144  |  Size: 263 B

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

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

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

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

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

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

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

Before After
Width: 144  |  Height: 144  |  Size: 263 B

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

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

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

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

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

Before After
Width: 144  |  Height: 144  |  Size: 263 B

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

Before After
Width: 192  |  Height: 192  |  Size: 303 B

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

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

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

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

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

Before After
Width: 144  |  Height: 144  |  Size: 263 B

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

Before After
Width: 192  |  Height: 192  |  Size: 303 B

+ 10
- 0
app/src/main/res/drawable/baseline_get_app_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="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
</vector>

+ 19
- 6
app/src/main/res/layout/item_attachment.xml View File

@ -16,25 +16,38 @@
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toStartOf="@+id/tvSize"
app:layout_constraintStart_toEndOf="@id/ivAttachments"
app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<TextView
android:id="@+id/tvType"
android:layout_width="0dp"
android:id="@+id/tvSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:gravity="end"
android:text="Type"
android:text="10 kB"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivDownload"
app:layout_constraintStart_toEndOf="@id/tvName"
app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<ImageView
android:id="@+id/ivDownload"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp"
android:src="@drawable/baseline_get_app_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvSize"
app:layout_constraintTop_toTopOf="@id/ivAttachments" />
</android.support.constraint.ConstraintLayout>

Loading…
Cancel
Save