diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-05 22:33:39 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-05 22:33:39 +0100 |
commit | aa42eb544a1ebf99dc52d71c917b899d1fce628d (patch) | |
tree | bb5523f3342823faf7dce746d298f2650936d03a /src/de/gultsch/chat/ui/ConversationFragment.java | |
parent | 4670585e7a474d878c823df6de1846980b5c65d3 (diff) |
basic muc support. reworked contact list stuff
Diffstat (limited to 'src/de/gultsch/chat/ui/ConversationFragment.java')
-rw-r--r-- | src/de/gultsch/chat/ui/ConversationFragment.java | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/de/gultsch/chat/ui/ConversationFragment.java b/src/de/gultsch/chat/ui/ConversationFragment.java index 1b8edbb5..f2726945 100644 --- a/src/de/gultsch/chat/ui/ConversationFragment.java +++ b/src/de/gultsch/chat/ui/ConversationFragment.java @@ -115,11 +115,19 @@ public class ConversationFragment extends Fragment { } ImageView imageView = (ImageView) view.findViewById(R.id.message_photo); if (type == RECIEVED) { - Uri uri = item.getConversation().getProfilePhotoUri(); - if (uri!=null) { - imageView.setImageURI(uri); - } else { - imageView.setImageBitmap(UIHelper.getUnknownContactPicture(item.getConversation().getName(), 200)); + if(item.getConversation().getMode()==Conversation.MODE_SINGLE) { + Uri uri = item.getConversation().getProfilePhotoUri(); + if (uri!=null) { + imageView.setImageURI(uri); + } else { + imageView.setImageBitmap(UIHelper.getUnknownContactPicture(item.getConversation().getName(), 200)); + } + } else if (item.getConversation().getMode()==Conversation.MODE_MULTI) { + if (item.getCounterpart()!=null) { + imageView.setImageBitmap(UIHelper.getUnknownContactPicture(item.getCounterpart(), 200)); + } else { + imageView.setImageBitmap(UIHelper.getUnknownContactPicture(item.getConversation().getName(), 200)); + } } } else { imageView.setImageURI(profilePicture); @@ -152,12 +160,9 @@ public class ConversationFragment extends Fragment { final ConversationActivity activity = (ConversationActivity) getActivity(); - // TODO check if bond and get data back - if (activity.xmppConnectionServiceBound) { this.conversation = activity.getConversationList().get(activity.getSelectedConversation()); - this.messageList.clear(); - this.messageList.addAll(this.conversation.getMessages()); + updateMessages(); // rendering complete. now go tell activity to close pane if (!activity.shouldPaneBeOpen()) { activity.getSlidingPaneLayout().closePane(); @@ -165,18 +170,14 @@ public class ConversationFragment extends Fragment { activity.getActionBar().setTitle(conversation.getName()); activity.invalidateOptionsMenu(); } - - int size = this.messageList.size(); - if (size >= 1) - messagesView.setSelection(size - 1); } } 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.messageList.clear(); - this.messageList.addAll(this.conversation.getMessages()); + updateMessages(); // rendering complete. now go tell activity to close pane if (!activity.shouldPaneBeOpen()) { activity.getSlidingPaneLayout().closePane(); @@ -190,5 +191,8 @@ public class ConversationFragment extends Fragment { this.messageList.clear(); this.messageList.addAll(this.conversation.getMessages()); this.messageListAdapter.notifyDataSetChanged(); + int size = this.messageList.size(); + if (size >= 1) + messagesView.setSelection(size - 1); } } |