Loading packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java +9 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.bubbles; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Path; import android.graphics.Point; import android.graphics.Rect; Loading @@ -38,6 +40,7 @@ public class BadgedImageView extends ImageView { private float mDotScale = 0f; private int mUpdateDotColor; private int mBubbleDefaultBgColor; private boolean mShowUpdateDot; private boolean mOnLeft; Loading @@ -59,6 +62,11 @@ public class BadgedImageView extends ImageView { setScaleType(ScaleType.CENTER_CROP); mIconSize = getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); mDotRenderer = new BadgeRenderer(mIconSize); TypedArray ta = context.obtainStyledAttributes( new int[] {android.R.attr.colorBackgroundFloating}); mBubbleDefaultBgColor = ta.getColor(0, Color.WHITE); ta.recycle(); } // TODO: Clipping oval path isn't great: rerender image into a separate, rounded bitmap and Loading @@ -70,6 +78,7 @@ public class BadgedImageView extends ImageView { mClipPath.addOval(getPaddingStart(), getPaddingTop(), getWidth() - getPaddingEnd(), getHeight() - getPaddingBottom(), Path.Direction.CW); canvas.clipPath(mClipPath); canvas.drawColor(mBubbleDefaultBgColor); super.onDraw(canvas); // After we've circle cropped what we're showing, restore so we don't clip the badge Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +13 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.ActivityView; import android.app.PendingIntent; import android.content.Context; import android.content.res.Resources; import android.graphics.Outline; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; Loading @@ -32,6 +33,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.view.WindowManager; Loading Loading @@ -674,6 +676,17 @@ public class BubbleStackView extends FrameLayout implements BubbleTouchHandler.F BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); bv.updateDotVisibility(); bv.setZ(bubbsCount - i); // Draw the shadow around the circle inscribed within the bubble's bounds. This // (intentionally) does not draw a shadow behind the update dot, which should be drawing // its own shadow since it's on a different (higher) plane. bv.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, mBubbleSize, mBubbleSize); } }); bv.setClipToOutline(false); } } Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java +9 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.bubbles; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Path; import android.graphics.Point; import android.graphics.Rect; Loading @@ -38,6 +40,7 @@ public class BadgedImageView extends ImageView { private float mDotScale = 0f; private int mUpdateDotColor; private int mBubbleDefaultBgColor; private boolean mShowUpdateDot; private boolean mOnLeft; Loading @@ -59,6 +62,11 @@ public class BadgedImageView extends ImageView { setScaleType(ScaleType.CENTER_CROP); mIconSize = getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); mDotRenderer = new BadgeRenderer(mIconSize); TypedArray ta = context.obtainStyledAttributes( new int[] {android.R.attr.colorBackgroundFloating}); mBubbleDefaultBgColor = ta.getColor(0, Color.WHITE); ta.recycle(); } // TODO: Clipping oval path isn't great: rerender image into a separate, rounded bitmap and Loading @@ -70,6 +78,7 @@ public class BadgedImageView extends ImageView { mClipPath.addOval(getPaddingStart(), getPaddingTop(), getWidth() - getPaddingEnd(), getHeight() - getPaddingBottom(), Path.Direction.CW); canvas.clipPath(mClipPath); canvas.drawColor(mBubbleDefaultBgColor); super.onDraw(canvas); // After we've circle cropped what we're showing, restore so we don't clip the badge Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +13 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.ActivityView; import android.app.PendingIntent; import android.content.Context; import android.content.res.Resources; import android.graphics.Outline; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; Loading @@ -32,6 +33,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.view.WindowManager; Loading Loading @@ -674,6 +676,17 @@ public class BubbleStackView extends FrameLayout implements BubbleTouchHandler.F BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); bv.updateDotVisibility(); bv.setZ(bubbsCount - i); // Draw the shadow around the circle inscribed within the bubble's bounds. This // (intentionally) does not draw a shadow behind the update dot, which should be drawing // its own shadow since it's on a different (higher) plane. bv.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, mBubbleSize, mBubbleSize); } }); bv.setClipToOutline(false); } } Loading