Show attachments and delivery status in email list
This commit is contained in:
@@ -6,9 +6,11 @@ import java.text.DateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.Part;
|
||||
|
||||
import i2p.bote.android.util.BoteHelper;
|
||||
import i2p.bote.email.Email;
|
||||
import i2p.bote.email.EmailDestination;
|
||||
import i2p.bote.fileencryption.PasswordException;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -80,10 +82,32 @@ public class EmailListAdapter extends ArrayAdapter<Email> {
|
||||
sent.setText(DateFormat.getInstance().format(
|
||||
email.getSentDate()));
|
||||
|
||||
List<Part> parts = email.getParts();
|
||||
for (Part part : parts) {
|
||||
if (Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) {
|
||||
((ImageView) v.findViewById(
|
||||
R.id.email_attachment)).setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (email.isNew()) {
|
||||
subject.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
from.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
}
|
||||
|
||||
// Set email status if we sent it
|
||||
String fromDest = EmailDestination.extractBase64Dest(fromAddress);
|
||||
if (fromDest != null && BoteHelper.getIdentity(fromDest) != null) {
|
||||
TextView emailStatus = (TextView) v.findViewById(R.id.email_status_text);
|
||||
if (email.isDelivered())
|
||||
((ImageView) v.findViewById(
|
||||
R.id.email_status)).setVisibility(View.VISIBLE);
|
||||
else if (email.getDeliveryPercentage() > 0)
|
||||
emailStatus.setText(email.getDeliveryPercentage() + "%");
|
||||
else
|
||||
emailStatus.setText(BoteHelper.getEmailStatus(email));
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
subject.setText("ERROR: " + e.getMessage());
|
||||
} catch (PasswordException e) {
|
||||
|
||||
Reference in New Issue
Block a user