/* Tibisay Movil Copyright (C) 2013 Antonio Araujo (aaraujo@cenditel.gob.ve), Jose Ruiz (jruiz@cenditel.gob.ve), Fundacion Centro Nacional de Desarrollo e Investigacion en Tecnologias Libres - CENDITEL. La Fundación CENDITEL concede permiso para usar, copiar, distribuir y/o modificar este programa, reconociendo el derecho que la humanidad posee al libre acceso al conocimiento, bajo los términos de la licencia de software GPL versión 2.0 de la Free Software Foundation. Este programa se distribuye con la esperanza de que sea util, pero SIN NINGUNA GARANTIA; tampoco las implicitas garantias de MERCANTILIDAD o ADECUACION A UN PROPOSITO PARTICULAR. Para mayor información sobre los términos de la licencia ver el archivo llamado "gpl-2.0.txt" en ingles. */ package ve.gob.cenditel.tibisaymovil; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import android.content.Intent; import android.net.Uri; /** * Utilities to create some {@link Intent}s used in the application. * * @author José M. Prieto (jmprieto@emergya.com) */ public class IntentUtils { /** * Send a file as an email attachment. * * @param file the File to be sent * @return the Intent */ public static Intent sendFile(File file) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); return intent; } /** * Send multiple files as email attachments. * * @param files an array of File's to be sent * @return the Intent */ public static Intent sendMultipleFiles(File[] files) { Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("message/rfc822"); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, TypeUtils.convertToUriArrayList(Arrays.asList(files))); return intent; } public static Intent sendMultipleFiles(ArrayList files) { Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("message/rfc822"); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files); return intent; } }