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 */ 14 package androidx.leanback.widget; 15 16 import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; 17 18 import android.view.LayoutInflater; 19 import android.view.View; 20 import android.view.ViewGroup; 21 22 import androidx.annotation.RestrictTo; 23 import androidx.leanback.R; 24 25 /** 26 * DividerPresenter provides a default presentation for {@link DividerRow} in HeadersFragment. 27 */ 28 public class DividerPresenter extends Presenter { 29 30 private final int mLayoutResourceId; 31 32 public DividerPresenter() { 33 this(R.layout.lb_divider); 34 } 35 36 /** 37 * @hide 38 */ 39 @RestrictTo(LIBRARY_GROUP) 40 public DividerPresenter(int layoutResourceId) { 41 mLayoutResourceId = layoutResourceId; 42 } 43 44 @Override 45 public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) { 46 View headerView = LayoutInflater.from(parent.getContext()) 47 .inflate(mLayoutResourceId, parent, false); 48 49 return new ViewHolder(headerView); 50 } 51 52 @Override 53 public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { 54 } 55 56 @Override 57 public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { 58 } 59 60 } 61