refresh contact list
This commit is contained in:
parent
aa42eb544a
commit
cda1c2c3a1
|
@ -30,56 +30,59 @@ public final class R {
|
|||
public static final int ic_action_add=0x7f020001;
|
||||
public static final int ic_action_add_person=0x7f020002;
|
||||
public static final int ic_action_delete=0x7f020003;
|
||||
public static final int ic_action_send=0x7f020004;
|
||||
public static final int ic_action_send_now=0x7f020005;
|
||||
public static final int ic_action_unsecure=0x7f020006;
|
||||
public static final int ic_launcher=0x7f020007;
|
||||
public static final int ic_profile=0x7f020008;
|
||||
public static final int message_border=0x7f020009;
|
||||
public static final int notification=0x7f02000a;
|
||||
public static final int section_header=0x7f02000b;
|
||||
public static final int ic_action_refresh=0x7f020004;
|
||||
public static final int ic_action_send=0x7f020005;
|
||||
public static final int ic_action_send_now=0x7f020006;
|
||||
public static final int ic_action_unsecure=0x7f020007;
|
||||
public static final int ic_launcher=0x7f020008;
|
||||
public static final int ic_profile=0x7f020009;
|
||||
public static final int message_border=0x7f02000a;
|
||||
public static final int notification=0x7f02000b;
|
||||
public static final int section_header=0x7f02000c;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int account_confirm_password_desc=0x7f0a0011;
|
||||
public static final int account_delete=0x7f0a0025;
|
||||
public static final int account_disable=0x7f0a0026;
|
||||
public static final int account_enable=0x7f0a0027;
|
||||
public static final int account_confirm_password_desc=0x7f0a0012;
|
||||
public static final int account_delete=0x7f0a0026;
|
||||
public static final int account_disable=0x7f0a0027;
|
||||
public static final int account_enable=0x7f0a0028;
|
||||
public static final int account_jid=0x7f0a0000;
|
||||
public static final int account_list=0x7f0a001a;
|
||||
public static final int account_password=0x7f0a000e;
|
||||
public static final int account_password_confirm2=0x7f0a0012;
|
||||
public static final int account_list=0x7f0a001b;
|
||||
public static final int account_password=0x7f0a000f;
|
||||
public static final int account_password_confirm2=0x7f0a0013;
|
||||
public static final int account_status=0x7f0a0002;
|
||||
public static final int account_usetls=0x7f0a000f;
|
||||
public static final int action_accounts=0x7f0a0022;
|
||||
public static final int action_add=0x7f0a001e;
|
||||
public static final int action_add_account=0x7f0a0024;
|
||||
public static final int action_archive=0x7f0a0021;
|
||||
public static final int action_details=0x7f0a0020;
|
||||
public static final int action_security=0x7f0a001f;
|
||||
public static final int action_settings=0x7f0a0023;
|
||||
public static final int contactList=0x7f0a0005;
|
||||
public static final int contact_display_name=0x7f0a0007;
|
||||
public static final int contact_jid=0x7f0a0008;
|
||||
public static final int contact_photo=0x7f0a0006;
|
||||
public static final int contacts_header=0x7f0a0004;
|
||||
public static final int conversation_image=0x7f0a0009;
|
||||
public static final int conversation_lastmsg=0x7f0a000b;
|
||||
public static final int conversation_lastupdate=0x7f0a000c;
|
||||
public static final int conversation_name=0x7f0a000a;
|
||||
public static final int edit_account_register_new=0x7f0a0010;
|
||||
public static final int list=0x7f0a0018;
|
||||
public static final int message_body=0x7f0a001c;
|
||||
public static final int message_photo=0x7f0a001b;
|
||||
public static final int message_time=0x7f0a001d;
|
||||
public static final int messages_view=0x7f0a0016;
|
||||
public static final int new_conversation_search=0x7f0a0003;
|
||||
public static final int selected_conversation=0x7f0a0019;
|
||||
public static final int slidingpanelayout=0x7f0a0017;
|
||||
public static final int textSendButton=0x7f0a0015;
|
||||
public static final int textView1=0x7f0a000d;
|
||||
public static final int account_usetls=0x7f0a0010;
|
||||
public static final int action_accounts=0x7f0a0023;
|
||||
public static final int action_add=0x7f0a001f;
|
||||
public static final int action_add_account=0x7f0a0025;
|
||||
public static final int action_archive=0x7f0a0022;
|
||||
public static final int action_details=0x7f0a0021;
|
||||
public static final int action_refresh_contacts=0x7f0a0029;
|
||||
public static final int action_security=0x7f0a0020;
|
||||
public static final int action_settings=0x7f0a0024;
|
||||
public static final int contactList=0x7f0a0006;
|
||||
public static final int contact_display_name=0x7f0a0008;
|
||||
public static final int contact_jid=0x7f0a0009;
|
||||
public static final int contact_photo=0x7f0a0007;
|
||||
public static final int contacts_header=0x7f0a0005;
|
||||
public static final int conversation_image=0x7f0a000a;
|
||||
public static final int conversation_lastmsg=0x7f0a000c;
|
||||
public static final int conversation_lastupdate=0x7f0a000d;
|
||||
public static final int conversation_name=0x7f0a000b;
|
||||
public static final int edit_account_register_new=0x7f0a0011;
|
||||
public static final int list=0x7f0a0019;
|
||||
public static final int message_body=0x7f0a001d;
|
||||
public static final int message_photo=0x7f0a001c;
|
||||
public static final int message_time=0x7f0a001e;
|
||||
public static final int messages_view=0x7f0a0017;
|
||||
public static final int new_conversation_search=0x7f0a0004;
|
||||
public static final int progressBar1=0x7f0a0003;
|
||||
public static final int selected_conversation=0x7f0a001a;
|
||||
public static final int slidingpanelayout=0x7f0a0018;
|
||||
public static final int textSendButton=0x7f0a0016;
|
||||
public static final int textView1=0x7f0a000e;
|
||||
public static final int textView2=0x7f0a0001;
|
||||
public static final int textinput=0x7f0a0014;
|
||||
public static final int textsend=0x7f0a0013;
|
||||
public static final int textinput=0x7f0a0015;
|
||||
public static final int textsend=0x7f0a0014;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int account_row=0x7f030000;
|
||||
|
|
BIN
res/drawable-hdpi/ic_action_refresh.png
Normal file
BIN
res/drawable-hdpi/ic_action_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 678 B |
BIN
res/drawable-mdpi/ic_action_refresh.png
Normal file
BIN
res/drawable-mdpi/ic_action_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 507 B |
BIN
res/drawable-xhdpi/ic_action_refresh.png
Normal file
BIN
res/drawable-xhdpi/ic_action_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 901 B |
BIN
res/drawable-xxhdpi/ic_action_refresh.png
Normal file
BIN
res/drawable-xxhdpi/ic_action_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -4,6 +4,16 @@
|
|||
android:layout_height="match_parent"
|
||||
android:background="#e5e5e5" >
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar1"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/new_conversation_search"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -42,5 +52,4 @@
|
|||
tools:listitem="@layout/contact" >
|
||||
|
||||
</ListView>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,5 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item
|
||||
android:id="@+id/action_refresh_contacts"
|
||||
android:orderInCategory="10"
|
||||
android:showAsAction="always"
|
||||
android:icon="@drawable/ic_action_refresh"
|
||||
android:title="Refresh contact list" />
|
||||
<item
|
||||
android:id="@+id/action_accounts"
|
||||
android:orderInCategory="90"
|
||||
|
|
|
@ -17,7 +17,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
|||
public static final String SYSTEMACCOUNT = "systemaccount";
|
||||
public static final String PHOTOURI = "photouri";
|
||||
public static final String OPENPGPKEY = "pgpkey";
|
||||
public static final String LASTONLINEPRESENCE = "presence";
|
||||
public static final String LASTPRESENCE = "presence";
|
||||
public static final String ACCOUNT = "accountUuid";
|
||||
|
||||
protected String accountUuid;
|
||||
|
@ -27,7 +27,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
|||
protected int systemAccount;
|
||||
protected String photoUri;
|
||||
protected String openPGPKey;
|
||||
protected long lastOnlinePresence;
|
||||
protected long lastPresence;
|
||||
|
||||
|
||||
protected Account account;
|
||||
|
@ -52,7 +52,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
|||
this.photoUri = photoUri;
|
||||
this.systemAccount = systemAccount;
|
||||
this.openPGPKey = pgpKey;
|
||||
this.lastOnlinePresence = lastseen;
|
||||
this.lastPresence = lastseen;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
|
@ -82,7 +82,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
|||
values.put(SYSTEMACCOUNT, systemAccount);
|
||||
values.put(PHOTOURI,photoUri);
|
||||
values.put(OPENPGPKEY,openPGPKey);
|
||||
values.put(LASTONLINEPRESENCE,lastOnlinePresence);
|
||||
values.put(LASTPRESENCE,lastPresence);
|
||||
return values;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
|||
cursor.getString(cursor.getColumnIndex(PHOTOURI)),
|
||||
cursor.getInt(cursor.getColumnIndex(SYSTEMACCOUNT)),
|
||||
cursor.getString(cursor.getColumnIndex(OPENPGPKEY)),
|
||||
cursor.getLong(cursor.getColumnIndex(LASTONLINEPRESENCE))
|
||||
cursor.getLong(cursor.getColumnIndex(LASTPRESENCE))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
db.execSQL("create table " + Contact.TABLENAME + "(" + Contact.UUID
|
||||
+ " TEXT PRIMARY KEY, " + Contact.ACCOUNT + " TEXT, "
|
||||
+ Contact.DISPLAYNAME + " TEXT," + Contact.JID + " TEXT,"
|
||||
+ Contact.LASTONLINEPRESENCE + " NUMBER, " + Contact.OPENPGPKEY
|
||||
+ Contact.LASTPRESENCE + " NUMBER, " + Contact.OPENPGPKEY
|
||||
+ " TEXT," + Contact.PHOTOURI + " TEXT," + Contact.SUBSCRIPTION
|
||||
+ " TEXT," + Contact.SYSTEMACCOUNT + " NUMBER, "
|
||||
+ "FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES "
|
||||
|
@ -217,10 +217,11 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public List<Contact> getContacts() {
|
||||
public List<Contact> getContacts(Account account) {
|
||||
List<Contact> list = new ArrayList<Contact>();
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
Cursor cursor = db.query(Contact.TABLENAME, null, null, null, null,
|
||||
String args[] = {account.getUuid()};
|
||||
Cursor cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT+"=?", args, null,
|
||||
null, null);
|
||||
while (cursor.moveToNext()) {
|
||||
list.add(Contact.fromCursor(cursor));
|
||||
|
|
|
@ -18,6 +18,7 @@ import de.gultsch.chat.xmpp.IqPacket;
|
|||
import de.gultsch.chat.xmpp.MessagePacket;
|
||||
import de.gultsch.chat.xmpp.OnIqPacketReceived;
|
||||
import de.gultsch.chat.xmpp.OnMessagePacketReceived;
|
||||
import de.gultsch.chat.xmpp.OnPresencePacketReceived;
|
||||
import de.gultsch.chat.xmpp.OnStatusChanged;
|
||||
import de.gultsch.chat.xmpp.PresencePacket;
|
||||
import de.gultsch.chat.xmpp.XmppConnection;
|
||||
|
@ -124,6 +125,18 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
};
|
||||
|
||||
private OnPresencePacketReceived presenceListener = new OnPresencePacketReceived() {
|
||||
|
||||
@Override
|
||||
public void onPresencePacketReceived(Account account, PresencePacket packet) {
|
||||
String jid = packet.getAttribute("from");
|
||||
String type = packet.getAttribute("type");
|
||||
if (type==null) {
|
||||
Log.d(LOGTAG,"online presence from "+jid);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public class XmppConnectionBinder extends Binder {
|
||||
public XmppConnectionService getService() {
|
||||
return XmppConnectionService.this;
|
||||
|
@ -157,6 +170,7 @@ public class XmppConnectionService extends Service {
|
|||
XmppConnection connection = new XmppConnection(account, pm);
|
||||
connection.setOnMessagePacketReceivedListener(this.messageListener);
|
||||
connection.setOnStatusChangedListener(this.statusListener);
|
||||
connection.setOnPresencePacketReceivedListener(this.presenceListener);
|
||||
Thread thread = new Thread(connection);
|
||||
thread.start();
|
||||
return connection;
|
||||
|
@ -185,8 +199,8 @@ public class XmppConnectionService extends Service {
|
|||
databaseBackend.updateMessage(message);
|
||||
}
|
||||
|
||||
public void getRoster(final OnRosterFetchedListener listener) {
|
||||
List<Contact> contacts = databaseBackend.getContacts();
|
||||
public void getRoster(Account account, final OnRosterFetchedListener listener) {
|
||||
List<Contact> contacts = databaseBackend.getContacts(account);
|
||||
if (listener != null) {
|
||||
listener.onRosterFetched(contacts);
|
||||
}
|
||||
|
@ -249,7 +263,6 @@ public class XmppConnectionService extends Service {
|
|||
if (roster != null) {
|
||||
for (Element item : roster.getChildren()) {
|
||||
Contact contact;
|
||||
Log.d(LOGTAG, item.toString());
|
||||
String name = item.getAttribute("name");
|
||||
String jid = item.getAttribute("jid");
|
||||
if (phoneContacts.containsKey(jid)) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ConversationActivity extends XmppActivity {
|
|||
protected SlidingPaneLayout spl;
|
||||
|
||||
private List<Conversation> conversationList = new ArrayList<Conversation>();
|
||||
private int selectedConversation = 0;
|
||||
private Conversation selectedConversation = null;
|
||||
private ListView listView;
|
||||
|
||||
private boolean paneShouldBeOpen = true;
|
||||
|
@ -50,7 +50,7 @@ public class ConversationActivity extends XmppActivity {
|
|||
|
||||
@Override
|
||||
public void onConversationListChanged() {
|
||||
final Conversation currentConv = conversationList.get(selectedConversation);
|
||||
final Conversation currentConv = getSelectedConversation();
|
||||
conversationList.clear();
|
||||
conversationList.addAll(xmppConnectionService
|
||||
.getConversations());
|
||||
|
@ -59,14 +59,14 @@ public class ConversationActivity extends XmppActivity {
|
|||
@Override
|
||||
public void run() {
|
||||
updateConversationList();
|
||||
for(int i = 0; i < conversationList.size(); ++i) {
|
||||
if (currentConv.equals(conversationList.get(i))) {
|
||||
selectedConversation = i;
|
||||
/*for(int i = 0; i < conversationList.size(); ++i) {
|
||||
if (currentConv == conversationList.get(i)) {
|
||||
selectedConversation = conversationList.get(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if(paneShouldBeOpen) {
|
||||
selectedConversation = 0;
|
||||
selectedConversation = conversationList.get(0);
|
||||
if (conversationList.size() >= 1) {
|
||||
swapConversationFragment();
|
||||
} else {
|
||||
|
@ -88,7 +88,7 @@ public class ConversationActivity extends XmppActivity {
|
|||
return this.conversationList;
|
||||
}
|
||||
|
||||
public int getSelectedConversation() {
|
||||
public Conversation getSelectedConversation() {
|
||||
return this.selectedConversation;
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,8 @@ public class ConversationActivity extends XmppActivity {
|
|||
public void onItemClick(AdapterView<?> arg0, View clickedView,
|
||||
int position, long arg3) {
|
||||
paneShouldBeOpen = false;
|
||||
if (selectedConversation != position) {
|
||||
selectedConversation = position;
|
||||
if (selectedConversation != conversationList.get(position)) {
|
||||
selectedConversation = conversationList.get(position);
|
||||
swapConversationFragment(); //.onBackendConnected(conversationList.get(position));
|
||||
} else {
|
||||
spl.closePane();
|
||||
|
@ -202,7 +202,7 @@ public class ConversationActivity extends XmppActivity {
|
|||
paneShouldBeOpen = false;
|
||||
if (conversationList.size() > 0) {
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getActionBar().setTitle(conversationList.get(selectedConversation).getName());
|
||||
getActionBar().setTitle(getSelectedConversation().getName());
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
@ -225,6 +225,11 @@ public class ConversationActivity extends XmppActivity {
|
|||
((MenuItem) menu.findItem(R.id.action_security)).setVisible(false);
|
||||
} else {
|
||||
((MenuItem) menu.findItem(R.id.action_add)).setVisible(false);
|
||||
if (this.getSelectedConversation()!=null) {
|
||||
if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) {
|
||||
((MenuItem) menu.findItem(R.id.action_security)).setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -245,12 +250,12 @@ public class ConversationActivity extends XmppActivity {
|
|||
startActivity(new Intent(this, NewConversationActivity.class));
|
||||
break;
|
||||
case R.id.action_archive:
|
||||
Conversation conv = getConversationList().get(selectedConversation);
|
||||
Conversation conv = getSelectedConversation();
|
||||
conv.setStatus(Conversation.STATUS_ARCHIVED);
|
||||
paneShouldBeOpen = true;
|
||||
spl.openPane();
|
||||
xmppConnectionService.archiveConversation(conv);
|
||||
selectedConversation = 0;
|
||||
selectedConversation = conversationList.get(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -333,7 +338,7 @@ public class ConversationActivity extends XmppActivity {
|
|||
|
||||
for(int i = 0; i < conversationList.size(); ++i) {
|
||||
if (conversationList.get(i).getUuid().equals(convToView)) {
|
||||
selectedConversation = i;
|
||||
selectedConversation = conversationList.get(i);
|
||||
}
|
||||
}
|
||||
paneShouldBeOpen = false;
|
||||
|
@ -356,7 +361,7 @@ public class ConversationActivity extends XmppActivity {
|
|||
selectedFragment.onBackendConnected();
|
||||
} else {
|
||||
Log.d("gultsch","conversationactivity. no old fragment found. creating new one");
|
||||
selectedConversation = 0;
|
||||
selectedConversation = conversationList.get(0);
|
||||
Log.d("gultsch","selected conversation is #"+selectedConversation);
|
||||
swapConversationFragment();
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public class ConversationFragment extends Fragment {
|
|||
final ConversationActivity activity = (ConversationActivity) getActivity();
|
||||
|
||||
if (activity.xmppConnectionServiceBound) {
|
||||
this.conversation = activity.getConversationList().get(activity.getSelectedConversation());
|
||||
this.conversation = activity.getSelectedConversation();
|
||||
updateMessages();
|
||||
// rendering complete. now go tell activity to close pane
|
||||
if (!activity.shouldPaneBeOpen()) {
|
||||
|
@ -176,7 +176,7 @@ public class ConversationFragment extends Fragment {
|
|||
public void onBackendConnected() {
|
||||
Log.d("gultsch","calling on backend connected in conversation fragment");
|
||||
final ConversationActivity activity = (ConversationActivity) getActivity();
|
||||
this.conversation = activity.getConversationList().get(activity.getSelectedConversation());
|
||||
this.conversation = activity.getSelectedConversation();
|
||||
updateMessages();
|
||||
// rendering complete. now go tell activity to close pane
|
||||
if (!activity.shouldPaneBeOpen()) {
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.widget.AdapterView.OnItemClickListener;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ImageView;
|
||||
import android.annotation.SuppressLint;
|
||||
|
@ -210,21 +211,25 @@ public class NewConversationActivity extends XmppActivity {
|
|||
}
|
||||
this.accounts = xmppConnectionService.getAccounts();
|
||||
this.rosterContacts.clear();
|
||||
xmppConnectionService.getRoster(new OnRosterFetchedListener() {
|
||||
|
||||
@Override
|
||||
public void onRosterFetched(List<Contact> roster) {
|
||||
rosterContacts.addAll(roster);
|
||||
runOnUiThread(new Runnable() {
|
||||
for(int i = 0; i < accounts.size(); ++i) {
|
||||
if (accounts.get(i).getStatus()==Account.STATUS_ONLINE) {
|
||||
xmppConnectionService.getRoster(accounts.get(i),new OnRosterFetchedListener() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateAggregatedContacts();
|
||||
public void onRosterFetched(List<Contact> roster) {
|
||||
rosterContacts.addAll(roster);
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateAggregatedContacts();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -243,10 +248,48 @@ public class NewConversationActivity extends XmppActivity {
|
|||
case R.id.action_accounts:
|
||||
startActivity(new Intent(this, ManageAccountActivity.class));
|
||||
break;
|
||||
case R.id.action_refresh_contacts:
|
||||
refreshContacts();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void refreshContacts() {
|
||||
final ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar1);
|
||||
final EditText searchBar = (EditText) findViewById(R.id.new_conversation_search);
|
||||
final TextView contactsHeader = (TextView) findViewById(R.id.contacts_header);
|
||||
final ListView contactList = (ListView) findViewById(R.id.contactList);
|
||||
searchBar.setVisibility(View.GONE);
|
||||
contactsHeader.setVisibility(View.GONE);
|
||||
contactList.setVisibility(View.GONE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
this.accounts = xmppConnectionService.getAccounts();
|
||||
this.rosterContacts.clear();
|
||||
for (int i = 0; i < accounts.size(); ++i) {
|
||||
if (accounts.get(i).getStatus()==Account.STATUS_ONLINE) {
|
||||
xmppConnectionService.updateRoster(accounts.get(i),
|
||||
new OnRosterFetchedListener() {
|
||||
|
||||
@Override
|
||||
public void onRosterFetched(final List<Contact> roster) {
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
rosterContacts.addAll(roster);
|
||||
progress.setVisibility(View.GONE);
|
||||
searchBar.setVisibility(View.VISIBLE);
|
||||
contactList.setVisibility(View.VISIBLE);
|
||||
contactList.setVisibility(View.VISIBLE);
|
||||
updateAggregatedContacts();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue