Merge "Fixed the inline launch animation for notification groups" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
047b8def3f
@@ -1856,7 +1856,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
float interpolation = Interpolators.FAST_OUT_SLOW_IN.getInterpolation(params.getProgress());
|
float interpolation = Interpolators.FAST_OUT_SLOW_IN.getInterpolation(params.getProgress());
|
||||||
int startClipTopAmount = params.getStartClipTopAmount();
|
int startClipTopAmount = params.getStartClipTopAmount();
|
||||||
if (mNotificationParent != null) {
|
if (mNotificationParent != null) {
|
||||||
top -= mNotificationParent.getTranslationY();
|
float parentY = mNotificationParent.getTranslationY();
|
||||||
|
top -= parentY;
|
||||||
mNotificationParent.setTranslationZ(translationZ);
|
mNotificationParent.setTranslationZ(translationZ);
|
||||||
int parentStartClipTopAmount = params.getParentStartClipTopAmount();
|
int parentStartClipTopAmount = params.getParentStartClipTopAmount();
|
||||||
if (startClipTopAmount != 0) {
|
if (startClipTopAmount != 0) {
|
||||||
@@ -1866,8 +1867,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
mNotificationParent.setClipTopAmount(clipTopAmount);
|
mNotificationParent.setClipTopAmount(clipTopAmount);
|
||||||
}
|
}
|
||||||
mNotificationParent.setExtraWidthForClipping(extraWidthForClipping);
|
mNotificationParent.setExtraWidthForClipping(extraWidthForClipping);
|
||||||
mNotificationParent.setMinimumHeightForClipping(params.getHeight()
|
float clipBottom = Math.max(params.getBottom(),
|
||||||
+ mNotificationParent.getActualHeight());
|
parentY + mNotificationParent.getActualHeight()
|
||||||
|
- mNotificationParent.getClipBottomAmount());
|
||||||
|
float clipTop = Math.min(params.getTop(), parentY);
|
||||||
|
int minimumHeightForClipping = (int) (clipBottom - clipTop);
|
||||||
|
mNotificationParent.setMinimumHeightForClipping(minimumHeightForClipping);
|
||||||
} else if (startClipTopAmount != 0) {
|
} else if (startClipTopAmount != 0) {
|
||||||
int clipTopAmount = (int) MathUtils.lerp(startClipTopAmount, 0, interpolation);
|
int clipTopAmount = (int) MathUtils.lerp(startClipTopAmount, 0, interpolation);
|
||||||
setClipTopAmount(clipTopAmount);
|
setClipTopAmount(clipTopAmount);
|
||||||
@@ -1922,6 +1927,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
|
|
||||||
private void setChildIsExpanding(boolean isExpanding) {
|
private void setChildIsExpanding(boolean isExpanding) {
|
||||||
mChildIsExpanding = isExpanding;
|
mChildIsExpanding = isExpanding;
|
||||||
|
updateClipping();
|
||||||
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1931,7 +1938,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldClipToActualHeight() {
|
protected boolean shouldClipToActualHeight() {
|
||||||
return super.shouldClipToActualHeight() && !mExpandAnimationRunning && !mChildIsExpanding;
|
return super.shouldClipToActualHeight() && !mExpandAnimationRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2827,7 +2834,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (child == mChildrenContainer) {
|
} else if (child == mChildrenContainer) {
|
||||||
if (!mChildIsExpanding && (isClippingNeeded() || !hasNoRounding())) {
|
if (isClippingNeeded() || !hasNoRounding()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (child instanceof NotificationGuts) {
|
} else if (child instanceof NotificationGuts) {
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ public abstract class ExpandableOutlineView extends ExpandableView {
|
|||||||
protected boolean mShouldTranslateContents;
|
protected boolean mShouldTranslateContents;
|
||||||
private boolean mTopAmountRounded;
|
private boolean mTopAmountRounded;
|
||||||
private float mDistanceToTopRoundness = -1;
|
private float mDistanceToTopRoundness = -1;
|
||||||
private float mExtraWidthForClipping;
|
|
||||||
private int mMinimumHeightForClipping = 0;
|
|
||||||
|
|
||||||
private final ViewOutlineProvider mProvider = new ViewOutlineProvider() {
|
private final ViewOutlineProvider mProvider = new ViewOutlineProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -120,11 +118,13 @@ public abstract class ExpandableOutlineView extends ExpandableView {
|
|||||||
if (!mCustomOutline) {
|
if (!mCustomOutline) {
|
||||||
int translation = mShouldTranslateContents && !ignoreTranslation
|
int translation = mShouldTranslateContents && !ignoreTranslation
|
||||||
? (int) getTranslation() : 0;
|
? (int) getTranslation() : 0;
|
||||||
left = Math.max(translation, 0);
|
int halfExtraWidth = (int) (mExtraWidthForClipping / 2.0f);
|
||||||
|
left = Math.max(translation, 0) - halfExtraWidth;
|
||||||
top = mClipTopAmount + mBackgroundTop;
|
top = mClipTopAmount + mBackgroundTop;
|
||||||
right = getWidth() + Math.min(translation, 0);
|
right = getWidth() + halfExtraWidth + Math.min(translation, 0);
|
||||||
bottom = Math.max(getActualHeight(), top);
|
bottom = Math.max(getActualHeight(), top);
|
||||||
int intersectBottom = Math.max(getActualHeight() - mClipBottomAmount, top);
|
int intersectBottom = Math.max(mMinimumHeightForClipping,
|
||||||
|
Math.max(getActualHeight() - mClipBottomAmount, top));
|
||||||
if (bottom != intersectBottom) {
|
if (bottom != intersectBottom) {
|
||||||
if (clipRoundedToBottom) {
|
if (clipRoundedToBottom) {
|
||||||
bottom = intersectBottom;
|
bottom = intersectBottom;
|
||||||
@@ -237,12 +237,16 @@ public abstract class ExpandableOutlineView extends ExpandableView {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setExtraWidthForClipping(float extraWidthForClipping) {
|
public void setExtraWidthForClipping(float extraWidthForClipping) {
|
||||||
mExtraWidthForClipping = extraWidthForClipping;
|
super.setExtraWidthForClipping(extraWidthForClipping);
|
||||||
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMinimumHeightForClipping(int minimumHeightForClipping) {
|
public void setMinimumHeightForClipping(int minimumHeightForClipping) {
|
||||||
mMinimumHeightForClipping = minimumHeightForClipping;
|
super.setMinimumHeightForClipping(minimumHeightForClipping);
|
||||||
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public abstract class ExpandableView extends FrameLayout {
|
|||||||
private int mActualHeight;
|
private int mActualHeight;
|
||||||
protected int mClipTopAmount;
|
protected int mClipTopAmount;
|
||||||
protected int mClipBottomAmount;
|
protected int mClipBottomAmount;
|
||||||
|
protected int mMinimumHeightForClipping = 0;
|
||||||
|
protected float mExtraWidthForClipping = 0;
|
||||||
private boolean mDark;
|
private boolean mDark;
|
||||||
private ArrayList<View> mMatchParentViews = new ArrayList<View>();
|
private ArrayList<View> mMatchParentViews = new ArrayList<View>();
|
||||||
private static Rect mClipRect = new Rect();
|
private static Rect mClipRect = new Rect();
|
||||||
@@ -390,14 +392,26 @@ public abstract class ExpandableView extends FrameLayout {
|
|||||||
protected void updateClipping() {
|
protected void updateClipping() {
|
||||||
if (mClipToActualHeight && shouldClipToActualHeight()) {
|
if (mClipToActualHeight && shouldClipToActualHeight()) {
|
||||||
int top = getClipTopAmount();
|
int top = getClipTopAmount();
|
||||||
mClipRect.set(0, top, getWidth(), Math.max(getActualHeight() + getExtraBottomPadding()
|
int bottom = Math.max(Math.max(getActualHeight() + getExtraBottomPadding()
|
||||||
- mClipBottomAmount, top));
|
- mClipBottomAmount, top), mMinimumHeightForClipping);
|
||||||
|
int halfExtraWidth = (int) (mExtraWidthForClipping / 2.0f);
|
||||||
|
mClipRect.set(-halfExtraWidth, top, getWidth() + halfExtraWidth, bottom);
|
||||||
setClipBounds(mClipRect);
|
setClipBounds(mClipRect);
|
||||||
} else {
|
} else {
|
||||||
setClipBounds(null);
|
setClipBounds(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMinimumHeightForClipping(int minimumHeightForClipping) {
|
||||||
|
mMinimumHeightForClipping = minimumHeightForClipping;
|
||||||
|
updateClipping();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtraWidthForClipping(float extraWidthForClipping) {
|
||||||
|
mExtraWidthForClipping = extraWidthForClipping;
|
||||||
|
updateClipping();
|
||||||
|
}
|
||||||
|
|
||||||
public float getHeaderVisibleAmount() {
|
public float getHeaderVisibleAmount() {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,10 +156,17 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the notification is displaying the menu, if so slide notification back
|
// Check if the notification is displaying the menu, if so slide notification back
|
||||||
if (row.getProvider() != null && row.getProvider().isMenuVisible()) {
|
if (isMenuVisible(row)) {
|
||||||
row.animateTranslateNotification(0);
|
row.animateTranslateNotification(0);
|
||||||
return;
|
return;
|
||||||
}
|
} else if (row.isChildInGroup() && isMenuVisible(row.getNotificationParent())) {
|
||||||
|
row.getNotificationParent().animateTranslateNotification(0);
|
||||||
|
return;
|
||||||
|
} else if (row.isSummaryWithChildren() && row.areChildrenExpanded()) {
|
||||||
|
// We never want to open the app directly if the user clicks in between
|
||||||
|
// the notifications.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Mark notification for one frame.
|
// Mark notification for one frame.
|
||||||
row.setJustClicked(true);
|
row.setJustClicked(true);
|
||||||
@@ -168,6 +175,10 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
|
|||||||
mCallback.onNotificationClicked(sbn, row);
|
mCallback.onNotificationClicked(sbn, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isMenuVisible(ExpandableNotificationRow row) {
|
||||||
|
return row.getProvider() != null && row.getProvider().isMenuVisible();
|
||||||
|
}
|
||||||
|
|
||||||
public void register(ExpandableNotificationRow row, StatusBarNotification sbn) {
|
public void register(ExpandableNotificationRow row, StatusBarNotification sbn) {
|
||||||
Notification notification = sbn.getNotification();
|
Notification notification = sbn.getNotification();
|
||||||
if (notification.contentIntent != null || notification.fullScreenIntent != null) {
|
if (notification.contentIntent != null || notification.fullScreenIntent != null) {
|
||||||
|
|||||||
@@ -278,6 +278,10 @@ public class ActivityLaunchAnimator {
|
|||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBottom() {
|
||||||
|
return bottom;
|
||||||
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return right - left;
|
return right - left;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -869,6 +869,7 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
ExpandableNotificationRow child = mChildren.get(childIdx);
|
ExpandableNotificationRow child = mChildren.get(childIdx);
|
||||||
child.setChildrenExpanded(childrenExpanded, false);
|
child.setChildrenExpanded(childrenExpanded, false);
|
||||||
}
|
}
|
||||||
|
updateHeaderTouchability();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContainingNotification(ExpandableNotificationRow parent) {
|
public void setContainingNotification(ExpandableNotificationRow parent) {
|
||||||
@@ -1209,6 +1210,13 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
ExpandableNotificationRow child = mChildren.get(i);
|
ExpandableNotificationRow child = mChildren.get(i);
|
||||||
child.setUserLocked(userLocked && !showingAsLowPriority());
|
child.setUserLocked(userLocked && !showingAsLowPriority());
|
||||||
}
|
}
|
||||||
|
updateHeaderTouchability();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateHeaderTouchability() {
|
||||||
|
if (mNotificationHeader != null) {
|
||||||
|
mNotificationHeader.setAcceptAllTouches(mChildrenExpanded || mUserLocked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNotificationUpdated() {
|
public void onNotificationUpdated() {
|
||||||
|
|||||||
Reference in New Issue
Block a user