Set a footerDrawerItem at a specific position

@param drawerItem
@param position
5953
public void setStickyFooterItemAtPosition(@NonNull IDrawerItem drawerItem, int position) {
        if (mDrawerBuilder.mStickyDrawerItems != null && mDrawerBuilder.mStickyDrawerItems.size() > position) {
            mDrawerBuilder.mStickyDrawerItems.set(position, drawerItem);
        }

        DrawerUtils.rebuildStickyFooterView(mDrawerBuilder);
    }
592406
private void formatNavDrawerItem(DrawerItem item, boolean selected) {
        if (item instanceof SeperatorDrawerItem || item instanceof SwitchDrawerItem) {
            // not applicable
            return;
        }

        // Get the associated view
        View view = mNavDrawerItemViews.get(item.getId());

        ImageView iconView = (ImageView) view.findViewById(R.id.icon);
        TextView titleView = (TextView) view.findViewById(R.id.title);

        // configure its appearance according to whether or not it's selected
        titleView.setTextColor(selected ?
                mConfig.getItemHighlightColor(mActivity) :
                UIUtils.getColorAttr(mActivity, android.R.attr.textColorPrimary));

        iconView.setColorFilter(selected ?
                mConfig.getItemHighlightColor(mActivity) :
                getResources().getColor(R.color.navdrawer_icon_tint), PorterDuff.Mode.SRC_ATOP);
    }
859939
public DrawerView addFixedItem(DrawerItem item) {
        if (item.getId() <= 0) {
            item.setId(System.nanoTime() * 100 + Math.round(Math.random() * 100));
        }
        for (DrawerItem oldItem : mAdapterFixed.getItems()) {
            if (oldItem.getId() == item.getId()) {
                mAdapterFixed.remove(oldItem);
                break;
            }
        }

        item.attachTo(mAdapterFixed);
        mAdapterFixed.add(item);
        updateFixedList();
        return this;
    }
1071889
public void setFooterDivider(Drawable drawable) {
        mFooterDivider = drawable;
        if (drawable != null) {
            mFooterDividerHeight = drawable.getIntrinsicHeight();
        } else {
            mFooterDividerHeight = 0;
        }
        mContentView.setWillNotDraw(drawable == null);
        mContentView.invalidate();
    }
667361
public static void setStickyFooterSelection(DrawerBuilder drawer, int position, Boolean fireOnClick) {
        if (position > -1) {
            if (drawer.mStickyFooterView != null && drawer.mStickyFooterView instanceof LinearLayout) {
                LinearLayout footer = (LinearLayout) drawer.mStickyFooterView;
                if (drawer.mStickyFooterDivider) {
                    position = position + 1;
                }
                if (footer.getChildCount() > position && position >= 0) {
                    IDrawerItem drawerItem = (IDrawerItem) footer.getChildAt(position).getTag(R.id.material_drawer_item);
                    onFooterDrawerItemClick(drawer, drawerItem, footer.getChildAt(position), fireOnClick);
                }
            }
        }
    }
236912
private void createNavDrawerItems(){
        if (mDrawerItemsListContainer == null) {
            return;
        }

        mNavDrawerItemViews.clear();
        mDrawerItemsListContainer.removeAllViews();
        for (DrawerItem item: mDrawerItems) {
            item.setSelected(item.getId() == mSelectedItem);
            View view = item.onCreateView(mActivity.getLayoutInflater(),
                    mDrawerItemsListContainer, mConfig.getItemHighlightColor(mActivity));
            if(!(item instanceof SeperatorDrawerItem)){
                view.setId(item.getId());
                mNavDrawerItemViews.put(item.getId(), view);
                mNavDrawerItems.put(item.getId(), item);

                // Set the view's click listener
                if(!(item instanceof SwitchDrawerItem)) {
                    view.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            onNavDrawerItemClicked(v.getId());
                        }
                    });
                }

            }

            mDrawerItemsListContainer.addView(view);
        }
    }
668260
@SafeVarargs
    public final FastItemAdapter<Item> add(int position, Item... items) {
        getItemAdapter().add(position, items);
        return this;
    }
1365816
public void setGranulePosition(long position) {
        currentGranulePosition = position;
        for(OggPage p : buffer) {
            p.setGranulePosition(position);
        }
    }
533141
public DrawerView addItem(DrawerItem item) {
        if (item.getId() <= 0) {
            item.setId(System.nanoTime() * 100 + Math.round(Math.random() * 100));
        }
        for (DrawerItem oldItem : mAdapter.getItems()) {
            if (oldItem.getId() == item.getId()) {
                mAdapter.remove(oldItem);
                break;
            }
        }

        item.attachTo(mAdapter);
        mAdapter.add(item);
        updateList();
        return this;
    }
1162059
private void setSelectedNavDrawerItem(int itemId) {
        for(DrawerItem item: mDrawerItems){
            formatNavDrawerItem(item, itemId == item.getId());
        }
    }
495858
public final void notifyFooterItemRangeChanged(int positionStart, int itemCount) {
        if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > footerItemCount) {
            throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
                    + (positionStart + itemCount - 1) + "] is not within the position bounds for footer items [0 - "
                    + (footerItemCount - 1) + "].");
        }
        notifyItemRangeChanged(positionStart + headerItemCount + contentItemCount, itemCount);
    }
988280
protected void removeBy(int position) {
        if (mGroupBasicAdapter != null) {
            if (position < mGroupBasicAdapter.getItemCount() && position >= 0) {
                BaseCell removeCell = mGroupBasicAdapter.getItemByPosition(position);
                removeBy(removeCell);
            }
        }
    }
1064767
public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, Object tag) {
        if (tag != null) {
            for (IDrawerItem drawerItem : drawerItems) {
                if (tag.equals(drawerItem.getTag())) {
                    return drawerItem;
                }
            }
        }
        return null;
    }
1002879
public static void handleHeaderView(DrawerBuilder drawer) {
        //use the AccountHeader if set
        if (drawer.mAccountHeader != null) {
            if (drawer.mAccountHeaderSticky) {
                drawer.mStickyHeaderView = drawer.mAccountHeader.getView();
            } else {
                drawer.mHeaderView = drawer.mAccountHeader.getView();
                drawer.mHeaderDivider = drawer.mAccountHeader.mAccountHeaderBuilder.mDividerBelowHeader;
                drawer.mHeaderPadding = drawer.mAccountHeader.mAccountHeaderBuilder.mPaddingBelowHeader;
            }
        }

        //sticky header view
        if (drawer.mStickyHeaderView != null) {
            //add the sticky footer view and align it to the bottom
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 1);
            drawer.mStickyHeaderView.setId(R.id.material_drawer_sticky_header);
            drawer.mSliderLayout.addView(drawer.mStickyHeaderView, 0, layoutParams);

            //now align the recyclerView below the stickyFooterView ;)
            RelativeLayout.LayoutParams layoutParamsListView = (RelativeLayout.LayoutParams) drawer.mRecyclerView.getLayoutParams();
            layoutParamsListView.addRule(RelativeLayout.BELOW, R.id.material_drawer_sticky_header);
            drawer.mRecyclerView.setLayoutParams(layoutParamsListView);

            //set a background color or the elevation will not work
            drawer.mStickyHeaderView.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(drawer.mActivity, R.attr.material_drawer_background, R.color.material_drawer_background));

            if (drawer.mStickyHeaderShadow) {
                //add a shadow
                if (Build.VERSION.SDK_INT >= 21) {
                    drawer.mStickyHeaderView.setElevation(UIUtils.convertDpToPixel(4, drawer.mActivity));
                } else {
                    View view = new View(drawer.mActivity);
                    view.setBackgroundResource(R.drawable.material_drawer_shadow_bottom);
                    drawer.mSliderLayout.addView(view, RelativeLayout.LayoutParams.MATCH_PARENT, (int) UIUtils.convertDpToPixel(4, drawer.mActivity));
                    //now align the shadow below the stickyHeader ;)
                    RelativeLayout.LayoutParams lps = (RelativeLayout.LayoutParams) view.getLayoutParams();
                    lps.addRule(RelativeLayout.BELOW, R.id.material_drawer_sticky_header);
                    view.setLayoutParams(lps);
                }
            }

            //remove the padding of the recyclerView again we have the header on top of it
            drawer.mRecyclerView.setPadding(0, 0, 0, 0);
        }

        // set the header (do this before the setAdapter because some devices will crash else
        if (drawer.mHeaderView != null) {
            if (drawer.mRecyclerView == null) {
                throw new RuntimeException("can't use a headerView without a recyclerView");
            }

            if (drawer.mHeaderPadding) {
                drawer.getHeaderAdapter().add(new ContainerDrawerItem().withView(drawer.mHeaderView).withHeight(drawer.mHeiderHeight).withDivider(drawer.mHeaderDivider).withViewPosition(ContainerDrawerItem.Position.TOP));
            } else {
                drawer.getHeaderAdapter().add(new ContainerDrawerItem().withView(drawer.mHeaderView).withHeight(drawer.mHeiderHeight).withDivider(drawer.mHeaderDivider).withViewPosition(ContainerDrawerItem.Position.NONE));
            }
            //set the padding on the top to 0
            drawer.mRecyclerView.setPadding(drawer.mRecyclerView.getPaddingLeft(), 0, drawer.mRecyclerView.getPaddingRight(), drawer.mRecyclerView.getPaddingBottom());
        }
    }
777680
public static void setDrawerVerticalPadding(View v, int level) {
        int verticalPadding = v.getContext().getResources().getDimensionPixelSize(R.dimen.material_drawer_vertical_padding);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            v.setPaddingRelative(verticalPadding * level, 0, verticalPadding, 0);
        } else {
            v.setPadding(verticalPadding * level, 0, verticalPadding, 0);
        }
    }
280536
public DrawerView removeItem(int position) {
        mAdapter.getItem(position).detach();
        mAdapter.remove(mAdapter.getItem(position));
        updateList();
        return this;
    }
356786
public FastAdapterDialog<Item> set(int position, Item item) {
        mItemAdapter.set(position, item);
        return this;
    }