com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem Java Examples

The following examples show how to use com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainViewModel.java    From hacker-news-android with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: MainViewModel.java    From hacker-news-android with Apache License 2.0 5 votes vote down vote up
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;
}