diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-09-26 12:44:02 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-09-26 12:44:02 -0700 |
commit | 9281c929d6e4abf0ddf77d614b2eb57f7528397a (patch) | |
tree | 223b626081127e8b7110ba186ce4d6c1de1a169f | |
parent | 782d1ae019a81f6c46908f2d056246a344759567 (diff) | |
download | packages_apps_settings-9281c929d6e4abf0ddf77d614b2eb57f7528397a.zip packages_apps_settings-9281c929d6e4abf0ddf77d614b2eb57f7528397a.tar.gz packages_apps_settings-9281c929d6e4abf0ddf77d614b2eb57f7528397a.tar.bz2 |
Explicitly show plugged state.
Change-Id: I4592382cdcc9e116d3af102fd76057968a6ea874
-rw-r--r-- | res/layout/battery_info.xml | 6 | ||||
-rw-r--r-- | res/values/strings.xml | 9 | ||||
-rw-r--r-- | src/com/android/settings/BatteryInfo.java | 20 |
3 files changed, 35 insertions, 0 deletions
diff --git a/res/layout/battery_info.xml b/res/layout/battery_info.xml index 62f5d69..1016ad1 100644 --- a/res/layout/battery_info.xml +++ b/res/layout/battery_info.xml @@ -26,6 +26,12 @@ <TextView android:id="@+id/status" style="@style/info_value" /> </LinearLayout> + <!-- Battery Status --> + <LinearLayout style="@style/entry_layout"> + <TextView android:text="@string/battery_info_power_label" style="@style/info_label" /> + <TextView android:id="@+id/power" style="@style/info_value" /> + </LinearLayout> + <!-- Battery Level --> <LinearLayout style="@style/entry_layout"> <TextView android:text="@string/battery_info_level_label" style="@style/info_label" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index c67c06c..3b55972 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -117,6 +117,8 @@ <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed --> <string name="battery_info_status_label">Battery status:</string> <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed --> + <string name="battery_info_power_label">Power plug:</string> + <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed --> <string name="battery_info_scale_label">Battery scale:</string> <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed --> <string name="battery_info_level_label">Battery level:</string> @@ -157,6 +159,13 @@ <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed --> <string name="battery_info_status_full">Full</string> + <!-- Battery Info screen. Units shown after a value. Used for diagnostic info screens, precise translation isn't needed --> + <string name="battery_info_power_unplugged">Unplugged</string> + <string name="battery_info_power_ac">AC</string> + <string name="battery_info_power_usb">USB</string> + <string name="battery_info_power_ac_usb">AC+USB</string> + <string name="battery_info_power_unknown">Unknown</string> + <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed --> <string name="battery_info_health_unknown">Unknown</string> <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed --> diff --git a/src/com/android/settings/BatteryInfo.java b/src/com/android/settings/BatteryInfo.java index 4c25570..1cbe47f 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); |