1 /* 2 * Copyright (C) 2016 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 com.example.android.leanback; 15 16 import android.content.Context; 17 import android.graphics.drawable.Drawable; 18 import android.util.AttributeSet; 19 import android.view.View; 20 import android.widget.LinearLayout; 21 22 import androidx.leanback.widget.SearchOrbView; 23 import androidx.leanback.widget.TitleViewAdapter; 24 25 public class CustomTitleView extends LinearLayout implements TitleViewAdapter.Provider { 26 27 private final TitleViewAdapter mTitleViewAdapter = new TitleViewAdapter() { 28 @Override 29 public View getSearchAffordanceView() { 30 return null; 31 } 32 33 @Override 34 public void setOnSearchClickedListener(View.OnClickListener listener) { 35 } 36 37 @Override 38 public void setAnimationEnabled(boolean enable) { 39 } 40 41 @Override 42 public Drawable getBadgeDrawable() { 43 return null; 44 } 45 46 @Override 47 public SearchOrbView.Colors getSearchAffordanceColors() { 48 return null; 49 } 50 51 @Override 52 public CharSequence getTitle() { 53 return null; 54 } 55 56 @Override 57 public void setBadgeDrawable(Drawable drawable) { 58 } 59 60 @Override 61 public void setSearchAffordanceColors(SearchOrbView.Colors colors) { 62 } 63 64 @Override 65 public void setTitle(CharSequence titleText) { 66 } 67 68 @Override 69 public void updateComponentsVisibility(int flags) { 70 } 71 }; 72 CustomTitleView(Context context)73 public CustomTitleView(Context context) { 74 this(context, null); 75 } 76 CustomTitleView(Context context, AttributeSet attrs)77 public CustomTitleView(Context context, AttributeSet attrs) { 78 this(context, attrs, 0); 79 } 80 CustomTitleView(Context context, AttributeSet attrs, int defStyleAttr)81 public CustomTitleView(Context context, AttributeSet attrs, int defStyleAttr) { 82 super(context, attrs, defStyleAttr); 83 } 84 85 @Override getTitleViewAdapter()86 public TitleViewAdapter getTitleViewAdapter() { 87 return mTitleViewAdapter; 88 } 89 } 90