diff options
author | Amith Yamasani <yamasani@google.com> | 2009-06-19 09:27:35 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2009-06-25 00:40:50 -0700 |
commit | 0f1e11e219c9e89bb4a939cd864eb03087e784be (patch) | |
tree | d48f409383ea3b6d667eb2c9a25238d99f9a9145 /src/com/android/settings/fuelgauge/PowerGaugePreference.java | |
parent | a54672f3a983766cf1dce754b3887807fcb723fa (diff) | |
download | packages_apps_settings-0f1e11e219c9e89bb4a939cd864eb03087e784be.zip packages_apps_settings-0f1e11e219c9e89bb4a939cd864eb03087e784be.tar.gz packages_apps_settings-0f1e11e219c9e89bb4a939cd864eb03087e784be.tar.bz2 |
Track native processes.
Add gauge to detail screen and make it look like the item from summary screen.
Some string changes.
Diffstat (limited to 'src/com/android/settings/fuelgauge/PowerGaugePreference.java')
-rw-r--r-- | src/com/android/settings/fuelgauge/PowerGaugePreference.java | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java index 5778b39..68f294c 100644 --- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java +++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java @@ -37,7 +37,7 @@ import com.android.settings.fuelgauge.PowerUsageSummary.BatterySipper; public class PowerGaugePreference extends Preference { private Drawable mIcon; - private GaugeDrawable mGauge; + private PercentageBar mGauge; private double mValue; private BatterySipper mInfo; private double mPercent; @@ -46,7 +46,7 @@ public class PowerGaugePreference extends Preference { super(context); setLayoutResource(R.layout.preference_powergauge); mIcon = icon; - mGauge = new GaugeDrawable(); + mGauge = new PercentageBar(); mGauge.bar = context.getResources().getDrawable(R.drawable.app_gauge); mInfo = info; } @@ -90,44 +90,4 @@ public class PowerGaugePreference extends Preference { percentView.setText((int) (Math.ceil(mPercent)) + "%"); } - static class GaugeDrawable extends Drawable { - Drawable bar; - double percent; - int lastWidth = -1; - - @Override - public void draw(Canvas canvas) { - if (lastWidth == -1) { - lastWidth = getBarWidth(); - bar.setBounds(0, 0, lastWidth, bar.getIntrinsicHeight()); - } - bar.draw(canvas); - } - - @Override - public int getOpacity() { - return PixelFormat.TRANSLUCENT; - } - - @Override - public void setAlpha(int alpha) { - // Ignore - } - - @Override - public void setColorFilter(ColorFilter cf) { - // Ignore - } - - private int getBarWidth() { - int width = (int) ((this.getBounds().width() * percent) / 100); - int intrinsicWidth = bar.getIntrinsicWidth(); - return Math.max(width, intrinsicWidth); - } - - @Override - public int getIntrinsicHeight() { - return bar.getIntrinsicHeight(); - } - } } |