OSDN Git Service

Show info icon when RestrictedListPreference is disabled
authorTony Mak <tonymak@google.com>
Tue, 28 Jun 2016 15:30:38 +0000 (16:30 +0100)
committerTony Mak <tonymak@google.com>
Mon, 4 Jul 2016 04:01:49 +0000 (04:01 +0000)
Fix: 29766349

src/com/android/settings/RestrictedListPreference.java

index 521b698..25d4fc9 100644 (file)
@@ -46,6 +46,7 @@ public class RestrictedListPreference extends CustomListPreference {
 
     public RestrictedListPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
+        setWidgetLayoutResource(R.layout.restricted_icon);
         mHelper = new RestrictedPreferenceHelper(context, this, attrs);
     }
 
@@ -59,6 +60,10 @@ public class RestrictedListPreference extends CustomListPreference {
     public void onBindViewHolder(PreferenceViewHolder holder) {
         super.onBindViewHolder(holder);
         mHelper.onBindViewHolder(holder);
+        final View restrictedIcon = holder.findViewById(R.id.restricted_icon);
+        if (restrictedIcon != null) {
+            restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE);
+        }
     }
 
     @Override