This commit is contained in:
iNPUTmice 2014-09-20 16:02:49 +02:00
parent 295bfb7f1d
commit 0b86f65bdc
4 changed files with 60 additions and 43 deletions

View file

@ -275,11 +275,23 @@ public class ConversationFragment extends Fragment {
@Override @Override
public void onContactPictureClicked(Message message) { public void onContactPictureClicked(Message message) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) { if (message.getStatus() <= Message.STATUS_RECEIVED) {
if (message.getPresence() != null) { if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
highlightInConference(message.getPresence()); if (message.getPresence() != null) {
highlightInConference(message.getPresence());
} else {
highlightInConference(message
.getCounterpart());
}
} else { } else {
highlightInConference(message.getCounterpart()); Contact contact = message.getConversation()
.getContact();
if (contact.showInRoster()) {
activity.switchToContactDetails(contact);
} else {
activity.showAddToRosterDialog(message
.getConversation());
}
} }
} }
} }
@ -289,11 +301,13 @@ public class ConversationFragment extends Fragment {
@Override @Override
public void onContactPictureLongClicked(Message message) { public void onContactPictureLongClicked(Message message) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) { if (message.getStatus() <= Message.STATUS_RECEIVED) {
if (message.getPresence() != null) { if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
privateMessageWith(message.getPresence()); if (message.getPresence() != null) {
} else { privateMessageWith(message.getPresence());
privateMessageWith(message.getCounterpart()); } else {
privateMessageWith(message.getCounterpart());
}
} }
} }
} }

View file

@ -62,7 +62,7 @@ public class ManageAccountActivity extends XmppActivity {
@Override @Override
public void onItemClick(AdapterView<?> arg0, View view, public void onItemClick(AdapterView<?> arg0, View view,
int position, long arg3) { int position, long arg3) {
editAccount(accountList.get(position)); switchToAccount(accountList.get(position));
} }
}); });
registerForContextMenu(accountListView); registerForContextMenu(accountListView);
@ -163,12 +163,6 @@ public class ManageAccountActivity extends XmppActivity {
} }
} }
private void editAccount(Account account) {
Intent intent = new Intent(this, EditAccountActivity.class);
intent.putExtra("jid", account.getJid());
startActivity(intent);
}
private void publishAvatar(Account account) { private void publishAvatar(Account account) {
Intent intent = new Intent(getApplicationContext(), Intent intent = new Intent(getApplicationContext(),
PublishProfilePictureActivity.class); PublishProfilePictureActivity.class);

View file

@ -248,6 +248,12 @@ public abstract class XmppActivity extends Activity {
startActivity(intent); startActivity(intent);
} }
public void switchToAccount(Account account) {
Intent intent = new Intent(this, EditAccountActivity.class);
intent.putExtra("jid", account.getJid());
startActivity(intent);
}
protected void inviteToConversation(Conversation conversation) { protected void inviteToConversation(Conversation conversation) {
Intent intent = new Intent(getApplicationContext(), Intent intent = new Intent(getApplicationContext(),
ChooseContactActivity.class); ChooseContactActivity.class);

View file

@ -406,6 +406,36 @@ public class MessageAdapter extends ArrayAdapter<Message> {
return view; return view;
} }
if (viewHolder.contact_picture != null) {
viewHolder.contact_picture
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (MessageAdapter.this.mOnContactPictureClickedListener != null) {
MessageAdapter.this.mOnContactPictureClickedListener
.onContactPictureClicked(item);
;
}
}
});
viewHolder.contact_picture
.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) {
MessageAdapter.this.mOnContactPictureLongClickedListener
.onContactPictureLongClicked(item);
return true;
} else {
return false;
}
}
});
}
if (type == RECEIVED) { if (type == RECEIVED) {
if (item.getConversation().getMode() == Conversation.MODE_MULTI) { if (item.getConversation().getMode() == Conversation.MODE_MULTI) {
Contact contact = item.getContact(); Contact contact = item.getContact();
@ -420,33 +450,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.contact_picture.setImageBitmap(mBitmapCache.get( viewHolder.contact_picture.setImageBitmap(mBitmapCache.get(
name, getContext())); name, getContext()));
} }
viewHolder.contact_picture
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (MessageAdapter.this.mOnContactPictureClickedListener != null) {
MessageAdapter.this.mOnContactPictureClickedListener
.onContactPictureClicked(item);
;
}
}
});
viewHolder.contact_picture
.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) {
MessageAdapter.this.mOnContactPictureLongClickedListener
.onContactPictureLongClicked(item);
return true;
} else {
return false;
}
}
});
} }
} }