Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02f51033 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Recompose bundle header when config changes" into main

parents 3fdd9acd a45986fd
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGetMaxAllowedVisibleChildren_bundle_likeCollapsed() {
        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        mChildrenContainer.setBundleHeaderViewModel(mock(BundleHeaderViewModel.class));
        Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(true),
@@ -132,7 +132,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGetMaxAllowedVisibleChildren_bundle_expandedChildren() {
        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        mChildrenContainer.setBundleHeaderViewModel(mock(BundleHeaderViewModel.class));
        mChildrenContainer.setChildrenExpanded(true);
@@ -143,7 +143,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testGetMaxAllowedVisibleChildren_bundle_userLocked() {
        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        mChildrenContainer.setBundleHeaderViewModel(mock(BundleHeaderViewModel.class));
        mGroup.setUserLocked(true);
@@ -317,7 +317,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
        View currentView = mChildrenContainer.getChildAt(mChildrenContainer.getChildCount() - 1);
        Assert.assertFalse(currentView instanceof ComposeView);

        View headerView = new ComposeView(mContext);
        ComposeView headerView = new ComposeView(mContext);
        mChildrenContainer.setBundleHeaderView(headerView);
        BundleHeaderViewModel viewModel = mKosmos.getBundleHeaderViewModel();
        mChildrenContainer.setBundleHeaderViewModel(viewModel);
+5 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.compose.ui.platform.ComposeView;
import androidx.dynamicanimation.animation.FloatPropertyCompat;
import androidx.dynamicanimation.animation.SpringAnimation;

@@ -1727,6 +1728,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        if (mBigPictureIconManager != null) {
            mBigPictureIconManager.updateMaxImageSizes();
        }
        if (mChildrenContainer != null) {
            mChildrenContainer.recomposeBundleHeader();
        }
    }

    public void onUiModeChanged() {
@@ -1909,7 +1913,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        mRedactionType = redactionType;
    }

    public void setBundleHeaderView(@NonNull View view) {
    public void setBundleHeaderView(@NonNull ComposeView view) {
        if (NotificationBundleUi.isUnexpectedlyInLegacyMode()) return;
        NotificationChildrenContainer childrenContainer = getChildrenContainerNonNull();
        childrenContainer.setBundleHeaderView(view);
+11 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.compose.ui.platform.ComposeView;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.widget.NotificationExpandButton;
@@ -130,7 +131,7 @@ public class NotificationChildrenContainer extends ViewGroup
     * This view is only set when this NCC is a bundle. If this view is set, all other header
     * view variants have to be null.
     */
    private View mBundleHeaderView;
    private ComposeView mBundleHeaderView;
    @Nullable private BundleHeaderViewModel mBundleHeaderViewModel;

    private NotificationHeaderView mGroupHeader;
@@ -224,6 +225,13 @@ public class NotificationChildrenContainer extends ViewGroup
                R.dimen.conversation_single_line_face_pile_size);
    }

    public void recomposeBundleHeader() {
        if (mBundleHeaderView != null) {
            mBundleHeaderView.disposeComposition();
            mBundleHeaderView.createComposition();
        }
    }

    @NonNull
    @Override
    public RoundableState getRoundableState() {
@@ -511,7 +519,7 @@ public class NotificationChildrenContainer extends ViewGroup
        mMinimizedGroupHeader = null;
        mMinimizedGroupHeaderWrapper = null;
    }
    public void setBundleHeaderView(@NonNull View view) {
    public void setBundleHeaderView(@NonNull ComposeView view) {
        if (NotificationBundleUi.isUnexpectedlyInLegacyMode()) return;
        initBundleDimens();
        mBundleHeaderView = view;
@@ -1643,6 +1651,7 @@ public class NotificationChildrenContainer extends ViewGroup
            addView(divider, index);
            mDividers.set(i, divider);
        }
        recomposeBundleHeader();
    }

    public void setUserLocked(boolean userLocked) {