Loading libs/WindowManager/Shell/res/values/dimen.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -97,7 +97,7 @@ <!-- How much the bubble flyout text container is elevated. --> <!-- How much the bubble flyout text container is elevated. --> <dimen name="bubble_flyout_elevation">4dp</dimen> <dimen name="bubble_flyout_elevation">4dp</dimen> <!-- How much padding is around the left and right sides of the flyout text. --> <!-- How much padding is around the left and right sides of the flyout text. --> <dimen name="bubble_flyout_padding_x">12dp</dimen> <dimen name="bubble_flyout_padding_x">14dp</dimen> <!-- How much padding is around the top and bottom of the flyout text. --> <!-- How much padding is around the top and bottom of the flyout text. --> <dimen name="bubble_flyout_padding_y">10dp</dimen> <dimen name="bubble_flyout_padding_y">10dp</dimen> <!-- Size of the triangle that points from the flyout to the bubble stack. --> <!-- Size of the triangle that points from the flyout to the bubble stack. --> Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -65,6 +65,9 @@ public class BubbleFlyoutView extends FrameLayout { private static final long FLYOUT_FADE_OUT_DURATION = 150L; private static final long FLYOUT_FADE_OUT_DURATION = 150L; private static final long FLYOUT_FADE_IN_DURATION = 250L; private static final long FLYOUT_FADE_IN_DURATION = 250L; // Whether the flyout view should show a pointer to the bubble. private static final boolean SHOW_POINTER = false; private final int mFlyoutPadding; private final int mFlyoutPadding; private final int mFlyoutSpaceFromBubble; private final int mFlyoutSpaceFromBubble; private final int mPointerSize; private final int mPointerSize; Loading Loading @@ -166,14 +169,16 @@ public class BubbleFlyoutView extends FrameLayout { final Resources res = getResources(); final Resources res = getResources(); mFlyoutPadding = res.getDimensionPixelSize(R.dimen.bubble_flyout_padding_x); mFlyoutPadding = res.getDimensionPixelSize(R.dimen.bubble_flyout_padding_x); mFlyoutSpaceFromBubble = res.getDimensionPixelSize(R.dimen.bubble_flyout_space_from_bubble); mFlyoutSpaceFromBubble = res.getDimensionPixelSize(R.dimen.bubble_flyout_space_from_bubble); mPointerSize = res.getDimensionPixelSize(R.dimen.bubble_flyout_pointer_size); mPointerSize = SHOW_POINTER ? res.getDimensionPixelSize(R.dimen.bubble_flyout_pointer_size) : 0; mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation); mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation); mFlyoutElevation = res.getDimensionPixelSize(R.dimen.bubble_flyout_elevation); mFlyoutElevation = res.getDimensionPixelSize(R.dimen.bubble_flyout_elevation); final TypedArray ta = mContext.obtainStyledAttributes( final TypedArray ta = mContext.obtainStyledAttributes( new int[] { new int[] { android.R.attr.colorBackgroundFloating, com.android.internal.R.attr.colorSurface, android.R.attr.dialogCornerRadius}); android.R.attr.dialogCornerRadius}); mFloatingBackgroundColor = ta.getColor(0, Color.WHITE); mFloatingBackgroundColor = ta.getColor(0, Color.WHITE); mCornerRadius = ta.getDimensionPixelSize(1, 0); mCornerRadius = ta.getDimensionPixelSize(1, 0); Loading @@ -182,7 +187,7 @@ public class BubbleFlyoutView extends FrameLayout { // Add padding for the pointer on either side, onDraw will draw it in this space. // Add padding for the pointer on either side, onDraw will draw it in this space. setPadding(mPointerSize, 0, mPointerSize, 0); setPadding(mPointerSize, 0, mPointerSize, 0); setWillNotDraw(false); setWillNotDraw(false); setClipChildren(false); setClipChildren(!SHOW_POINTER); setTranslationZ(mFlyoutElevation); setTranslationZ(mFlyoutElevation); setOutlineProvider(new ViewOutlineProvider() { setOutlineProvider(new ViewOutlineProvider() { @Override @Override Loading Loading @@ -461,6 +466,7 @@ public class BubbleFlyoutView extends FrameLayout { /** Renders the 'pointer' triangle that points from the flyout to the bubble stack. */ /** Renders the 'pointer' triangle that points from the flyout to the bubble stack. */ private void renderPointerTriangle( private void renderPointerTriangle( Canvas canvas, float currentFlyoutWidth, float currentFlyoutHeight) { Canvas canvas, float currentFlyoutWidth, float currentFlyoutHeight) { if (!SHOW_POINTER) return; canvas.save(); canvas.save(); // Translation to apply for the 'retraction' effect as the flyout collapses. // Translation to apply for the 'retraction' effect as the flyout collapses. Loading Loading @@ -488,13 +494,12 @@ public class BubbleFlyoutView extends FrameLayout { // current position. // current position. relevantTriangle.getOutline(mTriangleOutline); relevantTriangle.getOutline(mTriangleOutline); mTriangleOutline.offset((int) arrowTranslationX, (int) arrowTranslationY); mTriangleOutline.offset((int) arrowTranslationX, (int) arrowTranslationY); canvas.restore(); canvas.restore(); } } /** Builds an outline that includes the transformed flyout background and triangle. */ /** Builds an outline that includes the transformed flyout background and triangle. */ private void getOutline(Outline outline) { private void getOutline(Outline outline) { if (!mTriangleOutline.isEmpty()) { if (!mTriangleOutline.isEmpty() || !SHOW_POINTER) { // Draw the rect into the outline as a path so we can merge the triangle path into it. // Draw the rect into the outline as a path so we can merge the triangle path into it. final Path rectPath = new Path(); final Path rectPath = new Path(); final float interpolatedRadius = getInterpolatedRadius(); final float interpolatedRadius = getInterpolatedRadius(); Loading @@ -503,7 +508,7 @@ public class BubbleFlyoutView extends FrameLayout { outline.setPath(rectPath); outline.setPath(rectPath); // Get rid of the triangle path once it has disappeared behind the flyout. // Get rid of the triangle path once it has disappeared behind the flyout. if (mPercentStillFlyout > 0.5f) { if (SHOW_POINTER && mPercentStillFlyout > 0.5f) { outline.mPath.addPath(mTriangleOutline.mPath); outline.mPath.addPath(mTriangleOutline.mPath); } } Loading Loading
libs/WindowManager/Shell/res/values/dimen.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -97,7 +97,7 @@ <!-- How much the bubble flyout text container is elevated. --> <!-- How much the bubble flyout text container is elevated. --> <dimen name="bubble_flyout_elevation">4dp</dimen> <dimen name="bubble_flyout_elevation">4dp</dimen> <!-- How much padding is around the left and right sides of the flyout text. --> <!-- How much padding is around the left and right sides of the flyout text. --> <dimen name="bubble_flyout_padding_x">12dp</dimen> <dimen name="bubble_flyout_padding_x">14dp</dimen> <!-- How much padding is around the top and bottom of the flyout text. --> <!-- How much padding is around the top and bottom of the flyout text. --> <dimen name="bubble_flyout_padding_y">10dp</dimen> <dimen name="bubble_flyout_padding_y">10dp</dimen> <!-- Size of the triangle that points from the flyout to the bubble stack. --> <!-- Size of the triangle that points from the flyout to the bubble stack. --> Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -65,6 +65,9 @@ public class BubbleFlyoutView extends FrameLayout { private static final long FLYOUT_FADE_OUT_DURATION = 150L; private static final long FLYOUT_FADE_OUT_DURATION = 150L; private static final long FLYOUT_FADE_IN_DURATION = 250L; private static final long FLYOUT_FADE_IN_DURATION = 250L; // Whether the flyout view should show a pointer to the bubble. private static final boolean SHOW_POINTER = false; private final int mFlyoutPadding; private final int mFlyoutPadding; private final int mFlyoutSpaceFromBubble; private final int mFlyoutSpaceFromBubble; private final int mPointerSize; private final int mPointerSize; Loading Loading @@ -166,14 +169,16 @@ public class BubbleFlyoutView extends FrameLayout { final Resources res = getResources(); final Resources res = getResources(); mFlyoutPadding = res.getDimensionPixelSize(R.dimen.bubble_flyout_padding_x); mFlyoutPadding = res.getDimensionPixelSize(R.dimen.bubble_flyout_padding_x); mFlyoutSpaceFromBubble = res.getDimensionPixelSize(R.dimen.bubble_flyout_space_from_bubble); mFlyoutSpaceFromBubble = res.getDimensionPixelSize(R.dimen.bubble_flyout_space_from_bubble); mPointerSize = res.getDimensionPixelSize(R.dimen.bubble_flyout_pointer_size); mPointerSize = SHOW_POINTER ? res.getDimensionPixelSize(R.dimen.bubble_flyout_pointer_size) : 0; mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation); mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation); mFlyoutElevation = res.getDimensionPixelSize(R.dimen.bubble_flyout_elevation); mFlyoutElevation = res.getDimensionPixelSize(R.dimen.bubble_flyout_elevation); final TypedArray ta = mContext.obtainStyledAttributes( final TypedArray ta = mContext.obtainStyledAttributes( new int[] { new int[] { android.R.attr.colorBackgroundFloating, com.android.internal.R.attr.colorSurface, android.R.attr.dialogCornerRadius}); android.R.attr.dialogCornerRadius}); mFloatingBackgroundColor = ta.getColor(0, Color.WHITE); mFloatingBackgroundColor = ta.getColor(0, Color.WHITE); mCornerRadius = ta.getDimensionPixelSize(1, 0); mCornerRadius = ta.getDimensionPixelSize(1, 0); Loading @@ -182,7 +187,7 @@ public class BubbleFlyoutView extends FrameLayout { // Add padding for the pointer on either side, onDraw will draw it in this space. // Add padding for the pointer on either side, onDraw will draw it in this space. setPadding(mPointerSize, 0, mPointerSize, 0); setPadding(mPointerSize, 0, mPointerSize, 0); setWillNotDraw(false); setWillNotDraw(false); setClipChildren(false); setClipChildren(!SHOW_POINTER); setTranslationZ(mFlyoutElevation); setTranslationZ(mFlyoutElevation); setOutlineProvider(new ViewOutlineProvider() { setOutlineProvider(new ViewOutlineProvider() { @Override @Override Loading Loading @@ -461,6 +466,7 @@ public class BubbleFlyoutView extends FrameLayout { /** Renders the 'pointer' triangle that points from the flyout to the bubble stack. */ /** Renders the 'pointer' triangle that points from the flyout to the bubble stack. */ private void renderPointerTriangle( private void renderPointerTriangle( Canvas canvas, float currentFlyoutWidth, float currentFlyoutHeight) { Canvas canvas, float currentFlyoutWidth, float currentFlyoutHeight) { if (!SHOW_POINTER) return; canvas.save(); canvas.save(); // Translation to apply for the 'retraction' effect as the flyout collapses. // Translation to apply for the 'retraction' effect as the flyout collapses. Loading Loading @@ -488,13 +494,12 @@ public class BubbleFlyoutView extends FrameLayout { // current position. // current position. relevantTriangle.getOutline(mTriangleOutline); relevantTriangle.getOutline(mTriangleOutline); mTriangleOutline.offset((int) arrowTranslationX, (int) arrowTranslationY); mTriangleOutline.offset((int) arrowTranslationX, (int) arrowTranslationY); canvas.restore(); canvas.restore(); } } /** Builds an outline that includes the transformed flyout background and triangle. */ /** Builds an outline that includes the transformed flyout background and triangle. */ private void getOutline(Outline outline) { private void getOutline(Outline outline) { if (!mTriangleOutline.isEmpty()) { if (!mTriangleOutline.isEmpty() || !SHOW_POINTER) { // Draw the rect into the outline as a path so we can merge the triangle path into it. // Draw the rect into the outline as a path so we can merge the triangle path into it. final Path rectPath = new Path(); final Path rectPath = new Path(); final float interpolatedRadius = getInterpolatedRadius(); final float interpolatedRadius = getInterpolatedRadius(); Loading @@ -503,7 +508,7 @@ public class BubbleFlyoutView extends FrameLayout { outline.setPath(rectPath); outline.setPath(rectPath); // Get rid of the triangle path once it has disappeared behind the flyout. // Get rid of the triangle path once it has disappeared behind the flyout. if (mPercentStillFlyout > 0.5f) { if (SHOW_POINTER && mPercentStillFlyout > 0.5f) { outline.mPath.addPath(mTriangleOutline.mPath); outline.mPath.addPath(mTriangleOutline.mPath); } } Loading