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

Commit 44ffc93b authored by Josh Guilfoyle's avatar Josh Guilfoyle Committed by Josh Guilfoyle
Browse files

Replace status bar theme change hack with a proper reinflation approach.

Now, when the theme changes we reinflate all status bar views and
reattach them.  This is an approximate simulation of the normal Activity
onDestroy/onCreate cycle that the system goes through when a config
change (in our case, a theme change) occurs.

Also reverts "Hack to update status bar service drawables on theme
change.", a478f39e
parent 41348643
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,8 +21,9 @@
<!--    android:background="@drawable/status_bar_closed_default_background" -->
<com.android.systemui.statusbar.StatusBarView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/statusbar_background"
    android:orientation="vertical"
    android:focusable="true"
    android:descendantFocusability="afterDescendants"
    >
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
    android:descendantFocusability="afterDescendants"
    >

    <LinearLayout android:id="@+id/exp_view_lin_layout"
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
            >
    </com.android.systemui.statusbar.LatestItemView>

    <View android:id="@+id/separator"
    <View
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/divider_horizontal_light_opaque"
+4 −0
Original line number Diff line number Diff line
@@ -83,6 +83,10 @@ public class NotificationData {
        return null;
    }

    void clear() {
        mEntries.clear();
    }

    private int chooseIndex(final long when) {
        final int N = mEntries.size();
        for (int i=0; i<N; i++) {
+4 −24
Original line number Diff line number Diff line
@@ -67,30 +67,6 @@ public class StatusBarIconView extends AnimatedImageView {
        return a.equals(b);
    }

    /**
     * Refresh resources that might have changed due to a configuration change.
     */
    public void updateResources() {
        StatusBarIcon icon = mIcon;
        if (icon != null) {
            Drawable drawable = getIcon(icon);
            if (drawable != null) {
                setImageDrawable(drawable);
            }

            if (icon.number > 0) {
                mNumberBackground = getContext().getResources().getDrawable(
                        R.drawable.ic_notification_overlay);
                placeNumber();
            } else {
                mNumberBackground = null;
                mNumberText = null;
            }

            invalidate();
        }
    }

    /**
     * Returns whether the set succeeded.
     */
@@ -180,6 +156,10 @@ public class StatusBarIconView extends AnimatedImageView {
        return mIcon;
    }

    public String getStatusBarSlot() {
        return mSlot;
    }

    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        if (mNumberBackground != null) {
Loading