Merge "Remove conversation related options in bubble manage menu" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
61e0c88a2f
@@ -63,11 +63,11 @@
|
|||||||
android:tint="@color/bubbles_icon_tint"/>
|
android:tint="@color/bubbles_icon_tint"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/bubble_manage_menu_dont_bubble_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault"
|
android:textAppearance="@*android:style/TextAppearance.DeviceDefault" />
|
||||||
android:text="@string/bubbles_dont_bubble_conversation" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,8 @@
|
|||||||
<string name="bubbles_app_settings"><xliff:g id="notification_title" example="Android Messages">%1$s</xliff:g> settings</string>
|
<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] -->
|
<!-- 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>
|
<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]-->
|
<!-- Button text to stop a conversation from bubbling [CHAR LIMIT=60]-->
|
||||||
<string name="bubbles_dont_bubble_conversation">Don\u2019t bubble conversation</string>
|
<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]-->
|
<!-- Title text for the bubbles feature education cling shown when a bubble is on screen for the first time. [CHAR LIMIT=60]-->
|
||||||
|
|||||||
@@ -844,6 +844,8 @@ public class BubbleStackView extends FrameLayout
|
|||||||
private DismissView mDismissView;
|
private DismissView mDismissView;
|
||||||
|
|
||||||
private ViewGroup mManageMenu;
|
private ViewGroup mManageMenu;
|
||||||
|
private TextView mManageDontBubbleText;
|
||||||
|
private ViewGroup mManageSettingsView;
|
||||||
private ImageView mManageSettingsIcon;
|
private ImageView mManageSettingsIcon;
|
||||||
private TextView mManageSettingsText;
|
private TextView mManageSettingsText;
|
||||||
private boolean mShowingManage = false;
|
private boolean mShowingManage = false;
|
||||||
@@ -1217,7 +1219,11 @@ public class BubbleStackView extends FrameLayout
|
|||||||
mUnbubbleConversationCallback.accept(mBubbleData.getSelectedBubble().getKey());
|
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 -> {
|
view -> {
|
||||||
showManageMenu(false /* show */);
|
showManageMenu(false /* show */);
|
||||||
final BubbleViewProvider bubble = mBubbleData.getSelectedBubble();
|
final BubbleViewProvider bubble = mBubbleData.getSelectedBubble();
|
||||||
@@ -2868,10 +2874,19 @@ public class BubbleStackView extends FrameLayout
|
|||||||
// name and icon.
|
// name and icon.
|
||||||
if (show) {
|
if (show) {
|
||||||
final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey());
|
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());
|
mManageSettingsIcon.setImageBitmap(bubble.getRawAppBadge());
|
||||||
mManageSettingsText.setText(getResources().getString(
|
mManageSettingsText.setText(getResources().getString(
|
||||||
R.string.bubbles_app_settings, bubble.getAppName()));
|
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() {
|
private void updateExpandedBubble() {
|
||||||
if (DEBUG_BUBBLE_STACK_VIEW) {
|
if (DEBUG_BUBBLE_STACK_VIEW) {
|
||||||
Log.d(TAG, "updateExpandedBubble()");
|
Log.d(TAG, "updateExpandedBubble()");
|
||||||
|
|||||||
@@ -1245,6 +1245,24 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
// Show the menu
|
// Show the menu
|
||||||
stackView.showManageMenu(true);
|
stackView.showManageMenu(true);
|
||||||
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
|
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
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user