diff options
-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 62f5d6910..1016ad18c 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 c67c06c8c..3b5597234 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 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); |