diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-26 10:19:59 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-08-26 10:19:59 +0200 |
commit | f931c08da7fba912592fe7be495bfd47a4069178 (patch) | |
tree | e95ace84e02dd73cdc091a5efd42479d5d4d3ae7 | |
parent | b52f07929255f4cb43c97d6c2a0a019b0386fcb0 (diff) |
add snackbar for request presence subscription
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 15 | ||||
-rw-r--r-- | src/main/res/layout/fragment_conversation.xml | 3 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 2 |
3 files changed, 19 insertions, 1 deletions
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 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:background="?attr/color_background_secondary"> <ListView android:id="@+id/messages_view" diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 878e4be8..c03efa16 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -677,4 +677,6 @@ <string name="payment_required">Payment required</string> <string name="missing_internet_permission">Missing internet permission</string> <string name="me">Me</string> + <string name="contact_asks_for_presence_subscription">Contact asks for presence subscription</string> + <string name="allow">Allow</string> </resources> |