1 | /* |
---|
2 | Tibisay Movil |
---|
3 | |
---|
4 | Copyright (C) 2013 Antonio Araujo (aaraujo@cenditel.gob.ve), Jose Ruiz |
---|
5 | (jruiz@cenditel.gob.ve), Fundacion Centro Nacional de Desarrollo e |
---|
6 | Investigacion en Tecnologias Libres - CENDITEL. |
---|
7 | |
---|
8 | La Fundación CENDITEL concede permiso para usar, copiar, distribuir y/o |
---|
9 | modificar este programa, reconociendo el derecho que la humanidad posee al |
---|
10 | libre acceso al conocimiento, bajo los términos de la licencia de software |
---|
11 | GPL versión 2.0 de la Free Software Foundation. |
---|
12 | |
---|
13 | Este programa se distribuye con la esperanza de que sea util, pero SIN |
---|
14 | NINGUNA GARANTIA; tampoco las implicitas garantias de MERCANTILIDAD o |
---|
15 | ADECUACION A UN PROPOSITO PARTICULAR. |
---|
16 | |
---|
17 | Para mayor información sobre los términos de la licencia ver el archivo |
---|
18 | llamado "gpl-2.0.txt" en ingles. |
---|
19 | */ |
---|
20 | |
---|
21 | |
---|
22 | package ve.gob.cenditel.tibisaymovil; |
---|
23 | |
---|
24 | import java.io.File; |
---|
25 | import java.util.ArrayList; |
---|
26 | import java.util.Arrays; |
---|
27 | |
---|
28 | import android.content.Intent; |
---|
29 | import android.net.Uri; |
---|
30 | |
---|
31 | /** |
---|
32 | * Utilities to create some {@link Intent}s used in the application. |
---|
33 | * |
---|
34 | * @author José M. Prieto (jmprieto@emergya.com) |
---|
35 | */ |
---|
36 | public class IntentUtils { |
---|
37 | |
---|
38 | /** |
---|
39 | * Send a file as an email attachment. |
---|
40 | * |
---|
41 | * @param file the File to be sent |
---|
42 | * @return the Intent |
---|
43 | */ |
---|
44 | public static Intent sendFile(File file) { |
---|
45 | Intent intent = new Intent(Intent.ACTION_SEND); |
---|
46 | intent.setType("message/rfc822"); |
---|
47 | intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); |
---|
48 | return intent; |
---|
49 | } |
---|
50 | |
---|
51 | /** |
---|
52 | * Send multiple files as email attachments. |
---|
53 | * |
---|
54 | * @param files an array of File's to be sent |
---|
55 | * @return the Intent |
---|
56 | */ |
---|
57 | public static Intent sendMultipleFiles(File[] files) { |
---|
58 | Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); |
---|
59 | intent.setType("message/rfc822"); |
---|
60 | intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, TypeUtils.convertToUriArrayList(Arrays.asList(files))); |
---|
61 | return intent; |
---|
62 | } |
---|
63 | |
---|
64 | public static Intent sendMultipleFiles(ArrayList<Uri> files) { |
---|
65 | Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); |
---|
66 | intent.setType("message/rfc822"); |
---|
67 | intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files); |
---|
68 | return intent; |
---|
69 | } |
---|
70 | } |
---|