当前位置: 首页>>代码示例>>Java>>正文


Java ProfileSettingDrawerItem类代码示例

本文整理汇总了Java中com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem的典型用法代码示例。如果您正苦于以下问题:Java ProfileSettingDrawerItem类的具体用法?Java ProfileSettingDrawerItem怎么用?Java ProfileSettingDrawerItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProfileSettingDrawerItem类属于com.mikepenz.materialdrawer.model包,在下文中一共展示了ProfileSettingDrawerItem类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAccountHeader

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
private AccountHeader getAccountHeader(){
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String name = prefs.getString(SSConstants.SS_USER_NAME_INDEX, getString(R.string.ss_menu_anonymous_name));
    String email = prefs.getString(SSConstants.SS_USER_EMAIL_INDEX, getString(R.string.ss_menu_anonymous_email));
    String photo = prefs.getString(SSConstants.SS_USER_PHOTO_INDEX, MENU_ANONYMOUS_PHOTO);

    ssAccountHeader = new AccountHeaderBuilder()
            .withActivity(this)
            .withTranslucentStatusBar(true)
            .withHeaderBackground(R.color.colorPrimary)
            .addProfiles(
                    new ProfileDrawerItem().withName(name)
                            .withEmail(email)
                            .withIcon(photo)
                            .withSelectedTextColor(Color.parseColor(SSColorTheme.getInstance().getColorPrimary()))
                            .withIdentifier(MENU_HEADER_PROFILE_ID),
                    new ProfileSettingDrawerItem().withName(getString(R.string.ss_menu_sign_out)).withIdentifier(MENU_HEADER_LOGOUT_ID)
            )
            .withOnAccountHeaderListener(this)
            .build();

    return ssAccountHeader;
}
 
开发者ID:Adventech,项目名称:sabbath-school-android,代码行数:24,代码来源:SSBaseActivity.java

示例2: getLoggedInProfileItem

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
IProfile[] getLoggedInProfileItem() {
    if (mLoggedInProfiles == null) {
        mLoggedInProfiles = new IProfile[2];
        User currentUser = Select.from(User.class).first();
        ProfileDrawerItem profileDrawerItem = new ProfileDrawerItem().withIdentifier(LOGGED_IN_PROFILE_ITEM)
                                                                     .withIcon(TextDrawable.builder()
                                                                                           .buildRound(String.valueOf(currentUser.getUserName().charAt(0)),
                                                                                                       mResources.getColor(R.color.colorPrimaryDark)))
                                                                     .withName(currentUser.getUserName());
        ProfileSettingDrawerItem logoutDrawerItem = new ProfileSettingDrawerItem().withIdentifier(LOG_OUT_PROFILE_ITEM)
                                                                                  .withName("Logout")
                                                                                  .withDescription("Logout of current account")
                                                                                  .withIcon(mResources.getDrawable(R.drawable.ic_close));

        mLoggedInProfiles[0] = profileDrawerItem;
        mLoggedInProfiles[1] = logoutDrawerItem;
    }

    return mLoggedInProfiles;
}
 
开发者ID:dinosaurwithakatana,项目名称:hacker-news-android,代码行数:21,代码来源:MainViewModel.java

示例3: onProfileChanged

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
@Override
public boolean onProfileChanged(View view, IProfile profile, boolean current){
    if (profile instanceof ProfileSettingDrawerItem && profile.getIdentifier() == MENU_HEADER_LOGOUT_ID) {
        ssFirebaseAuth.signOut();
        SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
        SharedPreferences.Editor editor = shared.edit();
        editor.clear().commit();
        onLogoutEvent();
    }
    return false;
}
 
开发者ID:Adventech,项目名称:sabbath-school-android,代码行数:12,代码来源:SSBaseActivity.java

示例4: getDrawerHeader

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
private AccountHeader getDrawerHeader(ProfileDrawerItem profile) {
    return new AccountHeaderBuilder()
            .withActivity(this)
            .withSelectionListEnabledForSingleProfile(true)
            .withHeaderBackground(R.drawable.background_nav)
            .withHeaderBackgroundScaleType(ImageView.ScaleType.CENTER_CROP)
            .addProfiles(profile,
                    //TODO: Add  support for multi profiles
                    new ProfileSettingDrawerItem()
                            .withName("Wyloguj się")
                            .withIcon(R.drawable.logout)
                            .withOnDrawerItemClickListener(this::logout))
            .build();
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:15,代码来源:MainActivity.java

示例5: updateStationsList

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
public void updateStationsList() {
    // добавляем станции в navigation drawer

    drawerHeader.clear();

    for (int i = 0; i < Config.values.stations.size(); i++) {
        Station station = Config.values.stations.get(i);
        String nodename = station.nodename;

        ProfileDrawerItem dritem = new ProfileDrawerItem()
                .withEmail(station.address)
                .withName(nodename)
                .withNameShown(true)
                .withIcon(getStationIcon(nodename))
                .withIdentifier(i);

        drawerHeader.addProfile(dritem, i);
    }

    drawerHeader.addProfiles(
            new ProfileSettingDrawerItem().withName(getString(R.string.add_node)).withIdentifier(ADD_NODE).withIcon(GoogleMaterial.Icon.gmd_add),
            new ProfileSettingDrawerItem().withName(getString(R.string.manage_node)).withIdentifier(MANAGE_NODE).withIcon(GoogleMaterial.Icon.gmd_settings)
    );

    if (Config.currentSelectedStation > (Config.values.stations.size() - 1)) {
        Config.currentSelectedStation = 0;
        Config.saveCurrentStationPosition();
    }

    currentStation = Config.values.stations.get(Config.currentSelectedStation);
    drawerHeader.setActiveProfile(Config.currentSelectedStation);
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:33,代码来源:MainActivity.java

示例6: getLoggedOutProfileItem

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
IProfile[] getLoggedOutProfileItem() {
    if (mLoggedOutProfileItems == null) {
        mLoggedOutProfileItems = new IProfile[1];
        ProfileSettingDrawerItem profileAddAccountItem = new ProfileSettingDrawerItem().withIdentifier(ADD_ACCOUNT_PROFILE_ITEM)
                                                                                       .withName(mResources.getString(R.string.nav_drawer_login))
                                                                                       .withDescription(mResources.getString(R.string.nav_drawer_add_an_account))
                                                                                       .withIcon(mResources.getDrawable(R.drawable.ic_add));
        mLoggedOutProfileItems[0] = profileAddAccountItem;
    }
    return mLoggedOutProfileItems;
}
 
开发者ID:dinosaurwithakatana,项目名称:hacker-news-android,代码行数:12,代码来源:MainViewModel.java

示例7: onCreate

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);

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

    // Create a few sample profile
    final IProfile profile = new ProfileDrawerItem().withName("Mike Penz").withEmail("[email protected]").withIcon(R.drawable.profile);
    final IProfile profile2 = new ProfileDrawerItem().withName("Max Muster").withEmail("[email protected]").withIcon(R.drawable.profile2);
    final IProfile profile3 = new ProfileDrawerItem().withName("Felix House").withEmail("[email protected]").withIcon(R.drawable.profile3);
    final IProfile profile4 = new ProfileDrawerItem().withName("Mr. X").withEmail("[email protected]").withIcon(R.drawable.profile4);
    final IProfile profile5 = new ProfileDrawerItem().withName("Batman").withEmail("[email protected]").withIcon(R.drawable.profile5);

    // Create the AccountHeader
    headerResult = new AccountHeaderBuilder()
            .withActivity(this)
            .withCompactStyle(true)
            .withHeaderBackground(R.drawable.header)
            .addProfiles(
                    profile,
                    profile2,
                    profile3,
                    profile4,
                    profile5,
                    //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(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_plus).actionBar().paddingDp(5).colorRes(R.color.material_drawer_dark_primary_text)).withIdentifier(PROFILE_SETTING),
                    new ProfileSettingDrawerItem().withName("Manage Account").withIcon(GoogleMaterial.Icon.gmd_settings)
            )
            .withSavedInstance(savedInstanceState)
            .build();

    //Create the drawer
    result = new DrawerBuilder()
            .withActivity(this)
            .withAccountHeader(headerResult) //set the AccountHeader we created earlier for the header
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home).withIdentifier(1),
                    new PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad),
                    new PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye).withIdentifier(5),
                    new SectionDrawerItem().withName(R.string.drawer_item_section_header),
                    new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog),
                    new SecondaryDrawerItem().withName(R.string.drawer_item_help).withIcon(FontAwesome.Icon.faw_question).withEnabled(false),
                    new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github),
                    new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(FontAwesome.Icon.faw_bullhorn)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem != null && drawerItem.getIdentifier() == 1) {
                        startSupportActionMode(new ActionBarCallBack());
                        findViewById(R.id.action_mode_bar).setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(CompactHeaderDrawerActivity.this, R.attr.colorPrimary, R.color.material_drawer_primary));
                    }

                    if (drawerItem instanceof Nameable) {
                        toolbar.setTitle(((Nameable) drawerItem).getName().getText(CompactHeaderDrawerActivity.this));
                    }

                    return false;
                }
            })
            .withSavedInstance(savedInstanceState)
            .build();

    // set the selection to the item with the identifier 5
    if (savedInstanceState == null) {
        result.setSelection(5, false);
    }

    //set the back arrow in the toolbar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(false);
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:77,代码来源:CompactHeaderDrawerActivity.java

示例8: handleDrawerAuthentication

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
private void handleDrawerAuthentication() {
    // Reset by removing both.
    mAccountHeader.removeProfileByIdentifier(SIGN_IN_IDENTIFIER);
    mAccountHeader.removeProfileByIdentifier(SIGN_OUT_IDENTIFIER);

    if (isAuthenticated()) {
        mAccountHeader.updateProfile(
                mProfile.withEmail(getCurrentUser().getEmail()));

        mAccountHeader.addProfiles(
                new ProfileSettingDrawerItem()
                        .withIdentifier(SIGN_OUT_IDENTIFIER)
                        .withName(getString(R.string.sign_out))
                        .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_account_circle, getTheme())));

        mDrawerItems.get(R.id.tab_collection).withSelectable(true);
        mNavigationDrawer.updateItem(mDrawerItems.get(R.id.tab_collection));
        mDrawerItems.get(R.id.tab_decks).withSelectable(true);
        mNavigationDrawer.updateItem(mDrawerItems.get(R.id.tab_decks));
        mDrawerItems.get(R.id.tab_results).withSelectable(BuildConfig.DEBUG);
        mNavigationDrawer.updateItem(mDrawerItems.get(R.id.tab_results));
    } else {
        mAccountHeader.updateProfile(
                mProfile.withEmail(getString(R.string.signed_out)));

        mAccountHeader.removeProfileByIdentifier(SIGN_OUT_IDENTIFIER);
        mAccountHeader.addProfiles(
                new ProfileSettingDrawerItem()
                        .withIdentifier(SIGN_IN_IDENTIFIER)
                        .withName(getString(R.string.sign_in_default))
                        .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_account_circle, getTheme())));

        // If we are currently in an activity that requires authentication, switch to another.
        if (mCurrentTab == R.id.tab_collection ||
                mCurrentTab == R.id.tab_decks ||
                mCurrentTab == R.id.tab_results) {
            mNavigationDrawer.setSelection(R.id.tab_card_db);
        }

        mDrawerItems.get(R.id.tab_collection).withSelectable(false);
        mNavigationDrawer.updateItem(mDrawerItems.get(R.id.tab_collection));
        mDrawerItems.get(R.id.tab_decks).withSelectable(false);
        mNavigationDrawer.updateItem(mDrawerItems.get(R.id.tab_decks));
        mDrawerItems.get(R.id.tab_results).withSelectable(false);
        mNavigationDrawer.updateItem(mDrawerItems.get(R.id.tab_results));
    }
}
 
开发者ID:jamieadkins95,项目名称:Roach,代码行数:48,代码来源:MainActivity.java

示例9: getProfileSettingDrawerItem

import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; //导入依赖的package包/类
private IProfile getProfileSettingDrawerItem() {
    return new ProfileSettingDrawerItem()
            .withName(getString(R.string.action_manage_account))
            .withIcon(GoogleMaterial.Icon.gmd_settings)
            .withIdentifier(PROFILE_SETTING);
}
 
开发者ID:openfoodfacts,项目名称:openfoodfacts-androidapp,代码行数:7,代码来源:MainActivity.java


注:本文中的com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。