HeaderItem.java revision 30f578068f9972cdd69fedaaa66821c8e9a38a5e
1/*
2 * Copyright (C) 2014 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 */
14package android.support.v17.leanback.widget;
15
16import static android.support.v17.leanback.widget.ObjectAdapter.NO_ID;
17
18/**
19 * A header item is an item that describes metadata of {@link Row}, such as a category
20 * of media items.  Developer may override this class to add more information.
21 */
22public class HeaderItem {
23
24    private final long mId;
25    private final String mName;
26
27    /**
28     * Create a header item.  All fields are optional.
29     * @deprecated Use {@link #HeaderItem(long, String)} instead.
30     */
31    public HeaderItem(long id, String name, String imageUri) {
32        this(id, name);
33    }
34
35    /**
36     * Create a header item.  All fields are optional.
37     */
38    public HeaderItem(long id, String name) {
39        mId = id;
40        mName = name;
41    }
42
43    /**
44     * Create a header item.  All fields are optional.
45     * @deprecated Use {@link #HeaderItem(String)} instead.
46     */
47    public HeaderItem(String name, String imageUri) {
48        this(name);
49    }
50
51    /**
52     * Create a header item.
53     */
54    public HeaderItem(String name) {
55        this(NO_ID, name);
56    }
57
58    /**
59     * Returns a unique identifier for this item.
60     */
61    public final long getId() {
62        return mId;
63    }
64
65    /**
66     * Returns the name of this header item.
67     */
68    public final String getName() {
69        return mName;
70    }
71
72    /**
73     * Returns the icon for this header item.
74     * @deprecated Returns null
75     */
76    public final String getImageUri() {
77        return null;
78    }
79}
80