muzei-api / com.google.android.apps.muzei.api.provider / Artwork

Artwork

class Artwork

Artwork associated with a MuzeiArtProvider.

Artwork can be constructed using the empty constructor and the setter methods found on the Artwork object itself or by using the Builder.

Artwork can then be added to a MuzeiArtProvider by calling addArtwork(Artwork) directly from within a MuzeiArtProvider or by creating a ProviderClient and calling ProviderClient.addArtwork from anywhere in your application.

The static Artwork.fromCursor method allows you to convert a row retrieved from a MuzeiArtProvider into Artwork instance.

Types

Builder

A builder-style, fluent interface for creating Artwork objects.

class Builder

Constructors

<init>

Construct a new Artwork.

Artwork(title: String?, byline: String? = null, attribution: String? = null, token: String? = null, persistentUri: Uri? = null, webUri: Uri? = null, metadata: String? = null)

Properties

attribution

The artwork's user-visible attribution text.

val attribution: String?

byline

The artwork's user-visible byline, usually containing the author and date.

val byline: String?

data

The File where a local copy of this artwork is stored. When first inserted, this file most certainly does not exist and will be created from the InputStream returned by MuzeiArtProvider.openFile.

val data: File

dateAdded

The date this artwork was initially added to its MuzeiArtProvider.

val dateAdded: Date

dateModified

The date of the last modification of the artwork (i.e., the last time it was updated). This will initially be equal to the dateAdded.

val dateModified: Date

id

The ID assigned to this Artwork by its MuzeiArtProvider.

val id: Long

metadata

The provider specific metadata about the artwork.

val metadata: String?

persistentUri

The artwork's persistent URI, which must resolve to a JPEG or PNG image, ideally under 5MB. Your app should have long-lived access to this URI.

val persistentUri: Uri?

title

The artwork's user-visible title.

val title: String?

token

The token that uniquely defines the artwork.

val token: String?

webUri

The artwork's web URI. This is used by default in MuzeiArtProvider.getArtworkInfo to allow the user to view more details about the artwork.

val webUri: Uri?

Companion Object Functions

fromCursor

Converts the current row of the given Cursor to an Artwork object. The assumption is that this Cursor was retrieve from a MuzeiArtProvider and has the columns listed in ProviderContract.Artwork.

fun fromCursor(data: Cursor): Artwork