Loading core/java/android/view/NotificationHeaderView.java +6 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,12 @@ public class NotificationHeaderView extends RelativeLayout { /** * Center top line and expand button vertically. * Note that this is primarily only used as a remotable method to ensure the correct initial * state of the RemoteView. For further updating the position after the RemoteView has been * created, we directly apply a translation obtained from * {@link NotificationHeaderView#getTopLineTranslation()} and * {@link NotificationHeaderView#getExpandButtonTranslation()} to the corresponding children, in * order to have a smoother transition. */ @RemotableViewMethod public void centerTopLine(boolean center) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +33 −10 Original line number Diff line number Diff line Loading @@ -967,13 +967,25 @@ public class NotificationChildrenContainer extends ViewGroup mHeaderViewState.setAlpha(mHeaderVisibleAmount); if (notificationsRedesignTemplates()) { // While mUserLocked, the expandFactor reflects where in the drag-to-expand gesture // we are so that we can calculate the intermediary translation needed for the // header components. Otherwise, we just set the final desired translation based // on whether the group is expanded or not. float topLineTranslation = 0, expandButtonTranslation = 0; if (mUserLocked) { topLineTranslation = mGroupHeader.getTopLineTranslation() * expandFactor; expandButtonTranslation = mGroupHeader.getExpandButtonTranslation() * expandFactor; } else if (mChildrenExpanded) { topLineTranslation = mGroupHeader.getTopLineTranslation(); expandButtonTranslation = mGroupHeader.getExpandButtonTranslation(); } mTopLineViewState = initStateForGroupHeader(mTopLineViewState); mTopLineViewState.setYTranslation( mGroupHeader.getTopLineTranslation() * expandFactor); mTopLineViewState.setYTranslation(topLineTranslation); mExpandButtonViewState = initStateForGroupHeader(mExpandButtonViewState); mExpandButtonViewState.setYTranslation( mGroupHeader.getExpandButtonTranslation() * expandFactor); mExpandButtonViewState.setYTranslation(expandButtonTranslation); } } } Loading Loading @@ -1186,10 +1198,10 @@ public class NotificationChildrenContainer extends ViewGroup int childCount = mAttachedChildren.size(); ViewState tmpState = new ViewState(); float expandFraction = getGroupExpandFraction(); final boolean isExpanding = !showingAsLowPriority() final boolean isExpansionChanging = !showingAsLowPriority() && (mUserLocked || mContainingNotification.isGroupExpansionChanging()); final boolean dividersVisible = (mChildrenExpanded && mShowDividersWhenExpanded) || (isExpanding && !mHideDividersDuringExpand); || (isExpansionChanging && !mHideDividersDuringExpand); for (int i = childCount - 1; i >= 0; i--) { ExpandableNotificationRow child = mAttachedChildren.get(i); ExpandableViewState viewState = child.getViewState(); Loading Loading @@ -1220,11 +1232,22 @@ public class NotificationChildrenContainer extends ViewGroup } mGroupOverFlowState.animateTo(mOverflowNumber, properties); } if (mGroupHeader != null && mHeaderViewState != null) { if (mGroupHeader != null) { if (mHeaderViewState != null) { // TODO(389839492): For Groups in Bundles mGroupHeader might be initialized // but mHeaderViewState is null. mHeaderViewState.applyToView(mGroupHeader); } if (notificationsRedesignTemplates()) { if (mTopLineViewState != null) { mTopLineViewState.animateTo(mGroupHeader.getTopLineView(), properties); } if (mExpandButtonViewState != null) { mExpandButtonViewState.animateTo(mGroupHeader.getExpandButton(), properties); } } } updateChildrenClipping(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +0 −33 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.notification.stack; import static android.app.Flags.notificationsRedesignTemplates; import static android.os.Trace.TRACE_TAG_APP; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_UP; Loading Loading @@ -63,7 +62,6 @@ import android.util.MathUtils; import android.view.DisplayCutout; import android.view.InputDevice; import android.view.MotionEvent; import android.view.NotificationHeaderView; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; Loading Loading @@ -6777,41 +6775,10 @@ public class NotificationStackScrollLayout changedRow.setChildrenExpanded(expanded); onChildHeightChanged(changedRow, false /* needsAnimation */); updateGroupHeaderAlignment(changedRow, expanded); runAfterAnimationFinished(changedRow::onFinishedExpansionChange); } private void updateGroupHeaderAlignment(ExpandableNotificationRow row, boolean expanded) { if (!notificationsRedesignTemplates()) { return; } NotificationChildrenContainer childrenContainer = row.getChildrenContainer(); if (childrenContainer == null) { Log.wtf(TAG, "Tried to update group header alignment for something that's " + "not a group; key = " + row.getKey()); return; } NotificationHeaderView header = childrenContainer.getGroupHeader(); if (header != null) { resetYTranslation(header.getTopLineView()); resetYTranslation(header.getExpandButton()); header.centerTopLine(expanded); } } /** * Reset the y translation of the {@code view} via the {@link ViewState}, to ensure that the * animation state is updated correctly. */ private static void resetYTranslation(View view) { ViewState viewState = new ViewState(); viewState.initFrom(view); viewState.setYTranslation(0); viewState.applyToView(view); } private final ExpandHelper.Callback mExpandHelperCallback = new ExpandHelper.Callback() { @Override public ExpandableView getChildAtPosition(float touchX, float touchY) { Loading Loading
core/java/android/view/NotificationHeaderView.java +6 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,12 @@ public class NotificationHeaderView extends RelativeLayout { /** * Center top line and expand button vertically. * Note that this is primarily only used as a remotable method to ensure the correct initial * state of the RemoteView. For further updating the position after the RemoteView has been * created, we directly apply a translation obtained from * {@link NotificationHeaderView#getTopLineTranslation()} and * {@link NotificationHeaderView#getExpandButtonTranslation()} to the corresponding children, in * order to have a smoother transition. */ @RemotableViewMethod public void centerTopLine(boolean center) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +33 −10 Original line number Diff line number Diff line Loading @@ -967,13 +967,25 @@ public class NotificationChildrenContainer extends ViewGroup mHeaderViewState.setAlpha(mHeaderVisibleAmount); if (notificationsRedesignTemplates()) { // While mUserLocked, the expandFactor reflects where in the drag-to-expand gesture // we are so that we can calculate the intermediary translation needed for the // header components. Otherwise, we just set the final desired translation based // on whether the group is expanded or not. float topLineTranslation = 0, expandButtonTranslation = 0; if (mUserLocked) { topLineTranslation = mGroupHeader.getTopLineTranslation() * expandFactor; expandButtonTranslation = mGroupHeader.getExpandButtonTranslation() * expandFactor; } else if (mChildrenExpanded) { topLineTranslation = mGroupHeader.getTopLineTranslation(); expandButtonTranslation = mGroupHeader.getExpandButtonTranslation(); } mTopLineViewState = initStateForGroupHeader(mTopLineViewState); mTopLineViewState.setYTranslation( mGroupHeader.getTopLineTranslation() * expandFactor); mTopLineViewState.setYTranslation(topLineTranslation); mExpandButtonViewState = initStateForGroupHeader(mExpandButtonViewState); mExpandButtonViewState.setYTranslation( mGroupHeader.getExpandButtonTranslation() * expandFactor); mExpandButtonViewState.setYTranslation(expandButtonTranslation); } } } Loading Loading @@ -1186,10 +1198,10 @@ public class NotificationChildrenContainer extends ViewGroup int childCount = mAttachedChildren.size(); ViewState tmpState = new ViewState(); float expandFraction = getGroupExpandFraction(); final boolean isExpanding = !showingAsLowPriority() final boolean isExpansionChanging = !showingAsLowPriority() && (mUserLocked || mContainingNotification.isGroupExpansionChanging()); final boolean dividersVisible = (mChildrenExpanded && mShowDividersWhenExpanded) || (isExpanding && !mHideDividersDuringExpand); || (isExpansionChanging && !mHideDividersDuringExpand); for (int i = childCount - 1; i >= 0; i--) { ExpandableNotificationRow child = mAttachedChildren.get(i); ExpandableViewState viewState = child.getViewState(); Loading Loading @@ -1220,11 +1232,22 @@ public class NotificationChildrenContainer extends ViewGroup } mGroupOverFlowState.animateTo(mOverflowNumber, properties); } if (mGroupHeader != null && mHeaderViewState != null) { if (mGroupHeader != null) { if (mHeaderViewState != null) { // TODO(389839492): For Groups in Bundles mGroupHeader might be initialized // but mHeaderViewState is null. mHeaderViewState.applyToView(mGroupHeader); } if (notificationsRedesignTemplates()) { if (mTopLineViewState != null) { mTopLineViewState.animateTo(mGroupHeader.getTopLineView(), properties); } if (mExpandButtonViewState != null) { mExpandButtonViewState.animateTo(mGroupHeader.getExpandButton(), properties); } } } updateChildrenClipping(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +0 −33 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.notification.stack; import static android.app.Flags.notificationsRedesignTemplates; import static android.os.Trace.TRACE_TAG_APP; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_UP; Loading Loading @@ -63,7 +62,6 @@ import android.util.MathUtils; import android.view.DisplayCutout; import android.view.InputDevice; import android.view.MotionEvent; import android.view.NotificationHeaderView; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; Loading Loading @@ -6777,41 +6775,10 @@ public class NotificationStackScrollLayout changedRow.setChildrenExpanded(expanded); onChildHeightChanged(changedRow, false /* needsAnimation */); updateGroupHeaderAlignment(changedRow, expanded); runAfterAnimationFinished(changedRow::onFinishedExpansionChange); } private void updateGroupHeaderAlignment(ExpandableNotificationRow row, boolean expanded) { if (!notificationsRedesignTemplates()) { return; } NotificationChildrenContainer childrenContainer = row.getChildrenContainer(); if (childrenContainer == null) { Log.wtf(TAG, "Tried to update group header alignment for something that's " + "not a group; key = " + row.getKey()); return; } NotificationHeaderView header = childrenContainer.getGroupHeader(); if (header != null) { resetYTranslation(header.getTopLineView()); resetYTranslation(header.getExpandButton()); header.centerTopLine(expanded); } } /** * Reset the y translation of the {@code view} via the {@link ViewState}, to ensure that the * animation state is updated correctly. */ private static void resetYTranslation(View view) { ViewState viewState = new ViewState(); viewState.initFrom(view); viewState.setYTranslation(0); viewState.applyToView(view); } private final ExpandHelper.Callback mExpandHelperCallback = new ExpandHelper.Callback() { @Override public ExpandableView getChildAtPosition(float touchX, float touchY) { Loading