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

Commit 6fdfdbed authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Do not animate QSCustomizer when screen off" into qt-qpr1-dev

parents 4feb4522 f4b368e2
Loading
Loading
Loading
Loading
+25 −10
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ import androidx.recyclerview.widget.RecyclerView;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.plugins.qs.QSTile;
import com.android.systemui.qs.QSDetailClipper;
@@ -52,6 +52,8 @@ import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback;
import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Allows full-screen customization of QS, through show() and hide().
 *
@@ -66,6 +68,8 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene

    private final QSDetailClipper mClipper;
    private final LightBarController mLightBarController;
    private KeyguardMonitor mKeyguardMonitor;
    private final ScreenLifecycle mScreenLifecycle;
    private final TileQueryHelper mTileQueryHelper;
    private final View mTransparentView;

@@ -82,7 +86,11 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
    private boolean mOpening;
    private boolean mIsShowingNavBackdrop;

    public QSCustomizer(Context context, AttributeSet attrs) {
    @Inject
    public QSCustomizer(Context context, AttributeSet attrs,
            LightBarController lightBarController,
            KeyguardMonitor keyguardMonitor,
            ScreenLifecycle screenLifecycle) {
        super(new ContextThemeWrapper(context, R.style.edit_theme), attrs);

        LayoutInflater.from(getContext()).inflate(R.layout.qs_customize_panel_content, this);
@@ -115,7 +123,9 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
        DefaultItemAnimator animator = new DefaultItemAnimator();
        animator.setMoveDuration(TileAdapter.MOVE_DURATION);
        mRecyclerView.setItemAnimator(animator);
        mLightBarController = Dependency.get(LightBarController.class);
        mLightBarController = lightBarController;
        mKeyguardMonitor = keyguardMonitor;
        mScreenLifecycle = screenLifecycle;
        updateNavBackDrop(getResources().getConfiguration());
    }

@@ -177,7 +187,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
            queryTiles();
            mNotifQsContainer.setCustomizerAnimating(true);
            mNotifQsContainer.setCustomizerShowing(true);
            Dependency.get(KeyguardMonitor.class).addCallback(mKeyguardCallback);
            mKeyguardMonitor.addCallback(mKeyguardCallback);
            updateNavColors();
        }
    }
@@ -193,7 +203,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
            queryTiles();
            mNotifQsContainer.setCustomizerAnimating(false);
            mNotifQsContainer.setCustomizerShowing(true);
            Dependency.get(KeyguardMonitor.class).addCallback(mKeyguardCallback);
            mKeyguardMonitor.addCallback(mKeyguardCallback);
            updateNavColors();
        }
    }
@@ -203,16 +213,21 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
    }

    public void hide() {
        final boolean animate = mScreenLifecycle.getScreenState() != ScreenLifecycle.SCREEN_OFF;
        if (isShown) {
            MetricsLogger.hidden(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
            isShown = false;
            mToolbar.dismissPopupMenus();
            setCustomizing(false);
            save();
            if (animate) {
                mClipper.animateCircularClip(mX, mY, false, mCollapseAnimationListener);
            mNotifQsContainer.setCustomizerAnimating(true);
            } else {
                setVisibility(View.GONE);
            }
            mNotifQsContainer.setCustomizerAnimating(animate);
            mNotifQsContainer.setCustomizerShowing(false);
            Dependency.get(KeyguardMonitor.class).removeCallback(mKeyguardCallback);
            mKeyguardMonitor.removeCallback(mKeyguardCallback);
            updateNavColors();
        }
    }
@@ -268,7 +283,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene

    public void saveInstanceState(Bundle outState) {
        if (isShown) {
            Dependency.get(KeyguardMonitor.class).removeCallback(mKeyguardCallback);
            mKeyguardMonitor.removeCallback(mKeyguardCallback);
        }
        outState.putBoolean(EXTRA_QS_CUSTOMIZING, mCustomizing);
    }
@@ -300,7 +315,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
        @Override
        public void onKeyguardShowingChanged() {
            if (!isAttachedToWindow()) return;
            if (Dependency.get(KeyguardMonitor.class).isShowing() && !mOpening) {
            if (mKeyguardMonitor.isShowing() && !mOpening) {
                hide();
            }
        }
+2 −1
Original line number Diff line number Diff line
@@ -1738,7 +1738,8 @@ public class NotificationPanelView extends PanelView implements
    private void setQsExpansion(float height) {
        height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);
        mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0;
        if (height > mQsMinExpansionHeight && !mQsExpanded && !mStackScrollerOverscrolling) {
        if (height > mQsMinExpansionHeight && !mQsExpanded && !mStackScrollerOverscrolling
                && !mDozing) {
            setQsExpanded(true);
        } else if (height <= mQsMinExpansionHeight && mQsExpanded) {
            setQsExpanded(false);
+6 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.systemui.qs.QSFooterImpl;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.qs.QuickQSPanel;
import com.android.systemui.qs.QuickStatusBarHeader;
import com.android.systemui.qs.customize.QSCustomizer;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.phone.LockIcon;
@@ -172,6 +173,11 @@ public class InjectionInflationController {
         * Creates the QuickQSPanel.
         */
        QuickQSPanel createQuickQSPanel();

        /**
         * Creates the QSCustomizer.
         */
        QSCustomizer createQSCustomizer();
    }

    /**