Animate alpha for bubbles and background (3/n)
Use separate timings for bubble icons and bubble bar background when stashing and unstashing. Follows alpha timings applied to taskbar background and icons. Bug: 345488489 Test: TransientBubbleStashControllerTest Test: stash and unstash bubble bar in app by swiping up from taskbar Test: expand and collapse bubble bar in app by swiping up on bar Test: expand and collapse bubble bar on home screen by tapping on it Flag: com.android.wm.shell.enable_bubble_bar Change-Id: I485f6346539cb6c8ea6dd4d15f25a6421021fec1
This commit is contained in:
@@ -205,7 +205,6 @@ public class BubbleBarView extends FrameLayout {
|
||||
|
||||
public BubbleBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
setAlpha(0);
|
||||
setVisibility(INVISIBLE);
|
||||
mIconOverlapAmount = getResources().getDimensionPixelSize(R.dimen.bubblebar_icon_overlap);
|
||||
mBubbleBarPadding = getResources().getDimensionPixelSize(R.dimen.bubblebar_icon_spacing);
|
||||
@@ -319,6 +318,22 @@ public class BubbleBarView extends FrameLayout {
|
||||
mBubbleBarBackground.setScaleY(scaleY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set alpha for bubble views
|
||||
*/
|
||||
public void setBubbleAlpha(float alpha) {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
getChildAt(i).setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set alpha for bar background
|
||||
*/
|
||||
public void setBackgroundAlpha(float alpha) {
|
||||
mBubbleBarBackground.setAlpha((int) (255 * alpha));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets new icon sizes and newBubbleBarPadding between icons and bubble bar borders.
|
||||
*
|
||||
@@ -1029,7 +1044,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
// where the bubble will end up when the animation ends
|
||||
final float targetX = expandedX + expandedBarShift;
|
||||
bv.setTranslationX(widthState * (targetX - collapsedX) + collapsedX);
|
||||
bv.setAlpha(1);
|
||||
bv.setVisibility(VISIBLE);
|
||||
} else {
|
||||
// If bar is on the right, account for bubble bar expanding and shifting left
|
||||
final float collapsedBarShift = onLeft ? 0 : currentWidth - collapsedWidth;
|
||||
@@ -1039,9 +1054,9 @@ public class BubbleBarView extends FrameLayout {
|
||||
// the overflow.
|
||||
if (widthState == 0) {
|
||||
if (bv.isOverflow() || i > MAX_VISIBLE_BUBBLES_COLLAPSED - 1) {
|
||||
bv.setAlpha(0);
|
||||
bv.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
bv.setAlpha(1);
|
||||
bv.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1349,7 +1364,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
* touch bounds.
|
||||
*/
|
||||
public boolean isEventOverAnyItem(MotionEvent ev) {
|
||||
if (getVisibility() == View.VISIBLE) {
|
||||
if (getVisibility() == VISIBLE) {
|
||||
getBoundsOnScreen(mTempRect);
|
||||
return mTempRect.contains((int) ev.getX(), (int) ev.getY());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user