Merge branch 'develop' into send_file_pr311_with_develop
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / dialog / ShareLinkToDialog.java
index 68e1485..af21f78 100644 (file)
@@ -97,17 +97,21 @@ public class ShareLinkToDialog  extends SherlockDialogFragment {
             }
         }
         
-        // add activity for copy to clipboard
-        Intent copyToClipboardIntent = new Intent(getSherlockActivity(), CopyToClipboardActivity.class);
-        List<ResolveInfo> copyToClipboard = pm.queryIntentActivities(copyToClipboardIntent, 0);
-        if (!copyToClipboard.isEmpty()) {
-            activities.add(copyToClipboard.get(0));
+        boolean sendAction = mIntent.getBooleanExtra(Intent.ACTION_SEND, false);
+        
+        if (!sendAction) {
+            // add activity for copy to clipboard
+            Intent copyToClipboardIntent = new Intent(getSherlockActivity(), CopyToClipboardActivity.class);
+            List<ResolveInfo> copyToClipboard = pm.queryIntentActivities(copyToClipboardIntent, 0);
+            if (!copyToClipboard.isEmpty()) {
+                activities.add(copyToClipboard.get(0));
+            }
         }
         
         Collections.sort(activities, new ResolveInfo.DisplayNameComparator(pm)); 
         mAdapter = new ActivityAdapter(getSherlockActivity(), pm, activities);
         
-        boolean sendAction = mIntent.getBooleanExtra(Intent.ACTION_SEND, false);
+       
         
         if (sendAction) {
         
@@ -122,9 +126,11 @@ public class ShareLinkToDialog  extends SherlockDialogFragment {
                                    ComponentName name=new ComponentName(actInfo.applicationInfo.packageName, actInfo.name);
                                    mIntent.setComponent(name);                               
                                    
+                                   dialog.dismiss();    // explicitly added for Android 2.x devices
+
                                    // Send the file
                                    ((FileActivity)getSherlockActivity()).startActivity(mIntent);
-
+                                   
                                }
                            })
                        .create();
@@ -142,7 +148,8 @@ public class ShareLinkToDialog  extends SherlockDialogFragment {
                             
                                    // Create a new share resource
                                    FileOperationsHelper foh = new FileOperationsHelper();
-                                   foh.shareFileWithLinkToApp(mFile, mIntent, (FileActivity)getSherlockActivity()); 
+                                   foh.shareFileWithLinkToApp(mFile, mIntent, (FileActivity)getSherlockActivity());
+                                   
                                }
                            })
                        .create();