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

Commit cfaac7f1 authored by Matt Garnes's avatar Matt Garnes
Browse files

Add battery level text to status bar (1/2)

1. Add TextView to display battery level percentage next to the battery
icon.
2. Remove support for displaying battery percentage on the actual
battery icon itself.
3. Also respect view on lockscreen and opened notification drawer.

Change-Id: Iab6228f5316908961c8647773bd3c8655df29679
parent e1d33db8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2018,6 +2018,12 @@ public final class Settings {
         */
        public static final String SCREEN_BRIGHTNESS = "screen_brightness";

        /**
         * @hide
         * Control whether to display the battery text on the status bar in a standalone TextView.
         */
        public static final String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";

        /**
         * Control whether to enable automatic brightness mode.
         */
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@
    <fraction name="def_window_transition_scale">100%</fraction>
    <bool name="def_haptic_feedback">true</bool>

    <!-- Default battery status text toggle -->
    <bool name="def_status_bar_show_battery_percent">false</bool>

    <bool name="def_bluetooth_on">false</bool>
    <bool name="def_wifi_display_on">false</bool>
    <bool name="def_install_non_market_apps">false</bool>
+3 −0
Original line number Diff line number Diff line
@@ -2384,6 +2384,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {

            loadStringSetting(stmt, Settings.System.DATE_FORMAT,
                    R.string.def_date_format);

            loadBooleanSetting(stmt, Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT,
                    R.bool.def_status_bar_show_battery_percent);
        } finally {
            if (stmt != null) stmt.close();
        }
+9 −0
Original line number Diff line number Diff line
@@ -38,4 +38,13 @@
        android:layout_width="10.5dp"
        android:layout_marginBottom="0.33dp"
        android:layout_marginStart="4dip"/>

    <com.android.systemui.BatteryLevelTextView android:id="@+id/battery_level_text"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:gravity="center"
        android:layout_gravity="center_vertical"
        android:textColor="#ffffff"
        android:textSize="@dimen/battery_level_text_size"
        android:layout_marginStart="7dp"/>
</LinearLayout>
+10 −1
Original line number Diff line number Diff line
@@ -38,4 +38,13 @@
        android:layout_width="9.5dp"
        android:layout_marginBottom="@dimen/battery_margin_bottom"
        android:layout_marginStart="7dp"/>

    <com.android.systemui.BatteryLevelTextView android:id="@+id/battery_level_text"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:gravity="center"
        android:layout_gravity="center_vertical"
        android:textColor="#ffffff"
        android:textSize="@dimen/battery_level_text_size"
        android:layout_marginStart="7dp"/>
</LinearLayout>
Loading