Add controller for battery saver button
Bug: 72228477 Test: RunSettingsRoboTests Change-Id: Iae9096a10553ea761d099e1e72c1de56b693bac0
This commit is contained in:
@@ -42,6 +42,24 @@ public class LayoutPreference extends Preference {
|
||||
|
||||
public LayoutPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context, attrs, 0 /* defStyleAttr */);
|
||||
}
|
||||
|
||||
public LayoutPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public LayoutPreference(Context context, int resource) {
|
||||
this(context, LayoutInflater.from(context).inflate(resource, null, false));
|
||||
}
|
||||
|
||||
public LayoutPreference(Context context, View view) {
|
||||
super(context);
|
||||
setView(view);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Preference);
|
||||
mAllowDividerAbove = TypedArrayUtils.getBoolean(a, R.styleable.Preference_allowDividerAbove,
|
||||
R.styleable.Preference_allowDividerAbove, false);
|
||||
@@ -50,7 +68,7 @@ public class LayoutPreference extends Preference {
|
||||
a.recycle();
|
||||
|
||||
a = context.obtainStyledAttributes(
|
||||
attrs, com.android.internal.R.styleable.Preference, 0, 0);
|
||||
attrs, com.android.internal.R.styleable.Preference, defStyleAttr, 0);
|
||||
int layoutResource = a.getResourceId(com.android.internal.R.styleable.Preference_layout,
|
||||
0);
|
||||
if (layoutResource == 0) {
|
||||
@@ -64,15 +82,6 @@ public class LayoutPreference extends Preference {
|
||||
setView(view);
|
||||
}
|
||||
|
||||
public LayoutPreference(Context context, int resource) {
|
||||
this(context, LayoutInflater.from(context).inflate(resource, null, false));
|
||||
}
|
||||
|
||||
public LayoutPreference(Context context, View view) {
|
||||
super(context);
|
||||
setView(view);
|
||||
}
|
||||
|
||||
private void setView(View view) {
|
||||
setLayoutResource(R.layout.layout_preference_frame);
|
||||
final ViewGroup allDetails = view.findViewById(R.id.all_details);
|
||||
@@ -106,4 +115,4 @@ public class LayoutPreference extends Preference {
|
||||
return mRootView.findViewById(id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user