Search in sources :

Example 11 with SecondaryDrawerItem

use of com.mikepenz.materialdrawer.model.SecondaryDrawerItem in project LollipopShowcase by mikepenz.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final SharedPreferences pref = getSharedPreferences("com.mikepenz.applicationreader", 0);
    drawer = new DrawerBuilder(this).withToolbar(toolbar).addDrawerItems(new SwitchDrawerItem().withOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton compoundButton, boolean b) {
            SharedPreferences.Editor editor = pref.edit();
            editor.putBoolean("autouploadenabled", b);
            editor.apply();
        }
    }).withName(R.string.drawer_switch).withChecked(pref.getBoolean("autouploadenabled", false))).addStickyDrawerItems(new SecondaryDrawerItem().withName(R.string.drawer_opensource).withIdentifier(DRAWER_ITEM_OPEN_SOURCE).withIcon(FontAwesome.Icon.faw_github).withSelectable(false)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int i, IDrawerItem drawerItem) {
            if (drawerItem.getIdentifier() == DRAWER_ITEM_OPEN_SOURCE) {
                new LibsBuilder().withFields(R.string.class.getFields()).withVersionShown(true).withLicenseShown(true).withActivityTitle(getString(R.string.drawer_opensource)).withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).start(MainActivity.this);
            }
            return false;
        }
    }).withSelectedItem(-1).withSavedInstance(savedInstanceState).build();
    // Handle ProgressBar
    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    // Fab Button
    mFabButton = (FloatingActionButton) findViewById(R.id.fab_normal);
    mFabButton.setImageDrawable(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_file_upload).color(Color.WHITE).actionBar());
    mFabButton.setOnClickListener(fabClickListener);
    mRecyclerView = (RecyclerView) findViewById(R.id.list);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setItemAnimator(new CustomItemAnimator());
    //mRecyclerView.setItemAnimator(new ReboundItemAnimator());
    mAdapter = new ApplicationAdapter(new ArrayList<AppInfo>(), R.layout.row_application, MainActivity.this);
    mRecyclerView.setAdapter(mAdapter);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
    mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.theme_accent));
    mSwipeRefreshLayout.setRefreshing(true);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            new InitializeApplicationsTask().execute();
        }
    });
    new InitializeApplicationsTask().execute();
    if (savedInstanceState != null) {
        if (uploadComponentInfoTask != null) {
            if (uploadComponentInfoTask.isRunning) {
                uploadComponentInfoTask.showProgress(this);
            }
        }
    }
    //show progress
    mRecyclerView.setVisibility(View.GONE);
    mProgressBar.setVisibility(View.VISIBLE);
}
Also used : IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) OnCheckedChangeListener(com.mikepenz.materialdrawer.interfaces.OnCheckedChangeListener) SharedPreferences(android.content.SharedPreferences) ArrayList(java.util.ArrayList) SwitchDrawerItem(com.mikepenz.materialdrawer.model.SwitchDrawerItem) Drawer(com.mikepenz.materialdrawer.Drawer) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SecondaryDrawerItem(com.mikepenz.materialdrawer.model.SecondaryDrawerItem) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) LibsBuilder(com.mikepenz.aboutlibraries.LibsBuilder) CustomItemAnimator(com.mikepenz.lollipopshowcase.itemanimator.CustomItemAnimator) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder) ApplicationAdapter(com.mikepenz.lollipopshowcase.adapter.ApplicationAdapter) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable) CompoundButton(android.widget.CompoundButton) Toolbar(android.support.v7.widget.Toolbar)

Example 12 with SecondaryDrawerItem

use of com.mikepenz.materialdrawer.model.SecondaryDrawerItem in project MaterialDrawer by mikepenz.

the class MiniDrawer method generateMiniDrawerItem.

/**
     * generates a MiniDrawerItem from a IDrawerItem
     *
     * @param drawerItem
     * @return
     */
public IDrawerItem generateMiniDrawerItem(IDrawerItem drawerItem) {
    if (drawerItem instanceof SecondaryDrawerItem) {
        return mIncludeSecondaryDrawerItems ? new MiniDrawerItem((SecondaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground) : null;
    } else if (drawerItem instanceof PrimaryDrawerItem) {
        return new MiniDrawerItem((PrimaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground);
    } else if (drawerItem instanceof ProfileDrawerItem) {
        MiniProfileDrawerItem mpdi = new MiniProfileDrawerItem((ProfileDrawerItem) drawerItem);
        mpdi.withEnabled(mEnableProfileClick);
        return mpdi;
    }
    return null;
}
Also used : MiniDrawerItem(com.mikepenz.materialdrawer.model.MiniDrawerItem) PrimaryDrawerItem(com.mikepenz.materialdrawer.model.PrimaryDrawerItem) MiniProfileDrawerItem(com.mikepenz.materialdrawer.model.MiniProfileDrawerItem) ProfileDrawerItem(com.mikepenz.materialdrawer.model.ProfileDrawerItem) SecondaryDrawerItem(com.mikepenz.materialdrawer.model.SecondaryDrawerItem) MiniProfileDrawerItem(com.mikepenz.materialdrawer.model.MiniProfileDrawerItem)

Example 13 with SecondaryDrawerItem

use of com.mikepenz.materialdrawer.model.SecondaryDrawerItem in project Tusky by Vavassor.

the class MainActivity method setupDrawer.

private void setupDrawer() {
    headerResult = new AccountHeaderBuilder().withActivity(this).withSelectionListEnabledForSingleProfile(false).withDividerBelowHeader(false).withOnAccountHeaderProfileImageListener(new AccountHeader.OnAccountHeaderProfileImageListener() {

        @Override
        public boolean onProfileImageClick(View view, IProfile profile, boolean current) {
            if (current && loggedInAccountId != null) {
                Intent intent = new Intent(MainActivity.this, AccountActivity.class);
                intent.putExtra("id", loggedInAccountId);
                startActivity(intent);
                return true;
            }
            return false;
        }

        @Override
        public boolean onProfileImageLongClick(View view, IProfile profile, boolean current) {
            return false;
        }
    }).withCompactStyle(true).build();
    headerResult.getView().findViewById(R.id.material_drawer_account_header_current).setContentDescription(getString(R.string.action_view_profile));
    DrawerImageLoader.init(new AbstractDrawerImageLoader() {

        @Override
        public void set(ImageView imageView, Uri uri, Drawable placeholder) {
            Picasso.with(imageView.getContext()).load(uri).placeholder(placeholder).into(imageView);
        }

        @Override
        public void cancel(ImageView imageView) {
            Picasso.with(imageView.getContext()).cancelRequest(imageView);
        }
    });
    VectorDrawableCompat muteDrawable = VectorDrawableCompat.create(getResources(), R.drawable.ic_mute_24dp, getTheme());
    ThemeUtils.setDrawableTint(this, muteDrawable, R.attr.toolbar_icon_tint);
    drawer = new DrawerBuilder().withActivity(this).withAccountHeader(headerResult).withHasStableIds(true).withSelectedItem(-1).addDrawerItems(new PrimaryDrawerItem().withIdentifier(0).withName(getString(R.string.action_edit_profile)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_person), new PrimaryDrawerItem().withIdentifier(1).withName(getString(R.string.action_view_favourites)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_star), new PrimaryDrawerItem().withIdentifier(2).withName(getString(R.string.action_view_mutes)).withSelectable(false).withIcon(muteDrawable), new PrimaryDrawerItem().withIdentifier(3).withName(getString(R.string.action_view_blocks)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_block), new DividerDrawerItem(), new SecondaryDrawerItem().withIdentifier(4).withName(getString(R.string.action_view_preferences)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_settings), new SecondaryDrawerItem().withIdentifier(5).withName(getString(R.string.about_title_activity)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_info), new SecondaryDrawerItem().withIdentifier(6).withName(getString(R.string.action_logout)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_exit_to_app)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            if (drawerItem != null) {
                long drawerItemIdentifier = drawerItem.getIdentifier();
                if (drawerItemIdentifier == 0) {
                    Intent intent = new Intent(MainActivity.this, EditProfileActivity.class);
                    startActivity(intent);
                } else if (drawerItemIdentifier == 1) {
                    Intent intent = new Intent(MainActivity.this, FavouritesActivity.class);
                    startActivity(intent);
                } else if (drawerItemIdentifier == 2) {
                    Intent intent = new Intent(MainActivity.this, AccountListActivity.class);
                    intent.putExtra("type", AccountListActivity.Type.MUTES);
                    startActivity(intent);
                } else if (drawerItemIdentifier == 3) {
                    Intent intent = new Intent(MainActivity.this, AccountListActivity.class);
                    intent.putExtra("type", AccountListActivity.Type.BLOCKS);
                    startActivity(intent);
                } else if (drawerItemIdentifier == 4) {
                    Intent intent = new Intent(MainActivity.this, PreferencesActivity.class);
                    startActivity(intent);
                } else if (drawerItemIdentifier == 5) {
                    Intent intent = new Intent(MainActivity.this, AboutActivity.class);
                    startActivity(intent);
                } else if (drawerItemIdentifier == 6) {
                    logout();
                } else if (drawerItemIdentifier == 7) {
                    Intent intent = new Intent(MainActivity.this, AccountListActivity.class);
                    intent.putExtra("type", AccountListActivity.Type.FOLLOW_REQUESTS);
                    startActivity(intent);
                }
            }
            return false;
        }
    }).build();
}
Also used : AbstractDrawerImageLoader(com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader) PrimaryDrawerItem(com.mikepenz.materialdrawer.model.PrimaryDrawerItem) IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) DividerDrawerItem(com.mikepenz.materialdrawer.model.DividerDrawerItem) Drawable(android.graphics.drawable.Drawable) AccountHeaderBuilder(com.mikepenz.materialdrawer.AccountHeaderBuilder) Intent(android.content.Intent) Drawer(com.mikepenz.materialdrawer.Drawer) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) FloatingSearchView(com.arlib.floatingsearchview.FloatingSearchView) TextView(android.widget.TextView) Uri(android.net.Uri) VectorDrawableCompat(android.support.graphics.drawable.VectorDrawableCompat) SecondaryDrawerItem(com.mikepenz.materialdrawer.model.SecondaryDrawerItem) ImageView(android.widget.ImageView) IProfile(com.mikepenz.materialdrawer.model.interfaces.IProfile) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder)

Example 14 with SecondaryDrawerItem

use of com.mikepenz.materialdrawer.model.SecondaryDrawerItem in project ETSMobile-Android2 by ApplETS.

the class MainActivity method initDrawer.

private void initDrawer() {
    boolean isUserLoggedIn = ApplicationManager.userCredentials != null;
    String studentName = "";
    String codeUniversel = "";
    ProfilManager profilManager = new ProfilManager(this);
    Etudiant etudiant = profilManager.getEtudiant();
    if (etudiant != null) {
        String prenom = etudiant.prenom != null ? etudiant.prenom.trim() : "";
        String nom = etudiant.nom != null ? etudiant.nom.trim() : "";
        studentName = prenom + " " + nom;
        codeUniversel = etudiant.codePerm != null ? etudiant.codePerm : "";
    }
    headerResult = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(R.drawable.ets_background_grayscale).withSelectionListEnabledForSingleProfile(false).addProfiles(new ProfileDrawerItem().withName(codeUniversel).withEmail(studentName).withSelectedTextColor(ContextCompat.getColor(this, R.color.red)).withIcon(R.drawable.ic_user).withSelectable(isUserLoggedIn)).withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {

        @Override
        public boolean onProfileChanged(View view, IProfile profile, boolean current) {
            goToFragment(new ProfilFragment(), ProfilFragment.class.getName());
            return false;
        }
    }).build();
    DrawerBuilder drawerBuilder = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withAccountHeader(headerResult).withSelectedItem(isUserLoggedIn ? TODAY_FRAGMENT : ABOUT_FRAGMENT).withDisplayBelowStatusBar(true).withShowDrawerOnFirstLaunch(true).addDrawerItems(new ExpandableDrawerItem().withName(R.string.menu_section_1_moi).withSelectable(false).withSubItems(new SecondaryDrawerItem().withName(R.string.menu_section_1_ajd).withIdentifier(TODAY_FRAGMENT).withIcon(R.drawable.ic_ico_aujourdhui).withEnabled(isUserLoggedIn), new SecondaryDrawerItem().withName(R.string.menu_section_1_horaire).withIdentifier(SCHEDULE_FRAGMENT).withIcon(R.drawable.ic_ico_schedule).withEnabled(isUserLoggedIn), new SecondaryDrawerItem().withName(R.string.menu_section_1_notes).withIdentifier(COURSE_FRAGMENT).withIcon(R.drawable.ic_ico_notes).withEnabled(isUserLoggedIn), new SecondaryDrawerItem().withName(R.string.menu_section_2_moodle).withIdentifier(MOODLE_FRAGMENT).withIcon(R.drawable.ic_moodle_icon_small).withEnabled(isUserLoggedIn), new SecondaryDrawerItem().withName(R.string.menu_section_1_monETS).withIdentifier(MONETS_FRAGMENT).withIcon(R.drawable.ic_monets).withEnabled(isUserLoggedIn), new SecondaryDrawerItem().withName(R.string.menu_section_1_bandwith).withIdentifier(BANDWIDTH_FRAGMENT).withIcon(R.drawable.ic_ico_internet)).withIsExpanded(true), new ExpandableDrawerItem().withName(R.string.menu_section_2_ets).withSelectable(false).withSubItems(new SecondaryDrawerItem().withName(R.string.menu_section_2_news).withIdentifier(NEWS_FRAGMENT).withIcon(R.drawable.ic_ico_news), new SecondaryDrawerItem().withName(R.string.menu_section_2_events).withIdentifier(EVENTS_FRAGMENT).withIcon(R.drawable.ic_event_available), new SecondaryDrawerItem().withName(R.string.menu_section_2_bottin).withIdentifier(DIRECTORY_FRAGMENT).withIcon(R.drawable.ic_ico_bottin), new SecondaryDrawerItem().withName(R.string.menu_section_2_biblio).withIdentifier(LIBRARY_FRAGMENT).withIcon(R.drawable.ic_ico_library), new SecondaryDrawerItem().withName(R.string.menu_section_2_securite).withIdentifier(SECURITY_FRAGMENT).withIcon(R.drawable.ic_ico_security)), new ExpandableDrawerItem().withName(R.string.menu_section_3_applets).withSelectable(false).withSubItems(new SecondaryDrawerItem().withName(R.string.menu_section_3_apps).withIdentifier(ACHIEVEMENTS_FRAGMENT).withIcon(R.drawable.ic_star_60x60), new SecondaryDrawerItem().withName(R.string.menu_section_3_about).withIdentifier(ABOUT_FRAGMENT).withIcon(R.drawable.ic_logo_icon_final), new SecondaryDrawerItem().withName(R.string.menu_section_3_comms).withIdentifier(COMMENTS_FRAGMENT).withIcon(R.drawable.ic_ico_comment), new SecondaryDrawerItem().withName(R.string.menu_section_3_sponsors).withIdentifier(SPONSOR_FRAGMENT).withIcon(R.drawable.ic_ico_partners), new SecondaryDrawerItem().withName(R.string.menu_section_3_faq).withIdentifier(FAQ_FRAGMENT).withIcon(R.drawable.ic_ico_faq)));
    if (isUserLoggedIn)
        drawerBuilder.addStickyDrawerItems(new SecondaryDrawerItem().withName(R.string.action_logout).withIdentifier(LOGOUT).withTextColorRes(R.color.red));
    else
        drawerBuilder.addStickyDrawerItems(new SecondaryDrawerItem().withName(R.string.action_login).withIdentifier(LOGIN));
    drawerBuilder.withOnDrawerItemClickListener(drawerItemClickListener);
    drawerBuilder.build();
}
Also used : Etudiant(ca.etsmtl.applets.etsmobile.model.Etudiant) ProfilFragment(ca.etsmtl.applets.etsmobile.ui.fragment.ProfilFragment) ProfileDrawerItem(com.mikepenz.materialdrawer.model.ProfileDrawerItem) AccountHeaderBuilder(com.mikepenz.materialdrawer.AccountHeaderBuilder) View(android.view.View) SecondaryDrawerItem(com.mikepenz.materialdrawer.model.SecondaryDrawerItem) AccountHeader(com.mikepenz.materialdrawer.AccountHeader) ExpandableDrawerItem(com.mikepenz.materialdrawer.model.ExpandableDrawerItem) IProfile(com.mikepenz.materialdrawer.model.interfaces.IProfile) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder) ProfilManager(ca.etsmtl.applets.etsmobile.util.ProfilManager)

Example 15 with SecondaryDrawerItem

use of com.mikepenz.materialdrawer.model.SecondaryDrawerItem in project MaterialDrawer by mikepenz.

the class EmbeddedDrawerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_embedded);
    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    //set the back arrow in the toolbar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(R.string.drawer_item_embedded_drawer);
    // Create a few sample profile
    // NOTE you have to define the loader logic too. See the CustomApplication for more details
    final IProfile profile = new ProfileDrawerItem().withName("Mike Penz").withEmail("mikepenz@gmail.com").withIcon("https://avatars3.githubusercontent.com/u/1476232?v=3&s=460");
    final IProfile profile2 = new ProfileDrawerItem().withName("Bernat Borras").withEmail("alorma@github.com").withIcon(Uri.parse("https://avatars3.githubusercontent.com/u/887462?v=3&s=460"));
    final IProfile profile3 = new ProfileDrawerItem().withName("Max Muster").withEmail("max.mustermann@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile2));
    final IProfile profile4 = new ProfileDrawerItem().withName("Felix House").withEmail("felix.house@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile3));
    final IProfile profile5 = new ProfileDrawerItem().withName("Mr. X").withEmail("mister.x.super@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile4)).withIdentifier(4);
    final IProfile profile6 = new ProfileDrawerItem().withName("Batman").withEmail("batman@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile5));
    // Create the AccountHeader
    headerResult = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(R.drawable.header).withTranslucentStatusBar(false).addProfiles(profile, profile2, profile3, profile4, profile5, profile6, //don't ask but google uses 14dp for the add account icon in gmail but 20dp for the normal icons (like manage account)
    new ProfileSettingDrawerItem().withName("Add Account").withDescription("Add new GitHub Account").withIcon(GoogleMaterial.Icon.gmd_plus).withIdentifier(PROFILE_SETTING), new ProfileSettingDrawerItem().withName("Manage Account").withIcon(GoogleMaterial.Icon.gmd_settings)).withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {

        @Override
        public boolean onProfileChanged(View view, IProfile profile, boolean current) {
            //if the clicked item has the identifier 1 add a new profile ;)
            if (profile instanceof IDrawerItem && ((IDrawerItem) profile).getIdentifier() == PROFILE_SETTING) {
                IProfile newProfile = new ProfileDrawerItem().withNameShown(true).withName("Batman").withEmail("batman@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile5));
                if (headerResult.getProfiles() != null) {
                    //we know that there are 2 setting elements. set the new profile above them ;)
                    headerResult.addProfile(newProfile, headerResult.getProfiles().size() - 2);
                } else {
                    headerResult.addProfiles(newProfile);
                }
            }
            //false if you have not consumed the event and it should close the drawer
            return false;
        }
    }).withSavedInstance(savedInstanceState).build();
    result = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withTranslucentStatusBar(false).withAccountHeader(//set the AccountHeader we created earlier for the header
    headerResult).addDrawerItems(new PrimaryDrawerItem().withName(R.string.drawer_item_compact_header).withIcon(GoogleMaterial.Icon.gmd_sun).withIdentifier(1), new PrimaryDrawerItem().withName(R.string.drawer_item_action_bar_drawer).withIcon(FontAwesome.Icon.faw_home).withBadge("22").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)).withIdentifier(2), new PrimaryDrawerItem().withName(R.string.drawer_item_multi_drawer).withIcon(FontAwesome.Icon.faw_gamepad).withIdentifier(3), new PrimaryDrawerItem().withName(R.string.drawer_item_non_translucent_status_drawer).withIcon(FontAwesome.Icon.faw_eye).withIdentifier(4), new PrimaryDrawerItem().withDescription("A more complex sample").withName(R.string.drawer_item_advanced_drawer).withIcon(GoogleMaterial.Icon.gmd_adb).withIdentifier(5), new SectionDrawerItem().withName(R.string.drawer_item_section_header), new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github), new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(GoogleMaterial.Icon.gmd_format_color_fill).withTag("Bullhorn"), new DividerDrawerItem(), new SwitchDrawerItem().withName("Switch").withIcon(Octicons.Icon.oct_tools).withChecked(true).withOnCheckedChangeListener(onCheckedChangeListener), new ToggleDrawerItem().withName("Toggle").withIcon(Octicons.Icon.oct_tools).withChecked(true).withOnCheckedChangeListener(onCheckedChangeListener)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            if (drawerItem instanceof Nameable) {
                Toast.makeText(EmbeddedDrawerActivity.this, ((Nameable) drawerItem).getName().getText(EmbeddedDrawerActivity.this), Toast.LENGTH_SHORT).show();
            }
            return false;
        }
    }).withSavedInstance(savedInstanceState).buildView();
    ((ViewGroup) findViewById(R.id.frame_container)).addView(result.getSlider());
}
Also used : IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) PrimaryDrawerItem(com.mikepenz.materialdrawer.model.PrimaryDrawerItem) DividerDrawerItem(com.mikepenz.materialdrawer.model.DividerDrawerItem) ProfileSettingDrawerItem(com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem) ProfileDrawerItem(com.mikepenz.materialdrawer.model.ProfileDrawerItem) ViewGroup(android.view.ViewGroup) AccountHeaderBuilder(com.mikepenz.materialdrawer.AccountHeaderBuilder) SwitchDrawerItem(com.mikepenz.materialdrawer.model.SwitchDrawerItem) View(android.view.View) SecondaryDrawerItem(com.mikepenz.materialdrawer.model.SecondaryDrawerItem) ToggleDrawerItem(com.mikepenz.materialdrawer.model.ToggleDrawerItem) Nameable(com.mikepenz.materialdrawer.model.interfaces.Nameable) SectionDrawerItem(com.mikepenz.materialdrawer.model.SectionDrawerItem) BadgeStyle(com.mikepenz.materialdrawer.holder.BadgeStyle) IProfile(com.mikepenz.materialdrawer.model.interfaces.IProfile) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

SecondaryDrawerItem (com.mikepenz.materialdrawer.model.SecondaryDrawerItem)20 DrawerBuilder (com.mikepenz.materialdrawer.DrawerBuilder)18 PrimaryDrawerItem (com.mikepenz.materialdrawer.model.PrimaryDrawerItem)17 View (android.view.View)15 Toolbar (android.support.v7.widget.Toolbar)13 SectionDrawerItem (com.mikepenz.materialdrawer.model.SectionDrawerItem)13 IDrawerItem (com.mikepenz.materialdrawer.model.interfaces.IDrawerItem)12 AccountHeaderBuilder (com.mikepenz.materialdrawer.AccountHeaderBuilder)10 Drawer (com.mikepenz.materialdrawer.Drawer)10 ProfileDrawerItem (com.mikepenz.materialdrawer.model.ProfileDrawerItem)10 IProfile (com.mikepenz.materialdrawer.model.interfaces.IProfile)9 DividerDrawerItem (com.mikepenz.materialdrawer.model.DividerDrawerItem)7 Nameable (com.mikepenz.materialdrawer.model.interfaces.Nameable)7 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)6 BadgeStyle (com.mikepenz.materialdrawer.holder.BadgeStyle)4 ProfileSettingDrawerItem (com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem)4 SwitchDrawerItem (com.mikepenz.materialdrawer.model.SwitchDrawerItem)4 Intent (android.content.Intent)3 ToggleDrawerItem (com.mikepenz.materialdrawer.model.ToggleDrawerItem)3 MenuItem (android.view.MenuItem)2