use of com.trovebox.android.common.model.Photo in project mobile-android by photo.
the class ShareUtils method shareViaEMail.
/**
* Shares the specified photo via email. The email application should be
* installed on the user device
*
* @param photo
* @param context
* @param loadingControl the loading control for token retrieval operation
*/
public static void shareViaEMail(Photo photo, final Context context, LoadingControl loadingControl) {
RunnableWithParameter<Photo> runnable = new RunnableWithParameter<Photo>() {
@Override
public void run(Photo photo) {
String mailId = "";
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", mailId, null));
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, CommonUtils.getStringResource(R.string.share_email_default_title));
String url = PhotoUtils.getShareUrl(photo);
String bodyText = CommonUtils.getStringResource(R.string.share_email_default_body, url, url);
emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(bodyText));
context.startActivity(Intent.createChooser(emailIntent, CommonUtils.getStringResource(R.string.share_email_send_title)));
}
};
PhotoUtils.validateShareTokenExistsAsyncAndRunAsync(photo, runnable, null, loadingControl);
}
use of com.trovebox.android.common.model.Photo in project mobile-android by photo.
the class ShareUtils method shareViaSystem.
/**
* Shares the specified photo url via system share menu.
*
* @param photo
* @param context
* @param loadingControl the loading control for token retrieval operation
*/
public static void shareViaSystem(Photo photo, final Context context, LoadingControl loadingControl) {
RunnableWithParameter<Photo> runnable = new RunnableWithParameter<Photo>() {
@Override
public void run(Photo photo) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, CommonUtils.getStringResource(R.string.share_system_default_title));
String url = PhotoUtils.getShareUrl(photo);
String bodyText = CommonUtils.getStringResource(R.string.share_system_default_body, url, url);
shareIntent.putExtra(Intent.EXTRA_TEXT, bodyText);
context.startActivity(Intent.createChooser(shareIntent, CommonUtils.getStringResource(R.string.share_system_send_title)));
}
};
PhotoUtils.validateShareTokenExistsAsyncAndRunAsync(photo, runnable, null, loadingControl);
}
Aggregations