1 /*
2  * Copyright (C) 2024 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.healthconnect.controller.exportimport
18 
19 import android.content.Context
20 import android.util.AttributeSet
21 import android.widget.TextView
22 import androidx.preference.Preference
23 import androidx.preference.PreferenceViewHolder
24 import com.android.healthconnect.controller.R
25 
26 /** Preference for showing export status. */
27 class ExportStatusPreference(
28     context: Context,
29     private val exportTime: String,
30     attrs: AttributeSet? = null
31 ) : Preference(context, attrs) {
32     // TODO: b/325914485 - Add proper logging for this preference.
33 
34     companion object {
35         const val EXPORT_STATUS_PREFERENCE = "export_status_preference"
36     }
37 
38     init {
39         layoutResource = R.layout.widget_export_status_preference
40         key = EXPORT_STATUS_PREFERENCE
41     }
42 
onBindViewHoldernull43     override fun onBindViewHolder(holder: PreferenceViewHolder) {
44         super.onBindViewHolder(holder)
45 
46         val exportTimeTextView = holder.findViewById(R.id.export_time) as TextView
47         exportTimeTextView.text = this.exportTime
48     }
49 }
50