Merge "Fix NPE in obtainThemeColor due to use of Mocks" into sc-dev
This commit is contained in:
@@ -6562,7 +6562,7 @@ public class Notification implements Parcelable
|
|||||||
theme = new ContextThemeWrapper(mContext, R.style.Theme_DeviceDefault_DayNight)
|
theme = new ContextThemeWrapper(mContext, R.style.Theme_DeviceDefault_DayNight)
|
||||||
.getTheme();
|
.getTheme();
|
||||||
try (TypedArray ta = theme.obtainStyledAttributes(new int[]{attrRes})) {
|
try (TypedArray ta = theme.obtainStyledAttributes(new int[]{attrRes})) {
|
||||||
return ta.getColor(0, defaultColor);
|
return ta == null ? defaultColor : ta.getColor(0, defaultColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9060,10 +9060,8 @@ public class Notification implements Parcelable
|
|||||||
container.setDrawableTint(buttonId, false, tintColor,
|
container.setDrawableTint(buttonId, false, tintColor,
|
||||||
PorterDuff.Mode.SRC_ATOP);
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
|
|
||||||
final TypedArray typedArray = mBuilder.mContext.obtainStyledAttributes(
|
int rippleAlpha = Color.alpha(mBuilder.obtainThemeColor(
|
||||||
new int[]{ android.R.attr.colorControlHighlight });
|
android.R.attr.colorControlHighlight, COLOR_DEFAULT));
|
||||||
int rippleAlpha = Color.alpha(typedArray.getColor(0, 0));
|
|
||||||
typedArray.recycle();
|
|
||||||
int rippleColor = Color.argb(rippleAlpha, Color.red(tintColor), Color.green(tintColor),
|
int rippleColor = Color.argb(rippleAlpha, Color.red(tintColor), Color.green(tintColor),
|
||||||
Color.blue(tintColor));
|
Color.blue(tintColor));
|
||||||
container.setRippleDrawableColor(buttonId, ColorStateList.valueOf(rippleColor));
|
container.setRippleDrawableColor(buttonId, ColorStateList.valueOf(rippleColor));
|
||||||
|
|||||||
Reference in New Issue
Block a user