Commit c1ec16ee authored by Jeffrey I. Schiller's avatar Jeffrey I. Schiller

Merge branch 'ucr'

Change-Id: Ib6cff8abf1c421459ce27c3e91cc0ebbfdab27bc
parents 48d3190c babac434
...@@ -423,8 +423,15 @@ public abstract class ButtonBase extends AndroidViewComponent ...@@ -423,8 +423,15 @@ public abstract class ButtonBase extends AndroidViewComponent
private Drawable getSafeBackgroundDrawable() { private Drawable getSafeBackgroundDrawable() {
if (myBackgroundDrawable == null) { if (myBackgroundDrawable == null) {
Drawable.ConstantState state = defaultButtonDrawable.getConstantState(); Drawable.ConstantState state = defaultButtonDrawable.getConstantState();
if (state != null) { if (state != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
try {
myBackgroundDrawable = state.newDrawable().mutate(); myBackgroundDrawable = state.newDrawable().mutate();
} catch (NullPointerException e) {
// We see this on SDK 7, but given we can't easily test every version
// this is meant as a safeguard.
Log.e(LOG_TAG, "Unable to clone button drawable", e);
myBackgroundDrawable = defaultButtonDrawable;
}
} else { } else {
// Since we can't make a copy of the default we'll just use it directly // Since we can't make a copy of the default we'll just use it directly
myBackgroundDrawable = defaultButtonDrawable; myBackgroundDrawable = defaultButtonDrawable;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment