X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/271078a4039f3c674462f929bc97528901e41e64..af1f880b27f12c95703c37077e8074a9c9851df8:/src/com/owncloud/android/ui/dialog/ShareLinkToDialog.java diff --git a/src/com/owncloud/android/ui/dialog/ShareLinkToDialog.java b/src/com/owncloud/android/ui/dialog/ShareLinkToDialog.java index e0e76d14..68e1485b 100644 --- a/src/com/owncloud/android/ui/dialog/ShareLinkToDialog.java +++ b/src/com/owncloud/android/ui/dialog/ShareLinkToDialog.java @@ -107,23 +107,46 @@ public class ShareLinkToDialog extends SherlockDialogFragment { Collections.sort(activities, new ResolveInfo.DisplayNameComparator(pm)); mAdapter = new ActivityAdapter(getSherlockActivity(), pm, activities); - return new AlertDialog.Builder(getSherlockActivity()) - .setTitle(R.string.activity_chooser_title) - .setAdapter(mAdapter, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // Add the information of the chosen activity to the intent to send - ResolveInfo chosen = mAdapter.getItem(which); - ActivityInfo actInfo = chosen.activityInfo; - ComponentName name=new ComponentName(actInfo.applicationInfo.packageName, actInfo.name); - mIntent.setComponent(name); - - // Create a new share resource - FileOperationsHelper foh = new FileOperationsHelper(); - foh.shareFileWithLinkToApp(mFile, mIntent, (FileActivity)getSherlockActivity()); - } - }) - .create(); + boolean sendAction = mIntent.getBooleanExtra(Intent.ACTION_SEND, false); + + if (sendAction) { + + return new AlertDialog.Builder(getSherlockActivity()) + .setTitle(R.string.activity_chooser_send_file_title) + .setAdapter(mAdapter, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Add the information of the chosen activity to the intent to send + ResolveInfo chosen = mAdapter.getItem(which); + ActivityInfo actInfo = chosen.activityInfo; + ComponentName name=new ComponentName(actInfo.applicationInfo.packageName, actInfo.name); + mIntent.setComponent(name); + + // Send the file + ((FileActivity)getSherlockActivity()).startActivity(mIntent); + + } + }) + .create(); + } else { + return new AlertDialog.Builder(getSherlockActivity()) + .setTitle(R.string.activity_chooser_title) + .setAdapter(mAdapter, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Add the information of the chosen activity to the intent to send + ResolveInfo chosen = mAdapter.getItem(which); + ActivityInfo actInfo = chosen.activityInfo; + ComponentName name=new ComponentName(actInfo.applicationInfo.packageName, actInfo.name); + mIntent.setComponent(name); + + // Create a new share resource + FileOperationsHelper foh = new FileOperationsHelper(); + foh.shareFileWithLinkToApp(mFile, mIntent, (FileActivity)getSherlockActivity()); + } + }) + .create(); + } }