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() {
|
private void showBlockSubmenu(View view) {
|
||||||
@Override
|
final Jid jid = conversation.getJid();
|
||||||
public void onClick(final View view) {
|
|
||||||
final Jid jid = conversation.getJid();
|
|
||||||
if (jid.isDomainJid()) {
|
if (jid.isDomainJid()) {
|
||||||
BlockContactDialog.show(activity, conversation);
|
BlockContactDialog.show(activity, conversation);
|
||||||
} else {
|
} else {
|
||||||
|
@ -980,6 +978,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
});
|
});
|
||||||
popupMenu.show();
|
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() {
|
private OnClickListener mAllowPresenceSubscription = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -1030,9 +1042,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
} else if (conversation.isBlocked()) {
|
} else if (conversation.isBlocked()) {
|
||||||
showSnackbar(R.string.contact_blocked, R.string.unblock, this.mUnblockClickListener);
|
showSnackbar(R.string.contact_blocked, R.string.unblock, this.mUnblockClickListener);
|
||||||
} else if (contact != null && !contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
} 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)) {
|
} 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
|
} else if (mode == Conversation.MODE_MULTI
|
||||||
&& !conversation.getMucOptions().online()
|
&& !conversation.getMucOptions().online()
|
||||||
&& account.getStatus() == Account.State.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) {
|
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.setVisibility(View.VISIBLE);
|
||||||
snackbar.setOnClickListener(null);
|
snackbar.setOnClickListener(null);
|
||||||
snackbarMessage.setText(message);
|
snackbarMessage.setText(message);
|
||||||
|
@ -1393,6 +1409,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
snackbarAction.setText(action);
|
snackbarAction.setText(action);
|
||||||
}
|
}
|
||||||
snackbarAction.setOnClickListener(clickListener);
|
snackbarAction.setOnClickListener(clickListener);
|
||||||
|
snackbarAction.setOnLongClickListener(longClickListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideSnackbar() {
|
protected void hideSnackbar() {
|
||||||
|
|
Loading…
Reference in New Issue