mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-25 00:48:52 -05:00
will update messages on conversation update as well
This commit is contained in:
parent
d365bbe480
commit
bbdaf5b0bd
@ -73,6 +73,10 @@ public class ConversationActivity extends XmppActivity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ConversationFragment selectedFragment = (ConversationFragment) getFragmentManager().findFragmentByTag("conversation");
|
||||||
|
if (selectedFragment!=null) {
|
||||||
|
selectedFragment.updateMessages();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@ public class ConversationFragment extends Fragment {
|
|||||||
protected ListView messagesView;
|
protected ListView messagesView;
|
||||||
protected LayoutInflater inflater;
|
protected LayoutInflater inflater;
|
||||||
protected List<Message> messageList = new ArrayList<Message>();
|
protected List<Message> messageList = new ArrayList<Message>();
|
||||||
|
protected ArrayAdapter<Message> messageListAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(final LayoutInflater inflater,
|
public View onCreateView(final LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
@ -76,7 +77,7 @@ public class ConversationFragment extends Fragment {
|
|||||||
mProfileCursor.moveToFirst();
|
mProfileCursor.moveToFirst();
|
||||||
final Uri profilePicture = Uri.parse(mProfileCursor.getString(1));
|
final Uri profilePicture = Uri.parse(mProfileCursor.getString(1));
|
||||||
|
|
||||||
messagesView.setAdapter(new ArrayAdapter<Message>(this.getActivity()
|
messageListAdapter = new ArrayAdapter<Message>(this.getActivity()
|
||||||
.getApplicationContext(), R.layout.message_sent, this.messageList) {
|
.getApplicationContext(), R.layout.message_sent, this.messageList) {
|
||||||
|
|
||||||
private static final int SENT = 0;
|
private static final int SENT = 0;
|
||||||
@ -134,7 +135,8 @@ public class ConversationFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
messagesView.setAdapter(messageListAdapter);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@ -180,4 +182,10 @@ public class ConversationFragment extends Fragment {
|
|||||||
activity.invalidateOptionsMenu();
|
activity.invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateMessages() {
|
||||||
|
this.messageList.clear();
|
||||||
|
this.messageList.addAll(this.conversation.getMessages());
|
||||||
|
this.messageListAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user