diff --git a/src/com/fsck/k9/activity/AccountList.java b/src/com/fsck/k9/activity/AccountList.java index 638cf9024..d4f1f14c2 100644 --- a/src/com/fsck/k9/activity/AccountList.java +++ b/src/com/fsck/k9/activity/AccountList.java @@ -6,7 +6,6 @@ import java.util.List; import android.os.AsyncTask; import android.os.Bundle; -import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java index afa4b0973..f32c60e66 100644 --- a/src/com/fsck/k9/activity/Accounts.java +++ b/src/com/fsck/k9/activity/Accounts.java @@ -27,7 +27,6 @@ import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.util.SparseBooleanArray; -import android.util.TypedValue; import android.view.ContextMenu; import com.actionbarsherlock.app.ActionBar; diff --git a/src/com/fsck/k9/activity/FolderList.java b/src/com/fsck/k9/activity/FolderList.java index 6c9b103b8..ff51ad51d 100644 --- a/src/com/fsck/k9/activity/FolderList.java +++ b/src/com/fsck/k9/activity/FolderList.java @@ -14,7 +14,6 @@ import android.os.Handler; import android.os.PowerManager; import android.text.TextUtils.TruncateAt; import android.util.Log; -import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.KeyEvent; diff --git a/src/com/fsck/k9/view/MessageHeader.java b/src/com/fsck/k9/view/MessageHeader.java index 566a192b5..bab821950 100644 --- a/src/com/fsck/k9/view/MessageHeader.java +++ b/src/com/fsck/k9/view/MessageHeader.java @@ -10,12 +10,10 @@ import android.text.TextUtils; import android.text.style.StyleSpan; import android.util.Log; import android.util.AttributeSet; -import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; -import android.widget.ImageView; import android.widget.QuickContactBadge; import android.widget.ScrollView; @@ -46,7 +44,6 @@ public class MessageHeader extends ScrollView implements OnClickListener { private Context mContext; private TextView mFromView; private TextView mDateView; - private TextView mTimeView; private TextView mToView; private TextView mToLabel; private TextView mCcView; @@ -237,18 +234,10 @@ public class MessageHeader extends ScrollView implements OnClickListener { final CharSequence to = Address.toFriendly(message.getRecipients(Message.RecipientType.TO), contacts); final CharSequence cc = Address.toFriendly(message.getRecipients(Message.RecipientType.CC), contacts); - - - Address[] fromAddrs = message.getFrom(); Address[] toAddrs = message.getRecipients(Message.RecipientType.TO); Address[] ccAddrs = message.getRecipients(Message.RecipientType.CC); - boolean fromMe = mMessageHelper.toMe(account, fromAddrs); - boolean toMe = mMessageHelper.toMe(account, toAddrs); - boolean ccMe = mMessageHelper.toMe(account, ccAddrs); - - CharSequence displayName = mMessageHelper.getDisplayName(account, fromAddrs, toAddrs); String counterpartyAddress = null; if (fromMe) { @@ -261,8 +250,6 @@ public class MessageHeader extends ScrollView implements OnClickListener { counterpartyAddress = fromAddrs[0].getAddress(); } - - mMessage = message; mAccount = account; @@ -274,8 +261,6 @@ public class MessageHeader extends ScrollView implements OnClickListener { mContactBadge.setVisibility(View.GONE); } - - final String subject = message.getSubject(); if (StringUtils.isNullOrEmpty(subject)) { mSubjectView.setText(mContext.getText(R.string.general_no_subject)); @@ -284,23 +269,21 @@ public class MessageHeader extends ScrollView implements OnClickListener { } mSubjectView.setTextColor(0xff000000 | defaultSubjectColor); - if (date != null) { mDateView.setText(time + " - " + date); } else { mDateView.setText(time); } + if (K9.showContactPicture()) { - mContactBadge.assignContactFromEmail(counterpartyAddress.toString(), true); - if (counterpartyAddress != null) { - mContactsPictureLoader.loadContactPicture(counterpartyAddress.toString(), mContactBadge); - } else { - mContactBadge.setImageResource(R.drawable.ic_contact_picture); - } - - - + mContactBadge.assignContactFromEmail(counterpartyAddress, true); + if (counterpartyAddress != null) { + mContactsPictureLoader.loadContactPicture(counterpartyAddress, mContactBadge); + } else { + mContactBadge.setImageResource(R.drawable.ic_contact_picture); + } } + mFromView.setText(from); updateAddressField(mToView, to, mToLabel); @@ -342,18 +325,11 @@ public class MessageHeader extends ScrollView implements OnClickListener { private void updateAddressField(TextView v, CharSequence text, View label) { - if (TextUtils.isEmpty(text)) { - v.setVisibility(View.GONE); - label.setVisibility(View.GONE); - - return; - } - + boolean hasText = !TextUtils.isEmpty(text); v.setText(text); - v.setVisibility(View.VISIBLE); - label.setVisibility(View.VISIBLE); - + v.setVisibility(hasText ? View.VISIBLE : View.GONE); + label.setVisibility(hasText ? View.VISIBLE : View.GONE); } /**