Merge "Fixed a issue where notification icons don't align vertically while peeking" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-05-22 21:26:30 +00:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 18 deletions

View File

@@ -30,7 +30,6 @@ import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import java.util.ArrayList;
import java.util.Collection;
/**
* A global state to track all input states for the algorithm.
@@ -72,6 +71,7 @@ public class AmbientState {
private ExpandableNotificationRow mExpandingNotification;
private int mDarkTopPadding;
private float mDarkAmount;
private boolean mAppearing;
public AmbientState(Context context) {
reload(context);
@@ -436,4 +436,12 @@ public class AmbientState {
public int getDarkTopPadding() {
return mDarkTopPadding;
}
public void setAppearing(boolean appearing) {
mAppearing = appearing;
}
public boolean isAppearing() {
return mAppearing;
}
}

View File

@@ -885,7 +885,9 @@ public class NotificationStackScrollLayout extends ViewGroup
float appearEndPosition = getAppearEndPosition();
float appearStartPosition = getAppearStartPosition();
float appearFraction = 1.0f;
if (height >= appearEndPosition) {
boolean appearing = height < appearEndPosition;
mAmbientState.setAppearing(appearing);
if (!appearing) {
translationY = 0;
if (mShouldShowShelfOnly) {
stackHeight = mTopPadding + mShelf.getIntrinsicHeight();

View File

@@ -478,22 +478,6 @@ public class StackScrollAlgorithm {
childState.hidden = false;
}
}
// Let's hide all the views if we are not expanded. the views might otherwise be visible
// in the headsup area if a view was swiped away
if (!mIsExpanded) {
for (int i = 0; i < childCount; i++) {
boolean visible = false;
View child = algorithmState.visibleChildren.get(i);
if (child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
visible = row.isHeadsUp() || row.isHeadsUpAnimatingAway();
}
if (!visible) {
ExpandableViewState childState = resultState.getViewStateForView(child);
childState.hidden = true;
}
}
}
}
private void clampHunToTop(AmbientState ambientState, ExpandableNotificationRow row,
@@ -536,6 +520,10 @@ public class StackScrollAlgorithm {
int shelfStart = ambientState.getInnerHeight()
- ambientState.getShelf().getIntrinsicHeight();
if (ambientState.isAppearing() && !child.isAboveShelf()) {
// Don't show none heads-up notifications while in appearing phase.
childViewState.yTranslation = Math.max(childViewState.yTranslation, shelfStart);
}
childViewState.yTranslation = Math.min(childViewState.yTranslation, shelfStart);
if (childViewState.yTranslation >= shelfStart) {
childViewState.hidden = !child.isExpandAnimationRunning() && !child.hasExpandingChild();