當前位置: 首頁>>代碼示例>>Java>>正文


Java IDrawerItem.isEnabled方法代碼示例

本文整理匯總了Java中com.mikepenz.materialdrawer.model.interfaces.IDrawerItem.isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java IDrawerItem.isEnabled方法的具體用法?Java IDrawerItem.isEnabled怎麽用?Java IDrawerItem.isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.mikepenz.materialdrawer.model.interfaces.IDrawerItem的用法示例。


在下文中一共展示了IDrawerItem.isEnabled方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fillStickyDrawerItemFooter

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * helper method to fill the sticky footer with it's elements
 *
 * @param drawer
 * @param container
 * @param onClickListener
 */
public static void fillStickyDrawerItemFooter(DrawerBuilder drawer, ViewGroup container, View.OnClickListener onClickListener) {
    //add all drawer items
    for (IDrawerItem drawerItem : drawer.mStickyDrawerItems) {
        View view = drawerItem.generateView(container.getContext(), container);
        view.setTag(drawerItem);

        if (drawerItem.isEnabled()) {
            //UIUtils.setBackground(view, UIUtils.getSelectableBackground(container.getContext(), selected_color, true));
            view.setOnClickListener(onClickListener);
        }

        container.addView(view);

        //for android API 17 --> Padding not applied via xml
        DrawerUIUtils.setDrawerVerticalPadding(view);
    }
    //and really. don't ask about this. it won't set the padding if i don't set the padding for the container
    container.setPadding(0, 0, 0, 0);
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:27,代碼來源:DrawerUtils.java

示例2: onItemClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
    if (drawerItem instanceof AbstractDrawerItem && drawerItem.isEnabled()) {
        if (((AbstractDrawerItem) drawerItem).getSubItems() != null) {
            if (((AbstractDrawerItem) drawerItem).isExpanded()) {
                ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(180).start();
            } else {
                ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(0).start();
            }
        }
    }

    return mOnDrawerItemClickListener != null && mOnDrawerItemClickListener.onItemClick(view, position, drawerItem);
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:15,代碼來源:ExpandableDrawerItem.java

示例3: build

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
public View build() {
    //create the container view
    LinearLayout linearLayout = new LinearLayout(mContext);
    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    linearLayout.setOrientation(LinearLayout.VERTICAL);

    //create the divider
    if (mDivider) {
        LinearLayout divider = new LinearLayout(mContext);
        divider.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        divider.setMinimumHeight((int) UIUtils.convertDpToPixel(1, mContext));
        divider.setOrientation(LinearLayout.VERTICAL);
        divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mContext, R.attr.material_drawer_divider, R.color.material_drawer_divider));
        linearLayout.addView(divider);
    }

    //add all drawer items
    for (IDrawerItem drawerItem : mDrawerItems) {
        View view = drawerItem.generateView(mContext);
        view.setTag(drawerItem);

        if (drawerItem.isEnabled()) {
            view.setBackgroundResource(UIUtils.getSelectableBackgroundRes(mContext));
            view.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mOnDrawerItemClickListener != null) {
                        mOnDrawerItemClickListener.onItemClick(v, (IDrawerItem) v.getTag());
                    }
                }
            });
        }

        linearLayout.addView(view);
    }

    return linearLayout;
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:39,代碼來源:DrawerItemViewHelper.java

示例4: build

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
public View build() {
    //create the container view
    LinearLayout linearLayout = new LinearLayout(mContext);
    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    linearLayout.setOrientation(LinearLayout.VERTICAL);

    //create the divider
    if (mDivider) {
        LinearLayout divider = new LinearLayout(mContext);
        divider.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        divider.setMinimumHeight((int) UIUtils.convertDpToPixel(1, mContext));
        divider.setOrientation(LinearLayout.VERTICAL);
        divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mContext, R.attr.material_drawer_divider, R.color.material_drawer_divider));
        linearLayout.addView(divider);
    }

    //add all drawer items
    for (IDrawerItem drawerItem : mDrawerItems) {
        View view = drawerItem.generateView(mContext);
        view.setTag(drawerItem);

        if (drawerItem.isEnabled()) {
            view.setBackgroundResource(DrawerUIUtils.getSelectableBackground(mContext));
            view.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mOnDrawerItemClickListener != null) {
                        mOnDrawerItemClickListener.onItemClick(v, (IDrawerItem) v.getTag());
                    }
                }
            });
        }

        linearLayout.addView(view);
    }

    return linearLayout;
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:39,代碼來源:DrawerItemViewHelper.java

示例5: fillStickyDrawerItemFooter

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * helper method to fill the sticky footer with it's elements
 *
 * @param drawer
 * @param container
 * @param onClickListener
 */
public static void fillStickyDrawerItemFooter(DrawerBuilder drawer, ViewGroup container, View.OnClickListener onClickListener) {
    //add all drawer items
    for (IDrawerItem drawerItem : drawer.mStickyDrawerItems) {
        //get the selected_color
        int selected_color = UIUtils.getThemeColorFromAttrOrRes(container.getContext(), R.attr.material_drawer_selected, R.color.material_drawer_selected);
        if (drawerItem instanceof PrimaryDrawerItem) {
            selected_color = ColorHolder.color(((PrimaryDrawerItem) drawerItem).getSelectedColor(), container.getContext(), R.attr.material_drawer_selected, R.color.material_drawer_selected);
        } else if (drawerItem instanceof SecondaryDrawerItem) {
            selected_color = ColorHolder.color(((SecondaryDrawerItem) drawerItem).getSelectedColor(), container.getContext(), R.attr.material_drawer_selected, R.color.material_drawer_selected);
        }

        View view = drawerItem.generateView(container.getContext(), container);
        view.setTag(drawerItem);

        if (drawerItem.isEnabled()) {
            UIUtils.setBackground(view, DrawerUIUtils.getSelectableBackground(container.getContext(), selected_color));
            view.setOnClickListener(onClickListener);
        }

        container.addView(view);

        //for android API 17 --> Padding not applied via xml
        DrawerUIUtils.setDrawerVerticalPadding(view);
    }
    //and really. don't ask about this. it won't set the padding if i don't set the padding for the container
    container.setPadding(0, 0, 0, 0);
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:35,代碼來源:DrawerUtils.java

示例6: isEnabled

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
public boolean isEnabled(int position) {
    IDrawerItem item = getItem(position);
    return item != null && item.isEnabled();
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:5,代碼來源:BaseDrawerAdapter.java


注:本文中的com.mikepenz.materialdrawer.model.interfaces.IDrawerItem.isEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。