Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +48 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ public class NotificationContentView extends FrameLayout implements Notification private NotificationViewWrapper mContractedWrapper; private NotificationViewWrapper mExpandedWrapper; private NotificationViewWrapper mHeadsUpWrapper; @Nullable private NotificationViewWrapper mShownWrapper = null; private final HybridGroupManager mHybridGroupManager; private int mClipTopAmount; private int mContentHeight; Loading Loading @@ -417,6 +418,8 @@ public class NotificationContentView extends FrameLayout implements Notification mContractedChild = child; mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child, mContainingNotification); // The contracted wrapper has changed. If this is the shown wrapper, we need to update it. updateShownWrapper(mVisibleType); } private NotificationViewWrapper getWrapperForView(View child) { Loading Loading @@ -480,6 +483,8 @@ public class NotificationContentView extends FrameLayout implements Notification if (mContainingNotification != null) { applySystemActions(mExpandedChild, mContainingNotification.getEntry()); } // The expanded wrapper has changed. If this is the shown wrapper, we need to update it. updateShownWrapper(mVisibleType); } /** Loading Loading @@ -530,6 +535,8 @@ public class NotificationContentView extends FrameLayout implements Notification if (mContainingNotification != null) { applySystemActions(mHeadsUpChild, mContainingNotification.getEntry()); } // The heads up wrapper has changed. If this is the shown wrapper, we need to update it. updateShownWrapper(mVisibleType); } @Override Loading Loading @@ -886,6 +893,7 @@ public class NotificationContentView extends FrameLayout implements Notification forceUpdateVisibility(VISIBLE_TYPE_EXPANDED, mExpandedChild, mExpandedWrapper); forceUpdateVisibility(VISIBLE_TYPE_HEADSUP, mHeadsUpChild, mHeadsUpWrapper); forceUpdateVisibility(VISIBLE_TYPE_SINGLELINE, mSingleLineView, mSingleLineView); updateShownWrapper(mVisibleType); fireExpandedVisibleListenerIfVisible(); // forceUpdateVisibilities cancels outstanding animations without updating the // mAnimationStartVisibleType. Do so here instead. Loading Loading @@ -967,6 +975,7 @@ public class NotificationContentView extends FrameLayout implements Notification mHeadsUpChild, mHeadsUpWrapper); updateViewVisibility(visibleType, VISIBLE_TYPE_SINGLELINE, mSingleLineView, mSingleLineView); updateShownWrapper(visibleType); fireExpandedVisibleListenerIfVisible(); // updateViewVisibilities cancels outstanding animations without updating the // mAnimationStartVisibleType. Do so here instead. Loading @@ -980,6 +989,28 @@ public class NotificationContentView extends FrameLayout implements Notification } } /** * Called when the currently shown wrapper is potentially affected by a change to the * {mVisibleType} or the user-visibility of this view. * * @see View#isShown() */ private void updateShownWrapper(int visibleType) { final NotificationViewWrapper shownWrapper = isShown() ? getVisibleWrapper(visibleType) : null; if (mShownWrapper != shownWrapper) { NotificationViewWrapper hiddenWrapper = mShownWrapper; mShownWrapper = shownWrapper; if (hiddenWrapper != null) { hiddenWrapper.onContentShown(false); } if (shownWrapper != null) { shownWrapper.onContentShown(true); } } } private void animateToVisibleType(int visibleType) { final TransformableView shownView = getTransformableViewForVisibleType(visibleType); final TransformableView hiddenView = getTransformableViewForVisibleType(mVisibleType); Loading @@ -990,6 +1021,7 @@ public class NotificationContentView extends FrameLayout implements Notification mAnimationStartVisibleType = mVisibleType; shownView.transformFrom(hiddenView); getViewForVisibleType(visibleType).setVisibility(View.VISIBLE); updateShownWrapper(visibleType); hiddenView.transformTo(shownView, new Runnable() { @Override public void run() { Loading Loading @@ -1837,6 +1869,7 @@ public class NotificationContentView extends FrameLayout implements Notification @Override public void onVisibilityAggregated(boolean isVisible) { super.onVisibilityAggregated(isVisible); updateShownWrapper(mVisibleType); if (isVisible) { fireExpandedVisibleListenerIfVisible(); } Loading Loading @@ -2216,6 +2249,21 @@ public class NotificationContentView extends FrameLayout implements Notification @Nullable RemoteInputViewController mController; } @VisibleForTesting protected NotificationViewWrapper getContractedWrapper() { return mContractedWrapper; } @VisibleForTesting protected NotificationViewWrapper getExpandedWrapper() { return mExpandedWrapper; } @VisibleForTesting protected NotificationViewWrapper getHeadsUpWrapper() { return mHeadsUpWrapper; } @VisibleForTesting protected void setContractedWrapper(NotificationViewWrapper contractedWrapper) { mContractedWrapper = contractedWrapper; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationBigPictureTemplateViewWrapper.java +3 −5 Original line number Diff line number Diff line Loading @@ -68,13 +68,11 @@ public class NotificationBigPictureTemplateViewWrapper extends NotificationTempl } @Override public void setVisible(boolean visible) { super.setVisible(visible); public void onContentShown(boolean shown) { super.onContentShown(shown); BigPictureIconManager imageManager = mRow.getBigPictureIconManager(); if (imageManager != null) { // TODO(b/283082473) call it a bit earlier for true, as soon as the row starts to expand imageManager.onViewShown(visible); imageManager.onViewShown(shown); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -310,6 +310,17 @@ public abstract class NotificationViewWrapper implements TransformableView { mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); } /** * Called when the user-visibility of this content wrapper has changed. * * @param shown true if the content of this wrapper is user-visible, meaning that the wrapped * view and all of its ancestors are visible. * * @see View#isShown() */ public void onContentShown(boolean shown) { } /** * Called to indicate this view is removed */ Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.kt +333 −124 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +48 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ public class NotificationContentView extends FrameLayout implements Notification private NotificationViewWrapper mContractedWrapper; private NotificationViewWrapper mExpandedWrapper; private NotificationViewWrapper mHeadsUpWrapper; @Nullable private NotificationViewWrapper mShownWrapper = null; private final HybridGroupManager mHybridGroupManager; private int mClipTopAmount; private int mContentHeight; Loading Loading @@ -417,6 +418,8 @@ public class NotificationContentView extends FrameLayout implements Notification mContractedChild = child; mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child, mContainingNotification); // The contracted wrapper has changed. If this is the shown wrapper, we need to update it. updateShownWrapper(mVisibleType); } private NotificationViewWrapper getWrapperForView(View child) { Loading Loading @@ -480,6 +483,8 @@ public class NotificationContentView extends FrameLayout implements Notification if (mContainingNotification != null) { applySystemActions(mExpandedChild, mContainingNotification.getEntry()); } // The expanded wrapper has changed. If this is the shown wrapper, we need to update it. updateShownWrapper(mVisibleType); } /** Loading Loading @@ -530,6 +535,8 @@ public class NotificationContentView extends FrameLayout implements Notification if (mContainingNotification != null) { applySystemActions(mHeadsUpChild, mContainingNotification.getEntry()); } // The heads up wrapper has changed. If this is the shown wrapper, we need to update it. updateShownWrapper(mVisibleType); } @Override Loading Loading @@ -886,6 +893,7 @@ public class NotificationContentView extends FrameLayout implements Notification forceUpdateVisibility(VISIBLE_TYPE_EXPANDED, mExpandedChild, mExpandedWrapper); forceUpdateVisibility(VISIBLE_TYPE_HEADSUP, mHeadsUpChild, mHeadsUpWrapper); forceUpdateVisibility(VISIBLE_TYPE_SINGLELINE, mSingleLineView, mSingleLineView); updateShownWrapper(mVisibleType); fireExpandedVisibleListenerIfVisible(); // forceUpdateVisibilities cancels outstanding animations without updating the // mAnimationStartVisibleType. Do so here instead. Loading Loading @@ -967,6 +975,7 @@ public class NotificationContentView extends FrameLayout implements Notification mHeadsUpChild, mHeadsUpWrapper); updateViewVisibility(visibleType, VISIBLE_TYPE_SINGLELINE, mSingleLineView, mSingleLineView); updateShownWrapper(visibleType); fireExpandedVisibleListenerIfVisible(); // updateViewVisibilities cancels outstanding animations without updating the // mAnimationStartVisibleType. Do so here instead. Loading @@ -980,6 +989,28 @@ public class NotificationContentView extends FrameLayout implements Notification } } /** * Called when the currently shown wrapper is potentially affected by a change to the * {mVisibleType} or the user-visibility of this view. * * @see View#isShown() */ private void updateShownWrapper(int visibleType) { final NotificationViewWrapper shownWrapper = isShown() ? getVisibleWrapper(visibleType) : null; if (mShownWrapper != shownWrapper) { NotificationViewWrapper hiddenWrapper = mShownWrapper; mShownWrapper = shownWrapper; if (hiddenWrapper != null) { hiddenWrapper.onContentShown(false); } if (shownWrapper != null) { shownWrapper.onContentShown(true); } } } private void animateToVisibleType(int visibleType) { final TransformableView shownView = getTransformableViewForVisibleType(visibleType); final TransformableView hiddenView = getTransformableViewForVisibleType(mVisibleType); Loading @@ -990,6 +1021,7 @@ public class NotificationContentView extends FrameLayout implements Notification mAnimationStartVisibleType = mVisibleType; shownView.transformFrom(hiddenView); getViewForVisibleType(visibleType).setVisibility(View.VISIBLE); updateShownWrapper(visibleType); hiddenView.transformTo(shownView, new Runnable() { @Override public void run() { Loading Loading @@ -1837,6 +1869,7 @@ public class NotificationContentView extends FrameLayout implements Notification @Override public void onVisibilityAggregated(boolean isVisible) { super.onVisibilityAggregated(isVisible); updateShownWrapper(mVisibleType); if (isVisible) { fireExpandedVisibleListenerIfVisible(); } Loading Loading @@ -2216,6 +2249,21 @@ public class NotificationContentView extends FrameLayout implements Notification @Nullable RemoteInputViewController mController; } @VisibleForTesting protected NotificationViewWrapper getContractedWrapper() { return mContractedWrapper; } @VisibleForTesting protected NotificationViewWrapper getExpandedWrapper() { return mExpandedWrapper; } @VisibleForTesting protected NotificationViewWrapper getHeadsUpWrapper() { return mHeadsUpWrapper; } @VisibleForTesting protected void setContractedWrapper(NotificationViewWrapper contractedWrapper) { mContractedWrapper = contractedWrapper; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationBigPictureTemplateViewWrapper.java +3 −5 Original line number Diff line number Diff line Loading @@ -68,13 +68,11 @@ public class NotificationBigPictureTemplateViewWrapper extends NotificationTempl } @Override public void setVisible(boolean visible) { super.setVisible(visible); public void onContentShown(boolean shown) { super.onContentShown(shown); BigPictureIconManager imageManager = mRow.getBigPictureIconManager(); if (imageManager != null) { // TODO(b/283082473) call it a bit earlier for true, as soon as the row starts to expand imageManager.onViewShown(visible); imageManager.onViewShown(shown); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -310,6 +310,17 @@ public abstract class NotificationViewWrapper implements TransformableView { mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); } /** * Called when the user-visibility of this content wrapper has changed. * * @param shown true if the content of this wrapper is user-visible, meaning that the wrapped * view and all of its ancestors are visible. * * @see View#isShown() */ public void onContentShown(boolean shown) { } /** * Called to indicate this view is removed */ Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.kt +333 −124 File changed.Preview size limit exceeded, changes collapsed. Show changes