use of com.waz.api.ConversationsList in project wire-android by wireapp.
the class ConversationListFragment method onConversationListUpdated.
//////////////////////////////////////////////////////////////////////////////////////////
//
// Notifications
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void onConversationListUpdated(@NonNull final ConversationsList conversationsList) {
ConversationsList conversations = mode == Mode.SHARING ? conversationsList.getEstablishedConversations() : conversationsList;
conversationsListAdapter.setConversationList(conversations);
// We post this to notify that we are ready after the items are instantiated
swipeListView.post(new Runnable() {
@Override
public void run() {
if (getContainer() == null) {
return;
}
}
});
if (pendingCurrentConversation != null) {
final int pos = getStoreFactory().getConversationStore().getPositionInList(pendingCurrentConversation);
if (pos > 0) {
// set selection after updating the conversationlist
new Handler().post(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
int selectionPos = pos - LIST_VIEW_POSITION_OFFSET < 0 ? 0 : pos - LIST_VIEW_POSITION_OFFSET;
swipeListView.setSelectionFromTop(selectionPos, 0);
pendingCurrentConversation = null;
}
});
}
}
// sync state
onConversationSyncingStateHasChanged(getStoreFactory().getConversationStore().getConversationSyncingState());
CoreList<IConversation> archivedConversations = conversationsList.getArchivedConversations();
if (archivedConversations != null && archivedConversations.size() > 0) {
archiveBox.setAlpha(1f);
} else {
archiveBox.setAlpha(0f);
}
if (conversationsList.isReady()) {
maybeShowNoContactsLabel(conversationsList.size() == 0);
}
}
Aggregations