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


Java IDrawerItem類代碼示例

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


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

示例1: onDrawerItemClickListener

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
private boolean onDrawerItemClickListener(View view, int position, IDrawerItem drawerItem) {
    int id = (int) drawerItem.getIdentifier();
    switch (id) {
        case 1:
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragmentContainer, ItemsFragment.newInstance())
                    .commit();
            drawer.closeDrawer();
            break;
        case 2:
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragmentContainer, BottomSheetFragment.newInstance())
                    .commit();
            drawer.closeDrawer();
            break;
    }
    return true;
}
 
開發者ID:sathishmscict,項目名稱:ChipsLayoutManager,代碼行數:19,代碼來源:MainActivity.java

示例2: onItemClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
  int currentDrawerItemResource = drawerHelper.getDrawerItemResourceInPosition(position);
  switch (currentDrawerItemResource) {
    case DrawerContent.ITEM_SEND: {
      goToSendActivity(false, "");
      break;
    }
    case DrawerContent.ITEM_RECEIVE: {
      goToReceiveActivity(false);
      break;
    }

    case DrawerContent.ITEM_SETTINGS: {
      goToSettingsActivity(false);
      break;
    }
  }

  if (drawerHelper.isDrawerOpen()) {
    drawerHelper.closeDrawer();
  }
  return true;
}
 
開發者ID:AtlantPlatform,項目名稱:atlant-android,代碼行數:25,代碼來源:BaseActivity.java

示例3: addDepartamento

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
/**
 * Adicionar os departamentos
 * @param department
 * @param news
 */
private void addDepartamento( Department department, boolean news ) {
    if( news && this.departamentsWorks.contains( department ) ) return;
    else if( news ) this.departamentsWorks.add( department );

    this.departamentoContainer.withSubItems(
            new SecondaryDrawerItem().withName( department.getNome() )
                    .withIdentifier( department.getIdentifier() )
                    .withIcon( R.drawable.ic_home_teal_500_24dp )
                    .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                        @Override
                        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                            onChangeDepartmentTo( drawerItem.getIdentifier() );
                            return false;
                        }
                    })
    );
}
 
開發者ID:tec-ustp,項目名稱:SIIEScanner,代碼行數:23,代碼來源:MainBuildView.java

示例4: populateProfile

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
/**
 * Populate profile
 * @param department
 */
public void populateProfile( Department department){
    this.accountHeader.clear();
    for ( User user : department.getColaborators() ){
        addProfile( user );
    }

    this.currentDepartment = department;
    if( currentMenu != null && ((Fragment)currentMenu.getMainFrag()).isResumed() )
        this.currentMenu.getMainFrag().onDepartmentChange(department);
    else if(currentMenu != null ) {
        ( (Fragment)this.currentMenu.getMainFrag()).getArguments()
                .putString( Department.INSTANCE, currentDepartment.getKey() );
    }

    for( IDrawerItem item : this.departamentoContainer.getSubItems() ){
        if( item.getIdentifier() == department.getIdentifier() ){
            item.withSetSelected( true );
            this.departamentoContainer.withSetSelected( true );
        }
    }
}
 
開發者ID:tec-ustp,項目名稱:SIIEScanner,代碼行數:26,代碼來源:MainBuildView.java

示例5: addProfile

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
/**
 * Add new profile
 * @param user
 */
private void addProfile(User user) {
    this.accountHeader.addProfiles(
            new ProfileDrawerItem().withName( user.getName() )
                    .withEmail( user.getKey() )
                    .withIcon( user.createBitMap( this.main ) )
                    .withIdentifier( user.getIdentifier() )
                    .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                        @Override
                        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                            onProfileChange( view, position, drawerItem );
                            return false;
                        }
                    })
    );
}
 
開發者ID:tec-ustp,項目名稱:SIIEScanner,代碼行數:20,代碼來源:MainBuildView.java

示例6: reloadDrawerItems

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
@Override
protected List<IDrawerItem> reloadDrawerItems(Realm realm, boolean showOnlyUnread) {
    List<Feed> feeds = state.getStartDrawerItem().getFeeds(realm, showOnlyUnread);
    List<IDrawerItem> drawerItems = new ArrayList<>((feeds != null ? feeds.size() : 0) + 1);

    if (state.isFeedSelected())
        return drawerItems;

    drawerItems.add(new SectionDrawerItem()
            .withDivider(false)
            .withName(state.getStartDrawerItem().getName()));

    if (feeds != null) {
        for (Feed feed : feeds) {
            PrimaryDrawerItem drawerItem = new TreeItemDrawerItem(feed);
            drawerItem.withIdentifier(feed.getId());
            drawerItem.withBadge(feed.getUnreadCount());

            drawerItem.withSetSelected(state.getEndDrawerItem() != null && state.getEndDrawerItem().getId() == feed.getId());
            drawerItems.add(drawerItem);
        }
    }

    return drawerItems;
}
 
開發者ID:schaal,項目名稱:ocreader,代碼行數:26,代碼來源:DrawerManager.java

示例7: onCheckedChanged

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
    PreferenceManager.getDefaultSharedPreferences(ListActivity.this)
            .edit()
            .putBoolean(Preferences.SHOW_ONLY_UNREAD.getKey(), isChecked)
            .apply();

    if(drawerItem instanceof Nameable && drawerItem.getTag() instanceof AllUnreadFolder) {
        final AllUnreadFolder unreadFolder = (AllUnreadFolder) drawerItem.getTag();

        unreadFolder.updateName(ListActivity.this, isShowOnlyUnread());
        ((Nameable) drawerItem).withName(unreadFolder.getName());
    }

    drawerManager.reloadAdapters(getRealm(), isShowOnlyUnread());
    reloadListFragment();
}
 
開發者ID:schaal,項目名稱:ocreader,代碼行數:18,代碼來源:ListActivity.java

示例8: onItemClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
    int id = (int) drawerItem.getIdentifier();
    switch (id) {
        case ID_LIVE:
            playLive();
            break;
        case ID_HISTORY:
            break;
        case ID_SETTING:
            launchSetting();
            break;
        default:
            History history = (History) drawerItem.getTag();
            switch (history.getType()) {
                case DIRECTORY:
                    break;
                case FILE:
                    playHistory(history);
                    break;
            }
            break;
    }

    return false;
}
 
開發者ID:xdtianyu,項目名稱:LanCamera,代碼行數:27,代碼來源:MainActivity.java

示例9: setRecyclerViewSelection

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
/**
 * helper method to set the selection in the list
 *
 * @param drawer
 * @param position
 * @param fireOnClick
 * @param drawerItem
 * @return
 */
public static boolean setRecyclerViewSelection(DrawerBuilder drawer, int position, boolean fireOnClick, IDrawerItem drawerItem) {
    if (position >= -1) {
        //predefine selection (should be the first element
        if (drawer.mAdapter != null) {
            drawer.resetStickyFooterSelection();
            drawer.mAdapter.handleSelection(null, position);
            drawer.mCurrentSelection = position;
            drawer.mCurrentStickyFooterSelection = -1;
        }

        if (fireOnClick && drawer.mOnDrawerItemClickListener != null) {
            return drawer.mOnDrawerItemClickListener.onItemClick(null, position, drawerItem);
        }
    }

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

示例10: onProfileClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
/**
 * call this method to trigger the onProfileClick on the MiniDrawer
 */
public void onProfileClick() {
    //crossfade if we are cross faded
    if (mCrossFader != null) {
        if (mCrossFader.isCrossfaded()) {
            mCrossFader.crossfade();
        }
    }

    //update the current profile
    if (mAccountHeader != null) {
        IProfile profile = mAccountHeader.getActiveProfile();
        if (profile instanceof IDrawerItem) {
            mDrawerAdapter.setDrawerItem(0, generateMiniDrawerItem((IDrawerItem) profile));
        }
    }
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:20,代碼來源:MiniDrawer.java

示例11: goToActivityListener

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
private Drawer.OnDrawerItemClickListener goToActivityListener(
    @NonNull final Class<? extends Activity> activityClass) {
  return new Drawer.OnDrawerItemClickListener() {
    @Override
    public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
      // Don't open a new activity if we're already in the activity the user clicked on
      if (BaseActivity.this.getClass().equals(activityClass)) {
        return true;
      }
      startActivity(new Intent(BaseActivity.this, activityClass)
          .putExtra(INTENT_EXTRA_DRAWER_POSITION, position)
      );
      return true;
    }
  };
}
 
開發者ID:ShaolinZhang,項目名稱:HACKxFDU-CrisisProbingUAV,代碼行數:17,代碼來源:BaseActivity.java

示例12: onCreate

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample_dark_toolbar);

    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(R.string.drawer_item_menu_drawer);

    //Create the drawer
    result = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .inflateMenu(R.menu.example_menu)
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem instanceof Nameable) {
                        Toast.makeText(MenuDrawerActivity.this, ((Nameable) drawerItem).getName().getText(MenuDrawerActivity.this), Toast.LENGTH_SHORT).show();
                    }

                    return false;
                }
            }).build();
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:27,代碼來源:MenuDrawerActivity.java

示例13: switchDrawerContent

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
/**
 * method to switch the drawer content to new elements
 *
 * @param onDrawerItemClickListener
 * @param drawerItems
 * @param drawerSelection
 */
public void switchDrawerContent(@NonNull OnDrawerItemClickListener onDrawerItemClickListener, OnDrawerItemLongClickListener onDrawerItemLongClickListener, @NonNull List<IDrawerItem> drawerItems, int drawerSelection) {
    //just allow a single switched drawer
    if (!switchedDrawerContent()) {
        //save out previous values
        originalOnDrawerItemClickListener = getOnDrawerItemClickListener();
        originalOnDrawerItemLongClickListener = getOnDrawerItemLongClickListener();
        originalDrawerState = getAdapter().saveInstanceState(new Bundle());
        getAdapter().collapse(false);
        originalDrawerItems = getDrawerItems();
    }

    //set the new items
    setOnDrawerItemClickListener(onDrawerItemClickListener);
    setOnDrawerItemLongClickListener(onDrawerItemLongClickListener);
    setItems(drawerItems, true);
    setSelectionAtPosition(drawerSelection, false);

    //hide stickyFooter and it's shadow
    if (getStickyFooter() != null) {
        getStickyFooter().setVisibility(View.GONE);
    }
    if (getStickyFooterShadow() != null) {
        getStickyFooterShadow().setVisibility(View.GONE);
    }
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:33,代碼來源:Drawer.java

示例14: buildDrawerSelectionList

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入依賴的package包/類
/**
 * helper method to build and set the drawer selection list
 */
protected void buildDrawerSelectionList() {
    int selectedPosition = -1;
    int position = 0;
    ArrayList<IDrawerItem> profileDrawerItems = new ArrayList<>();
    if (mProfiles != null) {
        for (IProfile profile : mProfiles) {
            if (profile == mCurrentProfile) {
                if (mCurrentHiddenInList) {
                    continue;
                } else {
                    selectedPosition = mDrawer.mDrawerBuilder.getItemAdapter().getGlobalPosition(position);
                }
            }
            if (profile instanceof IDrawerItem) {
                ((IDrawerItem) profile).withSetSelected(false);
                profileDrawerItems.add((IDrawerItem) profile);
            }
            position = position + 1;
        }
    }
    mDrawer.switchDrawerContent(onDrawerItemClickListener, onDrawerItemLongClickListener, profileDrawerItems, selectedPosition);
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:26,代碼來源:AccountHeaderBuilder.java

示例15: 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


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