Matte supports Browse Mode Plugins for extending how it can display a user's shared albums. Read the general Extending with Plugins documentation before reading this document.
The default brose mode in the default Woosh theme looks like this:
Here, when you click on the Alternate Views link, it reveals all available browse modes which were registered with Matte when it started up:
Matte comes with 3 built-in browse mode plugins:
You can think of browse modes as different search queries that Matte will perform in order to generate the browse user interface. The result of the search is a set of albums, each album populated with the media items that fall into that album's grouping.
There is one main API to implement for browse mode plugins: BrowseModePlugin.
Each browse mode is defined by a mode key, which must be unique across all browse modes
registered with Matte. A single BrowseModePlugin
can support more than one mode.
The mode keys it supports are returned by the getSupportedModes()
method. In addition,
the supportsMode()
method returns true or false if it supports
a given mode key. These mode keys are passed to the Matte UI, so the UI can allow the user to
select different browse modes.
The find()
method is what performs the browse mode search and returns a
SearchResults
instance. It is passed a
BrowseAlbumsCommand instance,
which will be populated with the requested browse mode key, the anonymous user key of the
owner of the items being browsed, and optionally a section key that represents a
specific subset within the browse search results.
For browsing, it is expected the SearchResults
object returned by the
find()
method contain a collection of AlbumSearchResult
objects.
The plugin can support sections by returning a PaginationIndex
object
within the SearchResults
that specifies all available sections.
For each AlbumSearchResult
, the anonymous key must be generated with some
value that can later be passed back to the plugin as a PaginationCriteria.indexKey
value. That means the album anonymous keys need to be encoded in such a way they are
recognizable from normal browseing section keys.
Let's look at an example of how the PopularityBrowseModePlugin works within the default Woosh theme in Matte:
PaginationCriteria.indexKey
value."0 - 19:0"
. In this way, when a user clicks on
the album the 0 - 19:0 value will be passed as the PaginationCriteria.indexKey
value, which the plugin can decode as the 0 - 19
section, with the 0
offset album.The XML model for this example looks like this:
Each browse mode plugin should support viewing the virtual albums that it returns
in the browse search results by way of the
ViewAlbumController. That means
for each AlbumSearchResult
returned while browsing, the anonymousKey
should be set to some value that the plugin can understand later as a specific album to
find and return. In this case, the returned album should have MediaItemSearchResult
objects populated for each item within the virtual album.
For example, the XML model for a virtual album would look like this: