Explicitly show plugged state.
Change-Id: I4592382cdcc9e116d3af102fd76057968a6ea874
This commit is contained in:
@@ -26,6 +26,12 @@
|
|||||||
<TextView android:id="@+id/status" style="@style/info_value" />
|
<TextView android:id="@+id/status" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</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 -->
|
<!-- Battery Level -->
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/battery_info_level_label" style="@style/info_label" />
|
<TextView android:text="@string/battery_info_level_label" style="@style/info_label" />
|
||||||
|
@@ -117,6 +117,8 @@
|
|||||||
<!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- 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>
|
<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 -->
|
<!-- 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>
|
<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 -->
|
<!-- 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>
|
<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 -->
|
<!-- 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>
|
<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 -->
|
<!-- 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>
|
<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 -->
|
<!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
|
@@ -36,6 +36,7 @@ import com.android.internal.app.IBatteryStats;
|
|||||||
|
|
||||||
public class BatteryInfo extends Activity {
|
public class BatteryInfo extends Activity {
|
||||||
private TextView mStatus;
|
private TextView mStatus;
|
||||||
|
private TextView mPower;
|
||||||
private TextView mLevel;
|
private TextView mLevel;
|
||||||
private TextView mScale;
|
private TextView mScale;
|
||||||
private TextView mHealth;
|
private TextView mHealth;
|
||||||
@@ -111,6 +112,24 @@ public class BatteryInfo extends Activity {
|
|||||||
}
|
}
|
||||||
mStatus.setText(statusString);
|
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);
|
int health = intent.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN);
|
||||||
String healthString;
|
String healthString;
|
||||||
if (health == BatteryManager.BATTERY_HEALTH_GOOD) {
|
if (health == BatteryManager.BATTERY_HEALTH_GOOD) {
|
||||||
@@ -148,6 +167,7 @@ public class BatteryInfo extends Activity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
mStatus = (TextView)findViewById(R.id.status);
|
mStatus = (TextView)findViewById(R.id.status);
|
||||||
|
mPower = (TextView)findViewById(R.id.power);
|
||||||
mLevel = (TextView)findViewById(R.id.level);
|
mLevel = (TextView)findViewById(R.id.level);
|
||||||
mScale = (TextView)findViewById(R.id.scale);
|
mScale = (TextView)findViewById(R.id.scale);
|
||||||
mHealth = (TextView)findViewById(R.id.health);
|
mHealth = (TextView)findViewById(R.id.health);
|
||||||
|
Reference in New Issue
Block a user