Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public BottomBarBadge(Context context, int position, View tabToAddTo, // Rhyming accidentally! That's a Smoove Move!
                              Color backgroundColor)
            : base(context)
        {
            _tabToAddTo = tabToAddTo;

            AutoHideWhenSelection = true;

            var lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);

            LayoutParameters = lp;
            Gravity          = GravityFlags.Center;
            SetTextAppearance(context, 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);

            var container = new FrameLayout(context);

            container.LayoutParameters = lp;

            var parent = (ViewGroup)tabToAddTo.Parent;

            parent.RemoveView(tabToAddTo);

            container.Tag = tabToAddTo.Tag;
            container.AddView(tabToAddTo);
            container.AddView(this);

            parent.AddView(container, position);

            container.ViewTreeObserver.AddOnGlobalLayoutListener(this);
        }
Exemplo n.º 3
0
 private Drawable setBadgeSize(Context context, Color backgroundColor)
 {
     return(BadgeCircle.drawRoundCornerRectange(context, backgroundColor));
 }