diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 6702cefeb3e8c..0692b591acb89 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -58,7 +58,7 @@ 1.0 - 84dp + 86dp 64dp diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 7422902e593e9..fb58ba11e0ebd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -240,7 +240,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { != com.android.internal.R.id.status_bar_latest_event_content; int headsUpheight = headsUpCustom && beforeN ? mMaxHeadsUpHeightLegacy : mMaxHeadsUpHeight; - mMaxViewHeight = mNotificationMaxHeight; mPrivateLayout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight); mPublicLayout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight); } @@ -542,16 +541,23 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } private void initDimens() { - mNotificationMinHeightLegacy = getResources().getDimensionPixelSize( - R.dimen.notification_min_height_legacy); - mNotificationMinHeight = getResources().getDimensionPixelSize( - R.dimen.notification_min_height); - mNotificationMaxHeight = getResources().getDimensionPixelSize( - R.dimen.notification_max_height); - mMaxHeadsUpHeightLegacy = getResources().getDimensionPixelSize( + mNotificationMinHeightLegacy = getFontScaledHeight(R.dimen.notification_min_height_legacy); + mNotificationMinHeight = getFontScaledHeight(R.dimen.notification_min_height); + mNotificationMaxHeight = getFontScaledHeight(R.dimen.notification_max_height); + mMaxHeadsUpHeightLegacy = getFontScaledHeight( R.dimen.notification_max_heads_up_height_legacy); - mMaxHeadsUpHeight = getResources().getDimensionPixelSize( - R.dimen.notification_max_heads_up_height); + mMaxHeadsUpHeight = getFontScaledHeight(R.dimen.notification_max_heads_up_height); + } + + /** + * @param dimenId the dimen to look up + * @return the font scaled dimen as if it were in sp but doesn't shrink sizes below dp + */ + private int getFontScaledHeight(int dimenId) { + int dimensionPixelSize = getResources().getDimensionPixelSize(dimenId); + float factor = Math.max(1.0f, getResources().getDisplayMetrics().scaledDensity / + getResources().getDisplayMetrics().density); + return (int) (dimensionPixelSize * factor); } /** @@ -561,7 +567,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { public void reset() { super.reset(); final boolean wasExpanded = isExpanded(); - mMaxViewHeight = 0; mExpandable = false; mHasUserChangedExpansion = false; mUserLocked = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 8042b60714b2f..3176e2e1851a6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -24,7 +24,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; -import com.android.systemui.R; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import java.util.ArrayList; @@ -35,7 +34,6 @@ import java.util.ArrayList; public abstract class ExpandableView extends FrameLayout { protected OnHeightChangedListener mOnHeightChangedListener; - protected int mMaxViewHeight; private int mActualHeight; protected int mClipTopAmount; private boolean mActualHeightInitialized; @@ -49,8 +47,6 @@ public abstract class ExpandableView extends FrameLayout { public ExpandableView(Context context, AttributeSet attrs) { super(context, attrs); - mMaxViewHeight = getResources().getDimensionPixelSize( - R.dimen.notification_max_height); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index d5361dd75e83e..839bc455746db 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -144,11 +144,11 @@ public class NotificationContentView extends FrameLayout { } if (mContractedChild != null) { int heightSpec; + int size = Math.min(maxSize, mSmallHeight); if (shouldContractedBeFixedSize()) { - int size = Math.min(maxSize, mSmallHeight); heightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY); } else { - heightSpec = MeasureSpec.makeMeasureSpec(maxSize, MeasureSpec.AT_MOST); + heightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.AT_MOST); } mContractedChild.measure(widthMeasureSpec, heightSpec); int measuredHeight = mContractedChild.getMeasuredHeight();