diff options
| author | 2018-07-12 17:54:51 -0700 | |
|---|---|---|
| committer | 2018-07-12 17:54:51 -0700 | |
| commit | 67a6e07ed377ef9567a5db154e9849c89da91f06 (patch) | |
| tree | 39dac666f99e20f5973cc99d998e666466e71083 | |
| parent | 2656f6d0493a96b73d39eaa22cd619a8dc3c1431 (diff) | |
| parent | 090e9d232c6ba24ec9078e7cc3406aad3a548c3d (diff) | |
Merge "DO NOT MERGE: Use minimumHeight in QS header" into pi-dev
am: 090e9d232c
Change-Id: Ifdd605c54262b533b405a6161b7b857609d576bc
| -rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 3 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java | 30 |
2 files changed, 29 insertions, 4 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 883ed8dd17d9..3c84e5a91026 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -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> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index a9bfa45b6a73..36d832647207 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -34,6 +34,7 @@ import android.os.Handler; import android.provider.AlarmClock; import android.service.notification.ZenModeConfig; import android.support.annotation.VisibleForTesting; +import android.widget.FrameLayout; import android.text.format.DateUtils; import android.util.AttributeSet; import android.util.Log; @@ -269,8 +270,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 = @@ -281,10 +296,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(); |