aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-25 21:25:39 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-25 21:25:39 +0100
commit27a46c30757fb913594efdaf8606cf80cfa7d05c (patch)
treee762d71bcca440482b2f46059da7a66e4430cd01
parentae663440952fe0cffcfe4413b7268f045727454d (diff)
share uri for bookmark direclty from Start Conversation
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java21
-rw-r--r--src/main/res/menu/conference_context.xml3
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 30d7d20a0..2d24a27c9 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -13,6 +13,7 @@ import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.app.PendingIntent;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
@@ -339,6 +340,23 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
openConversationsForBookmark(bookmark);
}
+ protected void shareBookmarkUri() {
+ shareBookmarkUri(conference_context_id);
+ }
+
+ protected void shareBookmarkUri(int position) {
+ Bookmark bookmark = (Bookmark) conferences.get(position);
+ Intent shareIntent = new Intent();
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_TEXT, "xmpp:" + bookmark.getJid().toBareJid().toString() + "?join");
+ shareIntent.setType("text/plain");
+ try {
+ startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with)));
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
+ }
+ }
+
protected void openConversationsForBookmark(Bookmark bookmark) {
Jid jid = bookmark.getJid();
if (jid == null) {
@@ -1064,6 +1082,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
case R.id.context_join_conference:
activity.openConversationForBookmark();
break;
+ case R.id.context_share_uri:
+ activity.shareBookmarkUri();
+ break;
case R.id.context_delete_conference:
activity.deleteConference();
}
diff --git a/src/main/res/menu/conference_context.xml b/src/main/res/menu/conference_context.xml
index 6a6eb92d2..051a468d4 100644
--- a/src/main/res/menu/conference_context.xml
+++ b/src/main/res/menu/conference_context.xml
@@ -7,5 +7,8 @@
<item
android:id="@+id/context_delete_conference"
android:title="@string/delete_bookmark" />
+ <item
+ android:id="@+id/context_share_uri"
+ android:title="@string/share_uri_with" />
</menu> \ No newline at end of file