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

Commit 377e7ad8 authored by Jason Monk's avatar Jason Monk
Browse files

Move detail panel to its own thing

Move pieces of the detail panel from the header and QSPanel to be
in a single container to make the enter/exit be handled better
and code cleaner.

Change-Id: Id1e79b96830ee50051e340fb09ecde537a64e516
parent 209fd91d
Loading
Loading
Loading
Loading
+29 −6
Original line number Diff line number Diff line
@@ -14,13 +14,36 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<!-- Extends LinearLayout -->
<com.android.systemui.qs.QSDetail
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/qs_detail_background"
    android:paddingBottom="8dp"
    android:clickable="true"
    android:visibility="invisible"
    android:orientation="vertical">

    <include
        android:id="@+id/qs_detail_header"
        layout="@layout/qs_detail_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="28dp"
        />

    <com.android.systemui.statusbar.AlphaOptimizedImageView
        android:id="@+id/qs_detail_header_progress"
        android:src="@drawable/indeterminate_anim"
        android:alpha="0"
        android:background="@color/qs_detail_progress_track"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        systemui:hasOverlappingRendering="false"
        />

    <FrameLayout
            android:id="@android:id/content"
            android:layout_width="match_parent"
@@ -53,4 +76,4 @@
                android:focusable="true"/>

    </LinearLayout>
</LinearLayout>
</com.android.systemui.qs.QSDetail>
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingEnd="@dimen/qs_panel_padding"
    android:visibility="invisible"
    android:background="@drawable/btn_borderless_rect"
    android:gravity="center">

+2 −0
Original line number Diff line number Diff line
@@ -30,4 +30,6 @@

    <include layout="@layout/quick_status_bar_expanded_header" />

    <include android:id="@+id/qs_detail" layout="@layout/qs_detail" />

</com.android.systemui.qs.QSContainer>
+0 −8
Original line number Diff line number Diff line
@@ -159,14 +159,6 @@
        android:clipChildren="false"
        android:clipToPadding="false" />

    <include
        android:id="@+id/qs_detail_header"
        layout="@layout/qs_detail_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="28dp"
        />

    <com.android.systemui.statusbar.AlphaOptimizedImageView
        android:id="@+id/qs_detail_header_progress"
        android:src="@drawable/indeterminate_anim"
+10 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public class QSContainer extends FrameLayout {

    private int mHeightOverride = -1;
    private QSPanel mQSPanel;
    private QSDetail mQSDetail;
    protected BaseStatusBarHeader mHeader;
    private float mQsExpansion;
    private boolean mQsExpanded;
@@ -57,6 +58,8 @@ public class QSContainer extends FrameLayout {
    protected void onFinishInflate() {
        super.onFinishInflate();
        mQSPanel = (QSPanel) findViewById(R.id.quick_settings_panel);
        mQSDetail = (QSDetail) findViewById(R.id.qs_detail);
        mQSDetail.setQsPanel(mQSPanel);
        mHeader = (BaseStatusBarHeader) findViewById(R.id.header);
    }

@@ -82,7 +85,7 @@ public class QSContainer extends FrameLayout {
     * during closing the detail panel, this already returns the smaller height.
     */
    public int getDesiredHeight() {
        if (mQSPanel.isClosingDetail()) {
        if (mQSDetail.isClosingDetail()) {
            return mQSPanel.getGridHeight() + mHeader.getCollapsedHeight() + getPaddingBottom();
        } else {
            return getMeasuredHeight();
@@ -94,6 +97,7 @@ public class QSContainer extends FrameLayout {
        int height = (int) (mQsExpansion * (heightOverride - mHeader.getCollapsedHeight()))
                + mHeader.getCollapsedHeight();
        setBottom(getTop() + height);
        mQSDetail.setBottom(getTop() + height);
    }

    private void updateQsState() {
@@ -115,6 +119,10 @@ public class QSContainer extends FrameLayout {
        return mQSPanel;
    }

    public boolean isShowingDetail() {
        return mQSPanel.isShowingCustomize() || mQSDetail.isShowingDetail();
    }

    public void setHeaderClickable(boolean clickable) {
        if (DEBUG) Log.d(TAG, "setHeaderClickable " + clickable);
        mHeader.setClickable(clickable);
@@ -154,6 +162,7 @@ public class QSContainer extends FrameLayout {
        }
        mHeader.setExpansion(mKeyguardShowing ? 1 : expansion);
        mQSPanel.setTranslationY(translationScaleY * mQSPanel.getHeight());
        mQSDetail.setFullyExpanded(expansion == 1);
        updateBottom();
    }

Loading