Make the list in advanced battery page sorted by usage.

1. Make the preference dynamically generated in code
2. Make PowerUsageData comparable and add title resource id.

Bug: 34385770
Test: RunSettingsRoboTests
Change-Id: I1b90b4c6cc7107bc146e3554db04cec7641e1cde
This commit is contained in:
jackqdyulei
2017-02-09 09:38:01 -08:00
parent d72b6cc1e9
commit 22dbc106e7
4 changed files with 93 additions and 111 deletions

View File

@@ -49,13 +49,8 @@ public class PowerGaugePreference extends TintablePreference {
mIconSize = context.getResources().getDimensionPixelSize(R.dimen.app_icon_size);
}
public PowerGaugePreference(Context context, AttributeSet attrs) {
super(context, attrs);
final Drawable icon = context.getDrawable(R.drawable.ic_battery_circle);
setIcon(icon);
setWidgetLayoutResource(R.layout.preference_widget_summary);
mIconSize = icon.getIntrinsicWidth();
public PowerGaugePreference(Context context) {
this(context, null, null, null);
}
public void setContentDescription(String name) {