Esempio n. 1
0
 private void Init(Context context, Icon icon)
 {
     _context = context;
     _icon    = icon;
     _paint   = new TextPaint();
     _paint.SetTypeface(Iconify.FindTypefaceOf(icon).GetTypeface(context));
     _paint.SetStyle(Paint.Style.Fill);
     _paint.TextAlign     = Paint.Align.Center;
     _paint.UnderlineText = false;
     _paint.Color         = Color.Black;
     _paint.AntiAlias     = true;
 }
Esempio n. 2
0
        /// <summary>
        ///     Create an IconDrawable.
        /// </summary>
        /// <param name="context"> Your activity or application context. </param>
        /// <param name="iconKey"> The icon key you want this drawable to display. </param>
        /// <exception cref="IllegalArgumentException"> if the key doesn't match any icon. </exception>
        public IconDrawable(Context context, string iconKey)
        {
            if (string.IsNullOrWhiteSpace(iconKey))
            {
                throw new ArgumentNullException("iconKey");
            }

            var icon = Iconify.FindIconForKey(iconKey);

            if (!icon.HasValue)
            {
                throw new ArgumentException("No icon With that key \"" + iconKey + "\".");
            }
            Init(context, icon.Value);
        }