示例#1
0
        /// <summary>
        /// Used to set badge for given tab
        /// </summary>
        /// <param name="badgeItem">           holds badge data </param>
        /// <param name="bottomNavigationTab"> bottom navigation tab to which badge needs to be attached </param>
        private static void setBadgeForTab(BadgeItem badgeItem, BottomNavigationTab bottomNavigationTab)
        {
            if (badgeItem != null)
            {
                Context context = bottomNavigationTab.Context;

                GradientDrawable shape = getBadgeDrawable(badgeItem, context);
                bottomNavigationTab.badgeView.SetBackgroundDrawable(shape);

                bottomNavigationTab.BadgeItem = badgeItem;
                badgeItem.SetTextView(bottomNavigationTab.badgeView);
                bottomNavigationTab.badgeView.Visibility = ViewStates.Visible;

                bottomNavigationTab.badgeView.SetTextColor(new Color(badgeItem.GetTextColor(context)));
                bottomNavigationTab.badgeView.Text = badgeItem.Text;


                FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)bottomNavigationTab.badgeView.LayoutParameters;
                layoutParams.Gravity = badgeItem.Gravity;
                bottomNavigationTab.badgeView.LayoutParameters = layoutParams;

                if (badgeItem.Hidden)
                {
                    // if hide is called before the initialisation of bottom-bar this will handle that
                    // by hiding it.
                    badgeItem.Hide();
                }
            }
        }
示例#2
0
        internal static GradientDrawable getBadgeDrawable(BadgeItem badgeItem, Context context)
        {
            GradientDrawable shape = new GradientDrawable();

            shape.SetShape(ShapeType.Rectangle);
            shape.SetCornerRadius(context.Resources.GetDimensionPixelSize(Resource.Dimension.badge_corner_radius));
            shape.SetColor(new Color(badgeItem.GetBackgroundColor(context)));
            shape.SetStroke(badgeItem.BorderWidth, new Color(badgeItem.GetBorderColor(context)));
            return(shape);
        }
示例#3
0
 public ViewPropertyAnimatorListenerAnonymousInnerClass(BadgeItem outerInstance)
 {
     this.outerInstance = outerInstance;
 }
        /// <param name="badgeItem"> badge that needs to be displayed for this tab </param>
        /// <returns> this, to allow builder pattern </returns>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public BottomNavigationItem setBadgeItem(@Nullable BadgeItem badgeItem)
        public virtual BottomNavigationItem SetBadgeItem(BadgeItem badgeItem)
        {
            this.mBadgeItem = badgeItem;
            return(this);
        }