add snackbar for request presence subscription

This commit is contained in:
Daniel Gultsch 2016-08-26 10:19:59 +02:00
parent b52f079292
commit f931c08da7
3 changed files with 19 additions and 1 deletions

View File

@ -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() { private OnClickListener mAnswerSmpClickListener = new OnClickListener() {
@Override @Override
public void onClick(View view) { 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); showSnackbar(R.string.contact_blocked, R.string.unblock, this.mUnblockClickListener);
} else if (!contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { } else if (!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);
} 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 } else if (mode == Conversation.MODE_MULTI
&& !conversation.getMucOptions().online() && !conversation.getMucOptions().online()
&& account.getStatus() == Account.State.ONLINE) { && account.getStatus() == Account.State.ONLINE) {

View File

@ -2,7 +2,8 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/color_background_secondary">
<ListView <ListView
android:id="@+id/messages_view" android:id="@+id/messages_view"

View File

@ -677,4 +677,6 @@
<string name="payment_required">Payment required</string> <string name="payment_required">Payment required</string>
<string name="missing_internet_permission">Missing internet permission</string> <string name="missing_internet_permission">Missing internet permission</string>
<string name="me">Me</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> </resources>