Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fb235aa authored by Elliott Hughes's avatar Elliott Hughes Committed by Android (Google) Code Review
Browse files

Merge "Fix percentage formatting in SystemUI." into lmp-mr1-dev

parents 9ae2bca4 88d25510
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@
    <string name="status_bar_ongoing_events_title" msgid="1682504513316879202">"مستمر"</string>
    <string name="status_bar_latest_events_title" msgid="6594767438577593172">"الإشعارات"</string>
    <string name="battery_low_title" msgid="6456385927409742437">"البطارية منخفضة"</string>
    <string name="battery_low_percent_format" msgid="1077244949318261761">"المتبقي: <xliff:g id="NUMBER">%d%%</xliff:g>"</string>
    <string name="battery_low_percent_format_saver_started" msgid="6534746636002666456">"يتبقى <xliff:g id="NUMBER">%d%%</xliff:g>. وضع توفير الطاقة قيد التشغيل."</string>
    <string name="battery_low_percent_format" msgid="1077244949318261761">"المتبقي: <xliff:g id="NUMBER">%s</xliff:g>"</string>
    <string name="battery_low_percent_format_saver_started" msgid="6534746636002666456">"يتبقى <xliff:g id="NUMBER">%s</xliff:g>. وضع توفير الطاقة قيد التشغيل."</string>
    <string name="invalid_charger" msgid="4549105996740522523">"شحن USB غير معتمد.\nاستخدم الشاحن الموفر فقط."</string>
    <string name="invalid_charger_title" msgid="3515740382572798460">"لا يمكن إجراء الشحن عبر USB."</string>
    <string name="invalid_charger_text" msgid="5474997287953892710">"لا تستخدم سوى الشاحن المزوّد."</string>
@@ -224,8 +224,6 @@
    <string name="start_dreams" msgid="7219575858348719790">"حلم اليقظة"</string>
    <string name="ethernet_label" msgid="7967563676324087464">"Ethernet"</string>
    <string name="quick_settings_airplane_mode_label" msgid="5510520633448831350">"وضع الطائرة"</string>
    <string name="quick_settings_battery_charging_label" msgid="490074774465309209">"جارٍ الشحن، <xliff:g id="NUMBER">%d</xliff:g><xliff:g id="PERCENT">%%</xliff:g>"</string>
    <string name="quick_settings_battery_charged_label" msgid="8865413079414246081">"تم الشحن"</string>
    <string name="quick_settings_bluetooth_label" msgid="6304190285170721401">"بلوتوث"</string>
    <string name="quick_settings_bluetooth_multiple_devices_label" msgid="3912245565613684735">"بلوتوث (<xliff:g id="NUMBER">%d</xliff:g> من الأجهزة)"</string>
    <string name="quick_settings_bluetooth_off_label" msgid="8159652146149219937">"إيقاف البلوتوث"</string>
@@ -324,7 +322,6 @@
    <string name="battery_saver_notification_title" msgid="237918726750955859">"وضع توفير الطاقة قيد التشغيل"</string>
    <string name="battery_saver_notification_text" msgid="820318788126672692">"لخفض مستوى الأداء وبيانات الخلفية"</string>
    <string name="battery_saver_notification_action_text" msgid="109158658238110382">"إيقاف توفير شحن البطارية"</string>
    <string name="battery_level_template" msgid="1609636980292580020">"<xliff:g id="LEVEL">%d</xliff:g>%%"</string>
    <string name="notification_hidden_text" msgid="1135169301897151909">"المحتويات مخفية"</string>
    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> سيبدأ التقاط كل شيء يتم عرضه على الشاشة."</string>
    <string name="media_projection_remember_text" msgid="3103510882172746752">"عدم الإظهار مرة أخرى"</string>
+2 −5
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@
    <string name="status_bar_ongoing_events_title" msgid="1682504513316879202">"در حال انجام"</string>
    <string name="status_bar_latest_events_title" msgid="6594767438577593172">"اعلان‌ها"</string>
    <string name="battery_low_title" msgid="6456385927409742437">"شارژ باتری کم است"</string>
    <string name="battery_low_percent_format" msgid="1077244949318261761">"<xliff:g id="NUMBER">%d%%</xliff:g> باقیمانده است"</string>
    <string name="battery_low_percent_format_saver_started" msgid="6534746636002666456">"<xliff:g id="NUMBER">%d%%</xliff:g> باقی مانده است. ذخیره کننده باتری روشن است."</string>
    <string name="battery_low_percent_format" msgid="1077244949318261761">"<xliff:g id="NUMBER">%s</xliff:g> باقیمانده است"</string>
    <string name="battery_low_percent_format_saver_started" msgid="6534746636002666456">"<xliff:g id="NUMBER">%s</xliff:g> باقی مانده است. ذخیره کننده باتری روشن است."</string>
    <string name="invalid_charger" msgid="4549105996740522523">"شارژ USB پشتیبانی نمی‌شود.\nفقط از شارژر ارائه شده استفاده کنید."</string>
    <string name="invalid_charger_title" msgid="3515740382572798460">"شارژ با USB پشتیبانی نمی‌شود."</string>
    <string name="invalid_charger_text" msgid="5474997287953892710">"فقط از شارژر ارائه شده استفاده کنید."</string>
@@ -224,8 +224,6 @@
    <string name="start_dreams" msgid="7219575858348719790">"رویاپردازی"</string>
    <string name="ethernet_label" msgid="7967563676324087464">"اترنت"</string>
    <string name="quick_settings_airplane_mode_label" msgid="5510520633448831350">"حالت هواپیما"</string>
    <string name="quick_settings_battery_charging_label" msgid="490074774465309209">"در حال شارژ، <xliff:g id="NUMBER">%d</xliff:g><xliff:g id="PERCENT">%%</xliff:g>"</string>
    <string name="quick_settings_battery_charged_label" msgid="8865413079414246081">"شارژ شد"</string>
    <string name="quick_settings_bluetooth_label" msgid="6304190285170721401">"بلوتوث"</string>
    <string name="quick_settings_bluetooth_multiple_devices_label" msgid="3912245565613684735">"بلوتوث ( <xliff:g id="NUMBER">%d</xliff:g> دستگاه)"</string>
    <string name="quick_settings_bluetooth_off_label" msgid="8159652146149219937">"بلوتوث خاموش"</string>
@@ -324,7 +322,6 @@
    <string name="battery_saver_notification_title" msgid="237918726750955859">"ذخیره کننده باتری روشن است."</string>
    <string name="battery_saver_notification_text" msgid="820318788126672692">"عملکرد و اطلاعات پس‌زمینه را کاهش می‌دهد"</string>
    <string name="battery_saver_notification_action_text" msgid="109158658238110382">"خاموش کردن ذخیره‌کننده باتری"</string>
    <string name="battery_level_template" msgid="1609636980292580020">"<xliff:g id="LEVEL">%d</xliff:g>%%"</string>
    <string name="notification_hidden_text" msgid="1135169301897151909">"محتواها پنهان هستند"</string>
    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> شروع به ضبط هر چیزی می‌کند که در صفحه‌نمایش شما نمایش داده می‌شود."</string>
    <string name="media_projection_remember_text" msgid="3103510882172746752">"دوباره نشان داده نشود"</string>
+3 −15
Original line number Diff line number Diff line
@@ -62,12 +62,12 @@
    <string name="battery_low_title">Battery is low</string>

    <!-- A message that appears when the battery level is getting low in a dialog.  This is
        appened to the subtitle of the low battery alert.  "number" is the percentage of battery
        appened to the subtitle of the low battery alert.  "percentage" is the percentage of battery
        remaining [CHAR LIMIT=none]-->
    <string name="battery_low_percent_format"><xliff:g id="number">%d%%</xliff:g> remaining</string>
    <string name="battery_low_percent_format"><xliff:g id="percentage">%s</xliff:g> remaining</string>

    <!-- Same as battery_low_percent_format, with a notice about battery saver if on. [CHAR LIMIT=none]-->
    <string name="battery_low_percent_format_saver_started"><xliff:g id="number">%d%%</xliff:g> remaining. Battery saver is on.</string>
    <string name="battery_low_percent_format_saver_started"><xliff:g id="percentage">%s</xliff:g> remaining. Battery saver is on.</string>

    <!-- A message that appears when a USB charger is plugged in and the device does not
    support charging on it.  That is, a charger that fits into the USB port and goes into
@@ -115,11 +115,6 @@
    <!-- Label in system panel saying the device will show notifications [CHAR LIMIT=30] -->
    <string name="status_bar_settings_notifications">Notifications</string>

    <!-- Text to display next to the graphical battery meter.  [CHAR LIMIT=3] -->
    <string name="status_bar_settings_battery_meter_format" translatable="false">
        <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g>
    </string>

    <!-- Separator for PLMN and SPN in network name. -->
    <string name="status_bar_network_name_separator" translatable="false">|</string>

@@ -559,10 +554,6 @@

    <!-- QuickSettings: Airplane mode [CHAR LIMIT=NONE] -->
    <string name="quick_settings_airplane_mode_label">Airplane mode</string>
    <!-- QuickSettings: Battery Charging [CHAR LIMIT=NONE] -->
    <string name="quick_settings_battery_charging_label">Charging, <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>
    <!-- QuickSettings: Battery Charged [CHAR LIMIT=NONE] -->
    <string name="quick_settings_battery_charged_label">Charged</string>
    <!-- QuickSettings: Bluetooth [CHAR LIMIT=NONE] -->
    <string name="quick_settings_bluetooth_label">Bluetooth</string>
    <!-- QuickSettings: Bluetooth (Multiple) [CHAR LIMIT=NONE] -->
@@ -813,9 +804,6 @@
    <!-- Battery saver notification action text. [CHAR LIMIT=60] -->
    <string name="battery_saver_notification_action_text">Turn off battery saver</string>

    <!-- Battery level for expanded quick settings [CHAR LIMIT=2] -->
    <string name="battery_level_template"><xliff:g id="level" example="45">%d</xliff:g>%%</string>

    <!-- Text shown in place of notification contents when the notification is hidden on a secure lockscreen -->
    <string name="notification_hidden_text">Contents hidden</string>

+3 −1
Original line number Diff line number Diff line
@@ -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)
+4 −1
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.UserInfoController;

import java.text.NumberFormat;

/**
 * The header group on Keyguard.
 */
@@ -150,7 +152,8 @@ public class KeyguardStatusBarView extends RelativeLayout

    @Override
    public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
        mBatteryLevel.setText(getResources().getString(R.string.battery_level_template, level));
        String percentage = NumberFormat.getPercentInstance().format((double) level / 100.0);
        mBatteryLevel.setText(percentage);
        boolean changed = mBatteryCharging != charging;
        mBatteryCharging = charging;
        if (changed) {
Loading