Ejemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////////
        // Internal Methods of the class
        ///////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Internal method to setup tabs
        /// </summary>
        /// <param name="bottomNavigationTab"> Tab item </param>
        /// <param name="currentItem">         data structure for tab item </param>
        /// <param name="itemWidth">           tab item in-active width </param>
        /// <param name="itemActiveWidth">     tab item active width </param>
        private void setUpTab(BottomNavigationTab bottomNavigationTab, BottomNavigationItem currentItem, int itemWidth, int itemActiveWidth)
        {
            bottomNavigationTab.InactiveWidth = itemWidth;
            bottomNavigationTab.ActiveWidth   = itemActiveWidth;
            bottomNavigationTab.Position      = mBottomNavigationItems.IndexOf(currentItem);

            bottomNavigationTab.SetOnClickListener(new OnClickListenerAnonymousInnerClass(this));

            mBottomNavigationTabs.Add(bottomNavigationTab);

            BottomNavigationHelper.bindTabWithData(currentItem, bottomNavigationTab, this);

            bottomNavigationTab.initialise(mBackgroundStyle == BackgroundStyle.BACKGROUND_STYLE_STATIC);

            mTabContainer.AddView(bottomNavigationTab);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Used to get set data to the Tab views from navigation items
        /// </summary>
        /// <param name="bottomNavigationItem"> holds all the data </param>
        /// <param name="bottomNavigationTab">  view to which data need to be set </param>
        /// <param name="bottomNavigationBar">  view which holds all the tabs </param>
        public static void bindTabWithData(BottomNavigationItem bottomNavigationItem, BottomNavigationTab bottomNavigationTab, BottomNavigationBar bottomNavigationBar)
        {
            Context context = bottomNavigationBar.Context;

            bottomNavigationTab.Label = bottomNavigationItem.getTitle(context);
            bottomNavigationTab.Icon  = bottomNavigationItem.getIcon(context);

            int activeColor   = bottomNavigationItem.getActiveColor(context);
            int inActiveColor = bottomNavigationItem.getInActiveColor(context);

            if (activeColor != -1)
            {
                bottomNavigationTab.ActiveColor = activeColor;
            }
            else
            {
                bottomNavigationTab.ActiveColor = bottomNavigationBar.ActiveColor;
            }

            if (inActiveColor != -1)
            {
                bottomNavigationTab.InactiveColor = inActiveColor;
            }
            else
            {
                bottomNavigationTab.InactiveColor = bottomNavigationBar.InActiveColor;
            }

            if (bottomNavigationItem.InActiveIconAvailable)
            {
                Drawable inactiveDrawable = bottomNavigationItem.getInactiveIcon(context);
                if (inactiveDrawable != null)
                {
                    bottomNavigationTab.InactiveIcon = inactiveDrawable;
                }
            }

            bottomNavigationTab.ItemBackgroundColor = bottomNavigationBar.BackgroundColor;

            setBadgeForTab(bottomNavigationItem.BadgeItem, bottomNavigationTab);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Used to remove a tab.
 /// you should call initialise() after this to see the results effected.
 /// </summary>
 /// <param name="item"> bottom navigation tab details </param>
 /// <returns> this, to allow builder pattern </returns>
 public virtual BottomNavigationBar removeItem(BottomNavigationItem item)
 {
     mBottomNavigationItems.Remove(item);
     return(this);
 }
Ejemplo n.º 4
0
        //    @Override
        //    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        //        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        //    }

        ///////////////////////////////////////////////////////////////////////////
        // View Data Setter methods, Called before Initialize method
        ///////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Used to add a new tab.
        /// </summary>
        /// <param name="item"> bottom navigation tab details </param>
        /// <returns> this, to allow builder pattern </returns>
        public virtual BottomNavigationBar AddItem(BottomNavigationItem item)
        {
            mBottomNavigationItems.Add(item);
            return(this);
        }