Merge "Enable overflow" into rvc-dev am: 8f24e99754 am: 2c3b89e015
Change-Id: I081ce1cdefe4a37ddd3bedf7a276df1227fa286b
This commit is contained in:
@@ -73,9 +73,6 @@ public class BubbleExperimentConfig {
|
|||||||
|
|
||||||
private static final String WHITELISTED_AUTO_BUBBLE_APPS = "whitelisted_auto_bubble_apps";
|
private static final String WHITELISTED_AUTO_BUBBLE_APPS = "whitelisted_auto_bubble_apps";
|
||||||
|
|
||||||
private static final String ALLOW_BUBBLE_OVERFLOW = "allow_bubble_overflow";
|
|
||||||
private static final boolean ALLOW_BUBBLE_OVERFLOW_DEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When true, if a notification has the information necessary to bubble (i.e. valid
|
* When true, if a notification has the information necessary to bubble (i.e. valid
|
||||||
* contentIntent and an icon or image), then a {@link android.app.Notification.BubbleMetadata}
|
* contentIntent and an icon or image), then a {@link android.app.Notification.BubbleMetadata}
|
||||||
@@ -130,16 +127,6 @@ public class BubbleExperimentConfig {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* When true, show a menu when a bubble is long-pressed, which will allow the user to take
|
|
||||||
* actions on that bubble.
|
|
||||||
*/
|
|
||||||
static boolean allowBubbleOverflow(Context context) {
|
|
||||||
return Settings.Secure.getInt(context.getContentResolver(),
|
|
||||||
ALLOW_BUBBLE_OVERFLOW,
|
|
||||||
ALLOW_BUBBLE_OVERFLOW_DEFAULT ? 1 : 0) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If {@link #allowAnyNotifToBubble(Context)} is true, this method creates and adds
|
* If {@link #allowAnyNotifToBubble(Context)} is true, this method creates and adds
|
||||||
* {@link android.app.Notification.BubbleMetadata} to the notification entry as long as
|
* {@link android.app.Notification.BubbleMetadata} to the notification entry as long as
|
||||||
|
|||||||
@@ -520,9 +520,6 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setUpOverflow() {
|
private void setUpOverflow() {
|
||||||
if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int overflowBtnIndex = 0;
|
int overflowBtnIndex = 0;
|
||||||
if (mBubbleOverflow == null) {
|
if (mBubbleOverflow == null) {
|
||||||
mBubbleOverflow = new BubbleOverflow(mContext);
|
mBubbleOverflow = new BubbleOverflow(mContext);
|
||||||
@@ -733,8 +730,7 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
@Nullable
|
@Nullable
|
||||||
Bubble getExpandedBubble() {
|
Bubble getExpandedBubble() {
|
||||||
if (mExpandedBubble == null
|
if (mExpandedBubble == null
|
||||||
|| (BubbleExperimentConfig.allowBubbleOverflow(mContext)
|
|| (mExpandedBubble.getIconView() == mBubbleOverflow.getBtn()
|
||||||
&& mExpandedBubble.getIconView() == mBubbleOverflow.getBtn()
|
|
||||||
&& mExpandedBubble.getKey() == BubbleOverflow.KEY)) {
|
&& mExpandedBubble.getKey() == BubbleOverflow.KEY)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -785,9 +781,6 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateOverflowBtnVisibility(boolean apply) {
|
private void updateOverflowBtnVisibility(boolean apply) {
|
||||||
if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mIsExpanded) {
|
if (mIsExpanded) {
|
||||||
if (DEBUG_BUBBLE_STACK_VIEW) {
|
if (DEBUG_BUBBLE_STACK_VIEW) {
|
||||||
Log.d(TAG, "Show overflow button.");
|
Log.d(TAG, "Show overflow button.");
|
||||||
@@ -911,8 +904,7 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
float y = event.getRawY();
|
float y = event.getRawY();
|
||||||
if (mIsExpanded) {
|
if (mIsExpanded) {
|
||||||
if (isIntersecting(mBubbleContainer, x, y)) {
|
if (isIntersecting(mBubbleContainer, x, y)) {
|
||||||
if (BubbleExperimentConfig.allowBubbleOverflow(mContext)
|
if (isIntersecting(mBubbleOverflow.getBtn(), x, y)) {
|
||||||
&& isIntersecting(mBubbleOverflow.getBtn(), x, y)) {
|
|
||||||
return mBubbleOverflow.getBtn();
|
return mBubbleOverflow.getBtn();
|
||||||
}
|
}
|
||||||
// Could be tapping or dragging a bubble while expanded
|
// Could be tapping or dragging a bubble while expanded
|
||||||
@@ -1645,11 +1637,8 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
* @return the number of bubbles in the stack view.
|
* @return the number of bubbles in the stack view.
|
||||||
*/
|
*/
|
||||||
public int getBubbleCount() {
|
public int getBubbleCount() {
|
||||||
if (BubbleExperimentConfig.allowBubbleOverflow(mContext)) {
|
// Subtract 1 for the overflow button that is always in the bubble container.
|
||||||
// Subtract 1 for the overflow button which is always in the bubble container.
|
return mBubbleContainer.getChildCount() - 1;
|
||||||
return mBubbleContainer.getChildCount() - 1;
|
|
||||||
}
|
|
||||||
return mBubbleContainer.getChildCount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user