Search in sources :

Example 1 with RefFile

use of com.xabber.android.data.extension.references.RefFile in project xabber-android by redsolution.

the class HttpFileUploadManager method refMediaToAttachment.

private static Attachment refMediaToAttachment(RefMedia media) {
    Attachment attachment = new Attachment();
    attachment.setFileUrl(media.getUri());
    attachment.setIsImage(FileManager.isImageUrl(media.getUri()));
    RefFile file = media.getFile();
    if (file != null) {
        attachment.setTitle(file.getName());
        attachment.setMimeType(file.getMediaType());
        attachment.setDuration(file.getDuration());
        attachment.setFileSize(file.getSize());
        if (file.getHeight() > 0)
            attachment.setImageHeight(file.getHeight());
        if (file.getWidth() > 0)
            attachment.setImageWidth(file.getWidth());
    }
    return attachment;
}
Also used : RefFile(com.xabber.android.data.extension.references.RefFile) Attachment(com.xabber.android.data.database.messagerealm.Attachment)

Aggregations

Attachment (com.xabber.android.data.database.messagerealm.Attachment)1 RefFile (com.xabber.android.data.extension.references.RefFile)1