Add padlocks to preferences that can be disabled by policy.
Change-Id: I43b6b5954ef6ec65b86d99321cabab9f49df842d
This commit is contained in:
@@ -25,16 +25,22 @@ import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settingslib.RestrictedPreference;
|
||||
|
||||
/**
|
||||
* A preference item that can dim the icon when it's disabled, either directly or because its parent
|
||||
* is disabled.
|
||||
*/
|
||||
public class DimmableIconPreference extends Preference {
|
||||
public class DimmableIconPreference extends RestrictedPreference {
|
||||
private static final int ICON_ALPHA_ENABLED = 255;
|
||||
private static final int ICON_ALPHA_DISABLED = 102;
|
||||
|
||||
private final CharSequence mContentDescription;
|
||||
|
||||
public DimmableIconPreference(Context context) {
|
||||
this(context, (AttributeSet) null);
|
||||
}
|
||||
|
||||
public DimmableIconPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContentDescription = null;
|
||||
@@ -53,18 +59,6 @@ public class DimmableIconPreference extends Preference {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParentChanged(Preference parent, boolean disableChild) {
|
||||
dimIcon(disableChild);
|
||||
super.onParentChanged(parent, disableChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
dimIcon(!enabled);
|
||||
super.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||
super.onBindViewHolder(view);
|
||||
@@ -72,5 +66,6 @@ public class DimmableIconPreference extends Preference {
|
||||
final TextView titleView = (TextView) view.findViewById(android.R.id.title);
|
||||
titleView.setContentDescription(mContentDescription);
|
||||
}
|
||||
dimIcon(!isEnabled());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user