From f931c08da7fba912592fe7be495bfd47a4069178 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 26 Aug 2016 10:19:59 +0200 Subject: add snackbar for request presence subscription --- .../eu/siacs/conversations/ui/ConversationFragment.java | 15 +++++++++++++++ src/main/res/layout/fragment_conversation.xml | 3 ++- src/main/res/values/strings.xml | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 19e96daf..ad3ca4ea 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -818,6 +818,19 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } }; + private OnClickListener mAllowPresenceSubscription = new OnClickListener() { + @Override + public void onClick(View v) { + final Contact contact = conversation == null ? null : conversation.getContact(); + if (contact != null) { + activity.xmppConnectionService.sendPresencePacket(contact.getAccount(), + activity.xmppConnectionService.getPresenceGenerator() + .sendPresenceUpdatesTo(contact)); + hideSnackbar(); + } + } + }; + private OnClickListener mAnswerSmpClickListener = new OnClickListener() { @Override public void onClick(View view) { @@ -840,6 +853,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa showSnackbar(R.string.contact_blocked, R.string.unblock, this.mUnblockClickListener); } else if (!contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener); + } else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { + showSnackbar(R.string.contact_asks_for_presence_subscription, R.string.allow, this.mAllowPresenceSubscription); } else if (mode == Conversation.MODE_MULTI && !conversation.getMucOptions().online() && account.getStatus() == Account.State.ONLINE) { diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index 6a621287..9f54fc42 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -2,7 +2,8 @@ + android:layout_height="match_parent" + android:background="?attr/color_background_secondary"> Payment required Missing internet permission Me + Contact asks for presence subscription + Allow -- cgit v1.2.3