Adding workaround for issue with null drawable

A drawable is null which ought not be null, since it should have been set during inflation. Seems like a platform issue on one device. Adding a workaround to manually set it in code after inflation if necessary.

issue 15334203

Change-Id: Ideb80c231300e61f6dfe5336d6d647a3e1b51817
This commit is contained in:
Adam Cohen
2014-06-03 21:43:24 -07:00
parent e9a5119836
commit 18bbc6a013

View File

@@ -49,6 +49,13 @@ public class InfoDropTarget extends ButtonDropTarget {
Resources r = getResources();
mHoverColor = r.getColor(R.color.info_target_hover_tint);
mDrawable = (TransitionDrawable) getCurrentDrawable();
if (mDrawable == null) {
// TODO: investigate why this is ever happening. Presently only on one known device.
mDrawable = r.getDrawable(R.drawable.info_target_selector);
setCompoundDrawablesRelativeWithIntrinsicBounds(mDrawable, null, null, null);
}
if (null != mDrawable) {
mDrawable.setCrossFadeEnabled(true);
}