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

Commit 1a99a4a4 authored by Roman Birg's avatar Roman Birg Committed by Gerrit Code Review
Browse files

SystemUI: handle when brightness slider is hidden



With this patch, the quick settings area should automatically expand and
make room for the tile trashcan/instruction area when the user has the
brightness slider hidden.

Also adds a scrollview to the QS Settings page to allow the list to grow
without impacting the height of the qs panel.

Ref: CYNGNOS-1644

Change-Id: I03f552ec28a978c4cad1e7e7a52648ec3d311a07
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 5a3c86f9
Loading
Loading
Loading
Loading
+63 −51
Original line number Diff line number Diff line
@@ -18,8 +18,12 @@
        xmlns:systemui="http://schemas.android.com/apk/res-auto"
        android:id="@+id/quick_settings_settings_recursion_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="16dp"
        android:layout_height="match_parent"
        android:orientation="vertical">

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

        <TextView
@@ -37,8 +41,15 @@
                android:key="status_bar_show_weather"
                android:title="@string/quick_settings_title_show_weather"
                systemui:defaultValue="1"
            systemui:table="cm_system"
    />
                systemui:table="cm_system"/>

        <!-- brightness slider -->
        <com.android.systemui.qs.QSBooleanSettingRow
                style="@style/SettingRow"
                android:key="qs_show_brightness_slider"
                android:title="@string/quick_settings_title_show_brightness_slider"
                systemui:defaultValue="1"
                systemui:table="cm_system"/>

        <TextView
                android:layout_width="match_parent"
@@ -80,5 +91,6 @@

        </LinearLayout>

    </LinearLayout>
</com.android.systemui.qs.QSSettings>
+3 −3
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
    <LinearLayout
            android:id="@+id/delete_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:orientation="horizontal">
@@ -48,7 +48,7 @@
    <LinearLayout
            android:id="@+id/edit_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:orientation="horizontal">
@@ -73,7 +73,7 @@

    <TextView
            android:id="@+id/qs_toast"
            android:layout_height="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:gravity="center_vertical"
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@
    <string name="quick_settings_title_header">Header</string>
    <string name="quick_settings_title_tiles">Tiles</string>
    <string name="quick_settings_title_show_weather">Show weather</string>
    <string name="quick_settings_title_show_brightness_slider">Show brightness slider</string>
    <string name="quick_settings_title_enlarge_first_row">Enlarge first row</string>

    <!-- Screen pinning dialog description (for devices without navbar) -->
+12 −26
Original line number Diff line number Diff line
@@ -375,6 +375,7 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
            r.tile.setListening(mListening);
        }
        mFooter.setListening(mListening);
        mQsPanelTop.setListening(mListening);
        if (mListening) {
            refreshAllTiles();
        }
@@ -728,13 +729,6 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
        mHost.remove(spec);
    }

    public void ensurePagerState() {
        if (!isShowingDetail()) {
            final boolean pagingEnabled = getVisibleTilePageCount() > 1 || mDragging || mEditing;
            mViewPager.setPagingEnabled(pagingEnabled);
        }
    }

    public int getTilesPerPage(boolean firstPage) {
        if ((!mFirstRowLarge && firstPage) || !firstPage) {
            return QSTileHost.TILES_PER_PAGE + 1;
@@ -853,12 +847,10 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
        if (!isShowingDetail() && !isClosingDetail()) {
            mQsPanelTop.bringToFront();
        }

        ensurePagerState();
    }

    protected int getRowTop(int row) {
        int baseHeight = mBrightnessView.getMeasuredHeight();
        int baseHeight = mQsPanelTop.getMeasuredHeight();
        if (row <= 0) return baseHeight;
        return baseHeight + mLargeCellHeight - mDualTileUnderlap + (row - 1) * mCellHeight;
    }
@@ -1727,22 +1719,6 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
        }
    }

    @Override
    protected void setGridContentVisibility(boolean visible) {
        int newVis = visible ? VISIBLE : INVISIBLE;
        for (int i = 0; i < mRecords.size(); i++) {
            TileRecord tileRecord = mRecords.get(i);
            if (tileRecord.tileView.getVisibility() != GONE) {
                tileRecord.tileView.setVisibility(newVis);
            }
        }
        mQsPanelTop.setVisibility(showBrightnessSlider() ? newVis : GONE);
        if (mGridContentVisible != visible) {
            MetricsLogger.visibility(mContext, MetricsLogger.QS_PANEL, newVis);
        }
        mGridContentVisible = visible;
    }

    public void updateResources() {
        final Resources res = mContext.getResources();
        final int columns = Math.max(1, res.getInteger(R.integer.quick_settings_num_columns));
@@ -1773,6 +1749,12 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
        return mCurrentlyAnimating.contains(t);
    }

    public void cleanup() {
        if (mSettingsObserver != null) {
            mSettingsObserver.unobserve();
        }
    }

    public static class TilesListAdapter extends BaseExpandableListAdapter
            implements QSTile.DetailAdapter {

@@ -2106,6 +2088,10 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
        return mRecords.indexOf(mDraggingRecord) >= 0;
    }

    public boolean isOnSettingsPage() {
        return mEditing && mViewPager.getCurrentItem() == 0;
    }

    public void goToSettingsPage() {
        if (mEditing) {
            mViewPager.setCurrentItem(0, true);
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public class QSPage extends ViewGroup {
            record.tileView.measure(exactly(cw), exactly(ch));
            previousView = record.tileView.updateAccessibilityOrder(previousView);
        }
        setMeasuredDimension(width, exactly(mGridHeight));
        setMeasuredDimension(width, mGridHeight);
    }

    @Override
Loading