1/**
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
12 * the License.
13 */
14
15/**
16 * <p>Support classes providing low level Leanback user interface building blocks:
17 * widgets and helpers.</p>
18 * <p>
19 * The core interface to the developer’s model is the
20 * {@link android.support.v17.leanback.widget.ObjectAdapter}. It is similar to Adapter and the
21 * RecyclerView Adapter, but separates iterating items from presenting them as Views.
22 * Concrete implementations include
23 * {@link android.support.v17.leanback.widget.ArrayObjectAdapter} and
24 * {@link android.support.v17.leanback.widget.CursorObjectAdapter}, but a developer is free to use a
25 * subclass of an ObjectAdapter to iterate over any existing Object hierarchy.
26 * </p>
27 * <p>
28 * A {@link android.support.v17.leanback.widget.Presenter} creates Views and binds data from an Object
29 * to those Views. This is the
30 * complementary piece to ObjectAdapter that corresponds to existing Android adapter classes.
31 * The benefit to separating out a Presenter is that we can use it to generate Views outside of the
32 * context of an adapter. For example, a UI may represent data from a single Object in several places
33 * at once. Each View that needs to be generated can be produced by a different Presenter, while the
34 * Object is retrieved from the ObjectAdapter once.
35 * </p>
36 * A {@link android.support.v17.leanback.widget.PresenterSelector} determines which Presenter to use
37 * for a given Object from an
38 * ObjectAdapter. Two common cases are when an ObjectAdapter uses the same View type for every element
39 * ({@link android.support.v17.leanback.widget.SinglePresenterSelector}), and when the Presenter is
40 * determined by the Java class of
41 * the element ({@link android.support.v17.leanback.widget.ClassPresenterSelector}).  A developer is
42 * able to implement any selection logic
43 * as a PresenterSelector. For example, if all the elements of an ObjectAdapter have the same type,
44 * but certain elements are to be rendered using a 'promotional content' view in the developer’s
45 * application, the PresenterSelector may inspect the fields of each element before choosing the
46 * appropriate Presenter.
47 * </p>
48 * <p>
49 * The basic navigation model for Leanback is that of a vertical list of rows, each of which may
50 * be a horizontal list of items. Therefore, Leanback uses ObjectAdapters both for defining the
51 * horizontal data items as well as the list of rows themselves.
52 * </p>
53 * <p>Leanback defines a few basic data model classes for rows: the
54 * {@link android.support.v17.leanback.widget.Row}, which defines the
55 * abstract concept of a row with a header; and {@link android.support.v17.leanback.widget.ListRow},
56 * a concrete Row implementation that uses an ObjectAdapter to present a horizontal list of items.
57 * The corresponding presenter for the ListRow is the
58 * {@link android.support.v17.leanback.widget.ListRowPresenter}.
59 * </p>
60 * <p>
61 * Other types of Rows and corresponding RowPresenters are provided; however the application may
62 * define a custom subclass of {@link android.support.v17.leanback.widget.Row} and
63 * {@link android.support.v17.leanback.widget.RowPresenter}.
64 * </p>
65 */
66
67package android.support.v17.leanback.widget;
68