diff options
author | Elliott Hughes <enh@google.com> | 2014-10-03 12:06:17 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-10-03 12:06:17 -0700 |
commit | 88d255107d266d5aaca66cfd9e502aa2b9faa9e6 (patch) | |
tree | 99103cb05fa525fdeb0509427813917e9e0073c7 /packages/SystemUI/src/com/android/systemui/power | |
parent | 1c061d4862cf541757c3932abc382ec4f9f5620f (diff) | |
download | frameworks_base-88d255107d266d5aaca66cfd9e502aa2b9faa9e6.zip frameworks_base-88d255107d266d5aaca66cfd9e502aa2b9faa9e6.tar.gz frameworks_base-88d255107d266d5aaca66cfd9e502aa2b9faa9e6.tar.bz2 |
Fix percentage formatting in SystemUI.
Also remove some orphaned strings that tried to format percentages wrongly.
(The ar and fa localizations will be clobbered, but this lets you test this
change independently.)
Bug: 15476051
Change-Id: Ifd97d47446bdd2e95298b04e1a11542dfed7f9a1
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/power')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java index f184ad2..f69f2e6 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java @@ -43,6 +43,7 @@ import com.android.systemui.statusbar.phone.PhoneStatusBar; import com.android.systemui.statusbar.phone.SystemUIDialog; import java.io.PrintWriter; +import java.text.NumberFormat; public class PowerNotificationWarnings implements PowerUI.WarningsUI { private static final String TAG = PowerUI.TAG + ".Notification"; @@ -171,13 +172,14 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showWarningNotification() { final int textRes = mSaver ? R.string.battery_low_percent_format_saver_started : R.string.battery_low_percent_format; + final String percentage = NumberFormat.getPercentInstance().format((double) mBatteryLevel / 100.0); final Notification.Builder nb = new Notification.Builder(mContext) .setSmallIcon(R.drawable.ic_power_low) // Bump the notification when the bucket dropped. .setWhen(mBucketDroppedNegativeTimeMs) .setShowWhen(false) .setContentTitle(mContext.getString(R.string.battery_low_title)) - .setContentText(mContext.getString(textRes, mBatteryLevel)) + .setContentText(mContext.getString(textRes, percentage)) .setOnlyAlertOnce(true) .setPriority(Notification.PRIORITY_MAX) .setCategory(Notification.CATEGORY_SYSTEM) |