Permalink
Browse files

am f54c408: am ac5b230: App doesn\'t know your pic on initial send

* commit 'f54c40884e8d812605b7dfad27c763836b97f7e4':
  App doesn't know your pic on initial send
  • Loading branch information...
2 parents f899770 + f54c408 commit 34bdd1b621a23ca63fdc8c8c151f6add397ce457 Tom Taylor committed with Android Git Automerger Nov 8, 2012
Showing with 19 additions and 7 deletions.
  1. +19 −7 src/com/android/mms/ui/MessageListItem.java
@@ -150,8 +150,8 @@ public void bind(MessageItem msgItem, boolean convHasMultiRecipients, int positi
" new " + msgItem.toString());
}
boolean sameItem = mMessageItem != null && mMessageItem.mMsgId == msgItem.mMsgId;
-
mMessageItem = msgItem;
+
mPosition = position;
mMultiRecipients = convHasMultiRecipients;
@@ -305,7 +305,16 @@ private void bindCommonMessage(final boolean sameItem) {
// displaying it by the Presenter.
mBodyTextView.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
- if (!sameItem) {
+ boolean haveLoadedPdu = mMessageItem.isSms() || mMessageItem.mSlideshow != null;
+ // Here we're avoiding reseting the avatar to the empty avatar when we're rebinding
+ // to the same item. This happens when there's a DB change which causes the message item
+ // cache in the MessageListAdapter to get cleared. When an mms MessageItem is newly
+ // created, it has no info in it except the message id. The info is eventually loaded
+ // and bindCommonMessage is called again (see onPduLoaded below). When we haven't loaded
+ // the pdu, we don't want to call updateAvatarView because it
+ // will set the avatar to the generic avatar then when this method is called again
+ // from onPduLoaded, it will reset to the real avatar. This test is to avoid that flash.
+ if (!sameItem || haveLoadedPdu) {
boolean isSelf = Sms.isOutgoingFolder(mMessageItem.mBoxId);
String addr = isSelf ? null : mMessageItem.mAddress;
updateAvatarView(addr, isSelf);
@@ -324,7 +333,9 @@ private void bindCommonMessage(final boolean sameItem) {
mMessageItem.mTextContentType);
mMessageItem.setCachedFormattedMessage(formattedMessage);
}
- mBodyTextView.setText(formattedMessage);
+ if (!sameItem || haveLoadedPdu) {
+ mBodyTextView.setText(formattedMessage);
+ }
// Debugging code to put the URI of the image attachment in the body of the list item.
if (DEBUG) {
@@ -346,10 +357,11 @@ private void bindCommonMessage(final boolean sameItem) {
// If we're in the process of sending a message (i.e. pending), then we show a "SENDING..."
// string in place of the timestamp.
- mDateView.setText(buildTimestampLine(mMessageItem.isSending() ?
- mContext.getResources().getString(R.string.sending_message) :
- mMessageItem.mTimestamp));
-
+ if (!sameItem || haveLoadedPdu) {
+ mDateView.setText(buildTimestampLine(mMessageItem.isSending() ?
+ mContext.getResources().getString(R.string.sending_message) :
+ mMessageItem.mTimestamp));
+ }
if (mMessageItem.isSms()) {
showMmsView(false);
mMessageItem.setOnPduLoaded(null);

0 comments on commit 34bdd1b

Please sign in to comment.