mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-04 16:25:06 -05:00
show block menu after long press on allow/add back
This commit is contained in:
parent
63817ecda1
commit
22a058ff61
@ -954,10 +954,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
}
|
||||
};
|
||||
|
||||
private OnClickListener mBlockClickListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
final Jid jid = conversation.getJid();
|
||||
private void showBlockSubmenu(View view) {
|
||||
final Jid jid = conversation.getJid();
|
||||
if (jid.isDomainJid()) {
|
||||
BlockContactDialog.show(activity, conversation);
|
||||
} else {
|
||||
@ -980,6 +978,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
});
|
||||
popupMenu.show();
|
||||
}
|
||||
}
|
||||
|
||||
private OnClickListener mBlockClickListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
showBlockSubmenu(view);
|
||||
}
|
||||
};
|
||||
|
||||
@ -995,6 +999,14 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnLongClickListener mLongPressBlockListener = new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
showBlockSubmenu(v);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private OnClickListener mAllowPresenceSubscription = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -1030,9 +1042,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
} else if (conversation.isBlocked()) {
|
||||
showSnackbar(R.string.contact_blocked, R.string.unblock, this.mUnblockClickListener);
|
||||
} else if (contact != null && !contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
||||
showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener);
|
||||
showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener, this.mLongPressBlockListener);
|
||||
} else if (contact != null && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
||||
showSnackbar(R.string.contact_asks_for_presence_subscription, R.string.allow, this.mAllowPresenceSubscription);
|
||||
showSnackbar(R.string.contact_asks_for_presence_subscription, R.string.allow, this.mAllowPresenceSubscription, this.mLongPressBlockListener);
|
||||
} else if (mode == Conversation.MODE_MULTI
|
||||
&& !conversation.getMucOptions().online()
|
||||
&& account.getStatus() == Account.State.ONLINE) {
|
||||
@ -1384,6 +1396,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
}
|
||||
|
||||
protected void showSnackbar(final int message, final int action, final OnClickListener clickListener) {
|
||||
showSnackbar(message,action,clickListener,null);
|
||||
}
|
||||
|
||||
protected void showSnackbar(final int message, final int action, final OnClickListener clickListener, final View.OnLongClickListener longClickListener) {
|
||||
snackbar.setVisibility(View.VISIBLE);
|
||||
snackbar.setOnClickListener(null);
|
||||
snackbarMessage.setText(message);
|
||||
@ -1393,6 +1409,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
snackbarAction.setText(action);
|
||||
}
|
||||
snackbarAction.setOnClickListener(clickListener);
|
||||
snackbarAction.setOnLongClickListener(longClickListener);
|
||||
}
|
||||
|
||||
protected void hideSnackbar() {
|
||||
|
Loading…
Reference in New Issue
Block a user