1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 08:52:18 -05:00

Add new conversations to DeckAdapter in onResume()

Currently, when the user opens a ConversationActivity, goes off to do
something else without closing it, and then comes back to the activity,
conversations started since the ConversationActivity was paused (e.g. by
an incoming private message) will not appear in the ConversationGallery;
this is because we never check for new conversations in the onResume()
path.

Fortunately, this is an easy fix: we're already looping over all the
conversations in onResume() in order to add new messages to the
MessageListViews, so just look out for the new conversations and add
them to the ConversationGallery when we see them.
This commit is contained in:
Steven Luo 2011-08-16 02:11:04 -07:00 committed by Sebastian Kaspari
parent c8266fbe62
commit f84369bc19

View File

@ -312,11 +312,17 @@ public class ConversationActivity extends Activity implements ServiceConnection,
// Fill view with messages that have been buffered while paused // Fill view with messages that have been buffered while paused
for (Conversation conversation : mConversations) { for (Conversation conversation : mConversations) {
mAdapter = deckAdapter.getItemAdapter(conversation.getName()); String name = conversation.getName();
mAdapter = deckAdapter.getItemAdapter(name);
if (mAdapter != null) { if (mAdapter != null) {
mAdapter.addBulkMessages(conversation.getBuffer()); mAdapter.addBulkMessages(conversation.getBuffer());
conversation.clearBuffer(); conversation.clearBuffer();
} else {
// Was conversation created while we were paused?
if (deckAdapter.getPositionByName(name) == -1) {
onNewConversation(name);
}
} }
// Clear new message notifications for the selected conversation // Clear new message notifications for the selected conversation
@ -324,7 +330,7 @@ public class ConversationActivity extends Activity implements ServiceConnection,
Intent ackIntent = new Intent(this, IRCService.class); Intent ackIntent = new Intent(this, IRCService.class);
ackIntent.setAction(IRCService.ACTION_ACK_NEW_MENTIONS); ackIntent.setAction(IRCService.ACTION_ACK_NEW_MENTIONS);
ackIntent.putExtra(IRCService.EXTRA_ACK_SERVERID, serverId); ackIntent.putExtra(IRCService.EXTRA_ACK_SERVERID, serverId);
ackIntent.putExtra(IRCService.EXTRA_ACK_CONVTITLE, conversation.getName()); ackIntent.putExtra(IRCService.EXTRA_ACK_CONVTITLE, name);
startService(ackIntent); startService(ackIntent);
} }
} }