aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/ui/NewConversationActivity.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-02 16:05:15 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-02 16:05:15 +0100
commitd365bbe480bdd26a042b425c45227785ab4fbf51 (patch)
tree4389b79b60d89724fd74eebf5674834888e9b436 /src/de/gultsch/chat/ui/NewConversationActivity.java
parent53d9c9997a508985f0e19aba928bfa25c80ba23e (diff)
fetching roster. fixed sending messages as type chat
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/ui/NewConversationActivity.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/de/gultsch/chat/ui/NewConversationActivity.java b/src/de/gultsch/chat/ui/NewConversationActivity.java
index b8061b23..b41ca761 100644
--- a/src/de/gultsch/chat/ui/NewConversationActivity.java
+++ b/src/de/gultsch/chat/ui/NewConversationActivity.java
@@ -51,6 +51,7 @@ public class NewConversationActivity extends XmppActivity {
protected EditText search;
protected String searchString = "";
private TextView contactsHeader;
+ private List<Account> accounts;
protected void updateAggregatedContacts() {
@@ -76,7 +77,7 @@ public class NewConversationActivity extends XmppActivity {
if (Validator.isValidJid(searchString)) {
String name = searchString.split("@")[0];
- Contact newContact = new Contact(name, searchString,null);
+ Contact newContact = new Contact(null,name, searchString,null);
aggregatedContacts.add(newContact);
contactsHeader.setText("Create new contact");
} else {
@@ -87,6 +88,7 @@ public class NewConversationActivity extends XmppActivity {
}
contactsAdapter.notifyDataSetChanged();
+ contactsView.setScrollX(0);
}
static final String[] PROJECTION = new String[] {
@@ -229,7 +231,7 @@ public class NewConversationActivity extends XmppActivity {
/*if (profilePhoto == null) {
profilePhoto = DEFAULT_PROFILE_PHOTO;
}*/
- Contact contact = new Contact(
+ Contact contact = new Contact(null,
cursor.getString(cursor
.getColumnIndex(ContactsContract.Data.DISPLAY_NAME)),
cursor.getString(cursor
@@ -250,6 +252,25 @@ public class NewConversationActivity extends XmppActivity {
getActionBar().setDisplayHomeAsUpEnabled(false);
getActionBar().setHomeButtonEnabled(false);
}
+ this.accounts = xmppConnectionService.getAccounts();
+ this.rosterContacts.clear();
+ for(Account account : this.accounts) {
+ xmppConnectionService.getRoster(account, new OnRosterFetchedListener() {
+
+ @Override
+ public void onRosterFetched(List<Contact> roster) {
+ rosterContacts.addAll(roster);
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ updateAggregatedContacts();
+ }
+ });
+
+ }
+ });
+ }
}
@Override