diff options
author | Shriya Gupta <shrigupt@google.com> | 2023-03-15 08:52:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-03-15 08:52:55 +0000 |
commit | 9ee61ceaf4c2d42b94ccc148347beeb1ea1879e7 (patch) | |
tree | e437efad47be2f650740ad8d70d80d52a1076c50 /PermissionController/src/com/android/permissioncontroller/safetycenter | |
parent | da63aeab0d8249a0847ce992961e804dfa5f0929 (diff) | |
parent | 3e6f27c32150bd090ab7e2c2e3834b2d5fc5136c (diff) | |
download | Permission-9ee61ceaf4c2d42b94ccc148347beeb1ea1879e7.tar.gz |
Merge "Fix opacity for disabled entries with null-intent" into udc-dev
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/safetycenter')
3 files changed, 15 insertions, 6 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt index 7ff31d009..b8c9e035e 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt @@ -121,7 +121,7 @@ class SafetySubpageEntryPreference( val titleView = holder.findViewById(android.R.id.title) as? TextView? val summaryView = holder.findViewById(android.R.id.summary) as? TextView? - changeEnabledState(entry.isEnabled, titleView, summaryView) + changeEnabledState(entry.isEnabled, isEnabled(), titleView, summaryView) } override fun shouldHideSecondTarget(): Boolean = entry.iconAction == null diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt index 36377ebf5..c985ba006 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt @@ -67,17 +67,25 @@ internal class SafetyEntryCommonViewsManager(rootEntryView: ViewGroup?) { companion object { /** - * Change opacity to make some entries to look disabled but still be clickable + * Change opacity to make some entries look disabled but still be clickable * - * @param isEnabled whether the [android.safetycenter.SafetyCenterEntry] is enabled + * @param isEntryEnabled whether the [android.safetycenter.SafetyCenterEntry] is enabled + * @param isPreferenceEnabled whether the corresponding preference is enabled * @param titleView view displaying the title text of the entry * @param summaryView view displaying the summary text of the entry */ - fun changeEnabledState(isEnabled: Boolean, titleView: TextView?, summaryView: TextView?) { - if (isEnabled) { + fun changeEnabledState( + isEntryEnabled: Boolean, + isPreferenceEnabled: Boolean, + titleView: TextView?, + summaryView: TextView? + ) { + if (isEntryEnabled) { titleView?.alpha = 1f summaryView?.alpha = 1f - } else { + } else if (isPreferenceEnabled) { + /* Check that preference is enabled before lowering because disabled preferences + * already have a low visibility */ titleView?.alpha = 0.4f summaryView?.alpha = 0.4f } diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt index e28f782ab..1c29b92f9 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt @@ -176,6 +176,7 @@ constructor( isEnabled = entry.pendingIntent != null changeEnabledState( entry.isEnabled, + isEnabled, commonEntryView?.titleView, commonEntryView?.summaryView ) |