Search in sources :

Example 6 with Attachment

use of eu.siacs.conversations.ui.util.Attachment in project Conversations by siacs.

the class FileBackend method convertToAttachments.

public List<Attachment> convertToAttachments(List<DatabaseBackend.FilePath> relativeFilePaths) {
    List<Attachment> attachments = new ArrayList<>();
    for (DatabaseBackend.FilePath relativeFilePath : relativeFilePaths) {
        final String mime = MimeUtils.guessMimeTypeFromExtension(MimeUtils.extractRelevantExtension(relativeFilePath.path));
        final File file = getFileForPath(relativeFilePath.path, mime);
        attachments.add(Attachment.of(relativeFilePath.uuid, file, mime));
    }
    return attachments;
}
Also used : ArrayList(java.util.ArrayList) Attachment(eu.siacs.conversations.ui.util.Attachment) File(java.io.File) DownloadableFile(eu.siacs.conversations.entities.DownloadableFile)

Aggregations

Attachment (eu.siacs.conversations.ui.util.Attachment)6 Uri (android.net.Uri)2 ScrollState (eu.siacs.conversations.ui.util.ScrollState)2 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 Conversation (eu.siacs.conversations.entities.Conversation)1 DownloadableFile (eu.siacs.conversations.entities.DownloadableFile)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1