Example #1
0
        public virtual void setIcon(android.graphics.drawable.Drawable icon)
        {
            bool showIcon = mItemData.shouldShowIcon() || mForceShowIcon;

            if (!showIcon && !mPreserveIconSpacing)
            {
                return;
            }
            if (mIconView == null && icon == null && !mPreserveIconSpacing)
            {
                return;
            }
            if (mIconView == null)
            {
                insertIconView();
            }
            if (icon != null || mPreserveIconSpacing)
            {
                mIconView.setImageDrawable(showIcon ? icon : null);
                if (mIconView.getVisibility() != VISIBLE)
                {
                    mIconView.setVisibility(VISIBLE);
                }
            }
            else
            {
                mIconView.setVisibility(GONE);
            }
        }