Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.


public interface FacetProvider


This is the query interface to supply optional features(aka facets) on an object without the need of letting the object to subclass or implement java interfaces. Facets allow leanback to re-compose optional features from leanback ViewHolder to RecyclerView ViewHolder. A typical "facet" class is ItemAlignmentFacet that defines how to align a ViewHolder inside VerticalGridView or HorizontalGridView. A FacetProvider could be retrieved from two sources by VerticalGridView/HorizontalGridView in the following order.

  • ViewHolder based facet:

    RecyclerView.ViewHolder can implement FacetProvider. If app uses leanback Presenter.ViewHolder, the facet of Presenter.ViewHolder will be relayed by ItemBridgeAdapter.ViewHolder which is a wrapper of Presenter.ViewHolder. ViewHolder based facet is used less frequently than item view type based facet because in most cases ViewHolders of same type share the same alignment definition.

    For example, app calls viewHolder.setFacet(ItemAlignmentFacet.class, itemAlignmentFacet) to set alignment of the ViewHolder instance.

  • RecyclerView item view type based facet:

    RecyclerView.Adapter can implement FacetProviderAdapter which returns FacetProvider for each item view type. If app uses leanback ObjectAdapter and Presenter, app wraps the ObjectAdapter and Presenter using ItemBridgeAdapter. The implementation of ItemBridgeAdapter.getFacetProvider(int) will return the FacetProvider implemented by Presenter which is mapped to the item view type.

    For example, app calls presenter.setFacet(ItemAlignmentFacet.class, itemAlignmentFacet) to set alignment of all ViewHolders created by this Presenter.

  • Summary

    Public methods

    abstract Object getFacet(Class<?> facetClass)

    Queries optional implemented facet.

    Public methods


    public abstract Object getFacet (Class<?> facetClass)

    Queries optional implemented facet.

    facetClass Class: Facet classes to query, examples are: class of ItemAlignmentFacet.

    Object Facet implementation for the facetClass or null if feature not implemented.