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;
private float mDotScale = 0f;
private int mUpdateDotColor;
+ private int mBubbleDefaultBgColor;
private boolean mShowUpdateDot;
private boolean mOnLeft;
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
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
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;
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;
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);
}
}