show block menu after long press on allow/add back
This commit is contained in:
parent
63817ecda1
commit
22a058ff61
|
@ -954,9 +954,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
|||
}
|
||||
};
|
||||
|
||||
private OnClickListener mBlockClickListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
private void showBlockSubmenu(View view) {
|
||||
final Jid jid = conversation.getJid();
|
||||
if (jid.isDomainJid()) {
|
||||
BlockContactDialog.show(activity, conversation);
|
||||
|
@ -981,6 +979,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);
|
||||
}
|
||||
};
|
||||
|
||||
private OnClickListener mAddBackClickListener = new OnClickListener() {
|
||||
|
@ -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