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

Commit 048211a7 authored by Ivan Tkachenko's avatar Ivan Tkachenko
Browse files

Remove conversation related options in bubble manage menu

* Change "Don't bubble conversation" option text to "Don't bubble"
* Remove "Keep Notes settings" option from manage menu:
  * Remove goto settings option if bubble is app bubble (Bubble key equals `KEY_APP_BUBBLE`)

Test: manual
Test: atest BubblesTest
Bug: 268546471
Change-Id: I4384912cb7795ca5c6c0b798c4eef965ba2949ef
parent 7b53dca2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -63,11 +63,11 @@
            android:tint="@color/bubbles_icon_tint"/>

        <TextView
            android:id="@+id/bubble_manage_menu_dont_bubble_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault"
            android:text="@string/bubbles_dont_bubble_conversation" />
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault" />

    </LinearLayout>

+2 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@
    <string name="bubbles_app_settings"><xliff:g id="notification_title" example="Android Messages">%1$s</xliff:g> settings</string>
    <!-- Text used for the bubble dismiss area. Bubbles dragged to, or flung towards, this area will go away. [CHAR LIMIT=30] -->
    <string name="bubble_dismiss_text">Dismiss bubble</string>
    <!-- Button text to stop an app from bubbling [CHAR LIMIT=60]-->
    <string name="bubbles_dont_bubble">Don\u2019t bubble</string>
    <!-- Button text to stop a conversation from bubbling [CHAR LIMIT=60]-->
    <string name="bubbles_dont_bubble_conversation">Don\u2019t bubble conversation</string>
    <!-- Title text for the bubbles feature education cling shown when a bubble is on screen for the first time. [CHAR LIMIT=60]-->
+26 −2
Original line number Diff line number Diff line
@@ -844,6 +844,8 @@ public class BubbleStackView extends FrameLayout
    private DismissView mDismissView;

    private ViewGroup mManageMenu;
    private TextView mManageDontBubbleText;
    private ViewGroup mManageSettingsView;
    private ImageView mManageSettingsIcon;
    private TextView mManageSettingsText;
    private boolean mShowingManage = false;
@@ -1217,7 +1219,11 @@ public class BubbleStackView extends FrameLayout
                    mUnbubbleConversationCallback.accept(mBubbleData.getSelectedBubble().getKey());
                });

        mManageMenu.findViewById(R.id.bubble_manage_menu_settings_container).setOnClickListener(
        mManageDontBubbleText = mManageMenu
                .findViewById(R.id.bubble_manage_menu_dont_bubble_text);

        mManageSettingsView = mManageMenu.findViewById(R.id.bubble_manage_menu_settings_container);
        mManageSettingsView.setOnClickListener(
                view -> {
                    showManageMenu(false /* show */);
                    final BubbleViewProvider bubble = mBubbleData.getSelectedBubble();
@@ -2868,10 +2874,19 @@ public class BubbleStackView extends FrameLayout
        // name and icon.
        if (show) {
            final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey());
            if (bubble != null) {
            if (bubble != null && !bubble.isAppBubble()) {
                // Setup options for non app bubbles
                mManageDontBubbleText.setText(R.string.bubbles_dont_bubble_conversation);
                mManageSettingsIcon.setImageBitmap(bubble.getRawAppBadge());
                mManageSettingsText.setText(getResources().getString(
                        R.string.bubbles_app_settings, bubble.getAppName()));
                mManageSettingsView.setVisibility(VISIBLE);
            } else {
                // Setup options for app bubbles
                mManageDontBubbleText.setText(R.string.bubbles_dont_bubble);
                // App bubbles are not notification based
                // so we don't show the option to go to notification settings
                mManageSettingsView.setVisibility(GONE);
            }
        }

@@ -2936,6 +2951,15 @@ public class BubbleStackView extends FrameLayout
        }
    }

    /**
     * Checks whether manage menu notification settings action is available and visible
     * Used for testing
     */
    @VisibleForTesting
    public boolean isManageMenuSettingsVisible() {
        return mManageSettingsView != null && mManageSettingsView.getVisibility() == VISIBLE;
    }

    private void updateExpandedBubble() {
        if (DEBUG_BUBBLE_STACK_VIEW) {
            Log.d(TAG, "updateExpandedBubble()");
+18 −0
Original line number Diff line number Diff line
@@ -1245,6 +1245,24 @@ public class BubblesTest extends SysuiTestCase {
        // Show the menu
        stackView.showManageMenu(true);
        assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
        assertTrue(stackView.isManageMenuSettingsVisible());
    }

    @Test
    public void testShowManageMenuChangesSysuiState_appBubble() {
        mBubbleController.showOrHideAppBubble(mAppBubbleIntent, mUser0);
        assertTrue(mBubbleController.hasBubbles());

        // Expand the stack
        BubbleStackView stackView = mBubbleController.getStackView();
        mBubbleData.setExpanded(true);
        assertStackExpanded();
        assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);

        // Show the menu
        stackView.showManageMenu(true);
        assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
        assertFalse(stackView.isManageMenuSettingsVisible());
    }

    @Test