From 9281c929d6e4abf0ddf77d614b2eb57f7528397a Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Sat, 26 Sep 2009 12:44:02 -0700 Subject: Explicitly show plugged state. Change-Id: I4592382cdcc9e116d3af102fd76057968a6ea874 --- res/layout/battery_info.xml | 6 ++++++ res/values/strings.xml | 9 +++++++++ src/com/android/settings/BatteryInfo.java | 20 ++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/res/layout/battery_info.xml b/res/layout/battery_info.xml index 62f5d6910..1016ad18c 100644 --- a/res/layout/battery_info.xml +++ b/res/layout/battery_info.xml @@ -26,6 +26,12 @@ + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index c67c06c8c..3b5597234 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -117,6 +117,8 @@ Battery status: + Power plug: + Battery scale: Battery level: @@ -157,6 +159,13 @@ Full + + Unplugged + AC + USB + AC+USB + Unknown + Unknown diff --git a/src/com/android/settings/BatteryInfo.java b/src/com/android/settings/BatteryInfo.java index 4c25570e0..1cbe47f98 100644 --- a/src/com/android/settings/BatteryInfo.java +++ b/src/com/android/settings/BatteryInfo.java @@ -36,6 +36,7 @@ import com.android.internal.app.IBatteryStats; public class BatteryInfo extends Activity { private TextView mStatus; + private TextView mPower; private TextView mLevel; private TextView mScale; private TextView mHealth; @@ -111,6 +112,24 @@ public class BatteryInfo extends Activity { } mStatus.setText(statusString); + switch (plugType) { + case 0: + mPower.setText(getString(R.string.battery_info_power_unplugged)); + break; + case BatteryManager.BATTERY_PLUGGED_AC: + mPower.setText(getString(R.string.battery_info_power_ac)); + break; + case BatteryManager.BATTERY_PLUGGED_USB: + mPower.setText(getString(R.string.battery_info_power_usb)); + break; + case (BatteryManager.BATTERY_PLUGGED_AC|BatteryManager.BATTERY_PLUGGED_USB): + mPower.setText(getString(R.string.battery_info_power_ac_usb)); + break; + default: + mPower.setText(getString(R.string.battery_info_power_unknown)); + break; + } + int health = intent.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN); String healthString; if (health == BatteryManager.BATTERY_HEALTH_GOOD) { @@ -148,6 +167,7 @@ public class BatteryInfo extends Activity { super.onResume(); mStatus = (TextView)findViewById(R.id.status); + mPower = (TextView)findViewById(R.id.power); mLevel = (TextView)findViewById(R.id.level); mScale = (TextView)findViewById(R.id.scale); mHealth = (TextView)findViewById(R.id.health); -- cgit v1.2.3