com.google.android.apps.muzei.api
Class Artwork.Builder

java.lang.Object
  extended by com.google.android.apps.muzei.api.Artwork.Builder
Enclosing class:
Artwork

public static class Artwork.Builder
extends Object

A builder-style, fluent interface for creating Artwork objects. Example usage is below

 Artwork artwork = new Artwork.Builder()
         .imageUri(Uri.parse("http://example.com/image.jpg"))
         .title("Example image")
         .byline("Unknown person, c. 1980")
         .viewIntent(new Intent(Intent.ACTION_VIEW,
                 Uri.parse("http://example.com/imagedetails.html")))
         .build();
The only required field is the image URI, but you should really provide all the metadata, especially title, byline, and view intent.


Constructor Summary
Artwork.Builder()
           
 
Method Summary
 Artwork build()
          Creates and returns the final Artwork object.
 Artwork.Builder byline(String byline)
          Sets the artwork's user-visible byline (e.g.
 Artwork.Builder imageUri(Uri imageUri)
          Sets the artwork's image URI, which must resolve to a JPEG or PNG image, ideally under 5MB.
 Artwork.Builder title(String title)
          Sets the artwork's user-visible title.
 Artwork.Builder token(String token)
          Sets the artwork's opaque application-specific identifier.
 Artwork.Builder viewIntent(Intent viewIntent)
          Sets the activity Intent that will be started when the user clicks for more details about the artwork.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Artwork.Builder

public Artwork.Builder()
Method Detail

build

public Artwork build()
Creates and returns the final Artwork object. Once this method is called, it is not valid to further use this Artwork.Builder object.


byline

public Artwork.Builder byline(String byline)
Sets the artwork's user-visible byline (e.g. author and date).


imageUri

public Artwork.Builder imageUri(Uri imageUri)
Sets the artwork's image URI, which must resolve to a JPEG or PNG image, ideally under 5MB. Supported URI schemes are: While Muzei will download and cache the artwork, these URIs should be as long-lived as possible, since in the event Muzei's cache is wiped out, it will attempt to fetch the image again. Also, given that the device may not be connected to the network at the time an artwork is published, the time the URI may be fetched significantly after the artwork is published.


title

public Artwork.Builder title(String title)
Sets the artwork's user-visible title.


token

public Artwork.Builder token(String token)
Sets the artwork's opaque application-specific identifier.


viewIntent

public Artwork.Builder viewIntent(Intent viewIntent)
Sets the activity Intent that will be started when the user clicks for more details about the artwork.

The activity that this intent resolves to must have android:exported set to true.

Because artwork objects can be persisted across device reboots, pending intents, which would alleviate the exported requirement, are not currently supported.