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

Commit 3c704df4 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Prototype remove labels in QS

Add flag to not show labels in QS. This also makes it show more rows.

Added a switch in customizer to toggle the setting.

Some visual issues when toggling (media player), fixed by collapsing and
reopening QS.

In user builds, can be toggled with:

`adb shell settings put secure sysui_remove_labels {0, 1}`

Test: manual
Change-Id: I750c53d918b2d9590ff86eed67d1932444390828
parent f010d5de
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -50,4 +50,6 @@ public abstract class QSTileView extends LinearLayout {
    public abstract void onStateChanged(State state);
    public abstract void onStateChanged(State state);


    public abstract int getDetailY();
    public abstract int getDetailY();

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


    private boolean mShowLabels = true;

    public PagedTileLayout(Context context, AttributeSet attrs) {
    public PagedTileLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
        mScroller = new Scroller(context, SCROLL_CUBIC);
        mScroller = new Scroller(context, SCROLL_CUBIC);
@@ -82,6 +84,16 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
    }
    }
    private int mLastMaxHeight = -1;
    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) {
    public void saveInstanceState(Bundle outState) {
        outState.putInt(CURRENT_PAGE, getCurrentItem());
        outState.putInt(CURRENT_PAGE, getCurrentItem());
    }
    }
@@ -219,6 +231,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
                .inflate(R.layout.qs_paged_page, this, false);
                .inflate(R.layout.qs_paged_page, this, false);
        page.setMinRows(mMinRows);
        page.setMinRows(mMinRows);
        page.setMaxColumns(mMaxColumns);
        page.setMaxColumns(mMaxColumns);
        page.setShowLabels(mShowLabels);
        return page;
        return page;
    }
    }


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


        int getNumVisibleTiles();
        int getNumVisibleTiles();

        default void setShowLabels(boolean show) {}
    }
    }


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

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


        mTunerService.addTunable(mView, QS_SHOW_BRIGHTNESS);
        mTunerService.addTunable(mView, QS_SHOW_BRIGHTNESS);
        mTunerService.addTunable(mTunable, QS_REMOVE_LABELS);
        mView.updateResources();
        mView.updateResources();
        if (mView.isListening()) {
        if (mView.isListening()) {
            refreshAllTiles();
            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
    @Override
    protected QSTileRevealController createTileRevealController() {
    protected QSTileRevealController createTileRevealController() {
        return mQsTileRevealControllerFactory.create(
        return mQsTileRevealControllerFactory.create(
@@ -140,6 +150,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {


    @Override
    @Override
    protected void onViewDetached() {
    protected void onViewDetached() {
        mTunerService.removeTunable(mTunable);
        mTunerService.removeTunable(mView);
        mTunerService.removeTunable(mView);
        mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener);
        mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener);
        if (mBrightnessMirrorController != null) {
        if (mBrightnessMirrorController != null) {
@@ -305,5 +316,21 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
    public boolean isExpanded() {
    public boolean isExpanded() {
        return mView.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 Original line Diff line number Diff line
@@ -71,6 +71,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
    private float mRevealExpansion;
    private float mRevealExpansion;


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


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