source: dispositivos_moviles/TibisayMovil/src/ve/gob/cenditel/tibisaymovil/IntentUtils.java @ 8379cd8

Last change on this file since 8379cd8 was 8379cd8, checked in by Antonio Araujo Brett <aaraujo@…>, 11 years ago

Agregado encabezado de licencia a archivos fuentes.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2Tibisay Movil
3
4Copyright (C) 2013 Antonio Araujo (aaraujo@cenditel.gob.ve), Jose Ruiz
5(jruiz@cenditel.gob.ve), Fundacion Centro Nacional de Desarrollo e
6Investigacion en Tecnologias Libres - CENDITEL.
7
8La Fundación CENDITEL concede permiso para usar, copiar, distribuir y/o
9modificar este programa, reconociendo el derecho que la humanidad posee al
10libre acceso al conocimiento, bajo los términos de la licencia de software
11GPL versión 2.0 de la Free Software Foundation.
12
13Este programa se distribuye con la esperanza de que sea util, pero SIN
14NINGUNA GARANTIA; tampoco las implicitas garantias de MERCANTILIDAD o
15ADECUACION A UN PROPOSITO PARTICULAR.
16
17Para mayor información sobre los términos de la licencia ver el archivo
18llamado "gpl-2.0.txt" en ingles.
19*/
20
21
22package ve.gob.cenditel.tibisaymovil;
23
24import java.io.File;
25import java.util.ArrayList;
26import java.util.Arrays;
27
28import android.content.Intent;
29import 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 */
36public 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}
Note: See TracBrowser for help on using the repository browser.