summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2018-04-05 00:33:45 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-04-05 00:33:45 +0000
commitf6486683fa62a6fd81862a4f440ea40a34a9ff85 (patch)
tree4b032fba11add6ed804e078da46ae2ae428c936a
parent1ecd7aa188370b3f84a2cedcacf06537a5127c50 (diff)
parent15475702edd8f7f5643fa701e9e55d02e7fb7d97 (diff)
Merge "Shelf horizontal alignment was a few dps off" into pi-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java22
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java4
2 files changed, 21 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
index 55174349cc53..9adf923fa506 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
@@ -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.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 375e8606258f..da7dc07b2bfb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -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() {