diff options
| author | 2018-02-21 20:19:54 +0000 | |
|---|---|---|
| committer | 2018-02-21 20:19:54 +0000 | |
| commit | 72e94b6556a3a019e3b908e1d82ff8bdeba53702 (patch) | |
| tree | 0559c0cf9ee8185471024536e14168c15871786d | |
| parent | d137da9374928bc244a03adb4d72e0b99c64fe67 (diff) | |
| parent | c25989eb758256e5bb168046f3bd12067df1423d (diff) | |
Merge changes I30c76f2a,I83d3f0d2
* changes:
Fixed the launch animation for groups
Removed the notification action background
24 files changed, 280 insertions, 109 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 5204ad92a2b8..83617118740d 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -4587,7 +4587,8 @@ public class Notification implements Parcelable big.setViewVisibility(R.id.notification_material_reply_text_3, View.GONE); big.setTextViewText(R.id.notification_material_reply_text_3, null); - big.setViewLayoutMarginBottomDimen(R.id.notification_action_list_margin_target, 0); + big.setViewLayoutMarginBottomDimen(R.id.notification_action_list_margin_target, + R.dimen.notification_content_margin); } private RemoteViews applyStandardTemplateWithActions(int layoutId) { @@ -4608,16 +4609,7 @@ public class Notification implements Parcelable if (N > 0) { big.setViewVisibility(R.id.actions_container, View.VISIBLE); big.setViewVisibility(R.id.actions, View.VISIBLE); - if (p.ambient) { - big.setInt(R.id.actions, "setBackgroundColor", Color.TRANSPARENT); - } else if (isColorized()) { - big.setInt(R.id.actions, "setBackgroundColor", getActionBarColor()); - } else { - big.setInt(R.id.actions, "setBackgroundColor", mContext.getColor( - R.color.notification_action_list)); - } - big.setViewLayoutMarginBottomDimen(R.id.notification_action_list_margin_target, - R.dimen.notification_action_list_height); + big.setViewLayoutMarginBottomDimen(R.id.notification_action_list_margin_target, 0); if (N>MAX_ACTION_BUTTONS) N=MAX_ACTION_BUTTONS; for (int i=0; i<N; i++) { Action action = mActions.get(i); diff --git a/core/res/res/layout/notification_material_action_list.xml b/core/res/res/layout/notification_material_action_list.xml index 49b0ee79d01b..07559f439933 100644 --- a/core/res/res/layout/notification_material_action_list.xml +++ b/core/res/res/layout/notification_material_action_list.xml @@ -24,11 +24,9 @@ android:layout_width="match_parent" android:layout_height="@dimen/notification_action_list_height" android:paddingEnd="12dp" - android:paddingStart="8dp" android:orientation="horizontal" android:gravity="center_vertical" android:visibility="gone" - android:background="@color/notification_action_list" > <!-- actions will be added here --> </com.android.internal.widget.NotificationActionListLayout> diff --git a/core/res/res/layout/notification_material_reply_text.xml b/core/res/res/layout/notification_material_reply_text.xml index bc22eb49cf57..84603b06604e 100644 --- a/core/res/res/layout/notification_material_reply_text.xml +++ b/core/res/res/layout/notification_material_reply_text.xml @@ -28,7 +28,8 @@ android:layout_width="match_parent" android:layout_height="1dip" android:id="@+id/action_divider" - android:layout_marginBottom="15dp" + android:layout_marginTop="@dimen/notification_content_margin" + android:layout_marginBottom="@dimen/notification_content_margin" android:background="@drawable/notification_template_divider" /> <TextView @@ -53,7 +54,6 @@ android:id="@+id/notification_material_reply_text_1" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="15dp" android:layout_marginEnd="@dimen/notification_content_margin_end" android:textAppearance="@style/TextAppearance.Material.Notification.Reply" android:singleLine="true" /> diff --git a/core/res/res/layout/notification_template_material_ambient.xml b/core/res/res/layout/notification_template_material_ambient.xml index 19c4d2351292..525d493040fe 100644 --- a/core/res/res/layout/notification_template_material_ambient.xml +++ b/core/res/res/layout/notification_template_material_ambient.xml @@ -88,7 +88,6 @@ android:orientation="horizontal" android:gravity="center" android:visibility="gone" - android:background="@color/notification_action_list" /> </FrameLayout> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml index 445b19b5d01c..221bcf6a800c 100644 --- a/core/res/res/layout/notification_template_material_base.xml +++ b/core/res/res/layout/notification_template_material_base.xml @@ -30,7 +30,7 @@ android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" android:layout_marginTop="@dimen/notification_content_margin_top" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" + android:layout_marginBottom="@dimen/notification_content_margin" android:orientation="vertical" > <include layout="@layout/notification_template_part_line1" /> <include layout="@layout/notification_template_text" /> @@ -42,7 +42,7 @@ <include layout="@layout/notification_template_smart_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_content_margin_bottom" /> + android:layout_marginTop="@dimen/notification_content_margin" /> </LinearLayout> <include layout="@layout/notification_template_right_icon" /> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_big_base.xml b/core/res/res/layout/notification_template_material_big_base.xml index d47bff6403ec..21068908ffe8 100644 --- a/core/res/res/layout/notification_template_material_big_base.xml +++ b/core/res/res/layout/notification_template_material_big_base.xml @@ -20,6 +20,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" + android:clipChildren="false" android:tag="big" > <LinearLayout android:id="@+id/notification_action_list_margin_target" @@ -30,6 +31,7 @@ <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_weight="1" android:layout_gravity="top" > <include layout="@layout/notification_template_header" /> <LinearLayout @@ -39,7 +41,6 @@ android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" android:layout_marginTop="@dimen/notification_content_margin_top" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" android:orientation="vertical" > <include layout="@layout/notification_template_part_line1" /> <include layout="@layout/notification_template_text" /> @@ -61,7 +62,7 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" /> + android:layout_marginTop="@dimen/notification_content_margin" /> + <include layout="@layout/notification_material_action_list" /> </LinearLayout> - <include layout="@layout/notification_material_action_list" /> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_big_media.xml b/core/res/res/layout/notification_template_material_big_media.xml index cc4dd38741fd..b4e26483a2ad 100644 --- a/core/res/res/layout/notification_template_material_big_media.xml +++ b/core/res/res/layout/notification_template_material_big_media.xml @@ -46,7 +46,7 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/notification_content_margin_top" android:layout_marginStart="@dimen/notification_content_margin_start" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" + android:layout_marginBottom="@dimen/notification_content_margin" android:layout_marginEnd="@dimen/notification_content_margin_end" android:minHeight="@dimen/notification_min_content_height" android:orientation="vertical" diff --git a/core/res/res/layout/notification_template_material_big_picture.xml b/core/res/res/layout/notification_template_material_big_picture.xml index 76c0a676b6f3..7a1cc1eff167 100644 --- a/core/res/res/layout/notification_template_material_big_picture.xml +++ b/core/res/res/layout/notification_template_material_big_picture.xml @@ -20,17 +20,18 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:tag="bigPicture" + android:clipChildren="false" > <include layout="@layout/notification_template_header" /> <include layout="@layout/notification_template_right_icon" /> <LinearLayout + android:id="@+id/notification_action_list_margin_target" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="top" android:layout_marginTop="@dimen/notification_content_margin_top" android:clipToPadding="false" android:orientation="vertical" - android:id="@+id/notification_action_list_margin_target" > <LinearLayout android:id="@+id/notification_main_column" @@ -53,7 +54,6 @@ android:adjustViewBounds="true" android:layout_weight="1" android:layout_marginTop="13dp" - android:layout_marginBottom="16dp" android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" android:scaleType="centerCrop" @@ -69,7 +69,7 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" /> + android:layout_marginTop="@dimen/notification_content_margin" /> + <include layout="@layout/notification_material_action_list" /> </LinearLayout> - <include layout="@layout/notification_material_action_list" /> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml index ac4c052d6141..3a6f57335fed 100644 --- a/core/res/res/layout/notification_template_material_big_text.xml +++ b/core/res/res/layout/notification_template_material_big_text.xml @@ -19,6 +19,7 @@ android:id="@+id/status_bar_latest_event_content" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clipChildren="false" android:tag="bigText" > <include layout="@layout/notification_template_header" /> @@ -43,6 +44,7 @@ android:clipToPadding="false" android:minHeight="@dimen/notification_min_content_height" android:orientation="vertical" + android:layout_weight="1" > <include layout="@layout/notification_template_part_line1" /> <include layout="@layout/notification_template_progress" @@ -54,7 +56,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/notification_text_margin_top" - android:paddingBottom="@dimen/notification_content_margin_bottom" android:textAppearance="@style/TextAppearance.Material.Notification" android:singleLine="false" android:gravity="top" @@ -68,12 +69,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> <include layout="@layout/notification_template_smart_reply_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="@dimen/notification_content_margin_start" - android:layout_marginEnd="@dimen/notification_content_margin_end" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" /> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/notification_content_margin_start" + android:layout_marginEnd="@dimen/notification_content_margin_end" + android:layout_marginTop="@dimen/notification_content_margin" /> + <include layout="@layout/notification_material_action_list" /> </LinearLayout> - <include layout="@layout/notification_material_action_list" /> <include layout="@layout/notification_template_right_icon" /> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml index 718cf16a1fe9..23d879912ddd 100644 --- a/core/res/res/layout/notification_template_material_inbox.xml +++ b/core/res/res/layout/notification_template_material_inbox.xml @@ -20,6 +20,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:tag="inbox" + android:clipChildren="false" > <include layout="@layout/notification_template_header" /> <LinearLayout @@ -38,8 +39,8 @@ android:layout_gravity="top" android:paddingStart="@dimen/notification_content_margin_start" android:paddingEnd="@dimen/notification_content_margin_end" - android:paddingBottom="@dimen/notification_content_margin_bottom" android:minHeight="@dimen/notification_min_content_height" + android:layout_weight="1" android:clipToPadding="false" android:orientation="vertical" > @@ -124,8 +125,8 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" /> + android:layout_marginTop="@dimen/notification_content_margin" /> + <include layout="@layout/notification_material_action_list" /> </LinearLayout> - <include layout="@layout/notification_material_action_list" /> <include layout="@layout/notification_template_right_icon" /> </FrameLayout> diff --git a/core/res/res/layout/notification_template_material_media.xml b/core/res/res/layout/notification_template_material_media.xml index 2c69b90caa8c..3a0912bd2a90 100644 --- a/core/res/res/layout/notification_template_material_media.xml +++ b/core/res/res/layout/notification_template_material_media.xml @@ -49,7 +49,7 @@ android:layout_gravity="fill_vertical" android:layout_weight="1" android:minHeight="@dimen/notification_min_content_height" - android:paddingBottom="@dimen/notification_content_margin_bottom" + android:paddingBottom="@dimen/notification_content_margin" android:orientation="vertical" > <include layout="@layout/notification_template_part_line1"/> diff --git a/core/res/res/layout/notification_template_material_messaging.xml b/core/res/res/layout/notification_template_material_messaging.xml index 34f5ae8133be..53514a341504 100644 --- a/core/res/res/layout/notification_template_material_messaging.xml +++ b/core/res/res/layout/notification_template_material_messaging.xml @@ -19,10 +19,11 @@ android:id="@+id/status_bar_latest_event_content" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clipChildren="false" android:tag="messaging" > <include layout="@layout/notification_template_header"/> - <LinearLayout + <com.android.internal.widget.RemeasuringLinearLayout android:id="@+id/notification_action_list_margin_target" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -31,15 +32,15 @@ android:clipToPadding="false" android:orientation="vertical"> - <LinearLayout + <com.android.internal.widget.RemeasuringLinearLayout android:id="@+id/notification_main_column" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" + android:layout_weight="1" android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" android:minHeight="@dimen/notification_min_content_height" - android:layout_marginBottom="@dimen/notification_content_margin_bottom" android:orientation="vertical" > <com.android.internal.widget.MessagingLinearLayout @@ -47,12 +48,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:spacing="@dimen/notification_messaging_spacing" /> - <include layout="@layout/notification_template_smart_reply_container" + </com.android.internal.widget.RemeasuringLinearLayout> + <include layout="@layout/notification_template_smart_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_content_margin_bottom" /> - </LinearLayout> - </LinearLayout> - <include layout="@layout/notification_material_action_list" /> + android:layout_marginTop="@dimen/notification_content_margin" /> + <include layout="@layout/notification_material_action_list" /> + </com.android.internal.widget.RemeasuringLinearLayout> <include layout="@layout/notification_template_right_icon"/> </com.android.internal.widget.MessagingLayout> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index cfaab6ac2eec..2ce08ebb882f 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -176,13 +176,13 @@ <dimen name="notification_extra_margin_ambient">16dp</dimen> <!-- The height of the notification action list --> - <dimen name="notification_action_list_height">56dp</dimen> + <dimen name="notification_action_list_height">60dp</dimen> <!-- height of the content margin to accomodate for the header --> <dimen name="notification_content_margin_top">46dp</dimen> - <!-- height of the content margin on the bottom --> - <dimen name="notification_content_margin_bottom">20dp</dimen> + <!-- height of the content margin that is applied at the end of the notification content --> + <dimen name="notification_content_margin">20dp</dimen> <!-- The height of the progress bar. --> <dimen name="notification_progress_bar_height">15dp</dimen> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 6b527e3f314a..0493c2bec0d3 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2646,7 +2646,7 @@ <java-symbol type="dimen" name="notification_content_margin_end" /> <java-symbol type="dimen" name="notification_content_picture_margin" /> <java-symbol type="dimen" name="notification_content_margin_top" /> - <java-symbol type="dimen" name="notification_content_margin_bottom" /> + <java-symbol type="dimen" name="notification_content_margin" /> <java-symbol type="dimen" name="notification_header_background_height" /> <java-symbol type="dimen" name="notification_header_height" /> <java-symbol type="dimen" name="notification_header_expand_icon_size" /> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 2723df73aa52..bc2dff917b9a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -82,7 +82,6 @@ import com.android.systemui.statusbar.stack.AmbientState; import com.android.systemui.statusbar.stack.AnimationProperties; import com.android.systemui.statusbar.stack.ExpandableViewState; import com.android.systemui.statusbar.stack.NotificationChildrenContainer; -import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.StackScrollState; import java.util.ArrayList; @@ -181,6 +180,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView private AboveShelfChangedListener mAboveShelfChangedListener; private HeadsUpManager mHeadsUpManager; private View mHelperButton; + private boolean mChildIsExpanding; private boolean mJustClicked; private boolean mIconAnimationRunning; @@ -575,8 +575,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView * @param isChildInGroup Is this notification now in a group * @param parent the new parent notification */ - public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) {; + public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) { boolean childInGroup = StatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup; + if (mExpandAnimationRunning && !isChildInGroup && mNotificationParent != null) { + mNotificationParent.setChildIsExpanding(false); + mNotificationParent.setExtraWidthForClipping(0.0f); + mNotificationParent.setMinimumHeightForClipping(0); + } mNotificationParent = childInGroup ? parent : null; mPrivateLayout.setIsChildInGroup(childInGroup); mNotificationInflater.setIsChildInGroup(childInGroup); @@ -651,10 +656,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView visualStabilityManager, callback); } - public void getChildrenStates(StackScrollState resultState) { + public void getChildrenStates(StackScrollState resultState, + AmbientState ambientState) { if (mIsSummaryWithChildren) { ExpandableViewState parentState = resultState.getViewStateForView(this); - mChildrenContainer.getState(resultState, parentState); + mChildrenContainer.getState(resultState, parentState, ambientState); } } @@ -1601,28 +1607,52 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (params == null) { return; } - setTranslationY(params.getTop()); float zProgress = Interpolators.FAST_OUT_SLOW_IN.getInterpolation( params.getProgress(0, 50)); float translationZ = MathUtils.lerp(params.getStartTranslationZ(), mNotificationLaunchHeight, zProgress); setTranslationZ(translationZ); + float extraWidthForClipping = params.getWidth() - getWidth() + + MathUtils.lerp(0, mOutlineRadius * 2, params.getProgress()); + setExtraWidthForClipping(extraWidthForClipping); + int top = params.getTop(); + float interpolation = Interpolators.FAST_OUT_SLOW_IN.getInterpolation(params.getProgress()); + int startClipTopAmount = params.getStartClipTopAmount(); + if (mNotificationParent != null) { + top -= mNotificationParent.getTranslationY(); + mNotificationParent.setTranslationZ(translationZ); + int parentStartClipTopAmount = params.getParentStartClipTopAmount(); + if (startClipTopAmount != 0) { + int clipTopAmount = (int) MathUtils.lerp(parentStartClipTopAmount, + parentStartClipTopAmount - startClipTopAmount, + interpolation); + mNotificationParent.setClipTopAmount(clipTopAmount); + } + mNotificationParent.setExtraWidthForClipping(extraWidthForClipping); + mNotificationParent.setMinimumHeightForClipping(params.getHeight() + + mNotificationParent.getActualHeight()); + } else if (startClipTopAmount != 0) { + int clipTopAmount = (int) MathUtils.lerp(startClipTopAmount, 0, interpolation); + setClipTopAmount(clipTopAmount); + } + setTranslationY(top); setActualHeight(params.getHeight()); + mBackgroundNormal.setExpandAnimationParams(params); } public void setExpandAnimationRunning(boolean expandAnimationRunning) { + View contentView; + if (mIsSummaryWithChildren) { + contentView = mChildrenContainer; + } else { + contentView = getShowingLayout(); + } + if (mGuts != null && mGuts.isExposed()) { + contentView = mGuts; + } if (expandAnimationRunning) { - View contentView; - if (mIsSummaryWithChildren) { - contentView = mChildrenContainer; - } else { - contentView = getShowingLayout(); - } - if (mGuts != null && mGuts.isExposed()) { - contentView = mGuts; - } contentView.animate() .alpha(0f) .setDuration(ActivityLaunchAnimator.ANIMATION_DURATION_FADE_CONTENT) @@ -1637,15 +1667,35 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (mGuts != null) { mGuts.setAlpha(1.0f); } + if (contentView != null) { + contentView.setAlpha(1.0f); + } + setExtraWidthForClipping(0.0f); + if (mNotificationParent != null) { + mNotificationParent.setExtraWidthForClipping(0.0f); + mNotificationParent.setMinimumHeightForClipping(0); + } + } + if (mNotificationParent != null) { + mNotificationParent.setChildIsExpanding(mExpandAnimationRunning); } updateChildrenVisibility(); updateClipping(); mBackgroundNormal.setExpandAnimationRunning(expandAnimationRunning); } + private void setChildIsExpanding(boolean isExpanding) { + mChildIsExpanding = isExpanding; + } + + @Override + public boolean hasExpandingChild() { + return mChildIsExpanding; + } + @Override protected boolean shouldClipToActualHeight() { - return super.shouldClipToActualHeight() && !mExpandAnimationRunning; + return super.shouldClipToActualHeight() && !mExpandAnimationRunning && !mChildIsExpanding; } @Override @@ -1947,18 +1997,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } - private void updateMaxHeights() { + public void updateMaxHeights() { int intrinsicBefore = getIntrinsicHeight(); - View expandedChild = mPrivateLayout.getExpandedChild(); - if (expandedChild == null) { - expandedChild = mPrivateLayout.getContractedChild(); - } - mMaxExpandHeight = expandedChild.getHeight(); - View headsUpChild = mPrivateLayout.getHeadsUpChild(); - if (headsUpChild == null) { - headsUpChild = mPrivateLayout.getContractedChild(); - } - mHeadsUpHeight = headsUpChild.getHeight(); + mMaxExpandHeight = mPrivateLayout.getExpandHeight(); + mHeadsUpHeight = mPrivateLayout.getHeadsUpHeight(); if (intrinsicBefore != getIntrinsicHeight()) { notifyHeightChanged(true /* needsAnimation */); } @@ -2245,7 +2287,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mGuts.setClipBottomAmount(clipBottomAmount); } } - if (mChildrenContainer != null) { + if (mChildrenContainer != null && !mChildIsExpanding) { // We have to update this even if it hasn't changed, since the children locations can // have changed mChildrenContainer.setClipBottomAmount(clipBottomAmount); @@ -2453,7 +2495,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView public boolean isAboveShelf() { return !isOnKeyguard() && (mIsPinned || mHeadsupDisappearRunning || (mIsHeadsUp && mAboveShelf) - || mExpandAnimationRunning); + || mExpandAnimationRunning || mChildIsExpanding); } public void setShowAmbient(boolean showAmbient) { @@ -2478,7 +2520,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView return true; } } else if (child == mChildrenContainer) { - if (isClippingNeeded() || !hasNoRounding()) { + if (!mChildIsExpanding && (isClippingNeeded() || !hasNoRounding())) { return true; } } else if (child instanceof NotificationGuts) { @@ -2544,11 +2586,19 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (row.isExpandAnimationRunning()) { return; } + handleFixedTranslationZ(row); super.applyToView(view); row.applyChildrenState(mOverallState); } } + private void handleFixedTranslationZ(ExpandableNotificationRow row) { + if (row.hasExpandingChild()) { + zTranslation = row.getTranslationZ(); + clipTopAmount = row.getClipTopAmount(); + } + } + @Override protected void onYTranslationAnimationFinished(View view) { super.onYTranslationAnimationFinished(view); @@ -2567,6 +2617,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (row.isExpandAnimationRunning()) { return; } + handleFixedTranslationZ(row); super.animateTo(child, properties); row.startChildAnimation(mOverallState, properties); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java index 66b3a75f4037..8bc22016efae 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java @@ -61,7 +61,7 @@ public abstract class ExpandableOutlineView extends ExpandableView { private final Path mClipPath = new Path(); private boolean mCustomOutline; private float mOutlineAlpha = -1f; - private float mOutlineRadius; + protected float mOutlineRadius; private boolean mAlwaysRoundBothCorners; private Path mTmpPath = new Path(); private Path mTmpPath2 = new Path(); @@ -78,6 +78,8 @@ public abstract class ExpandableOutlineView extends ExpandableView { protected boolean mShouldTranslateContents; private boolean mClipRoundedToClipTopAmount; private float mDistanceToTopRoundness = -1; + private float mExtraWidthForClipping; + private int mMinimumHeightForClipping = 0; private final ViewOutlineProvider mProvider = new ViewOutlineProvider() { @Override @@ -202,11 +204,11 @@ public abstract class ExpandableOutlineView extends ExpandableView { canvas.save(); Path intersectPath = null; if (mClipRoundedToClipTopAmount) { - int left = 0; + int left = (int) (- mExtraWidthForClipping / 2.0f); int top = (int) (mClipTopAmount - mDistanceToTopRoundness); - int right = getWidth(); - int bottom = (int) Math.max(getActualHeight() - mClipBottomAmount, - top + mOutlineRadius); + int right = getWidth() + (int) (mExtraWidthForClipping + left); + int bottom = (int) Math.max(mMinimumHeightForClipping, + Math.max(getActualHeight() - mClipBottomAmount, top + mOutlineRadius)); ExpandableOutlineView.getRoundedRectPath(left, top, right, bottom, mOutlineRadius, 0.0f, mClipPath); @@ -234,6 +236,14 @@ public abstract class ExpandableOutlineView extends ExpandableView { return result; } + public void setExtraWidthForClipping(float extraWidthForClipping) { + mExtraWidthForClipping = extraWidthForClipping; + } + + public void setMinimumHeightForClipping(int minimumHeightForClipping) { + mMinimumHeightForClipping = minimumHeightForClipping; + } + @Override public void setDistanceToTopRoundness(float distanceToTopRoundness) { super.setDistanceToTopRoundness(distanceToTopRoundness); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 1496a41a9b47..204adc813f50 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -543,6 +543,10 @@ public abstract class ExpandableView extends FrameLayout { return false; } + public boolean hasExpandingChild() { + return false; + } + /** * A listener notifying when {@link #getActualHeight} changes. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index c4d0b79a69c8..91960df9b01d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -143,6 +143,8 @@ public class NotificationContentView extends FrameLayout { private int mClipBottomAmount; private boolean mIsLowPriority; private boolean mIsContentExpandable; + private boolean mRemoteInputVisible; + private int mUnrestrictedContentHeight; public NotificationContentView(Context context, AttributeSet attrs) { @@ -293,6 +295,24 @@ public class NotificationContentView extends FrameLayout { setMeasuredDimension(width, ownHeight); } + /** + * Get the extra height that needs to be added to the notification height for a given + * {@link RemoteInputView}. + * This is needed when the user is inline replying in order to ensure that the reply bar has + * enough padding. + * + * @param remoteInput The remote input to check. + * @return The extra height needed. + */ + private int getExtraRemoteInputHeight(RemoteInputView remoteInput) { + if (remoteInput != null && remoteInput.getVisibility() == VISIBLE + && remoteInput.isActive()) { + return getResources().getDimensionPixelSize( + com.android.internal.R.dimen.notification_content_margin); + } + return 0; + } + private boolean updateContractedHeaderWidth() { // We need to update the expanded and the collapsed header to have exactly the same with to // have the expand buttons laid out at the same location. @@ -538,19 +558,23 @@ public class NotificationContentView extends FrameLayout { } public void setContentHeight(int contentHeight) { - mContentHeight = Math.max(Math.min(contentHeight, getHeight()), getMinHeight()); + mUnrestrictedContentHeight = Math.max(contentHeight, getMinHeight()); + int maxContentHeight = mContainingNotification.getIntrinsicHeight() + - getExtraRemoteInputHeight(mExpandedRemoteInput) + - getExtraRemoteInputHeight(mHeadsUpRemoteInput); + mContentHeight = Math.min(mUnrestrictedContentHeight, maxContentHeight); selectLayout(mAnimate /* animate */, false /* force */); int minHeightHint = getMinContentHeightHint(); NotificationViewWrapper wrapper = getVisibleWrapper(mVisibleType); if (wrapper != null) { - wrapper.setContentHeight(mContentHeight, minHeightHint); + wrapper.setContentHeight(mUnrestrictedContentHeight, minHeightHint); } wrapper = getVisibleWrapper(mTransformationStartVisibleType); if (wrapper != null) { - wrapper.setContentHeight(mContentHeight, minHeightHint); + wrapper.setContentHeight(mUnrestrictedContentHeight, minHeightHint); } updateClipping(); @@ -692,9 +716,9 @@ public class NotificationContentView extends FrameLayout { if (mContainingNotification.isShowingAmbient()) { return getShowingAmbientView().getHeight(); } else if (mExpandedChild != null) { - return mExpandedChild.getHeight(); + return mExpandedChild.getHeight() + getExtraRemoteInputHeight(mExpandedRemoteInput); } else if (mIsHeadsUp && mHeadsUpChild != null && !mContainingNotification.isOnKeyguard()) { - return mHeadsUpChild.getHeight(); + return mHeadsUpChild.getHeight() + getExtraRemoteInputHeight(mHeadsUpRemoteInput); } return mContractedChild.getHeight(); } @@ -746,7 +770,7 @@ public class NotificationContentView extends FrameLayout { private void updateClipping() { if (mClipToActualHeight) { int top = (int) (mClipTopAmount - getTranslationY()); - int bottom = (int) (mContentHeight - mClipBottomAmount - getTranslationY()); + int bottom = (int) (mUnrestrictedContentHeight - mClipBottomAmount - getTranslationY()); bottom = Math.max(top, bottom); mClipBounds.set(0, top, getWidth(), bottom); setClipBounds(mClipBounds); @@ -790,7 +814,8 @@ public class NotificationContentView extends FrameLayout { } NotificationViewWrapper visibleWrapper = getVisibleWrapper(visibleType); if (visibleWrapper != null) { - visibleWrapper.setContentHeight(mContentHeight, getMinContentHeightHint()); + visibleWrapper.setContentHeight(mUnrestrictedContentHeight, + getMinContentHeightHint()); } updateBackgroundColor(animate); } @@ -1276,6 +1301,7 @@ public class NotificationContentView extends FrameLayout { mContext.getColor(R.color.remote_input_hint))); existing.setWrapper(wrapper); + existing.setOnVisibilityChangedListener(this::setRemoteInputVisible); if (existingPendingIntent != null || existing.isActive()) { // The current action could be gone, or the pending intent no longer valid. @@ -1576,4 +1602,31 @@ public class NotificationContentView extends FrameLayout { } return null; } + + public int getExpandHeight() { + View expandedChild = mExpandedChild; + if (expandedChild == null) { + expandedChild = mContractedChild; + } + return expandedChild.getHeight() + getExtraRemoteInputHeight(mExpandedRemoteInput); + } + + public int getHeadsUpHeight() { + View headsUpChild = mHeadsUpChild; + if (headsUpChild == null) { + headsUpChild = mContractedChild; + } + return headsUpChild.getHeight()+ getExtraRemoteInputHeight(mHeadsUpRemoteInput); + } + + public void setRemoteInputVisible(boolean remoteInputVisible) { + mRemoteInputVisible = remoteInputVisible; + setClipChildren(!remoteInputVisible); + } + + @Override + public void setClipChildren(boolean clipChildren) { + clipChildren = clipChildren && !mRemoteInputVisible; + super.setClipChildren(clipChildren); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java index ef44ad17e1c7..1d9cdf73b9c2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java @@ -42,8 +42,6 @@ import com.android.systemui.statusbar.phone.NotificationPanelView; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBarWindowView; -import java.util.function.Consumer; - /** * A class that allows activities to be launched in a seamless way where the notification * transforms nicely into the starting window. @@ -134,8 +132,24 @@ public class ActivityLaunchAnimator { ValueAnimator anim = ValueAnimator.ofFloat(0, 1); mParams.startPosition = mSourceNotification.getLocationOnScreen(); mParams.startTranslationZ = mSourceNotification.getTranslationZ(); + mParams.startClipTopAmount = mSourceNotification.getClipTopAmount(); + if (mSourceNotification.isChildInGroup()) { + int parentClip = mSourceNotification + .getNotificationParent().getClipTopAmount(); + mParams.parentStartClipTopAmount = parentClip; + // We need to calculate how much the child is clipped by the parent + // because children always have 0 clipTopAmount + if (parentClip != 0) { + float childClip = parentClip + - mSourceNotification.getTranslationY(); + if (childClip > 0.0f) { + mParams.startClipTopAmount = (int) Math.ceil(childClip); + } + } + } int targetWidth = app.sourceContainerBounds.width(); - int notificationHeight = mSourceNotification.getActualHeight(); + int notificationHeight = mSourceNotification.getActualHeight() + - mSourceNotification.getClipBottomAmount(); int notificationWidth = mSourceNotification.getWidth(); anim.setDuration(ANIMATION_DURATION); anim.setInterpolator(Interpolators.LINEAR); @@ -241,6 +255,8 @@ public class ActivityLaunchAnimator { int top; int right; int bottom; + int startClipTopAmount; + int parentStartClipTopAmount; public ExpandAnimationParameters() { } @@ -258,15 +274,32 @@ public class ActivityLaunchAnimator { } public int getTopChange() { - return Math.min(top - startPosition[1], 0); + // We need this compensation to ensure that the QS moves in sync. + int clipTopAmountCompensation = 0; + if (startClipTopAmount != 0.0f) { + clipTopAmountCompensation = (int) MathUtils.lerp(0, startClipTopAmount, + Interpolators.FAST_OUT_SLOW_IN.getInterpolation(linearProgress)); + } + return Math.min(top - startPosition[1] - clipTopAmountCompensation, 0); } + public float getProgress() { + return linearProgress; + } public float getProgress(long delay, long duration) { return MathUtils.constrain((linearProgress * ANIMATION_DURATION - delay) / duration, 0.0f, 1.0f); } + public int getStartClipTopAmount() { + return startClipTopAmount; + } + + public int getParentStartClipTopAmount() { + return parentStartClipTopAmount; + } + public float getStartTranslationZ() { return startTranslationZ; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index aa537279e944..4ffe5fe019c0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -2804,6 +2804,7 @@ public class StatusBar extends SystemUI implements DemoMode, public void setRemoteInputActive(NotificationData.Entry entry, boolean remoteInputActive) { mHeadsUpManager.setRemoteInputActive(entry, remoteInputActive); + entry.row.updateMaxHeights(); } public void lockScrollTo(NotificationData.Entry entry) { mStackScroller.lockScrollTo(entry.row); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java index 179c0d57aa50..d74a59e75933 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java @@ -60,6 +60,8 @@ import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.notification.NotificationViewWrapper; import com.android.systemui.statusbar.stack.StackStateAnimator; +import java.util.function.Consumer; + /** * Host for the remote input. */ @@ -90,6 +92,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene private boolean mResetting; private NotificationViewWrapper mWrapper; + private Consumer<Boolean> mOnVisibilityChangedListener; public RemoteInputView(Context context, AttributeSet attrs) { super(context, attrs); @@ -451,6 +454,18 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene mWrapper = wrapper; } + public void setOnVisibilityChangedListener(Consumer<Boolean> visibilityChangedListener) { + mOnVisibilityChangedListener = visibilityChangedListener; + } + + @Override + protected void onVisibilityChanged(View changedView, int visibility) { + super.onVisibilityChanged(changedView, visibility); + if (changedView == this) { + mOnVisibilityChangedListener.accept(visibility == VISIBLE); + } + } + /** * An EditText that changes appearance based on whether it's focusable and becomes * un-focusable whenever the user navigates away from it or it becomes invisible. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java index d7a810eca02e..0f637fb5a40a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java @@ -220,8 +220,7 @@ public class AmbientState { } public int getInnerHeight() { - return Math.max(Math.min(mLayoutHeight, mMaxLayoutHeight) - mTopPadding - - mExpandAnimationTopChange, mLayoutMinHeight); + return Math.max(Math.min(mLayoutHeight, mMaxLayoutHeight) - mTopPadding, mLayoutMinHeight); } public boolean isShadeExpanded() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index 4ca33cd3f601..ac2a1e1e041f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -120,6 +120,7 @@ public class NotificationChildrenContainer extends ViewGroup { super(context, attrs, defStyleAttr, defStyleRes); initDimens(); mHybridGroupManager = new HybridGroupManager(getContext(), this); + setClipChildren(false); } private void initDimens() { @@ -134,7 +135,7 @@ public class NotificationChildrenContainer extends ViewGroup { R.dimen.notification_children_container_top_padding); mHeaderHeight = mNotificationHeaderMargin + mNotificatonTopPadding; mCollapsedBottompadding = res.getDimensionPixelSize( - com.android.internal.R.dimen.notification_content_margin_bottom); + com.android.internal.R.dimen.notification_content_margin); mEnableShadowOnChildNotifications = res.getBoolean(R.bool.config_enableShadowOnChildNotifications); mShowDividersWhenExpanded = @@ -533,11 +534,12 @@ public class NotificationChildrenContainer extends ViewGroup { /** * Update the state of all its children based on a linear layout algorithm. - * - * @param resultState the state to update + * @param resultState the state to update * @param parentState the state of the parent + * @param ambientState */ - public void getState(StackScrollState resultState, ExpandableViewState parentState) { + public void getState(StackScrollState resultState, ExpandableViewState parentState, + AmbientState ambientState) { int childCount = mChildren.size(); int yPosition = mNotificationHeaderMargin; boolean firstChild = true; @@ -553,6 +555,7 @@ public class NotificationChildrenContainer extends ViewGroup { boolean childrenExpandedAndNotAnimating = mChildrenExpanded && !mContainingNotification.isGroupExpansionChanging(); + int launchTransitionCompensation = 0; for (int i = 0; i < childCount; i++) { ExpandableNotificationRow child = mChildren.get(i); if (!firstChild) { @@ -577,13 +580,13 @@ public class NotificationChildrenContainer extends ViewGroup { ExpandableViewState childState = resultState.getViewStateForView(child); int intrinsicHeight = child.getIntrinsicHeight(); childState.height = intrinsicHeight; - childState.yTranslation = yPosition; + childState.yTranslation = yPosition + launchTransitionCompensation; childState.hidden = false; // When the group is expanded, the children cast the shadows rather than the parent // so use the parent's elevation here. childState.zTranslation = (childrenExpandedAndNotAnimating && mEnableShadowOnChildNotifications) - ? mContainingNotification.getTranslationZ() + ? parentState.zTranslation : 0; childState.dimmed = parentState.dimmed; childState.dark = parentState.dark; @@ -600,6 +603,9 @@ public class NotificationChildrenContainer extends ViewGroup { childState.location = parentState.location; childState.inShelf = parentState.inShelf; yPosition += intrinsicHeight; + if (child.isExpandAnimationRunning()) { + launchTransitionCompensation = -ambientState.getExpandAnimationTopChange(); + } } if (mOverflowNumber != null) { @@ -637,7 +643,7 @@ public class NotificationChildrenContainer extends ViewGroup { } mHeaderViewState.initFrom(mNotificationHeader); mHeaderViewState.zTranslation = childrenExpandedAndNotAnimating - ? mContainingNotification.getTranslationZ() + ? parentState.zTranslation : 0; } } @@ -727,6 +733,9 @@ public class NotificationChildrenContainer extends ViewGroup { } private void updateChildrenClipping() { + if (mContainingNotification.hasExpandingChild()) { + return; + } int childCount = mChildren.size(); int layoutEnd = mContainingNotification.getActualHeight() - mClipBottomAmount; for (int i = 0; i < childCount; i++) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index d68a7b1dc205..51737a863748 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -91,17 +91,18 @@ public class StackScrollAlgorithm { updateClipping(resultState, algorithmState, ambientState); updateSpeedBumpState(resultState, algorithmState, ambientState); updateShelfState(resultState, ambientState); - getNotificationChildrenStates(resultState, algorithmState); + getNotificationChildrenStates(resultState, algorithmState, ambientState); } private void getNotificationChildrenStates(StackScrollState resultState, - StackScrollAlgorithmState algorithmState) { + StackScrollAlgorithmState algorithmState, + AmbientState ambientState) { int childCount = algorithmState.visibleChildren.size(); for (int i = 0; i < childCount; i++) { ExpandableView v = algorithmState.visibleChildren.get(i); if (v instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) v; - row.getChildrenStates(resultState); + row.getChildrenStates(resultState, ambientState); } } } @@ -323,7 +324,9 @@ public class StackScrollAlgorithm { } ExpandableNotificationRow expandingNotification = ambientState.getExpandingNotification(); state.indexOfExpandingNotification = expandingNotification != null - ? state.visibleChildren.indexOf(expandingNotification) + ? expandingNotification.isChildInGroup() + ? state.visibleChildren.indexOf(expandingNotification.getNotificationParent()) + : state.visibleChildren.indexOf(expandingNotification) : -1; } @@ -386,7 +389,7 @@ public class StackScrollAlgorithm { childViewState.location = ExpandableViewState.LOCATION_MAIN_AREA; float inset = ambientState.getTopPadding() + ambientState.getStackTranslation(); - if (i < algorithmState.getIndexOfExpandingNotification()) { + if (i <= algorithmState.getIndexOfExpandingNotification()) { inset += ambientState.getExpandAnimationTopChange(); } if (child.mustStayOnScreen() && childViewState.yTranslation >= 0) { @@ -515,7 +518,7 @@ public class StackScrollAlgorithm { - ambientState.getShelf().getIntrinsicHeight(); childViewState.yTranslation = Math.min(childViewState.yTranslation, shelfStart); if (childViewState.yTranslation >= shelfStart) { - childViewState.hidden = !child.isExpandAnimationRunning(); + childViewState.hidden = !child.isExpandAnimationRunning() && !child.hasExpandingChild(); childViewState.inShelf = true; childViewState.headsUpIsVisible = false; } |