diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-05-20 11:44:43 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-05-20 11:44:43 +0200 |
commit | f79d92ab67206254df1c0c348898d60c3a741e0e (patch) | |
tree | 36e5d1e23ee5f87b508af8cd087cbe994fc52791 /src/eu | |
parent | 13f9f23946a1e8260b92c6006d0f7981fff8d35c (diff) |
highlight people in conferences by clicken on their picture
Diffstat (limited to 'src/eu')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index b551e6adc..7ab019361 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -392,20 +392,17 @@ public class ConversationFragment extends Fragment { if (type == RECIEVED) { if (item.getConversation().getMode() == Conversation.MODE_MULTI) { - if (item.getCounterpart() != null) { - viewHolder.contact_picture - .setImageBitmap(mBitmapCache.get(item - .getCounterpart(), null, - getActivity() - .getApplicationContext())); - } else { - viewHolder.contact_picture - .setImageBitmap(mBitmapCache.get( - item.getConversation().getName( - useSubject), null, - getActivity() - .getApplicationContext())); - } + viewHolder.contact_picture.setImageBitmap(mBitmapCache + .get(item.getCounterpart(), null, getActivity() + .getApplicationContext())); + viewHolder.contact_picture + .setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + highlightInConference(item.getCounterpart()); + } + }); } } @@ -461,6 +458,22 @@ public class ConversationFragment extends Fragment { return view; } + protected void highlightInConference(String nick) { + if (chatMsg.getText().toString().isEmpty()) { + chatMsg.setText(nick+": "); + } else { + String oldString = chatMsg.getText().toString(); + if (oldString.endsWith(" ")) { + chatMsg.setText(oldString+nick+" "); + } else { + chatMsg.setText(oldString+" "+nick+" "); + } + } + int position = chatMsg.length(); + Editable etext = chatMsg.getText(); + Selection.setSelection(etext, position); + } + protected Bitmap findSelfPicture() { SharedPreferences sharedPref = PreferenceManager .getDefaultSharedPreferences(getActivity() |