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

Commit 25eee5c4 authored by James Nylen's avatar James Nylen Committed by Steve Kondik
Browse files

Add setting to hide notification pulldown after clicking a power widget button

Change-Id: Ibbb2da79ef93502990d122d1f31664e578a44a79
parent ffa2badf
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2271,6 +2271,12 @@ public final class Settings {
         */
        public static final String EXPANDED_VIEW_WIDGET = "expanded_view_widget";

        /**
         * Whether to hide the notification screen after clicking on a widget button
         * @hide
         */
        public static final String EXPANDED_HIDE_ONCHANGE = "expanded_hide_onchange";

        /**
         * Notification Indicator Color
         * @hide
+16 −1
Original line number Diff line number Diff line
@@ -286,6 +286,7 @@ public class StatusBarService extends IStatusBar.Stub
    int mDisabled = 0;

    private HashMap<String,PowerButton> mUsedPowerButtons = new HashMap<String,PowerButton>();
    private boolean mHideOnPowerButtonChange = false;

    /**
     * Construct the service, add the status bar view to the window manager
@@ -1927,6 +1928,9 @@ public class StatusBarService extends IStatusBar.Stub
            PowerButton btn = mUsedPowerButtons.get(type);
            btn.toggleState(mContext);
            updateWidget();
            if(mHideOnPowerButtonChange) {
                deactivate();
            }
        }
    };

@@ -1951,6 +1955,9 @@ public class StatusBarService extends IStatusBar.Stub
            setupWidget(buttonType, posi + 1);
        }
        updateWidget();

        mHideOnPowerButtonChange = (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.EXPANDED_HIDE_ONCHANGE, 0) == 1);
    }

    private void setupWidget(String buttonType, int position) {
@@ -2304,6 +2311,10 @@ public class StatusBarService extends IStatusBar.Stub
                    Settings.System.getUriFor(Settings.System.EXPANDED_VIEW_WIDGET),
                         false, this);

            resolver.registerContentObserver(
                    Settings.System.getUriFor(Settings.System.EXPANDED_HIDE_ONCHANGE),
                         false, this);

            resolver.registerContentObserver(
                    Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS_MODE),
                         false, this);
@@ -2354,7 +2365,11 @@ public class StatusBarService extends IStatusBar.Stub
                }
            } else if (uri.equals(Settings.System.getUriFor(Settings.System.WIDGET_BUTTONS))) {
                setupPowerWidget();
            } else if (uri.equals(Settings.System.getUriFor(Settings.System.EXPANDED_VIEW_WIDGET))) {
            } else if (uri.equals(Settings.System.getUriFor(
                    Settings.System.EXPANDED_HIDE_ONCHANGE))) {
                setupPowerWidget();
            } else if (uri.equals(Settings.System.getUriFor(
                    Settings.System.EXPANDED_VIEW_WIDGET))) {
                boolean powerWidget = Settings.System.getInt(mContext.getContentResolver(),
                            Settings.System.EXPANDED_VIEW_WIDGET, 1) == 1;
                if(!powerWidget) {