示例#1
0
        public override VisualLineElement ConstructElement(int offset)
        {
            var match = FindMatch(offset);

            if (match == null || match.Item1 != 0)
            {
                return(null);
            }

            BadgePosition badgePosition = match.Item2;

            var bitmap = badgePosition?.Badge?.BitmapImage;

            if (bitmap == null)
            {
                return(null);
            }

            var image = new System.Windows.Controls.Image
            {
                Source = bitmap,
                Width  = bitmap.PixelWidth,
                Height = bitmap.PixelHeight
            };

            return(new InlineObjectElement(badgePosition.Text.Length, image));
        }
示例#2
0
        public void DoWindowContents(Rect canvas)
        {
            Listing_Standard list = new Listing_Standard();

            list.ColumnWidth = canvas.width;
            list.Begin(canvas);

            // badge position setting
            list.Label("PawnBadge.BadgePosition".Translate());
            list.GapLine();
            if (list.RadioButton("PawnBadge.BadgePosition_Top".Translate(), badgePosition == BadgePosition.Top, 0f, null))
            {
                badgePosition = BadgePosition.Top;
            }
            if (list.RadioButton("PawnBadge.BadgePosition_Left".Translate(), badgePosition == BadgePosition.Left, 0f, null))
            {
                badgePosition = BadgePosition.Left;
            }
            if (list.RadioButton("PawnBadge.BadgePosition_Right".Translate(), badgePosition == BadgePosition.Right, 0f, null))
            {
                badgePosition = BadgePosition.Right;
            }
            if (list.RadioButton("PawnBadge.BadgePosition_Bottom".Translate(), badgePosition == BadgePosition.Bottom, 0f, null))
            {
                badgePosition = BadgePosition.Bottom;
            }
            list.Gap();

            // badge size setting
            list.Label("PawnBadge.BadgeSize".Translate());
            list.GapLine();
            if (list.RadioButton("PawnBadge.BadgeSize_Small".Translate(), badgeSize == BadgeSize.Small, 0f, null))
            {
                badgeSize = BadgeSize.Small;
            }
            if (list.RadioButton("PawnBadge.BadgeSize_Medium".Translate(), badgeSize == BadgeSize.Medium, 0f, null))
            {
                badgeSize = BadgeSize.Medium;
            }
            if (list.RadioButton("PawnBadge.BadgeSize_Large".Translate(), badgeSize == BadgeSize.Large, 0f, null))
            {
                badgeSize = BadgeSize.Large;
            }
            list.Gap();

            // disable base badges
            list.CheckboxLabeled("PawnBadge.DisableBaseBadges".Translate(), ref disableBaseBadges);

            list.End();
        }
示例#3
0
        /// <summary>
        /// BottomBarBadge
        /// </summary>
        /// <param name="context"></param>
        /// <param name="position"></param>
        /// <param name="backgroundColor"></param>
        public BottomBarBadge(Context context, int position, Color backgroundColor)
            : base(context)
        {
            _needUpdateLayout = true;

            AutoHideWhenSelection = true;
            Position = BadgePosition.Right;

            TabPosition = position;

            LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            Gravity          = GravityFlags.Center;
            SetTextAppearance(Resource.Style.BB_BottomBarBadge_Text);

            int           three            = MiscUtils.DpToPixel(context, 3);
            ShapeDrawable backgroundCircle = BadgeCircle.Make(three * 3, backgroundColor);

            SetPadding(three, three, three, three);
            SetBackgroundCompat(backgroundCircle);
        }
示例#4
0
        public BottomBarBadge(Context context, int position, Color backgroundColor, int badgeLimit)
            : base(context)
        {
            _needUpdateLayout   = true;
            _backgroundColor    = backgroundColor;
            _context            = context;
            _limitToShowInBadge = badgeLimit;

            AutoHideWhenSelection = true;
            Position = BadgePosition.Right;


            TabPosition = position;

            Gravity = GravityFlags.Center;

            SetTextAppearance(context, Resource.Style.BB_BottomBarBadge_Text);

            SetBackgroundCompat(setBadgeSize(context, backgroundColor));
        }
示例#5
0
 public static string FormatPosition(BadgePosition position)
 {
     return(((int)position).ToString());
 }
 public static void SetBadgePosition(BindableObject view, BadgePosition value)
 {
     view.SetValue(BadgePositionProperty, value);
 }
示例#7
0
 public BadgeBase(BaseType type, BadgeColor color, BadgePosition position = BadgePosition.UpperLeft)
 {
     Type     = type;
     Color    = color;
     Position = position;
 }
示例#8
0
 public BadgeSymbol(SymbolType type, BadgeColor color, BadgePosition position)
 {
     Type     = type;
     Color    = color;
     Position = position;
 }