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
public void onContactPictureClicked(Message message) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
if (message.getPresence() != null) {
highlightInConference(message.getPresence());
if (message.getStatus() <= Message.STATUS_RECEIVED) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
if (message.getPresence() != null) {
highlightInConference(message.getPresence());
} else {
highlightInConference(message
.getCounterpart());
}
} 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
public void onContactPictureLongClicked(Message message) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
if (message.getPresence() != null) {
privateMessageWith(message.getPresence());
} else {
privateMessageWith(message.getCounterpart());
if (message.getStatus() <= Message.STATUS_RECEIVED) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
if (message.getPresence() != null) {
privateMessageWith(message.getPresence());
} else {
privateMessageWith(message.getCounterpart());
}
}
}
}

View file

@ -62,7 +62,7 @@ public class ManageAccountActivity extends XmppActivity {
@Override
public void onItemClick(AdapterView<?> arg0, View view,
int position, long arg3) {
editAccount(accountList.get(position));
switchToAccount(accountList.get(position));
}
});
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) {
Intent intent = new Intent(getApplicationContext(),
PublishProfilePictureActivity.class);

View file

@ -247,6 +247,12 @@ public abstract class XmppActivity extends Activity {
intent.putExtra("contact", contact.getJid());
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) {
Intent intent = new Intent(getApplicationContext(),

View file

@ -406,6 +406,36 @@ public class MessageAdapter extends ArrayAdapter<Message> {
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 (item.getConversation().getMode() == Conversation.MODE_MULTI) {
Contact contact = item.getContact();
@ -420,33 +450,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.contact_picture.setImageBitmap(mBitmapCache.get(
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;
}
}
});
}
}