public final class IntentShare
extends java.lang.Object
implements android.os.Parcelable
IntentShare is designed to enhance the sharing experience by allowing to share
different content according to the application the user will choose to share with.| Modifier and Type | Class and Description |
|---|---|
static class |
IntentShare.ExtraProvider
Used to provide specific extras for a given package name
|
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<IntentShare> |
CREATOR
Parcelable.
|
static java.lang.String |
FACEBOOK
Facebook package.
|
static java.lang.String |
TWITTER
Twitter package.
|
| Modifier | Constructor and Description |
|---|---|
protected |
IntentShare(android.os.Parcel in)
IntentShare is designed to enhance the sharing experience by allowing to share
different content according to the application the user will choose to share with. |
| Modifier and Type | Method and Description |
|---|---|
IntentShare |
addExtraProvider(IntentShare.ExtraProvider extraProvider)
Allow to add a specific intent for a given
|
IntentShare |
chooserTitle(java.lang.String title)
Title that will be displayed in the chooser.
|
IntentShare |
comparatorProvider(TargetActivityComparatorProvider comparatorProvider)
Provide a custom
Comparator in order to sort the TargetActivity
displayed to the user. |
void |
deliver()
Deliver the intent to the system.
|
int |
describeContents() |
IntentShare |
facebookBody(android.net.Uri link)
Link which will be used as single shared content if target application is the facebook
since facebook app don't handle
Intent.EXTRA_TEXT
Override text(String) for the Facebook application. |
IntentShare |
iconLoader(IconLoader iconLoader)
Set the
IconLoader used to load target activities icon. |
IntentShare |
image(android.net.Uri imageUri)
Image which will be set as
Intent.EXTRA_STREAM if the
target application can handle it. |
IntentShare |
listener(IntentShareListener listener)
Allow to set a listener to be notified on chosen target activity.
|
IntentShare |
mailBody(java.lang.String mailBody)
Text which will be shared by any application marked as mail client
(application which can handle "message/rfc822").
|
IntentShare |
mailSubject(java.lang.String mailSubject)
Text which will be displayed inside the subject field of any application marked as mail
client (applcation which can handle "message/rfc822").
|
IntentShare |
text(java.lang.String text)
Text which will be shared.
|
IntentShare |
twitterBody(java.lang.String tweet)
Text which will be used as tweet body if target application is the Twitter one.
|
static IntentShare |
with(android.content.Context context)
IntentShare is designed to enhance the sharing experience by allowing to share
different content according to the application the user will choose to share with. |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final android.os.Parcelable.Creator<IntentShare> CREATOR
public static final java.lang.String FACEBOOK
public static final java.lang.String TWITTER
protected IntentShare(android.os.Parcel in)
IntentShare is designed to enhance the sharing experience by allowing to share
different content according to the application the user will choose to share with.in - parcel.public int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelablepublic static IntentShare with(android.content.Context context)
IntentShare is designed to enhance the sharing experience by allowing to share
different content according to the application the user will choose to share with.context - context from which the sharing is initiated.public IntentShare chooserTitle(java.lang.String title)
title - title that will be displayed in the chooser.IntentShare for method chaining.public IntentShare iconLoader(IconLoader iconLoader)
IconLoader used to load target activities icon.iconLoader - icon loader.IntentShare for method chaining.public IntentShare comparatorProvider(TargetActivityComparatorProvider comparatorProvider)
Comparator in order to sort the TargetActivity
displayed to the user.
By default, TargetActivities are sorted by the recentness of their selection. If it's the
behaviour that you are looking for, don't use this method and let the default comparator
bring the magic.comparatorProvider - comparator used to sort the TargetActivities displayed to the user.
Will override the default sorting by recentness.IntentShare for method chaining.public IntentShare text(java.lang.String text)
Intent.EXTRA_TEXTtext - text to share.IntentShare for method chaining.public IntentShare image(android.net.Uri imageUri)
Intent.EXTRA_STREAM if the
target application can handle it.imageUri - Uri of the image.IntentShare for method chaining.public IntentShare mailBody(java.lang.String mailBody)
text(String) for every mail application.mailBody - text set as text body for mail application.IntentShare for method chaining.public IntentShare mailSubject(java.lang.String mailSubject)
mailBody(String)mailSubject - subject of the mail.IntentShare for method chaining.public IntentShare facebookBody(android.net.Uri link)
Intent.EXTRA_TEXT
Override text(String) for the Facebook application.link - link to the content.IntentShare for method chaining.public IntentShare twitterBody(java.lang.String tweet)
text(String) for the Twitter application.
Note that length compliancy (140 char) isn't handle by the library anymore since tweet lenght can't be easily deduced from the text length directly.
Please refer to the following link if you want to ensure the length check on your side: https://blog.twitter.com/2016/doing-more-with-140-characters
tweet - tweet body.IntentShare for method chaining.public IntentShare listener(IntentShareListener listener)
listener - listener to register.IntentShare for method chaining.public IntentShare addExtraProvider(IntentShare.ExtraProvider extraProvider)
extraProvider - extra provider for a given package;IntentShare for method chaining.public void deliver()