public ResizeWidthAnimation(ShiftingBottomNavigationTab outerInstance, View view, int width) { this.outerInstance = outerInstance; mView = view; mWidth = width; mStartWidth = view.Width; }
/////////////////////////////////////////////////////////////////////////// // Initialise Method /////////////////////////////////////////////////////////////////////////// /// <summary> /// This method should be called at the end of all customisation method. /// This method will take all changes in to consideration and redraws tabs. /// </summary> public virtual void Initialise() { mSelectedPosition = DEFAULT_SELECTED_POSITION; mBottomNavigationTabs.Clear(); if (mBottomNavigationItems.Count > 0) { mTabContainer.RemoveAllViews(); if (mMode == Mode.MODE_DEFAULT) { if (mBottomNavigationItems.Count <= MIN_SIZE) { mMode = Mode.MODE_FIXED; } else { mMode = Mode.MODE_SHIFTING; } } if (mBackgroundStyle == BackgroundStyle.BACKGROUND_STYLE_DEFAULT) { if (mMode == Mode.MODE_FIXED) { mBackgroundStyle = BackgroundStyle.BACKGROUND_STYLE_STATIC; } else { mBackgroundStyle = BackgroundStyle.BACKGROUND_STYLE_RIPPLE; } } if (mBackgroundStyle == BackgroundStyle.BACKGROUND_STYLE_STATIC) { mBackgroundOverlay.Visibility = ViewStates.Gone; mContainer.SetBackgroundColor(new Color(mBackgroundColor)); } int screenWidth = Utils.getScreenWidth(Context); if (mMode == Mode.MODE_FIXED) { int[] widths = BottomNavigationHelper.getMeasurementsForFixedMode(Context, screenWidth, mBottomNavigationItems.Count, mScrollable); int itemWidth = widths[0]; foreach (BottomNavigationItem currentItem in mBottomNavigationItems) { FixedBottomNavigationTab bottomNavigationTab = new FixedBottomNavigationTab(Context); setUpTab(bottomNavigationTab, currentItem, itemWidth, itemWidth); } } else if (mMode == Mode.MODE_SHIFTING) { int[] widths = BottomNavigationHelper.getMeasurementsForShiftingMode(Context, screenWidth, mBottomNavigationItems.Count, mScrollable); int itemWidth = widths[0]; int itemActiveWidth = widths[1]; foreach (BottomNavigationItem currentItem in mBottomNavigationItems) { ShiftingBottomNavigationTab bottomNavigationTab = new ShiftingBottomNavigationTab(Context); setUpTab(bottomNavigationTab, currentItem, itemWidth, itemActiveWidth); } } if (mBottomNavigationTabs.Count > mFirstSelectedPosition) { selectTabInternal(mFirstSelectedPosition, true, false, false); } else if (mBottomNavigationTabs.Count > 0) { selectTabInternal(0, true, false, false); } } }