Merge "Shelf horizontal alignment was a few dps off" into pi-dev
This commit is contained in:
@@ -151,6 +151,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
||||
private ArrayMap<String, ArrayList<StatusBarIcon>> mReplacingIcons;
|
||||
// Keep track of the last visible icon so collapsed container can report on its location
|
||||
private IconState mLastVisibleIconState;
|
||||
private IconState mFirstVisibleIconState;
|
||||
private float mVisualOverflowStart;
|
||||
// Keep track of overflow in range [0, 3]
|
||||
private int mNumDots;
|
||||
@@ -159,7 +160,6 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
||||
private int[] mAbsolutePosition = new int[2];
|
||||
private View mIsolatedIconForAnimation;
|
||||
|
||||
|
||||
public NotificationIconContainer(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initDimens();
|
||||
@@ -192,10 +192,15 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
||||
paint.setColor(Color.BLUE);
|
||||
canvas.drawLine(end, 0, end, height, paint);
|
||||
|
||||
paint.setColor(Color.BLACK);
|
||||
paint.setColor(Color.GREEN);
|
||||
int lastIcon = (int) mLastVisibleIconState.xTranslation;
|
||||
canvas.drawLine(lastIcon, 0, lastIcon, height, paint);
|
||||
|
||||
if (mFirstVisibleIconState != null) {
|
||||
int firstIcon = (int) mFirstVisibleIconState.xTranslation;
|
||||
canvas.drawLine(firstIcon, 0, firstIcon, height, paint);
|
||||
}
|
||||
|
||||
paint.setColor(Color.RED);
|
||||
canvas.drawLine(mVisualOverflowStart, 0, mVisualOverflowStart, height, paint);
|
||||
|
||||
@@ -210,6 +215,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
initDimens();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
float centerY = getHeight() / 2.0f;
|
||||
@@ -395,6 +401,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
||||
mNumDots = 0;
|
||||
if (firstOverflowIndex != -1) {
|
||||
translationX = mVisualOverflowStart;
|
||||
mFirstVisibleIconState = null;
|
||||
for (int i = firstOverflowIndex; i < childCount; i++) {
|
||||
View view = getChildAt(i);
|
||||
IconState iconState = mIconStates.get(view);
|
||||
@@ -409,6 +416,9 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
||||
}
|
||||
translationX += (mNumDots == MAX_DOTS ? MAX_DOTS * dotWidth : dotWidth)
|
||||
* iconState.iconAppearAmount;
|
||||
if (mFirstVisibleIconState == null) {
|
||||
mFirstVisibleIconState = iconState;
|
||||
}
|
||||
mLastVisibleIconState = iconState;
|
||||
} else {
|
||||
iconState.visibleState = StatusBarIconView.STATE_HIDDEN;
|
||||
@@ -417,10 +427,16 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
||||
} else if (childCount > 0) {
|
||||
View lastChild = getChildAt(childCount - 1);
|
||||
mLastVisibleIconState = mIconStates.get(lastChild);
|
||||
mFirstVisibleIconState = mIconStates.get(getChildAt(0));
|
||||
}
|
||||
boolean center = mDark;
|
||||
if (center && translationX < getLayoutEnd()) {
|
||||
float delta = (getLayoutEnd() - translationX) / 2;
|
||||
float initialTranslation =
|
||||
mFirstVisibleIconState == null ? 0 : mFirstVisibleIconState.xTranslation;
|
||||
float contentWidth = getFinalTranslationX() - initialTranslation;
|
||||
float availableSpace = getLayoutEnd() - getActualPaddingStart();
|
||||
float delta = (availableSpace - contentWidth) / 2;
|
||||
|
||||
if (firstOverflowIndex != -1) {
|
||||
// If we have an overflow, only count those half for centering because the dots
|
||||
// don't have a lot of visual weight.
|
||||
|
||||
@@ -3922,12 +3922,11 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
requestChildrenUpdate();
|
||||
applyCurrentBackgroundBounds();
|
||||
updateWillNotDraw();
|
||||
updateAntiBurnInTranslation();
|
||||
notifyHeightChangeListener(mShelf);
|
||||
}
|
||||
|
||||
private void updateAntiBurnInTranslation() {
|
||||
setTranslationX(mAmbientState.isDark() ? mAntiBurnInOffsetX : 0);
|
||||
setTranslationX(mAntiBurnInOffsetX * mDarkAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3948,6 +3947,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
updateContentHeight();
|
||||
}
|
||||
updateBackgroundDimming();
|
||||
updateAntiBurnInTranslation();
|
||||
}
|
||||
|
||||
public float getDarkAmount() {
|
||||
|
||||
Reference in New Issue
Block a user