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

Commit a2019f5a authored by Roman Birg's avatar Roman Birg Committed by Michael Bestas
Browse files

SystemUI: Add quick settings pull down with one finger



Logic is currently set to use 1/3 of right hand side of the statusbar to
trigger a quick settings quick pull down, quickly.

Change-Id: I3f536496f724f07d2419a5b2db5fa8f8261609e7
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>

SystemUI: fix right hand side gestures on lockscreen

two finger quick pulldown was not accounting for being in the keyguard
adn was eating touch events when it shouldn't be.

Change-Id: I625d48a4002aaaf2d55d7efaed65d892ab7aa13c
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>

SystemUI: add Settings.System toggle for quick-quick settings pulldown

Change-Id: I3c5dcfc23f39bf8be6c402e25f61e6f57a8add2c
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>

From: Zhao Wei Liew <zhaoweiliew@gmail.com>
SystemUI: statusbar: Fix QS quick pulldown feature

Bring in the fixes from CM 13.

This commit squashes the following patches from CM 13.0:
68c40f32 SystemUI: fix QS quick pull down
477f58dc SystemUI: hook up settings observer in notificationpanel
d2bec52c SystemUI: Fix quick-quick settings pulldown settings
eb10bc20 Add left QS quick pulldown (1/3)

Change-Id: Ie122477261d96499c80640cf274d22fba6642a01

From: Zhao Wei Liew <zhaoweiliew@gmail.com>
(partial) SystemUI: Use Tuner API for CM settings
Get rid of all the excess code by implementing TunerService.Tunable
and observing any changes made to the settings through it.

Remove UserContentObserver as the Tuner API handles user switches.

Also remove some unused imports that were introduced in earlier
CM commits, but were never removed since.

Change-Id: I3c5dcfc23f39bf8be6c402e25f61e6f57a8add2c
parent cc0ef24f
Loading
Loading
Loading
Loading
+34 −2
Original line number Diff line number Diff line
@@ -100,8 +100,11 @@ import com.android.systemui.statusbar.policy.KeyguardMonitor;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.InjectionInflationController;

import lineageos.providers.LineageSettings;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -119,7 +122,7 @@ public class NotificationPanelView extends PanelView implements
        OnHeadsUpChangedListener, QS.HeightListener, ZenModeController.Callback,
        ConfigurationController.ConfigurationListener, StateListener,
        PulseExpansionHandler.ExpansionCallback, DynamicPrivacyController.Listener,
        NotificationWakeUpCoordinator.WakeUpListener {
        NotificationWakeUpCoordinator.WakeUpListener, TunerService.Tunable {

    private static final boolean DEBUG = false;

@@ -153,6 +156,9 @@ public class NotificationPanelView extends PanelView implements
    static final String COUNTER_PANEL_OPEN_QS = "panel_open_qs";
    private static final String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek";

    private static final String STATUS_BAR_QUICK_QS_PULLDOWN =
            "lineagesystem:" + LineageSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN;

    private static final Rect mDummyDirtyRect = new Rect(0, 0, 1, 1);
    private static final Rect mEmptyRect = new Rect();

@@ -438,6 +444,8 @@ public class NotificationPanelView extends PanelView implements
     */
    private boolean mDelayShowingKeyguardStatusBar;

    private int mOneFingerQuickSettingsIntercept;

    @Inject
    public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
            InjectionInflationController injectionInflationController,
@@ -541,6 +549,7 @@ public class NotificationPanelView extends PanelView implements
        Dependency.get(StatusBarStateController.class).addCallback(this);
        Dependency.get(ZenModeController.class).addCallback(this);
        Dependency.get(ConfigurationController.class).addCallback(this);
        Dependency.get(TunerService.class).addTunable(this, STATUS_BAR_QUICK_QS_PULLDOWN);
        mUpdateMonitor.registerCallback(mKeyguardUpdateCallback);
        // Theme might have changed between inflating this view and attaching it to the window, so
        // force a call to onThemeChanged
@@ -554,9 +563,17 @@ public class NotificationPanelView extends PanelView implements
        Dependency.get(StatusBarStateController.class).removeCallback(this);
        Dependency.get(ZenModeController.class).removeCallback(this);
        Dependency.get(ConfigurationController.class).removeCallback(this);
        Dependency.get(TunerService.class).removeTunable(this);
        mUpdateMonitor.removeCallback(mKeyguardUpdateCallback);
    }

    @Override
    public void onTuningChanged(String key, String newValue) {
        if (STATUS_BAR_QUICK_QS_PULLDOWN.equals(key)) {
            mOneFingerQuickSettingsIntercept = newValue == null ? 1 : Integer.parseInt(newValue);
        }
    }

    @Override
    protected void loadDimens() {
        super.loadDimens();
@@ -1342,7 +1359,22 @@ public class NotificationPanelView extends PanelView implements
                && (event.isButtonPressed(MotionEvent.BUTTON_SECONDARY)
                || event.isButtonPressed(MotionEvent.BUTTON_TERTIARY));

        return twoFingerDrag || stylusButtonClickDrag || mouseButtonClickDrag;
        final float w = getMeasuredWidth();
        final float x = event.getX();
        float region = w * 1.f / 4.f; // TODO overlay region fraction?
        boolean showQsOverride = false;

        switch (mOneFingerQuickSettingsIntercept) {
            case 1: // Right side pulldown
                showQsOverride = isLayoutRtl() ? x < region : w - region < x;
                break;
            case 2: // Left side pulldown
                showQsOverride = isLayoutRtl() ? w - region < x : x < region;
                break;
        }
        showQsOverride &= mBarState == StatusBarState.SHADE;

        return twoFingerDrag || showQsOverride || stylusButtonClickDrag || mouseButtonClickDrag;
    }

    private void handleQsDown(MotionEvent event) {