Use default attr instead of styleable

Test: manual => toggle dark theme, pointer changes color
Test: manual => expanded view radius as expected
Change-Id: I5df4f1a6e5295678a08b5cf43f55028d4259e6f2
This commit is contained in:
Lyn Han
2019-12-10 14:34:12 -08:00
parent 10672be4de
commit 61bfdb3a9e
2 changed files with 6 additions and 15 deletions

View File

@@ -154,12 +154,5 @@
<declare-styleable name="CaptionsToggleImageButton">
<attr name="optedOut" format="boolean" />
</declare-styleable>
<!-- Theme attributes used to style the appearance of expanded Bubbles -->
<declare-styleable name="BubbleExpandedView">
<attr name="android:colorBackgroundFloating" />
<attr name="android:dialogCornerRadius" />
</declare-styleable>
</resources>

View File

@@ -278,17 +278,15 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
}
void applyThemeAttrs() {
TypedArray ta = getContext().obtainStyledAttributes(R.styleable.BubbleExpandedView);
int bgColor = ta.getColor(
R.styleable.BubbleExpandedView_android_colorBackgroundFloating, Color.WHITE);
float cornerRadius = ta.getDimension(
R.styleable.BubbleExpandedView_android_dialogCornerRadius, 0);
final TypedArray ta = mContext.obtainStyledAttributes(
new int[] {
android.R.attr.colorBackgroundFloating,
android.R.attr.dialogCornerRadius});
int bgColor = ta.getColor(0, Color.WHITE);
float cornerRadius = ta.getDimensionPixelSize(1, 0);
ta.recycle();
// Update triangle color.
mPointerDrawable.setTint(bgColor);
// Update ActivityView cornerRadius
if (ScreenDecorationsUtils.supportsRoundedCornersOnWindows(mContext.getResources())) {
mActivityView.setCornerRadius(cornerRadius);
}