Merge "Notifications in landscape should line up with the QS tiles." into sc-dev am: 580ee3e136
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14938833 Change-Id: I007eb5584c99de37bdd2e96642379aba5a8394e2
This commit is contained in:
@@ -445,6 +445,9 @@
|
||||
<!-- Adjust the theme on fully custom and decorated custom view notifications -->
|
||||
<bool name="config_adjustThemeOnNotificationCustomViews">false</bool>
|
||||
|
||||
<!-- Notifications are sized to match the width of two (of 4) qs tiles in landscape. -->
|
||||
<bool name="config_skinnyNotifsInLandscape">true</bool>
|
||||
|
||||
<!-- If true, enable the advance anti-falsing classifier on the lockscreen. On some devices it
|
||||
does not work well, particularly with noisy touchscreens. Note that disabling it may
|
||||
increase the rate of unintentional unlocks. -->
|
||||
|
||||
@@ -111,6 +111,7 @@ import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController
|
||||
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
||||
import com.android.systemui.statusbar.policy.ScrollAdapter;
|
||||
import com.android.systemui.util.Assert;
|
||||
import com.android.systemui.util.leak.RotationUtils;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -421,6 +422,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
animateScroll();
|
||||
};
|
||||
private int mCornerRadius;
|
||||
private int mMinimumPaddings;
|
||||
private int mQsTilePadding;
|
||||
private boolean mSkinnyNotifsInLandscape;
|
||||
private int mSidePaddings;
|
||||
private final Rect mBackgroundAnimationRect = new Rect();
|
||||
private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>();
|
||||
@@ -896,7 +900,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
R.dimen.min_top_overscroll_to_qs);
|
||||
mStatusBarHeight = res.getDimensionPixelSize(R.dimen.status_bar_height);
|
||||
mBottomMargin = res.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom);
|
||||
mSidePaddings = res.getDimensionPixelSize(R.dimen.notification_side_paddings);
|
||||
mMinimumPaddings = res.getDimensionPixelSize(R.dimen.notification_side_paddings);
|
||||
mQsTilePadding = res.getDimensionPixelOffset(R.dimen.qs_tile_margin_horizontal);
|
||||
mSkinnyNotifsInLandscape = res.getBoolean(R.bool.config_skinnyNotifsInLandscape);
|
||||
mSidePaddings = mMinimumPaddings; // Updated in onMeasure by updateSidePadding()
|
||||
mMinInteractionHeight = res.getDimensionPixelSize(
|
||||
R.dimen.notification_min_interaction_height);
|
||||
mCornerRadius = res.getDimensionPixelSize(R.dimen.notification_corner_radius);
|
||||
@@ -906,6 +913,21 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
com.android.internal.R.dimen.quick_qs_offset_height);
|
||||
}
|
||||
|
||||
void updateSidePadding(int viewWidth) {
|
||||
if (viewWidth == 0 || !mSkinnyNotifsInLandscape) {
|
||||
mSidePaddings = mMinimumPaddings;
|
||||
return;
|
||||
}
|
||||
// Portrait is easy, just use the dimen for paddings
|
||||
if (RotationUtils.getRotation(mContext) == RotationUtils.ROTATION_NONE) {
|
||||
mSidePaddings = mMinimumPaddings;
|
||||
return;
|
||||
}
|
||||
final int innerWidth = viewWidth - mMinimumPaddings * 2;
|
||||
final int qsTileWidth = (innerWidth - mQsTilePadding * 3) / 4;
|
||||
mSidePaddings = mMinimumPaddings + qsTileWidth + mQsTilePadding;
|
||||
}
|
||||
|
||||
void updateCornerRadius() {
|
||||
int newRadius = getResources().getDimensionPixelSize(R.dimen.notification_corner_radius);
|
||||
if (mCornerRadius != newRadius) {
|
||||
@@ -966,6 +988,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
updateSidePadding(width);
|
||||
int childWidthSpec = MeasureSpec.makeMeasureSpec(width - mSidePaddings * 2,
|
||||
MeasureSpec.getMode(widthMeasureSpec));
|
||||
// Don't constrain the height of the children so we know how big they'd like to be
|
||||
@@ -2117,7 +2140,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
|
||||
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
|
||||
private void updateContentHeight() {
|
||||
final float scrimTopPadding = mAmbientState.isOnKeyguard() ? 0 : mSidePaddings;
|
||||
final float scrimTopPadding = mAmbientState.isOnKeyguard() ? 0 : mMinimumPaddings;
|
||||
int height = (int) scrimTopPadding;
|
||||
float previousPaddingRequest = mPaddingBetweenElements;
|
||||
int numShownItems = 0;
|
||||
|
||||
Reference in New Issue
Block a user