highlight people in conferences by clicken on their picture

This commit is contained in:
Daniel Gultsch 2014-05-20 11:44:43 +02:00
parent 13f9f23946
commit f79d92ab67

View file

@ -392,20 +392,17 @@ public class ConversationFragment extends Fragment {
if (type == RECIEVED) { if (type == RECIEVED) {
if (item.getConversation().getMode() == Conversation.MODE_MULTI) { if (item.getConversation().getMode() == Conversation.MODE_MULTI) {
if (item.getCounterpart() != null) { viewHolder.contact_picture.setImageBitmap(mBitmapCache
viewHolder.contact_picture .get(item.getCounterpart(), null, getActivity()
.setImageBitmap(mBitmapCache.get(item
.getCounterpart(), null,
getActivity()
.getApplicationContext())); .getApplicationContext()));
} else {
viewHolder.contact_picture viewHolder.contact_picture
.setImageBitmap(mBitmapCache.get( .setOnClickListener(new OnClickListener() {
item.getConversation().getName(
useSubject), null, @Override
getActivity() public void onClick(View v) {
.getApplicationContext())); highlightInConference(item.getCounterpart());
} }
});
} }
} }
@ -461,6 +458,22 @@ public class ConversationFragment extends Fragment {
return view; 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() { protected Bitmap findSelfPicture() {
SharedPreferences sharedPref = PreferenceManager SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(getActivity() .getDefaultSharedPreferences(getActivity()