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

Commit e15017ed authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Change QQS to use tiles with side labels

* 2x2 in portrait, 1x4 in landscape
* 4 columns in landscape QS

Other fixes while changing this:
* Animations between QQS and QS look better
* Fix alignment of tiles labels
* Improve line logic for labels

Test: manual
Test: atest SystemUITests
Bug: 171319433
Bug: 180632445
Fixes: 180472943
Fixes: 180191343
Change-Id: I67fbe27796461bee7d2364f81b47f2efd31e4b41
parent 5ba00654
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
    android:layout_height="wrap_content"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:minHeight="48dp"
    android:paddingTop="12dp">
    <LinearLayout
        android:id="@+id/label_group"
+3 −0
Original line number Diff line number Diff line
@@ -91,6 +91,9 @@
    <!-- The number of columns in the QuickSettings -->
    <integer name="quick_settings_num_columns">3</integer>

    <!-- The number of columns in the Quick Settings customizer -->
    <integer name="quick_settings_edit_num_columns">@integer/quick_settings_num_columns</integer>

    <!-- The number of rows in the QuickSettings -->
    <integer name="quick_settings_max_rows">3</integer>

+18 −10
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.systemui.qs.QSPanel.QSTileLayout;
import com.android.systemui.qs.TouchAnimator.Builder;
import com.android.systemui.qs.TouchAnimator.Listener;
import com.android.systemui.qs.dagger.QSScope;
import com.android.systemui.qs.tileimpl.QSTileBaseView;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.tuner.TunerService.Tunable;
@@ -56,7 +55,8 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
    private final ArrayList<View> mAllViews = new ArrayList<>();
    /**
     * List of {@link View}s representing Quick Settings that are being animated from the quick QS
     * position to the normal QS panel.
     * position to the normal QS panel. These views will only show once the animation is complete,
     * to prevent overlapping of semi transparent views
     */
    private final ArrayList<View> mQuickQsViews = new ArrayList<>();
    private final QuickQSPanel mQuickQsPanel;
@@ -233,7 +233,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
                // Quick tiles.
                QSTileView quickTileView = mQuickQSPanelController.getTileView(tile);
                if (quickTileView == null) continue;
                View qqsBgCircle = ((QSTileBaseView) quickTileView).getBgCircle();

                getRelativePosition(loc1, quickTileView.getIcon().getIconView(), view);
                getRelativePosition(loc2, tileIcon, view);
@@ -255,11 +254,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
                    translationXBuilder.addFloat(tileView, "translationX", -xDiff, 0);
                    translationYBuilder.addFloat(tileView, "translationY", -yDiff, 0);

                    if (mFeatureFlags.isQSLabelsEnabled()) {
                        firstPageBuilder.addFloat(qqsBgCircle, "alpha", 1, 1, 0);
                        mAllViews.add(qqsBgCircle);
                    }

                } else { // These tiles disappear when expanding
                    firstPageBuilder.addFloat(quickTileView, "alpha", 1, 0);
                    translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff);
@@ -271,7 +265,11 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
                            translationX);
                }

                if (mFeatureFlags.isQSLabelsEnabled()) {
                    mQuickQsViews.add(tileView);
                } else {
                    mQuickQsViews.add(tileView.getIconWithBackground());
                }
                mAllViews.add(tileView.getIcon());
                mAllViews.add(quickTileView);
            } else if (mFullRows && isIconInAnimatedRow(count)) {
@@ -362,7 +360,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
        if(view == parent || view == null) return;
        // Ignore tile pages as they can have some offset we don't want to take into account in
        // RTL.
        if (!(view instanceof PagedTileLayout.TilePage || view instanceof SideLabelTileLayout)) {
        if (!isAPage(view)) {
            loc1[0] += view.getLeft();
            loc1[1] += view.getTop();
        }
@@ -374,6 +372,16 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
        getRelativePositionInt(loc1, (View) view.getParent(), parent);
    }

    // Returns true if the view is a possible page in PagedTileLayout
    private boolean isAPage(View view) {
        if (view instanceof PagedTileLayout.TilePage) {
            return true;
        } else if (view instanceof SideLabelTileLayout) {
            return !(view instanceof QuickQSPanel.QQSSideLabelTileLayout);
        }
        return false;
    }

    public void setPosition(float position) {
        if (mNeedsAnimatorUpdate) {
            updateAnimators();
+16 −12
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class QSPanel extends LinearLayout implements Tunable {
    private int mMediaTotalBottomMargin;
    private int mFooterMarginStartHorizontal;
    private Consumer<Boolean> mMediaVisibilityChangedListener;
    private boolean mSideLabels;
    protected boolean mSideLabels;

    public QSPanel(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -201,6 +201,9 @@ public class QSPanel extends LinearLayout implements Tunable {
                mFooterPageIndicator.setNumPages(((PagedTileLayout) mTileLayout).getNumPages());
            }

            // In landscape, mTileLayout's parent is not the panel but a view that contains the
            // tile layout and the media controls.
            if (((View) mTileLayout).getParent() == this) {
                // Allow the UI to be as big as it want's to, we're in a scroll view
                int newHeight = 10000;
                int availableHeight = MeasureSpec.getSize(heightMeasureSpec);
@@ -212,6 +215,7 @@ public class QSPanel extends LinearLayout implements Tunable {
                heightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY);
                ((PagedTileLayout) mTileLayout).setExcessHeight(excessHeight);
            }
        }
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        // We want all the logic of LinearLayout#onMeasure, and for it to assign the excess space
@@ -758,7 +762,7 @@ public class QSPanel extends LinearLayout implements Tunable {
                // Let's use 3 columns to match the current layout
                int columns;
                if (mSideLabels) {
                    columns = horizontal ? 1 : 2;
                    columns = horizontal ? 2 : 4;
                } else {
                    columns = horizontal ? 3 : TileLayout.NO_MAX_COLUMNS;
                }
+1 −7
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.qs;

import static com.android.systemui.media.dagger.MediaModule.QS_PANEL;
import static com.android.systemui.qs.QSPanel.QS_SHOW_BRIGHTNESS;
import static com.android.systemui.qs.dagger.QSFlagsModule.QS_LABELS_FLAG;
import static com.android.systemui.qs.dagger.QSFragmentModule.QS_USING_MEDIA_PLAYER;

import android.annotation.NonNull;
@@ -66,7 +65,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {

    private BrightnessMirrorController mBrightnessMirrorController;
    private boolean mGridContentVisible = true;
    private boolean mQsLabelsFlag;

    private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener =
            new QSPanel.OnConfigurationChangedListener() {
@@ -93,7 +91,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
            DumpManager dumpManager, MetricsLogger metricsLogger, UiEventLogger uiEventLogger,
            QSLogger qsLogger, BrightnessController.Factory brightnessControllerFactory,
            BrightnessSlider.Factory brightnessSliderFactory,
            @Named(QS_LABELS_FLAG) boolean qsLabelsFlag,
            FeatureFlags featureFlags) {
        super(view, qstileHost, qsCustomizerController, usingMediaPlayer, mediaHost,
                metricsLogger, uiEventLogger, qsLogger, dumpManager, featureFlags);
@@ -108,9 +105,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
        mView.setBrightnessView(mBrightnessSlider.getRootView());

        mBrightnessController = brightnessControllerFactory.create(mBrightnessSlider);

        mQsLabelsFlag = qsLabelsFlag;
        mSideLabels = qsLabelsFlag;
    }

    @Override
@@ -329,7 +323,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
        @Override
        public void onTuningChanged(String key, String newValue) {
            if (QS_REMOVE_LABELS.equals(key)) {
                if (!mQsLabelsFlag) return;
                if (!mQSLabelFlag) return;
                boolean newShowLabels = newValue == null || "0".equals(newValue);
                if (mShowLabels == newShowLabels) return;
                mShowLabels = newShowLabels;
Loading