Merge "Remove don't bubble option for app bubbles" into udc-dev

This commit is contained in:
Ivan Tkachenko
2023-04-13 17:50:46 +00:00
committed by Android (Google) Code Review
4 changed files with 20 additions and 9 deletions

View File

@@ -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:textAppearance="@*android:style/TextAppearance.DeviceDefault"
android:text="@string/bubbles_dont_bubble_conversation" />
</LinearLayout>

View File

@@ -146,8 +146,6 @@
<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]-->

View File

@@ -842,7 +842,7 @@ public class BubbleStackView extends FrameLayout
private DismissView mDismissView;
private ViewGroup mManageMenu;
private TextView mManageDontBubbleText;
private ViewGroup mManageDontBubbleView;
private ViewGroup mManageSettingsView;
private ImageView mManageSettingsIcon;
private TextView mManageSettingsText;
@@ -1217,8 +1217,8 @@ public class BubbleStackView extends FrameLayout
mUnbubbleConversationCallback.accept(mBubbleData.getSelectedBubble().getKey());
});
mManageDontBubbleText = mManageMenu
.findViewById(R.id.bubble_manage_menu_dont_bubble_text);
mManageDontBubbleView = mManageMenu
.findViewById(R.id.bubble_manage_menu_dont_bubble_container);
mManageSettingsView = mManageMenu.findViewById(R.id.bubble_manage_menu_settings_container);
mManageSettingsView.setOnClickListener(
@@ -2890,14 +2890,16 @@ public class BubbleStackView extends FrameLayout
final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey());
if (bubble != null && !bubble.isAppBubble()) {
// Setup options for non app bubbles
mManageDontBubbleText.setText(R.string.bubbles_dont_bubble_conversation);
mManageDontBubbleView.setVisibility(VISIBLE);
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 have no conversations
// so we don't show the option to not bubble conversation
mManageDontBubbleView.setVisibility(GONE);
// App bubbles are not notification based
// so we don't show the option to go to notification settings
mManageSettingsView.setVisibility(GONE);
@@ -2965,6 +2967,15 @@ public class BubbleStackView extends FrameLayout
}
}
/**
* Checks whether manage menu don't bubble conversation action is available and visible
* Used for testing
*/
@VisibleForTesting
public boolean isManageMenuDontBubbleVisible() {
return mManageDontBubbleView != null && mManageDontBubbleView.getVisibility() == VISIBLE;
}
/**
* Checks whether manage menu notification settings action is available and visible
* Used for testing

View File

@@ -1257,6 +1257,7 @@ public class BubblesTest extends SysuiTestCase {
stackView.showManageMenu(true);
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
assertTrue(stackView.isManageMenuSettingsVisible());
assertTrue(stackView.isManageMenuDontBubbleVisible());
}
@Test
@@ -1274,6 +1275,7 @@ public class BubblesTest extends SysuiTestCase {
stackView.showManageMenu(true);
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
assertFalse(stackView.isManageMenuSettingsVisible());
assertFalse(stackView.isManageMenuDontBubbleVisible());
}
@Test