--- a/src/com/beem/project/beem/service/Contact.java Fri Oct 23 18:05:12 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Fri Oct 23 18:12:54 2009 +0200
@@ -253,8 +253,14 @@
* @param name the mName to set
*/
public void setName(String name) {
- if (name != null)
+ if (name == null || "".equals(name)) {
+ this.mName = this.mJID;
+ this.mName = StringUtils.parseName(this.mName);
+ if (this.mName == null || "".equals(this.mName))
+ this.mName = this.mJID;
+ } else {
this.mName = name;
+ }
}
/**
--- a/src/com/beem/project/beem/ui/ContactList.java Fri Oct 23 18:05:12 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Fri Oct 23 18:12:54 2009 +0200
@@ -15,7 +15,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
-import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
@@ -561,14 +560,7 @@
}
imgV.setImageDrawable(imageDrawable);
- String mContactName = curContact.getName();
- if (mContactName == null || "".equals(mContactName)) {
- mContactName = curContact.getJID();
- mContactName = StringUtils.parseName(mContactName);
- if ("".equals(mContactName))
- mContactName = curContact.getJID();
- }
- v.setText(mContactName);
+ v.setText(curContact.getName());
v.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
v.setTextColor(Color.WHITE);
v.setTextSize(14);
--- a/src/com/beem/project/beem/ui/SendIM.java Fri Oct 23 18:05:12 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java Fri Oct 23 18:12:54 2009 +0200
@@ -64,7 +64,6 @@
private Handler mHandler;
private Contact mContact;
private ImageView mStatusIcon;
- private String mContactName;
private IChatManager mChatManager;
private IChatManagerListener mChatManagerListener;
private IMessageListener mMessageListener;
@@ -316,14 +315,7 @@
if (mRoster.getContact(mContact.getJID()) != null) {
mContact = mRoster.getContact(mContact.getJID());
mStatusText.setText(mContact.getMsgState());
- String contactName = mContact.getName();
- if (contactName == null || "".equals(contactName)) {
- contactName = mContact.getJID();
- contactName = StringUtils.parseName(contactName);
- if (contactName == null || "".equals(contactName))
- contactName = mContact.getJID();
- }
- mLogin.setText(contactName);
+ mLogin.setText(mContact.getName());
}
updateStatusIcon();
}
@@ -386,7 +378,7 @@
mSpeak = 1;
} else {
if (mSpeak != 2)
- mText.append(getString(R.string.SendIMSays, mContactName, message.getBody()));
+ mText.append(getString(R.string.SendIMSays, mContact.getName(), message.getBody()));
else
mText.append(getString(R.string.SendIMSameSpeaker, message.getBody()));
mSpeak = 2;
@@ -531,7 +523,7 @@
} else if (mSpeak == 2)
mText.append(getString(R.string.SendIMSameSpeaker, m.getBody()));
else
- mText.append(getString(R.string.SendIMSays, mContactName, m.getBody()));
+ mText.append(getString(R.string.SendIMSays, mContact.getName(), m.getBody()));
mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
mToSend.requestFocus();
mSpeak = 2;