Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18bbc6a0 authored by Adam Cohen's avatar Adam Cohen
Browse files

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
parent e9a51198
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);
        }