Merge "Remove unused flags from bubble controller" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-05 05:10:58 +00:00
committed by Android (Google) Code Review
4 changed files with 13 additions and 81 deletions

View File

@@ -109,11 +109,6 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
/** Use an activityView for an auto-bubbled notifs if it has an appropriate content intent */ /** Use an activityView for an auto-bubbled notifs if it has an appropriate content intent */
private static final String ENABLE_BUBBLE_CONTENT_INTENT = "experiment_bubble_content_intent"; private static final String ENABLE_BUBBLE_CONTENT_INTENT = "experiment_bubble_content_intent";
/** Whether the row of bubble circles are anchored to the top or bottom of the screen. */
private static final String ENABLE_BUBBLES_AT_TOP = "experiment_enable_top_bubbles";
/** Flag to position the header below the activity view */
private static final String ENABLE_BUBBLE_FOOTER = "experiment_enable_bubble_footer";
private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness"; private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness";
private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness"; private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness";
@@ -607,22 +602,6 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
ENABLE_BUBBLES, 1) != 0; ENABLE_BUBBLES, 1) != 0;
} }
/**
* Whether bubbles should be positioned at the top of the screen or not.
*/
public static boolean showBubblesAtTop(Context context) {
return Settings.Secure.getInt(context.getContentResolver(),
ENABLE_BUBBLES_AT_TOP, 0) != 0;
}
/**
* Whether the bubble chrome should display as a footer or not (in which case it's a header).
*/
public static boolean useFooter(Context context) {
return Settings.Secure.getInt(context.getContentResolver(),
ENABLE_BUBBLE_FOOTER, 0) != 0;
}
/** Default stiffness to use for bubble physics animations. */ /** Default stiffness to use for bubble physics animations. */
public static int getBubbleStiffness(Context context, int defaultStiffness) { public static int getBubbleStiffness(Context context, int defaultStiffness) {
return Settings.Secure.getInt( return Settings.Secure.getInt(

View File

@@ -74,10 +74,6 @@ import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
public class BubbleExpandedView extends LinearLayout implements View.OnClickListener { public class BubbleExpandedView extends LinearLayout implements View.OnClickListener {
private static final String TAG = "BubbleExpandedView"; private static final String TAG = "BubbleExpandedView";
// Configurable via bubble settings; just for testing
private boolean mUseFooter;
private boolean mShowOnTop;
// The triangle pointing to the expanded view // The triangle pointing to the expanded view
private View mPointerView; private View mPointerView;
private int mPointerMargin; private int mPointerMargin;
@@ -185,11 +181,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
int bgColor = ta.getColor(0, Color.WHITE); int bgColor = ta.getColor(0, Color.WHITE);
ta.recycle(); ta.recycle();
mShowOnTop = BubbleController.showBubblesAtTop(getContext());
mUseFooter = BubbleController.useFooter(getContext());
ShapeDrawable triangleDrawable = new ShapeDrawable( ShapeDrawable triangleDrawable = new ShapeDrawable(
TriangleShape.create(width, height, mShowOnTop /* pointUp */)); TriangleShape.create(width, height, false /* pointUp */));
triangleDrawable.setTint(bgColor); triangleDrawable.setTint(bgColor);
mPointerView.setBackground(triangleDrawable); mPointerView.setBackground(triangleDrawable);
@@ -238,18 +231,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
} }
return view.onApplyWindowInsets(insets); return view.onApplyWindowInsets(insets);
}); });
if (!mShowOnTop) {
removeView(mPointerView);
if (mUseFooter) {
View divider = findViewById(R.id.divider);
viewWrapper.removeView(divider);
removeView(viewWrapper);
addView(divider);
addView(viewWrapper);
}
addView(mPointerView);
}
} }
@Override @Override
@@ -289,9 +270,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
final float cr = ta2.getDimension(0, 0f); final float cr = ta2.getDimension(0, 0f);
ta2.recycle(); ta2.recycle();
float[] radii = mUseFooter float[] radii = new float[] {cr, cr, cr, cr, 0, 0, 0, 0};
? new float[] {0, 0, 0, 0, cr, cr, cr, cr}
: new float[] {cr, cr, cr, cr, 0, 0, 0, 0};
GradientDrawable chromeBackground = new GradientDrawable(); GradientDrawable chromeBackground = new GradientDrawable();
chromeBackground.setShape(GradientDrawable.RECTANGLE); chromeBackground.setShape(GradientDrawable.RECTANGLE);
chromeBackground.setCornerRadii(radii); chromeBackground.setCornerRadii(radii);
@@ -353,11 +332,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
// Still in the shade... remove it // Still in the shade... remove it
parent.removeView(mNotifRow); parent.removeView(mNotifRow);
} }
if (mShowOnTop) { addView(mNotifRow, 1 /* index */);
addView(mNotifRow);
} else {
addView(mNotifRow, mUseFooter ? 0 : 1);
}
} }
} }

View File

@@ -810,28 +810,16 @@ public class BubbleStackView extends FrameLayout {
* y position when the bubbles are expanded as well as the bounds of the dismiss target. * y position when the bubbles are expanded as well as the bounds of the dismiss target.
*/ */
int getMaxExpandedHeight() { int getMaxExpandedHeight() {
boolean showOnTop = BubbleController.showBubblesAtTop(getContext());
int expandedY = (int) mExpandedAnimationController.getExpandedY(); int expandedY = (int) mExpandedAnimationController.getExpandedY();
if (showOnTop) { return expandedY - getStatusBarHeight();
// PIP dismiss view uses FLAG_LAYOUT_IN_SCREEN so we need to subtract the bottom inset
int pipDismissHeight = mPipDismissHeight - getBottomInset();
return mDisplaySize.y - expandedY - mBubbleSize - pipDismissHeight;
} else {
return expandedY - getStatusBarHeight();
}
} }
/** /**
* Calculates the y position of the expanded view when it is expanded. * Calculates the y position of the expanded view when it is expanded.
*/ */
float getYPositionForExpandedView() { float getYPositionForExpandedView() {
boolean showOnTop = BubbleController.showBubblesAtTop(getContext()); return mExpandedAnimationController.getExpandedY()
if (showOnTop) { - mExpandedBubble.expandedView.getExpandedSize() - mBubblePadding;
return getStatusBarHeight() + mBubbleSize + mBubblePadding;
} else {
return mExpandedAnimationController.getExpandedY()
- mExpandedBubble.expandedView.getExpandedSize() - mBubblePadding;
}
} }
/** /**

View File

@@ -26,7 +26,6 @@ import androidx.dynamicanimation.animation.DynamicAnimation;
import androidx.dynamicanimation.animation.SpringForce; import androidx.dynamicanimation.animation.SpringForce;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.google.android.collect.Sets; import com.google.android.collect.Sets;
@@ -222,23 +221,14 @@ public class ExpandedAnimationController
if (mLayout == null || mLayout.getRootWindowInsets() == null) { if (mLayout == null || mLayout.getRootWindowInsets() == null) {
return 0; return 0;
} }
final boolean showOnTop = BubbleController.showBubblesAtTop(mLayout.getContext());
final WindowInsets insets = mLayout.getRootWindowInsets(); final WindowInsets insets = mLayout.getRootWindowInsets();
if (showOnTop) { int keyboardHeight = insets.getSystemWindowInsetBottom()
return mBubblePaddingPx + Math.max( - insets.getStableInsetBottom();
mStatusBarHeight, float bottomInset = keyboardHeight > 0
insets.getDisplayCutout() != null ? keyboardHeight
? insets.getDisplayCutout().getSafeInsetTop() : (mPipDismissHeight - insets.getStableInsetBottom());
: 0); // Stable insets are excluded from display size, so we must subtract it
} else { return mDisplaySize.y - mBubbleSizePx - mBubblePaddingPx - bottomInset;
int keyboardHeight = insets.getSystemWindowInsetBottom()
- insets.getStableInsetBottom();
float bottomInset = keyboardHeight > 0
? keyboardHeight
: (mPipDismissHeight - insets.getStableInsetBottom());
// Stable insets are excluded from display size, so we must subtract it
return mDisplaySize.y - mBubbleSizePx - mBubblePaddingPx - bottomInset;
}
} }
@Override @Override