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

Unverified Commit 5f76298b 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.

[Pig]: Forward port to R
[bgcngm]: Forward port to S

Change-Id: I3c5dcfc23f39bf8be6c402e25f61e6f57a8add2c
parent 5ad12c4c
Loading
Loading
Loading
Loading
+40 −1
Original line number Diff line number Diff line
@@ -35,9 +35,11 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.app.Fragment;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Insets;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Handler;
import android.util.IndentingPrintWriter;
import android.util.Log;
import android.util.MathUtils;
@@ -104,6 +106,8 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.LargeScreenUtils;
import com.android.systemui.util.kotlin.JavaAdapter;

import lineageos.providers.LineageSettings;

import dagger.Lazy;

import java.io.PrintWriter;
@@ -289,6 +293,9 @@ public class QuickSettingsController implements Dumpable {
    private int mLastNotificationsClippingTopBound;
    private int mLastNotificationsClippingTopBoundNssl;

    private int mOneFingerQuickSettingsIntercept;
    private final ContentObserver mOneFingerQuickSettingsInterceptObserver;

    private final Region mInterceptRegion = new Region();
    /** The end bounds of a clipping animation. */
    private final Rect mClippingAnimationEndBounds = new Rect();
@@ -396,6 +403,16 @@ public class QuickSettingsController implements Dumpable {
        mJavaAdapter = javaAdapter;

        mLockscreenShadeTransitionController.addCallback(new LockscreenShadeTransitionCallback());

        mOneFingerQuickSettingsInterceptObserver = new ContentObserver(null) {
            @Override
            public void onChange(boolean selfChange) {
                mOneFingerQuickSettingsIntercept = LineageSettings.System.getInt(
                        mPanelView.getContext().getContentResolver(),
                        LineageSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 0);
            }
        };

        dumpManager.registerDumpable(this);
    }

@@ -590,7 +607,22 @@ public class QuickSettingsController implements Dumpable {
                        MotionEvent.BUTTON_SECONDARY) || event.isButtonPressed(
                        MotionEvent.BUTTON_TERTIARY));

        return twoFingerDrag || stylusButtonClickDrag || mouseButtonClickDrag;
        final float w = mQs.getView().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 = mQs.getView().isLayoutRtl() ? x < region : w - region < x;
                break;
            case 2: // Left side pulldown
                showQsOverride = mQs.getView().isLayoutRtl() ? w - region < x : x < region;
                break;
        }
        showQsOverride &= mBarState == StatusBarState.SHADE;

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


@@ -2180,12 +2212,19 @@ public class QuickSettingsController implements Dumpable {
            mShadeTransitionController.setQs(mQs);
            mNotificationStackScrollLayoutController.setQsHeader((ViewGroup) mQs.getHeader());
            mQs.setScrollListener(mQsScrollListener);
            mPanelView.getContext().getContentResolver().registerContentObserver(
                    LineageSettings.System.getUriFor(
                            LineageSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN),
                    false, mOneFingerQuickSettingsInterceptObserver);
            mOneFingerQuickSettingsInterceptObserver.onChange(true);
            updateExpansion();
        }

        /** */
        @Override
        public void onFragmentViewDestroyed(String tag, Fragment fragment) {
            mPanelView.getContext().getContentResolver().unregisterContentObserver(
                    mOneFingerQuickSettingsInterceptObserver);
            // Manual handling of fragment lifecycle is only required because this bridges
            // non-fragment and fragment code. Once we are using a fragment for the notification
            // panel, mQs will not need to be null cause it will be tied to the same lifecycle.