From 5e93be9cbc17b438150610bb08b5f34c6865d1cc Mon Sep 17 00:00:00 2001 From: str4d Date: Wed, 27 Aug 2014 05:27:03 +0000 Subject: [PATCH] Show recipient for emails listed in Outbox and Sent --- TODO | 1 - .../java/i2p/bote/android/EmailListAdapter.java | 14 +++++++++----- app/src/main/res/layout/listitem_email.xml | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index 5e093f8..f35591c 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ Fixes: - Auto-comma the To: field when it loses focus -- Show recipient for emails listed in Outbox and Sent - Ask to login when opening "Create new identity" - Fix tick over selected emails - Refine view email page diff --git a/app/src/main/java/i2p/bote/android/EmailListAdapter.java b/app/src/main/java/i2p/bote/android/EmailListAdapter.java index e75e527..00fb1b8 100644 --- a/app/src/main/java/i2p/bote/android/EmailListAdapter.java +++ b/app/src/main/java/i2p/bote/android/EmailListAdapter.java @@ -55,7 +55,7 @@ public class EmailListAdapter extends ArrayAdapter { ImageView picture = (ImageView) v.findViewById(R.id.contact_picture); TextView subject = (TextView) v.findViewById(R.id.email_subject); - TextView from = (TextView) v.findViewById(R.id.email_from); + TextView address = (TextView) v.findViewById(R.id.email_address); TextView content = (TextView) v.findViewById(R.id.email_content); TextView sent = (TextView) v.findViewById(R.id.email_sent); @@ -72,14 +72,18 @@ public class EmailListAdapter extends ArrayAdapter { //} try { - String fromAddress = email.getOneFromAddress(); + String otherAddress; + if (BoteHelper.isSentEmail(email)) + otherAddress = email.getOneRecipient(); + else + otherAddress = email.getOneFromAddress(); - Bitmap pic = BoteHelper.getPictureForAddress(fromAddress); + Bitmap pic = BoteHelper.getPictureForAddress(otherAddress); if (pic != null) picture.setImageBitmap(pic); subject.setText(email.getSubject()); - from.setText(BoteHelper.getNameAndShortDestination(fromAddress)); + address.setText(BoteHelper.getNameAndShortDestination(otherAddress)); if (email.getSentDate() != null) sent.setText(DateFormat.getInstance().format( email.getSentDate())); @@ -95,7 +99,7 @@ public class EmailListAdapter extends ArrayAdapter { if (email.isUnread()) { subject.setTypeface(Typeface.DEFAULT_BOLD); - from.setTypeface(Typeface.DEFAULT_BOLD); + address.setTypeface(Typeface.DEFAULT_BOLD); } TextView emailStatus = (TextView) v.findViewById(R.id.email_status); diff --git a/app/src/main/res/layout/listitem_email.xml b/app/src/main/res/layout/listitem_email.xml index 494e643..19280e5 100644 --- a/app/src/main/res/layout/listitem_email.xml +++ b/app/src/main/res/layout/listitem_email.xml @@ -38,7 +38,7 @@ android:id="@+id/email_content" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignLeft="@+id/email_from" + android:layout_alignLeft="@+id/email_address" android:layout_below="@+id/email_subject" android:layout_toStartOf="@+id/email_status" android:ellipsize="end" @@ -46,7 +46,7 @@ android:text="Content" />