• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.permissioncontroller.permission.ui.handheld.v36
18 
19 import android.content.Context
20 import android.os.Build
21 import android.util.AttributeSet
22 import android.widget.TextView
23 import androidx.annotation.AttrRes
24 import androidx.annotation.RequiresApi
25 import androidx.annotation.StyleRes
26 import androidx.preference.PreferenceViewHolder
27 import com.android.permissioncontroller.R
28 import com.android.permissioncontroller.permission.ui.handheld.PermissionPreference
29 
30 @RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM)
31 class AppPermissionFooterLinkPreference : PermissionPreference {
32     constructor(context: Context) : super(context)
33 
34     constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
35 
36     constructor(
37         context: Context,
38         attrs: AttributeSet?,
39         @AttrRes defStyleAttr: Int,
40     ) : super(context, attrs, defStyleAttr)
41 
42     constructor(
43         context: Context,
44         attrs: AttributeSet?,
45         @AttrRes defStyleAttr: Int,
46         @StyleRes defStyleRes: Int,
47     ) : super(context, attrs, defStyleAttr, defStyleRes)
48 
49     init {
50         layoutResource = R.layout.app_permission_footer_link_preference
51     }
52 
onBindViewHoldernull53     override fun onBindViewHolder(holder: PreferenceViewHolder) {
54         super.onBindViewHolder(holder)
55         if (
56             context.resources.getBoolean(
57                 R.bool.config_appPermissionFooterLinkPreferenceSummaryUnderlined
58             )
59         ) {
60             val summary = holder.findViewById(android.R.id.summary) as TextView
61             summary.paint.isUnderlineText = true
62         }
63     }
64 }
65