1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.documentsui.sidebar; 18 19 import static com.android.documentsui.base.SharedMinimal.DEBUG; 20 21 import android.util.Log; 22 import android.view.View; 23 import android.widget.TextView; 24 25 import com.android.documentsui.R; 26 import com.android.documentsui.base.UserId; 27 28 /** 29 * An {@link Item} for displaying text in the side bar. 30 */ 31 class HeaderItem extends Item { 32 private static final String TAG = "HeaderItem"; 33 34 private static final String STRING_ID = "HeaderItem"; 35 HeaderItem(String title)36 HeaderItem(String title) { 37 super(R.layout.item_root_header, title, STRING_ID, UserId.UNSPECIFIED_USER); 38 } 39 40 @Override bindView(View convertView)41 void bindView(View convertView) { 42 final TextView titleView = convertView.findViewById(android.R.id.title); 43 titleView.setText(title); 44 } 45 46 @Override isRoot()47 boolean isRoot() { 48 return false; 49 } 50 51 @Override open()52 void open() { 53 if (DEBUG) { 54 Log.d(TAG, "Ignoring click/hover on spacer item."); 55 } 56 } 57 } 58