aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/ui/NewConversationActivity.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-01 01:25:56 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-01 01:25:56 +0100
commit43531113b798cda6b2f76257641f38b0af986437 (patch)
tree73107f086ec5d772a9041aa3ad4b1c7b8e0dcce9 /src/de/gultsch/chat/ui/NewConversationActivity.java
parentc3e4f0eaacf8ab32ceab32b8f46e8b7d85c71cfb (diff)
more code cleanup for xmpp parser. more eventy. nice unknown contact pictures
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/ui/NewConversationActivity.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/de/gultsch/chat/ui/NewConversationActivity.java b/src/de/gultsch/chat/ui/NewConversationActivity.java
index 9df5d5eb..b8061b23 100644
--- a/src/de/gultsch/chat/ui/NewConversationActivity.java
+++ b/src/de/gultsch/chat/ui/NewConversationActivity.java
@@ -9,7 +9,9 @@ import de.gultsch.chat.R;
import de.gultsch.chat.entities.Account;
import de.gultsch.chat.entities.Contact;
import de.gultsch.chat.entities.Conversation;
+import de.gultsch.chat.utils.Beautifier;
import de.gultsch.chat.utils.Validator;
+import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.text.Editable;
@@ -74,8 +76,7 @@ public class NewConversationActivity extends XmppActivity {
if (Validator.isValidJid(searchString)) {
String name = searchString.split("@")[0];
- Contact newContact = new Contact(name, searchString,
- DEFAULT_PROFILE_PHOTO);
+ Contact newContact = new Contact(name, searchString,null);
aggregatedContacts.add(newContact);
contactsHeader.setText("Create new contact");
} else {
@@ -100,8 +101,6 @@ public class NewConversationActivity extends XmppActivity {
+ "\") AND (" + ContactsContract.CommonDataKinds.Im.PROTOCOL
+ "=\"" + ContactsContract.CommonDataKinds.Im.PROTOCOL_JABBER
+ "\")";
- protected static final String DEFAULT_PROFILE_PHOTO = "android.resource://de.gultsch.chat/"
- + R.drawable.ic_profile;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -150,8 +149,13 @@ public class NewConversationActivity extends XmppActivity {
.setText(getItem(position).getDisplayName());
((TextView) view.findViewById(R.id.contact_jid))
.setText(getItem(position).getJid());
- ((ImageView) view.findViewById(R.id.contact_photo))
- .setImageURI(getItem(position).getProfilePhoto());
+ String profilePhoto = getItem(position).getProfilePhoto();
+ ImageView imageView = (ImageView) view.findViewById(R.id.contact_photo);
+ if (profilePhoto!=null) {
+ imageView.setImageURI(Uri.parse(profilePhoto));
+ } else {
+ imageView.setImageBitmap(Beautifier.getUnknownContactPicture(getItem(position).getDisplayName(),90));
+ }
return view;
}
};
@@ -222,9 +226,9 @@ public class NewConversationActivity extends XmppActivity {
while (cursor.moveToNext()) {
String profilePhoto = cursor.getString(cursor
.getColumnIndex(ContactsContract.Data.PHOTO_THUMBNAIL_URI));
- if (profilePhoto == null) {
+ /*if (profilePhoto == null) {
profilePhoto = DEFAULT_PROFILE_PHOTO;
- }
+ }*/
Contact contact = new Contact(
cursor.getString(cursor
.getColumnIndex(ContactsContract.Data.DISPLAY_NAME)),