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

Commit db4a640c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use minimumHeight in QS header"

parents f8585dcb 84b98954
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -252,6 +252,9 @@
         -->
    <dimen name="qs_header_system_icons_area_height">48dp</dimen>

    <!-- How far the quick-quick settings panel extends below the status bar -->
    <dimen name="qs_quick_header_panel_height">128dp</dimen>

    <!-- The height of the container that holds the system icons in the quick settings header in the
         car setting. -->
    <dimen name="car_qs_header_system_icons_area_height">54dp</dimen>
+26 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.media.AudioManager;
import android.os.Handler;
import android.provider.AlarmClock;
import android.service.notification.ZenModeConfig;
import android.widget.FrameLayout;
import androidx.annotation.VisibleForTesting;
import android.text.format.DateUtils;
import android.util.AttributeSet;
@@ -270,8 +271,22 @@ public class QuickStatusBarHeader extends RelativeLayout implements
        updateResources();
    }

    /**
     * The height of QQS should always be the status bar height + 128dp. This is normally easy, but
     * when there is a notch involved the status bar can remain a fixed pixel size.
     */
    private void updateMinimumHeight() {
        int sbHeight = mContext.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.status_bar_height);
        int qqsHeight = mContext.getResources().getDimensionPixelSize(
                R.dimen.qs_quick_header_panel_height);

        setMinimumHeight(sbHeight + qqsHeight);
    }

    private void updateResources() {
        Resources resources = mContext.getResources();
        updateMinimumHeight();

        // Update height for a few views, especially due to landscape mode restricting space.
        mHeaderTextContainerView.getLayoutParams().height =
@@ -282,10 +297,17 @@ public class QuickStatusBarHeader extends RelativeLayout implements
                com.android.internal.R.dimen.quick_qs_offset_height);
        mSystemIconsView.setLayoutParams(mSystemIconsView.getLayoutParams());

        getLayoutParams().height = resources.getDimensionPixelSize(mQsDisabled
                ? com.android.internal.R.dimen.quick_qs_offset_height
                : com.android.internal.R.dimen.quick_qs_total_height);
        setLayoutParams(getLayoutParams());
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
        if (mQsDisabled) {
            lp.height = resources.getDimensionPixelSize(
                    com.android.internal.R.dimen.quick_qs_offset_height);
        } else {
            lp.height = Math.max(getMinimumHeight(),
                    resources.getDimensionPixelSize(
                            com.android.internal.R.dimen.quick_qs_offset_height));
        }

        setLayoutParams(lp);

        updateStatusIconAlphaAnimator();
        updateHeaderTextContainerAlphaAnimator();