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 package com.android.settings.deviceinfo.legal 17 18 import android.content.Context 19 import androidx.preference.Preference 20 import com.android.settings.R 21 import com.android.settingslib.metadata.PreferenceAvailabilityProvider 22 import com.android.settingslib.metadata.PreferenceMetadata 23 import com.android.settingslib.preference.PreferenceBinding 24 25 // LINT.IfChange 26 class WallpaperAttributionsPreference : 27 PreferenceMetadata, PreferenceBinding, PreferenceAvailabilityProvider { 28 override val key: String 29 get() = KEY 30 31 override val title: Int 32 get() = R.string.wallpaper_attributions 33 34 override val summary: Int 35 get() = R.string.wallpaper_attributions_values 36 bindnull37 override fun bind(preference: Preference, metadata: PreferenceMetadata) { 38 super.bind(preference, metadata) 39 preference.isSelectable = false 40 } 41 isAvailablenull42 override fun isAvailable(context: Context) = 43 context.resources.getBoolean(R.bool.config_show_wallpaper_attribution) 44 45 companion object { 46 const val KEY = "wallpaper_attributions" 47 } 48 } 49 // LINT.ThenChange(WallpaperAttributionsPreferenceController.java) 50