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

Commit 46e909c7 authored by Steve Elliott's avatar Steve Elliott Committed by Automerger Merge Worker
Browse files

Merge "Make smart reply insertion logic more robust" into sc-dev am: a23475b1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14232126

Change-Id: I6441faac1bfd6df33d7eda96c846aee9c67c8a4e
parents 301bec1c a23475b1
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -1481,18 +1481,26 @@ public class NotificationContentView extends FrameLayout {
            return null;
        }

        SmartReplyView smartReplyView = null;
        if (smartReplyContainer.getChildCount() == 1
                && smartReplyContainer.getChildAt(0) instanceof SmartReplyView) {
        // Search for an existing SmartReplyView
        int index = 0;
        final int childCount = smartReplyContainer.getChildCount();
        for (; index < childCount; index++) {
            View child = smartReplyContainer.getChildAt(index);
            if (child.getId() == R.id.smart_reply_view && child instanceof SmartReplyView) {
                break;
            }
        }

        if (index < childCount) {
            // If we already have a SmartReplyView - replace it with the newly inflated one. The
            // newly inflated one is connected to the new inflated smart reply/action buttons.
            smartReplyContainer.removeAllViews();
            smartReplyContainer.removeViewAt(index);
        }
        if (smartReplyContainer.getChildCount() == 0
                && inflatedSmartReplyViewHolder != null
        SmartReplyView smartReplyView = null;
        if (inflatedSmartReplyViewHolder != null
                && inflatedSmartReplyViewHolder.getSmartReplyView() != null) {
            smartReplyView = inflatedSmartReplyViewHolder.getSmartReplyView();
            smartReplyContainer.addView(smartReplyView);
            smartReplyContainer.addView(smartReplyView, index);
        }
        if (smartReplyView != null) {
            smartReplyView.resetSmartSuggestions(smartReplyContainer);