1 /* 2 * Copyright (C) 2022 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.v34 18 19 import android.app.Application 20 import android.content.Context 21 import android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE 22 import android.os.UserHandle 23 import android.view.View 24 import androidx.annotation.RequiresApi 25 import androidx.preference.PreferenceViewHolder 26 import com.android.permissioncontroller.R 27 import com.android.permissioncontroller.permission.ui.handheld.SmartIconLoadPackagePermissionPreference 28 29 /** 30 * A preference with package label, summary, app icon and settings gear icon, to represent updates 31 * in data sharing for one app. 32 */ 33 @RequiresApi(UPSIDE_DOWN_CAKE) 34 class AppDataSharingUpdatePreference( 35 app: Application, 36 packageName: String, 37 user: UserHandle, 38 context: Context 39 ) : SmartIconLoadPackagePermissionPreference(app, packageName, user, context) { 40 41 init { 42 layoutResource = R.layout.app_data_sharing_settings_preference 43 } 44 45 /** [View.OnClickListener] for the preference. */ 46 var preferenceClick: View.OnClickListener? = null 47 set(value) { 48 field = value 49 notifyChanged() 50 } 51 onBindViewHoldernull52 override fun onBindViewHolder(holder: PreferenceViewHolder) { 53 super.onBindViewHolder(holder) 54 55 holder.itemView.setOnClickListener(preferenceClick) 56 } 57 } 58