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


Java ProfileDrawerItem类代码示例

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


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

示例1: loadProjects

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
private void loadProjects() {

        mProjects = mTinyDB.getListObject(PREF_KEY, Project.class);

        if (mProjects.size() == 0) {
            DataEntry.setTableName("");
            mToolbar.setTitle(R.string.app_name);
            mFab.setVisibility(View.INVISIBLE);
            mNoProject = true;
        } else { //Start counter where we stopped
            int lastId = ((Project) mProjects.get(mProjects.size() - 1)).getId();
            Project.setCounter(lastId + 1);
        }

        mProfiles = new ArrayList<>();
        for (Object p : mProjects) {
            Project project = (Project) p;
            Drawable drawable = ContextCompat.getDrawable(this, R.drawable.disk);
            drawable.setColorFilter(project.getPrimaryColor(), PorterDuff.Mode.SRC_ATOP);
            mProfiles.add(new ProfileDrawerItem().withName(project.getName())
                    .withIcon(drawable)
                    .withOnDrawerItemClickListener(this));
        }
    }
 
开发者ID:IdeaTrackerPlus,项目名称:IdeaTrackerPlus,代码行数:25,代码来源:MainActivity.java

示例2: addProfile

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的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

示例3: getAccountHeader

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的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

示例4: getAccountHeaderBuilder

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
/**
 * @return desired header
 * Sets up account header
 * will not be added if null
 */
@Nullable
@Override
protected AccountHeaderBuilder getAccountHeaderBuilder() {
    return new AccountHeaderBuilder().withActivity(this)
            .withHeaderBackground(R.color.colorPrimary)
            .withSelectionFirstLine(s(R.string.app_name))
            .withSelectionSecondLine(BuildConfig.VERSION_NAME)
            .withProfileImagesClickable(false)
            .withResetDrawerOnProfileListClick(false)
            .addProfiles(
                    new ProfileDrawerItem().withIcon(ContextCompat.getDrawable(this, R.mipmap.ic_launcher))
            )
            .withSelectionListEnabled(false)
            .withSelectionListEnabledForSingleProfile(false);
}
 
开发者ID:AllanWang,项目名称:Capsule,代码行数:21,代码来源:MainActivity.java

示例5: setupAllAccountHeaders

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
private void setupAllAccountHeaders() {
    allAccountHeaders = new ArrayList<>();
    List<User> users = User.getAllUsers();
    for (int i = 0; i < users.size(); i++) {
        ProfileDrawerItem profileDrawerItem = new ProfileDrawerItem().withName(users.get(i).getUsername());
        /**
         * A fun image for each profile drawer
         */
        if (i % 3 == 0)
            profileDrawerItem.withIcon(getResources().getDrawable(R.drawable.user_white));
        if (i % 3 == 1)
            profileDrawerItem.withIcon(getResources().getDrawable(R.drawable.user_blue));
        if (i % 3 == 2)
            profileDrawerItem.withIcon(getResources().getDrawable(R.drawable.user_grey));
        allAccountHeaders.add(profileDrawerItem);
    }

    final String createAccount = getString(R.string.drawer_new_account);
    allAccountHeaders.add(new ProfileDrawerItem().withName(createAccount).withIcon(getResources().getDrawable(R.drawable.plus)));
}
 
开发者ID:CreaRo,项目名称:dawebmail,代码行数:21,代码来源:MainActivity.java

示例6: getLoggedInProfileItem

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的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

示例7: genProfile

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
private IProfile genProfile(Patient p) {
    final int schedules = DB.schedules().findAll(p).size();
    String fakeMail;
    if (schedules > 0) {
        fakeMail = home.getString(R.string.active_schedules_number, schedules);
    } else {
        fakeMail = home.getString(R.string.active_schedules_none);
    }

    return new ProfileDrawerItem()
            .withIdentifier(p.getId().intValue())
            .withName(p.getName())
            .withEmail(fakeMail)
            .withIcon(AvatarMgr.res(p.getAvatar()))
            .withNameShown(true);
}
 
开发者ID:citiususc,项目名称:calendula,代码行数:17,代码来源:LeftDrawerMgr.java

示例8: onConnected

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
@Override
public void onConnected(@Nullable Bundle bundle) {
    loadingView.setVisibility(View.VISIBLE);
    if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {
        if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.GET_ACCOUNTS)) {
            Toast.makeText(getApplicationContext(), getString(R.string.should_accept_permissions), Toast.LENGTH_LONG).show();
            return;
            //                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.GET_ACCOUNTS}, PERMISSION_REQUEST_GET_ACCOUNTS);
        } else {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.GET_ACCOUNTS}, PERMISSION_REQUEST_GET_ACCOUNTS);
        }
        return;
    }

    new Thread(new Runnable() {
        @Override
        public void run() {
            DataManager.setGoogleAccountLink(true);
            Drive.DriveApi.getAppFolder(mGoogleApiClient).listChildren(mGoogleApiClient).setResultCallback(connectDriveCallback);
        }
    }).start();

    Person person = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);

    headerResult.removeProfile(0);
    headerResult.addProfiles(new ProfileDrawerItem().withName(person.getDisplayName()).withEmail(Plus.AccountApi.getAccountName(mGoogleApiClient)).withIcon(person.getImage().getUrl()));
    if (person.getCover() != null && person.getCover().getCoverPhoto() != null && person.getCover().getCoverPhoto().getUrl() != null)
        headerResult.setHeaderBackground(new ImageHolder(person.getCover().getCoverPhoto().getUrl()));
    drawer.removeItems(4, 11);
}
 
开发者ID:JeanBarriere,项目名称:Note,代码行数:31,代码来源:MainActivity.java

示例9: onFetchUserInfoSuccess

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
private void onFetchUserInfoSuccess(Account me, String domain) {
    // Add the header image and avatar from the account, into the navigation drawer header.
    ImageView background = headerResult.getHeaderBackgroundView();
    background.setBackgroundColor(ContextCompat.getColor(this, R.color.window_background_dark));
    Picasso.with(MainActivity.this)
            .load(me.header)
            .placeholder(R.drawable.account_header_default)
            .into(background);

    headerResult.clear();
    headerResult.addProfiles(
            new ProfileDrawerItem()
                    .withName(me.getDisplayName())
                    .withEmail(String.format("%[email protected]%s", me.username, domain))
                    .withIcon(me.avatar)
    );

    // Show follow requests in the menu, if this is a locked account.
    if (me.locked) {
        PrimaryDrawerItem followRequestsItem = new PrimaryDrawerItem()
                .withIdentifier(DRAWER_ITEM_FOLLOW_REQUESTS)
                .withName(R.string.action_view_follow_requests)
                .withSelectable(false)
                .withIcon(GoogleMaterial.Icon.gmd_person_add);
        drawer.addItemAtPosition(followRequestsItem, 3);
    }

    // Update the current login information.
    loggedInAccountId = me.id;
    loggedInAccountUsername = me.username;
    getPrivatePreferences().edit()
            .putString("loggedInAccountId", loggedInAccountId)
            .putString("loggedInAccountUsername", loggedInAccountUsername)
            .putBoolean("loggedInAccountLocked", me.locked)
            .apply();
}
 
开发者ID:Vavassor,项目名称:Tusky,代码行数:37,代码来源:MainActivity.java

示例10: getAccountHeader

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
private AccountHeader getAccountHeader(Activity activity) {
    //@formatter:off
    return new AccountHeaderBuilder()
                    .withActivity(activity)
                    .withHeaderBackground(R.color.primary_dark)
                    .addProfiles(
                        new ProfileDrawerItem()
                                        .withName(activity.getString(R.string.app_name))
                    )
                    .build();
    //@formatter:on
}
 
开发者ID:beczesz,项目名称:FragmentNavigationPatternDemo,代码行数:13,代码来源:DrawerManager.java

示例11: setupNavigationDrawer

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
private void setupNavigationDrawer() {
    ProfileDrawerItem section = new ProfileDrawerItem()
            .withSetSelected(false)
            .withSetSelected(false)
            .withEnabled(false);
    PrimaryDrawerItem joyType0DrawerItem = new PrimaryDrawerItem().withName("Basic Gamepad").withTag(KEY_BASIC_GAMEPAD_1).withLevel(2);
    PrimaryDrawerItem joyType1DrawerItem = new PrimaryDrawerItem().withName("Assault Horizon").withTag(KEY_ASSAULT_HORIZON).withLevel(2);
    PrimaryDrawerItem joyType2DrawerItem = new PrimaryDrawerItem().withName("Awesomenauts").withTag(KEY_AWESOMENAUTS).withLevel(2);
    PrimaryDrawerItem joyType3DrawerItem = new PrimaryDrawerItem().withName("BombSquad").withTag(KEY_BOMBSQUAD).withLevel(2);
    PrimaryDrawerItem joyType4DrawerItem = new PrimaryDrawerItem().withName("Final Fantasy XIII").withTag(KEY_FINAL_FANTASY_XIII).withLevel(2);
    SectionDrawerItem sectionDrawerItem = new SectionDrawerItem().withName("Joystick Type").withTextColorRes(R.color.colorAccent);
    PrimaryDrawerItem deviceDrawerItem = new PrimaryDrawerItem().withName("Device Connection").withTag(KEY_DEVICE_CONNECTION).withIcon(GoogleMaterial.Icon.gmd_devices);
    PrimaryDrawerItem settingsDrawerItem = new PrimaryDrawerItem().withName("Settings").withTag("settings").withIcon(GoogleMaterial.Icon.gmd_settings);

    ndMenu = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(tbMain)
            .withCloseOnClick(true)
            .withFireOnInitialOnClick(true)
            .withSelectedItemByPosition(6)
            .withDelayDrawerClickEvent(300)
            .withDisplayBelowStatusBar(true)
            .withTranslucentStatusBar(false)
            .withOnDrawerItemClickListener(this)
            .addDrawerItems(section, deviceDrawerItem, settingsDrawerItem, sectionDrawerItem, joyType0DrawerItem, joyType1DrawerItem, joyType2DrawerItem, joyType3DrawerItem, joyType4DrawerItem)
            .build();
}
 
开发者ID:akexorcist,项目名称:Droid2JoyStick,代码行数:28,代码来源:MainActivity.java

示例12: setupDrawer

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
@Override
public void setupDrawer(Me me, Optional<LuckyNumber> luckyNumber) {

    TextDrawable icon = getIcon(me);
    ProfileDrawerItem profile = getProfileDrawerItem(me, icon);

    DrawerBuilder drawerBuilder = new DrawerBuilder()
            .withActivity(this)
            .addStickyDrawerItems(settingsPresenter.convertToDrawerItem(this::displayFragment))
            .withDelayOnDrawerClose(50)
            .withOnDrawerNavigationListener(clickedView -> {
                onBackPressed();
                return true;
            })
            .withActionBarDrawerToggle(true)
            .withActionBarDrawerToggleAnimated(true)
            .withToolbar(toolbar)
            .withAccountHeader(getDrawerHeader(profile));


    StreamSupport.stream(fragmentPresenters)
            .sorted(Ordering.natural().onResultOf(MainFragmentPresenter::getOrder))
            .map(presenter -> presenter.convertToDrawerItem(p -> displayFragment(presenter)))
            .forEach(drawerBuilder::addDrawerItems);

    if (luckyNumber.isPresent()) {
        drawerBuilder.addDrawerItems(
                new DividerDrawerItem(),
                getLuckyNumberDrawerItem(luckyNumber.get()));
    }

    this.drawer = drawerBuilder.build();
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:34,代码来源:MainActivity.java

示例13: getDrawerHeader

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的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

示例14: initAccount

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的package包/类
@UiThread void initAccount() {
  headerResult = new AccountHeaderBuilder().withActivity(act)
      .withHeaderBackground(R.color.colorPrimary)
      .addProfiles(new ProfileDrawerItem().withName("Usuário"))
      .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
        @Override
        public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
          return false;
        }
      })
      .build();
}
 
开发者ID:Pierry,项目名称:cartolapp,代码行数:13,代码来源:ToolbarBase.java

示例15: updateStationsList

import com.mikepenz.materialdrawer.model.ProfileDrawerItem; //导入依赖的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


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