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

Commit fd7ac356 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Fix for disappearing status bar power widgets after changing theme" into gingerbread

parents c161b416 4638a22b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -400,6 +400,12 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
        mDateView = (DateView)sb.findViewById(R.id.date);
        mCmBatteryMiniIcon = (CmBatteryMiniIcon)sb.findViewById(R.id.CmBatteryMiniIcon);

        /* Destroy any existing widgets before recreating the expanded dialog
         * to ensure there are no lost context issues */
        if (mPowerWidget != null) {
            mPowerWidget.destroyWidget();
        }

        mExpandedDialog = new ExpandedDialog(context);
        mExpandedView = expanded;
        mExpandedContents = expanded.findViewById(R.id.notificationLinearLayout);
+8 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ public class PowerWidget extends FrameLayout {
        updateVisibility();
    }

    public void setupWidget() {
    public void destroyWidget() {
        Log.i(TAG, "Clearing any old widget stuffs");
        // remove all views from the layout
        removeAllViews();
@@ -92,14 +92,21 @@ public class PowerWidget extends FrameLayout {
        // unregister our content receiver
        if(mBroadcastReceiver != null) {
            mContext.unregisterReceiver(mBroadcastReceiver);
            mBroadcastReceiver = null;
        }
        // unobserve our content
        if(mObserver != null) {
            mObserver.unobserve();
            mObserver = null;
        }

        // clear the button instances
        PowerButton.unloadAllButtons();
    }


    public void setupWidget() {
        destroyWidget();

        Log.i(TAG, "Setting up widget");