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

Commit cf591db0 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Confine the quick settings trigger to the right third of the status bar.

Pulling down anywhere on the status bar when a panel is
already showing will switch to the other panel.

Also adjust gesture recorder output to track the settings
panel and annotate it separately.

Change-Id: I0ca3b395b5f2c6c8767237126bce26d0e8c9b8c0
parent 978f853d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
     limitations under the License.
-->

<com.android.systemui.statusbar.phone.PanelView
<com.android.systemui.statusbar.phone.SettingsPanelView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
@@ -42,4 +42,4 @@
            android:src="@drawable/status_bar_close"
            />
    </LinearLayout>
</com.android.systemui.statusbar.phone.PanelView>
 No newline at end of file
</com.android.systemui.statusbar.phone.SettingsPanelView >
 No newline at end of file
+1 −3
Original line number Diff line number Diff line
@@ -22,15 +22,13 @@ import android.util.AttributeSet;
public class NotificationPanelView extends PanelView {
    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, attrs);
        android.util.Slog.v("NotificationPanelView", "ctor");
    }


    @Override
    public void fling(float vel, boolean always) {
        ((PhoneStatusBarView) mBar).mBar.getGestureRecorder().tag(
            "fling " + ((vel > 0) ? "open" : "closed"),
            "v=" + vel);
            "notifications,v=" + vel);
        super.fling(vel, always);
    }
}
+7 −4
Original line number Diff line number Diff line
@@ -64,15 +64,18 @@ public class PanelBar extends FrameLayout {
        return getMeasuredHeight();
    }

    public PanelView selectPanelForTouchX(float x) {
        final int N = mPanels.size();
        return mPanels.get((int)(N * x / getMeasuredWidth()));
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        // figure out which panel needs to be talked to here
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            final int N = mPanels.size();
            final int i = (int)(N * event.getX() / getMeasuredWidth());
            mTouchingPanel = mPanels.get(i);
            mTouchingPanel = selectPanelForTouchX(event.getX());
            mPanelHolder.setSelectedPanel(mTouchingPanel);
            LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %d", mState, i);
            LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s", mState, mTouchingPanel.getName());
            if (mState == STATE_CLOSED || mState == STATE_OPEN) {
                go(STATE_TRANSITIONING);
                onPanelPeeked();
+2 −2
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ public class PanelView extends FrameLayout {
                                    xVel, yVel,
                                    vel);

                            fling(vel, false);
                            fling(vel, true);

                            mVelocityTracker.recycle();
                            mVelocityTracker = null;
@@ -238,7 +238,7 @@ public class PanelView extends FrameLayout {
    public void fling(float vel, boolean always) {
        mVel = vel;

        if (mVel != 0) {
        if (always||mVel != 0) {
            animationTick(0); // begin the animation
        }
    }
+25 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class PhoneStatusBarView extends PanelBar {
    PhoneStatusBar mBar;
    int mScrimColor;
    PanelView mFadingPanel = null;
    PanelView mNotificationPanel, mSettingsPanel;

    public PhoneStatusBarView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -58,6 +59,16 @@ public class PhoneStatusBarView extends PanelBar {
        mScrimColor = res.getColor(R.color.notification_panel_scrim_color);
    }

    @Override
    public void addPanel(PanelView pv) {
        super.addPanel(pv);
        if (pv.getId() == R.id.notification_panel) {
            mNotificationPanel = pv;
        } else if (pv.getId() == R.id.settings_panel){
            mSettingsPanel = pv;
        }
    }

    @Override
    public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
        if (super.onRequestSendAccessibilityEvent(child, event)) {
@@ -73,6 +84,20 @@ public class PhoneStatusBarView extends PanelBar {
        return false;
    }

    @Override
    public PanelView selectPanelForTouchX(float x) {
        // We split the status bar into thirds: the left 2/3 are for notifications, and the 
        // right 1/3 for quick settings. If you pull the status bar down a second time you'll
        // toggle panels no matter where you pull it down.
        final float w = (float) getMeasuredWidth();
        final float f = x / w;
        if (f > 0.67f && mSettingsPanel.getExpandedFraction() != 1.0f
                || mNotificationPanel.getExpandedFraction() == 1.0f) {
            return mSettingsPanel;
        }
        return mNotificationPanel;
    }

    @Override
    public void onPanelPeeked() {
        super.onPanelPeeked();
Loading