Merge "Fix the spacing between bubble bar and expanded view" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
21d1cb3d1a
@@ -226,8 +226,6 @@
|
||||
<dimen name="bubble_user_education_padding_end">58dp</dimen>
|
||||
<!-- Padding between the bubble and the user education text. -->
|
||||
<dimen name="bubble_user_education_stack_padding">16dp</dimen>
|
||||
<!-- Size of the bubble bar (height), should match transient_taskbar_size in Launcher. -->
|
||||
<dimen name="bubblebar_size">72dp</dimen>
|
||||
<!-- The size of the caption bar inset at the top of bubble bar expanded view. -->
|
||||
<dimen name="bubble_bar_expanded_view_caption_height">32dp</dimen>
|
||||
<!-- The height of the dots shown for the caption menu in the bubble bar expanded view.. -->
|
||||
|
||||
@@ -1075,8 +1075,9 @@ public class BubbleController implements ConfigurationChangeListener,
|
||||
* <p>This is used by external callers (launcher).
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void expandStackAndSelectBubbleFromLauncher(String key, boolean onLauncherHome) {
|
||||
mBubblePositioner.setShowingInBubbleBar(onLauncherHome);
|
||||
public void expandStackAndSelectBubbleFromLauncher(String key, int bubbleBarXCoordinate,
|
||||
int bubbleBarYCoordinate) {
|
||||
mBubblePositioner.setBubbleBarPosition(bubbleBarXCoordinate, bubbleBarYCoordinate);
|
||||
|
||||
if (BubbleOverflow.KEY.equals(key)) {
|
||||
mBubbleData.setSelectedBubbleFromLauncher(mBubbleData.getOverflow());
|
||||
@@ -2087,9 +2088,10 @@ public class BubbleController implements ConfigurationChangeListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBubble(String key, boolean onLauncherHome) {
|
||||
public void showBubble(String key, int bubbleBarXCoordinate, int bubbleBarYCoordinate) {
|
||||
mMainExecutor.execute(
|
||||
() -> mController.expandStackAndSelectBubbleFromLauncher(key, onLauncherHome));
|
||||
() -> mController.expandStackAndSelectBubbleFromLauncher(
|
||||
key, bubbleBarXCoordinate, bubbleBarYCoordinate));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
@@ -102,10 +103,7 @@ public class BubblePositioner {
|
||||
private int[] mPaddings = new int[4];
|
||||
|
||||
private boolean mShowingInBubbleBar;
|
||||
private boolean mBubblesOnHome;
|
||||
private int mBubbleBarSize;
|
||||
private int mBubbleBarHomeAdjustment;
|
||||
private final PointF mBubbleBarPosition = new PointF();
|
||||
private final Point mBubbleBarPosition = new Point();
|
||||
|
||||
public BubblePositioner(Context context, WindowManager windowManager) {
|
||||
mContext = context;
|
||||
@@ -166,11 +164,9 @@ public class BubblePositioner {
|
||||
mSpacingBetweenBubbles = res.getDimensionPixelSize(R.dimen.bubble_spacing);
|
||||
mDefaultMaxBubbles = res.getInteger(R.integer.bubbles_max_rendered);
|
||||
mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
|
||||
mBubbleBarHomeAdjustment = mExpandedViewPadding / 2;
|
||||
mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top);
|
||||
mBubbleOffscreenAmount = res.getDimensionPixelSize(R.dimen.bubble_stack_offscreen);
|
||||
mStackOffset = res.getDimensionPixelSize(R.dimen.bubble_stack_offset);
|
||||
mBubbleBarSize = res.getDimensionPixelSize(R.dimen.bubblebar_size);
|
||||
|
||||
if (mShowingInBubbleBar) {
|
||||
mExpandedViewLargeScreenWidth = isLandscape()
|
||||
@@ -722,11 +718,9 @@ public class BubblePositioner {
|
||||
mShowingInBubbleBar = showingInBubbleBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether bubbles are showing on launcher home, in which case positions are different.
|
||||
*/
|
||||
public void setBubblesOnHome(boolean bubblesOnHome) {
|
||||
mBubblesOnHome = bubblesOnHome;
|
||||
/** Sets the position of the bubble bar in screen coordinates. */
|
||||
public void setBubbleBarPosition(int x, int y) {
|
||||
mBubbleBarPosition.set(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -747,11 +741,7 @@ public class BubblePositioner {
|
||||
|
||||
/** The bottom position of the expanded view when showing above the bubble bar. */
|
||||
public int getExpandedViewBottomForBubbleBar() {
|
||||
return getAvailableRect().height()
|
||||
+ mInsets.top
|
||||
- mBubbleBarSize
|
||||
- mExpandedViewPadding
|
||||
- getBubbleBarHomeAdjustment();
|
||||
return mBubbleBarPosition.y - mExpandedViewPadding;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -764,19 +754,7 @@ public class BubblePositioner {
|
||||
/**
|
||||
* Returns the on screen co-ordinates of the bubble bar.
|
||||
*/
|
||||
public PointF getBubbleBarPosition() {
|
||||
mBubbleBarPosition.set(getAvailableRect().width() - mBubbleBarSize,
|
||||
getAvailableRect().height() - mBubbleBarSize
|
||||
- mExpandedViewPadding - getBubbleBarHomeAdjustment());
|
||||
public Point getBubbleBarPosition() {
|
||||
return mBubbleBarPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* When bubbles are shown on launcher home, there's an extra bit of padding that needs to
|
||||
* be applied between the expanded view and the bubble bar. This returns the adjustment value
|
||||
* if bubbles are showing on home.
|
||||
*/
|
||||
private int getBubbleBarHomeAdjustment() {
|
||||
return mBubblesOnHome ? mBubbleBarHomeAdjustment : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ interface IBubbles {
|
||||
|
||||
oneway void unregisterBubbleListener(in IBubblesListener listener) = 2;
|
||||
|
||||
oneway void showBubble(in String key, in boolean onLauncherHome) = 3;
|
||||
oneway void showBubble(in String key, in int bubbleBarXCoordinate,
|
||||
in int bubbleBarYCoordinate) = 3;
|
||||
|
||||
oneway void removeBubble(in String key, in int reason) = 4;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Point;
|
||||
import android.util.Log;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class BubbleBarAnimationHelper {
|
||||
bev.setVisibility(VISIBLE);
|
||||
|
||||
// Set the pivot point for the scale, so the view animates out from the bubble bar.
|
||||
PointF bubbleBarPosition = mPositioner.getBubbleBarPosition();
|
||||
Point bubbleBarPosition = mPositioner.getBubbleBarPosition();
|
||||
mExpandedViewContainerMatrix.setScale(
|
||||
1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT,
|
||||
1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT,
|
||||
|
||||
@@ -1996,7 +1996,7 @@ public class BubblesTest extends SysuiTestCase {
|
||||
|
||||
FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener();
|
||||
mBubbleController.registerBubbleStateListener(bubbleStateListener);
|
||||
mBubbleController.expandStackAndSelectBubbleFromLauncher(mBubbleEntry.getKey(), true);
|
||||
mBubbleController.expandStackAndSelectBubbleFromLauncher(mBubbleEntry.getKey(), 500, 1000);
|
||||
|
||||
assertThat(mBubbleController.getLayerView().isExpanded()).isTrue();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user