147520b68e50572a9775a662410c5aff8300c8784Craig Stout/* 247520b68e50572a9775a662410c5aff8300c8784Craig Stout * Copyright (C) 2014 The Android Open Source Project 347520b68e50572a9775a662410c5aff8300c8784Craig Stout * 447520b68e50572a9775a662410c5aff8300c8784Craig Stout * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 547520b68e50572a9775a662410c5aff8300c8784Craig Stout * in compliance with the License. You may obtain a copy of the License at 647520b68e50572a9775a662410c5aff8300c8784Craig Stout * 747520b68e50572a9775a662410c5aff8300c8784Craig Stout * http://www.apache.org/licenses/LICENSE-2.0 847520b68e50572a9775a662410c5aff8300c8784Craig Stout * 947520b68e50572a9775a662410c5aff8300c8784Craig Stout * Unless required by applicable law or agreed to in writing, software distributed under the License 1047520b68e50572a9775a662410c5aff8300c8784Craig Stout * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 1147520b68e50572a9775a662410c5aff8300c8784Craig Stout * or implied. See the License for the specific language governing permissions and limitations under 1247520b68e50572a9775a662410c5aff8300c8784Craig Stout * the License. 1347520b68e50572a9775a662410c5aff8300c8784Craig Stout */ 1447520b68e50572a9775a662410c5aff8300c8784Craig Stoutpackage android.support.v17.leanback.widget; 1547520b68e50572a9775a662410c5aff8300c8784Craig Stout 1647520b68e50572a9775a662410c5aff8300c8784Craig Stoutimport static android.support.v17.leanback.widget.ObjectAdapter.NO_ID; 1747520b68e50572a9775a662410c5aff8300c8784Craig Stout 1847520b68e50572a9775a662410c5aff8300c8784Craig Stout/** 1947520b68e50572a9775a662410c5aff8300c8784Craig Stout * A header item is an item that describes metadata of {@link Row}, such as a category 2047520b68e50572a9775a662410c5aff8300c8784Craig Stout * of media items. Developer may override this class to add more information. 2147520b68e50572a9775a662410c5aff8300c8784Craig Stout */ 2247520b68e50572a9775a662410c5aff8300c8784Craig Stoutpublic class HeaderItem { 2347520b68e50572a9775a662410c5aff8300c8784Craig Stout 2447520b68e50572a9775a662410c5aff8300c8784Craig Stout private final long mId; 2547520b68e50572a9775a662410c5aff8300c8784Craig Stout private final String mName; 2647520b68e50572a9775a662410c5aff8300c8784Craig Stout 2747520b68e50572a9775a662410c5aff8300c8784Craig Stout /** 2847520b68e50572a9775a662410c5aff8300c8784Craig Stout * Create a header item. All fields are optional. 2930f578068f9972cdd69fedaaa66821c8e9a38a5eCraig Stout */ 3030f578068f9972cdd69fedaaa66821c8e9a38a5eCraig Stout public HeaderItem(long id, String name) { 3147520b68e50572a9775a662410c5aff8300c8784Craig Stout mId = id; 3247520b68e50572a9775a662410c5aff8300c8784Craig Stout mName = name; 3347520b68e50572a9775a662410c5aff8300c8784Craig Stout } 3447520b68e50572a9775a662410c5aff8300c8784Craig Stout 3547520b68e50572a9775a662410c5aff8300c8784Craig Stout /** 3630f578068f9972cdd69fedaaa66821c8e9a38a5eCraig Stout * Create a header item. 3730f578068f9972cdd69fedaaa66821c8e9a38a5eCraig Stout */ 3830f578068f9972cdd69fedaaa66821c8e9a38a5eCraig Stout public HeaderItem(String name) { 3930f578068f9972cdd69fedaaa66821c8e9a38a5eCraig Stout this(NO_ID, name); 4047520b68e50572a9775a662410c5aff8300c8784Craig Stout } 4147520b68e50572a9775a662410c5aff8300c8784Craig Stout 4247520b68e50572a9775a662410c5aff8300c8784Craig Stout /** 4347520b68e50572a9775a662410c5aff8300c8784Craig Stout * Returns a unique identifier for this item. 4447520b68e50572a9775a662410c5aff8300c8784Craig Stout */ 4547520b68e50572a9775a662410c5aff8300c8784Craig Stout public final long getId() { 4647520b68e50572a9775a662410c5aff8300c8784Craig Stout return mId; 4747520b68e50572a9775a662410c5aff8300c8784Craig Stout } 4847520b68e50572a9775a662410c5aff8300c8784Craig Stout 4947520b68e50572a9775a662410c5aff8300c8784Craig Stout /** 5047520b68e50572a9775a662410c5aff8300c8784Craig Stout * Returns the name of this header item. 5147520b68e50572a9775a662410c5aff8300c8784Craig Stout */ 5247520b68e50572a9775a662410c5aff8300c8784Craig Stout public final String getName() { 5347520b68e50572a9775a662410c5aff8300c8784Craig Stout return mName; 5447520b68e50572a9775a662410c5aff8300c8784Craig Stout } 5547520b68e50572a9775a662410c5aff8300c8784Craig Stout} 56