provide access to show qr code from context menu in start conversation activity

This commit is contained in:
Daniel Gultsch 2018-04-20 17:12:47 +02:00
parent 8c1458abbf
commit 7368df94f7
2 changed files with 13 additions and 12 deletions

View File

@ -345,11 +345,6 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
switchToConversation(conversation); switchToConversation(conversation);
} }
protected void openConversationForContact() {
int position = contact_context_id;
openConversationForContact(position);
}
protected void openConversationForBookmark() { protected void openConversationForBookmark() {
openConversationForBookmark(conference_context_id); openConversationForBookmark(conference_context_id);
} }
@ -397,6 +392,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
switchToContactDetails(contact); switchToContactDetails(contact);
} }
protected void showQrForContact() {
int position = contact_context_id;
Contact contact = (Contact) contacts.get(position);
showQrCode("xmpp:"+contact.getJid().asBareJid().toEscapedString());
}
protected void toggleContactBlock() { protected void toggleContactBlock() {
final int position = contact_context_id; final int position = contact_context_id;
BlockContactDialog.show(this, (Contact) contacts.get(position)); BlockContactDialog.show(this, (Contact) contacts.get(position));
@ -1047,12 +1048,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
return true; return true;
} }
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.context_start_conversation:
activity.openConversationForContact();
break;
case R.id.context_contact_details: case R.id.context_contact_details:
activity.openDetailsForContact(); activity.openDetailsForContact();
break; break;
case R.id.context_show_qr:
activity.showQrForContact();
break;
case R.id.context_contact_block_unblock: case R.id.context_contact_block_unblock:
activity.toggleContactBlock(); activity.toggleContactBlock();
break; break;

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/context_start_conversation"
android:title="@string/start_conversation"/>
<item <item
android:id="@+id/context_contact_details" android:id="@+id/context_contact_details"
android:title="@string/view_contact_details"/> android:title="@string/view_contact_details"/>
<item
android:id="@+id/context_show_qr"
android:title="@string/show_qr_code"/>
<item <item
android:id="@+id/context_contact_block_unblock" android:id="@+id/context_contact_block_unblock"
android:title="@string/block_contact"/> android:title="@string/block_contact"/>