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

Commit ac01a46c authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge "Fix manage click listener for promoted bubble" into main

parents e94d2d72 6d780499
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -372,6 +372,7 @@ public class BubbleExpandedView extends LinearLayout {
        //   ==> activity view
        //   ==> manage button
        bringChildToFront(mManageButton);
        setManageClickListener();

        applyThemeAttrs();

@@ -502,6 +503,7 @@ public class BubbleExpandedView extends LinearLayout {
                R.layout.bubble_manage_button, this /* parent */, false /* attach */);
        addView(mManageButton);
        mManageButton.setVisibility(visibility);
        setManageClickListener();
        post(() -> {
            int touchAreaHeight =
                    getResources().getDimensionPixelSize(
@@ -646,9 +648,8 @@ public class BubbleExpandedView extends LinearLayout {
        }
    }

    // TODO: Could listener be passed when we pass StackView / can we avoid setting this like this
    void setManageClickListener(OnClickListener manageClickListener) {
        mManageButton.setOnClickListener(manageClickListener);
    private void setManageClickListener() {
        mManageButton.setOnClickListener(v -> mStackView.onManageBubbleClicked());
    }

    /**
+2 −16
Original line number Diff line number Diff line
@@ -1374,7 +1374,6 @@ public class BubbleStackView extends FrameLayout
        // The menu itself should respect locale direction so the icons are on the correct side.
        mManageMenu.setLayoutDirection(LAYOUT_DIRECTION_LOCALE);
        addView(mManageMenu);
        updateManageButtonListener();
    }

    /**
@@ -3375,14 +3374,6 @@ public class BubbleStackView extends FrameLayout
            mExpandedViewContainer.setAlpha(0f);
            mExpandedViewContainer.addView(bev);

            postDelayed(() -> {
                // Set the Manage button click handler from postDelayed. This appears to resolve
                // a race condition with adding the BubbleExpandedView view to the expanded view
                // container. Due to the race condition the click handler sometimes is not set up
                // correctly and is never called.
                updateManageButtonListener();
            }, 0);

            if (!mIsExpansionAnimating) {
                mIsBubbleSwitchAnimating = true;
                mSurfaceSynchronizer.syncSurfaceAndRun(() -> {
@@ -3392,13 +3383,8 @@ public class BubbleStackView extends FrameLayout
        }
    }

    private void updateManageButtonListener() {
        BubbleExpandedView bev = getExpandedView();
        if (mIsExpanded && bev != null) {
            bev.setManageClickListener((view) -> {
    void onManageBubbleClicked() {
        showManageMenu(true /* show */);
            });
        }
    }

    /**