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

Commit 8b9d67fb authored by Jason Monk's avatar Jason Monk
Browse files

Move QS Edit into QSContainer

This will let it play nicely with heads up.

 - Move to QS Container.
 - QS Edit is always full height (some layout hacks to do this)
 - Always draw QS customizer on top when animating
 - Block all panel scrolling while QS edit is open (all touches
   go to editing)
 - Instantaneously change the height of the QS container at
   start/end of animation as needed

Bug: 26969293
Change-Id: Iedc6f5aaf659dcc6750972eae5f69cc0cd2df844
parent fdadb4b4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -14,10 +14,12 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- Height is 0 because it will be managed by the QSContainer manually -->
<com.android.systemui.qs.customize.QSCustomizer
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_height="0dp"
    android:orientation="vertical"
    android:background="@drawable/qs_customizer_background"
    android:gravity="center_horizontal">
+3 −0
Original line number Diff line number Diff line
@@ -34,4 +34,7 @@

    <include android:id="@+id/qs_detail" layout="@layout/qs_detail" />

    <include android:id="@+id/qs_customize" layout="@layout/qs_customize_panel"
        android:visibility="gone" />

</com.android.systemui.qs.QSContainer>
+4 −2
Original line number Diff line number Diff line
@@ -43,8 +43,10 @@
            android:id="@+id/qs_density_container"
            android:layout="@layout/qs_panel"
            android:layout_width="@dimen/notification_panel_width"
            android:layout_height="wrap_content"
            android:layout_gravity="@integer/notification_panel_layout_gravity" />
            android:layout_height="match_parent"
            android:layout_gravity="@integer/notification_panel_layout_gravity"
            android:clipToPadding="false"
            android:clipChildren="false" />

        <com.android.systemui.statusbar.stack.NotificationStackScrollLayout
            android:id="@+id/notification_stack_scroller"
+41 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.qs;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.graphics.Point;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
@@ -26,7 +27,9 @@ import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.qs.customize.QSCustomizer;
import com.android.systemui.statusbar.phone.BaseStatusBarHeader;
import com.android.systemui.statusbar.phone.NotificationPanelView;
import com.android.systemui.statusbar.phone.QSTileHost;
import com.android.systemui.statusbar.stack.StackStateAnimator;

@@ -39,6 +42,8 @@ public class QSContainer extends FrameLayout {
    private static final String TAG = "QSContainer";
    private static final boolean DEBUG = false;

    private final Point mSizePoint = new Point();

    private int mHeightOverride = -1;
    private QSPanel mQSPanel;
    private QSDetail mQSDetail;
@@ -51,6 +56,8 @@ public class QSContainer extends FrameLayout {

    private long mDelay;
    private QSAnimator mQSAnimator;
    private QSCustomizer mQSCustomizer;
    private NotificationPanelView mPanelView;

    public QSContainer(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -65,21 +72,33 @@ public class QSContainer extends FrameLayout {
        mHeader = (BaseStatusBarHeader) findViewById(R.id.header);
        mQSAnimator = new QSAnimator(this, (QuickQSPanel) mHeader.findViewById(R.id.quick_qs_panel),
                mQSPanel);
        mQSCustomizer = (QSCustomizer) findViewById(R.id.qs_customize);
        mQSCustomizer.setQsContainer(this);
    }

    public void setHost(QSTileHost qsh) {
        mQSPanel.setHost(qsh);
        mQSPanel.setHost(qsh, mQSCustomizer);
        mHeader.setQSPanel(mQSPanel);
        mQSDetail.setHost(qsh);
        mQSAnimator.setHost(qsh);
    }

    public void setPanelView(NotificationPanelView panelView) {
        mPanelView = panelView;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        // Since we control our own bottom, be whatever size we want.
        // Otherwise the QSPanel ends up with 0 height when the window is only the
        // size of the status bar.
        super.onMeasure(widthMeasureSpec, MeasureSpec.UNSPECIFIED);

        // QSCustomizer is always be the height of the screen, but do this after
        // other measuring to avoid changing the height of the QSContainer.
        getDisplay().getRealSize(mSizePoint);
        mQSCustomizer.measure(widthMeasureSpec,
                MeasureSpec.makeMeasureSpec(mSizePoint.y, MeasureSpec.EXACTLY));
    }

    @Override
@@ -88,6 +107,10 @@ public class QSContainer extends FrameLayout {
        updateBottom();
    }

    public boolean isCustomizing() {
        return mQSCustomizer.isCustomizing();
    }

    /**
     * Overrides the height of this view (post-layout), so that the content is clipped to that
     * height and the background is set to that height.
@@ -104,6 +127,9 @@ public class QSContainer extends FrameLayout {
     * during closing the detail panel, this already returns the smaller height.
     */
    public int getDesiredHeight() {
        if (isCustomizing()) {
            return getHeight();
        }
        if (mQSDetail.isClosingDetail()) {
            return mQSPanel.getGridHeight() + mHeader.getCollapsedHeight() + getPaddingBottom();
        } else {
@@ -111,9 +137,18 @@ public class QSContainer extends FrameLayout {
        }
    }

    public void notifyCustomizeChanged() {
        // The customize state changed, so our height changed.
        updateBottom();
        // Let the panel know the position changed and it needs to update where notifications
        // and whatnot are.
        mPanelView.onQsHeightChanged();
    }

    private void updateBottom() {
        int heightOverride = mHeightOverride != -1 ? mHeightOverride : getMeasuredHeight();
        int height = (int) (mQsExpansion * (heightOverride - mHeader.getCollapsedHeight()))
        int height = mQSCustomizer.isCustomizing() ? mQSCustomizer.getHeight()
                : (int) (mQsExpansion * (heightOverride - mHeader.getCollapsedHeight()))
                + mHeader.getCollapsedHeight();
        setBottom(getTop() + height);
        mQSDetail.setBottom(getTop() + height);
@@ -138,6 +173,10 @@ public class QSContainer extends FrameLayout {
        return mQSPanel;
    }

    public QSCustomizer getCustomizer() {
        return mQSCustomizer;
    }

    public boolean isShowingDetail() {
        return mQSPanel.isShowingCustomize() || mQSDetail.isShowingDetail();
    }
+5 −8
Original line number Diff line number Diff line
@@ -155,12 +155,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
        return mHost.createTile(subPanel);
    }

    protected void createCustomizePanel() {
        mCustomizePanel = (QSCustomizer) LayoutInflater.from(mContext)
                .inflate(R.layout.qs_customize_panel, null);
        mCustomizePanel.setHost(mHost);
    }

    public void setBrightnessMirror(BrightnessMirrorController c) {
        super.onFinishInflate();
        ToggleSlider brightnessSlider = (ToggleSlider) findViewById(R.id.brightness_slider);
@@ -173,12 +167,15 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
        mCallback = callback;
    }

    public void setHost(QSTileHost host) {
    public void setHost(QSTileHost host, QSCustomizer customizer) {
        mHost = host;
        mHost.addCallback(this);
        setTiles(mHost.getTiles());
        mFooter.setHost(host);
        createCustomizePanel();
        mCustomizePanel = customizer;
        if (mCustomizePanel != null) {
            mCustomizePanel.setHost(mHost);
        }
    }

    public QSTileHost getHost() {
Loading