Ui changes in battery main page
1. Refine the battery header view
2. Move stats section to the place above power management
3. Add last full charge battery stat
4. Add the disclaimer as a footer
Also update the method name in test file, and this ui changes
also fix the header flash problem.
Bug: 36576021
Bug: 36494178
Test: RunSettingsRoboTests
Change-Id: I9784dbbbe16e61da7287f300183347dd4eee6a2b
(cherry picked from commit edfd09d590
)
This commit is contained in:
@@ -29,8 +29,11 @@ import com.android.settings.TintablePreference;
|
||||
import com.android.settings.Utils;
|
||||
|
||||
/**
|
||||
* Custom preference for displaying power consumption as a bar and an icon on
|
||||
* Custom preference for displaying battery usage info as a bar and an icon on
|
||||
* the left for the subsystem/app type.
|
||||
*
|
||||
* The battery usage info could be usage percentage or usage time. The preference
|
||||
* won't show any icon if it is null.
|
||||
*/
|
||||
public class PowerGaugePreference extends TintablePreference {
|
||||
private final int mIconSize;
|
||||
@@ -41,7 +44,20 @@ public class PowerGaugePreference extends TintablePreference {
|
||||
|
||||
public PowerGaugePreference(Context context, Drawable icon, CharSequence contentDescription,
|
||||
BatteryEntry info) {
|
||||
super(context, null);
|
||||
this(context, null, icon, contentDescription, info);
|
||||
}
|
||||
|
||||
public PowerGaugePreference(Context context) {
|
||||
this(context, null, null, null, null);
|
||||
}
|
||||
|
||||
public PowerGaugePreference(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, null, null, null);
|
||||
}
|
||||
|
||||
private PowerGaugePreference(Context context, AttributeSet attrs, Drawable icon,
|
||||
CharSequence contentDescription, BatteryEntry info) {
|
||||
super(context, attrs);
|
||||
setIcon(icon != null ? icon : new ColorDrawable(0));
|
||||
setWidgetLayoutResource(R.layout.preference_widget_summary);
|
||||
mInfo = info;
|
||||
@@ -49,10 +65,6 @@ public class PowerGaugePreference extends TintablePreference {
|
||||
mIconSize = context.getResources().getDimensionPixelSize(R.dimen.app_icon_size);
|
||||
}
|
||||
|
||||
public PowerGaugePreference(Context context) {
|
||||
this(context, null, null, null);
|
||||
}
|
||||
|
||||
public void setContentDescription(String name) {
|
||||
mContentDescription = name;
|
||||
notifyChanged();
|
||||
@@ -67,6 +79,11 @@ public class PowerGaugePreference extends TintablePreference {
|
||||
return mProgress.toString();
|
||||
}
|
||||
|
||||
public void setSubtitle(String subtitle) {
|
||||
mProgress = subtitle;
|
||||
notifyChanged();
|
||||
}
|
||||
|
||||
BatteryEntry getInfo() {
|
||||
return mInfo;
|
||||
}
|
||||
|
Reference in New Issue
Block a user