public final class

EmbeddedAttachment

extends Object
implements Attachment
java.lang.Object
   ↳ chan.content.model.EmbeddedAttachment

Class Overview

This class can handle some embedded links. See obtain(String).

Summary

Nested Classes
enum EmbeddedAttachment.ContentType Embedded file content type. 
Public Constructors
EmbeddedAttachment(Uri fileUri, Uri thumbnailUri, String embeddedType, EmbeddedAttachment.ContentType contentType, boolean canDownload, String forcedName)

Constructor for EmbeddedAttachment.

Public Methods
EmbeddedAttachment.ContentType getContentType()

Returns attachment content type.

String getEmbeddedType()

Returns attachment embedded type.

Uri getFileUri()

Returns attachment file URI.

String getForcedName()

Returns forced file name.

Uri getThumbnailUri()

Returns attachment thumbnail URI.

boolean isCanDownload()

Returns whether attachment could be downloaded by it's file URI.

static EmbeddedAttachment obtain(String data)

Returns EmbeddedAttachment if client support this type by itself.

[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public EmbeddedAttachment (Uri fileUri, Uri thumbnailUri, String embeddedType, EmbeddedAttachment.ContentType contentType, boolean canDownload, String forcedName)

Constructor for EmbeddedAttachment.

By default file name will be obtain from the last path segment of file URI. You can override this name with forcedName argument.

Parameters
fileUri Uri: File or page URI.
thumbnailUri Uri: Thumbnail URI.
embeddedType String: Embedded file type string. For example, "YouTube".
contentType EmbeddedAttachment.ContentType: Content type.
canDownload boolean: If fileUri is direct file URI, you can pass true. This allows user to download file.
forcedName String: Overridden file name.

Public Methods

public EmbeddedAttachment.ContentType getContentType ()

Returns attachment content type.

Returns
EmbeddedAttachment.ContentType

public String getEmbeddedType ()

Returns attachment embedded type.

Returns
String

public Uri getFileUri ()

Returns attachment file URI.

Returns
Uri

public String getForcedName ()

Returns forced file name.

Returns
String

public Uri getThumbnailUri ()

Returns attachment thumbnail URI.

Returns
Uri

public boolean isCanDownload ()

Returns whether attachment could be downloaded by it's file URI.

Returns
boolean

public static EmbeddedAttachment obtain (String data)

Returns EmbeddedAttachment if client support this type by itself.

List of supported embedded types:

  • YouTube
  • Vimeo
  • Vocaroo

You can pass any string as data argument that contains links from the list above including strings with embed or iframe HTML tags. Application will try to find links by itself.

Parameters
data String: String with URI.
Returns
EmbeddedAttachment EmbeddedAttachment instance or null if embedded link is not supported.