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

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

Merge "Prototype remove labels in QS"

parents fafb66fb 3c704df4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -50,4 +50,6 @@ public abstract class QSTileView extends LinearLayout {
    public abstract void onStateChanged(State state);

    public abstract int getDetailY();

    public void setShowLabels(boolean show) {}
}
+13 −0
Original line number Diff line number Diff line
@@ -70,6 +70,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
    private int mMinRows = 1;
    private int mMaxColumns = TileLayout.NO_MAX_COLUMNS;

    private boolean mShowLabels = true;

    public PagedTileLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        mScroller = new Scroller(context, SCROLL_CUBIC);
@@ -82,6 +84,16 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
    }
    private int mLastMaxHeight = -1;

    @Override
    public void setShowLabels(boolean show) {
        mShowLabels = show;
        for (TilePage p : mPages) {
            p.setShowLabels(show);
        }
        mDistributeTiles = true;
        requestLayout();
    }

    public void saveInstanceState(Bundle outState) {
        outState.putInt(CURRENT_PAGE, getCurrentItem());
    }
@@ -219,6 +231,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
                .inflate(R.layout.qs_paged_page, this, false);
        page.setMinRows(mMinRows);
        page.setMaxColumns(mMaxColumns);
        page.setShowLabels(mShowLabels);
        return page;
    }

+2 −0
Original line number Diff line number Diff line
@@ -829,6 +829,8 @@ public class QSPanel extends LinearLayout implements Tunable {
        default void setExpansion(float expansion) {}

        int getNumVisibleTiles();

        default void setShowLabels(boolean show) {}
    }

    interface OnConfigurationChangedListener {
+27 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ import javax.inject.Named;
 */
@QSScope
public class QSPanelController extends QSPanelControllerBase<QSPanel> {
    public static final String QS_REMOVE_LABELS = "sysui_remove_labels";

    private final QSSecurityFooter mQsSecurityFooter;
    private final TunerService mTunerService;
    private final QSCustomizerController mQsCustomizerController;
@@ -120,6 +122,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
        updateMediaDisappearParameters();

        mTunerService.addTunable(mView, QS_SHOW_BRIGHTNESS);
        mTunerService.addTunable(mTunable, QS_REMOVE_LABELS);
        mView.updateResources();
        if (mView.isListening()) {
            refreshAllTiles();
@@ -132,6 +135,13 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
        }
    }

    @Override
    boolean switchTileLayout(boolean force) {
        boolean result = super.switchTileLayout(force);
        getTileLayout().setShowLabels(mShowLabels);
        return result;
    }

    @Override
    protected QSTileRevealController createTileRevealController() {
        return mQsTileRevealControllerFactory.create(
@@ -140,6 +150,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {

    @Override
    protected void onViewDetached() {
        mTunerService.removeTunable(mTunable);
        mTunerService.removeTunable(mView);
        mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener);
        if (mBrightnessMirrorController != null) {
@@ -305,5 +316,21 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
    public boolean isExpanded() {
        return mView.isExpanded();
    }

    private TunerService.Tunable mTunable = new TunerService.Tunable() {
        @Override
        public void onTuningChanged(String key, String newValue) {
            if (QS_REMOVE_LABELS.equals(key)) {
                boolean newShowLabels = "0".equals(newValue);
                if (mShowLabels == newShowLabels) return;
                mShowLabels = newShowLabels;
                for (TileRecord t : mRecords) {
                    t.tileView.setShowLabels(mShowLabels);
                }
                getTileLayout().setShowLabels(mShowLabels);
                mView.requestLayout();
            }
        }
    };
}
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
    private float mRevealExpansion;

    private final QSHost.Callback mQSHostCallback = this::setTiles;
    protected boolean mShowLabels = true;

    private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener =
            new QSPanel.OnConfigurationChangedListener() {
@@ -183,6 +184,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
        final TileRecord r = new TileRecord();
        r.tile = tile;
        r.tileView = mHost.createTileView(tile, collapsedView);
        r.tileView.setShowLabels(mShowLabels);
        mView.addTile(r);
        mRecords.add(r);
        mCachedSpecs = getTilesSpecs();
Loading