share uri for bookmark direclty from Start Conversation
This commit is contained in:
parent
66457c9f2e
commit
f2d9539d90
|
@ -13,6 +13,7 @@ import android.app.FragmentManager;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.app.ListFragment;
|
import android.app.ListFragment;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
@ -324,6 +325,23 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
openConversationsForBookmark(bookmark);
|
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) {
|
protected void openConversationsForBookmark(Bookmark bookmark) {
|
||||||
Jid jid = bookmark.getJid();
|
Jid jid = bookmark.getJid();
|
||||||
if (jid == null) {
|
if (jid == null) {
|
||||||
|
@ -1142,6 +1160,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
case R.id.context_join_conference:
|
case R.id.context_join_conference:
|
||||||
activity.openConversationForBookmark();
|
activity.openConversationForBookmark();
|
||||||
break;
|
break;
|
||||||
|
case R.id.context_share_uri:
|
||||||
|
activity.shareBookmarkUri();
|
||||||
|
break;
|
||||||
case R.id.context_delete_conference:
|
case R.id.context_delete_conference:
|
||||||
activity.deleteConference();
|
activity.deleteConference();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/context_delete_conference"
|
android:id="@+id/context_delete_conference"
|
||||||
android:title="@string/delete_bookmark"/>
|
android:title="@string/delete_bookmark"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/context_share_uri"
|
||||||
|
android:title="@string/share_uri_with"/>
|
||||||
</menu>
|
</menu>
|
Loading…
Reference in a new issue