|
@@ -11,6 +11,7 @@ import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
|
|
|
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|
|
|
+import com.nextcloud.client.utils.IntentUtil;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.ui.adapter.SendButtonAdapter;
|
|
import com.owncloud.android.ui.adapter.SendButtonAdapter;
|
|
@@ -80,7 +81,7 @@ public class SendFilesDialog extends BottomSheetDialogFragment {
|
|
View view = inflater.inflate(R.layout.send_files_fragment, container, false);
|
|
View view = inflater.inflate(R.layout.send_files_fragment, container, false);
|
|
|
|
|
|
// populate send apps
|
|
// populate send apps
|
|
- Intent sendIntent = createSendIntent();
|
|
|
|
|
|
+ Intent sendIntent = IntentUtil.createSendIntent(requireContext(), files);
|
|
|
|
|
|
List<SendButtonData> sendButtonDataList = setupSendButtonData(sendIntent);
|
|
List<SendButtonData> sendButtonDataList = setupSendButtonData(sendIntent);
|
|
|
|
|
|
@@ -124,36 +125,4 @@ public class SendFilesDialog extends BottomSheetDialogFragment {
|
|
}
|
|
}
|
|
return sendButtonDataList;
|
|
return sendButtonDataList;
|
|
}
|
|
}
|
|
-
|
|
|
|
- @NonNull
|
|
|
|
- private Intent createSendIntent() {
|
|
|
|
- Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
|
|
|
- sendIntent.setType(getUniqueMimetype());
|
|
|
|
- sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, getExposedFileUris());
|
|
|
|
- sendIntent.putExtra(Intent.ACTION_SEND, true);
|
|
|
|
- return sendIntent;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Nullable
|
|
|
|
- private String getUniqueMimetype() {
|
|
|
|
- String mimetype = files[0].getMimeType();
|
|
|
|
-
|
|
|
|
- for (OCFile file : files) {
|
|
|
|
- if (!mimetype.equals(file.getMimeType())) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return mimetype;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private ArrayList<Uri> getExposedFileUris() {
|
|
|
|
- ArrayList<Uri> uris = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- for (OCFile file : files) {
|
|
|
|
- uris.add(file.getExposedFileUri(requireContext()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return uris;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|