1 /* 2 * Copyright (C) 2023 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.android.healthconnect.controller.data.entries 15 16 import android.view.LayoutInflater 17 import android.view.View 18 import android.view.ViewGroup 19 import android.widget.LinearLayout 20 import android.widget.TextView 21 import com.android.healthconnect.controller.R 22 import com.android.healthconnect.controller.data.entries.FormattedEntry.EntryDateSectionHeader 23 import com.android.healthconnect.controller.shared.recyclerview.ViewBinder 24 25 /** View binder for a section title that looks like a PreferenceCategory. */ 26 class SectionTitleViewBinder : ViewBinder<EntryDateSectionHeader, LinearLayout> { newViewnull27 override fun newView(parent: ViewGroup): LinearLayout { 28 return LayoutInflater.from(parent.context).inflate(R.layout.section_title, parent, false) 29 as LinearLayout 30 } 31 bindnull32 override fun bind(view: View, data: EntryDateSectionHeader, index: Int) { 33 val titleView = view.findViewById<TextView>(android.R.id.title) 34 titleView.text = data.date 35 } 36 } 37