@Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { //sample usage of the onProfileChanged listener //if the clicked item has the identifier 1 add a new profile ;) if (profile instanceof IDrawerItem && profile.getIdentifier() == PROFILE_SETTING) { int count = 100 + headerResult.getProfiles().size() + 1; IProfile newProfile = new ProfileDrawerItem().withNameShown(true).withName("Batman" + count).withEmail("batman" + count + "@gmail.com").withIcon(R.drawable.profile5).withIdentifier(count); 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; } })
headerBuilder.addProfiles(new ProfileDrawerItem() .withNameShown(true) .withName(R.string.integrated_inbox_title) .withEmail(parent.getString(R.string.integrated_inbox_detail)) .withIcon(new IconicsDrawable(parent, FontAwesome.Icon.faw_users) .colorRes(R.color.material_drawer_background).backgroundColor(Color.GRAY) .sizeDp(56).paddingDp(8)) .withSetSelected(unifiedInboxSelected) .withIdentifier(DRAWER_ID_UNIFIED_INBOX) ); long drawerId = (account.getAccountNumber()+1) << DRAWER_ACCOUNT_SHIFT; ProfileDrawerItem pdi = new ProfileDrawerItem() .withNameShown(true) .withName(account.getDescription()) .withEmail(account.getEmail()) .withIdentifier(drawerId) .withSetSelected(false) .withTag(account); pdi.withIcon(photoUri); } else { pdi.withIcon(new IconicsDrawable(parent, FontAwesome.Icon.faw_user_alt) .colorRes(R.color.material_drawer_background).backgroundColor(account.getChipColor()) .sizeDp(56).paddingDp(14));
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)); } }
color(getResources().getColor(R.color.colorPrimaryDark)).sizeDp(100); profile_d_item = new ProfileDrawerItem(). withName("me"). withIcon(d1);
binding.swipeRefreshLayout.setOnRefreshListener(this); profileDrawerItem = new ProfileDrawerItem() .withName(preferences.getString(Preferences.USERNAME.getKey(), getString(R.string.app_name))) .withEmail(Preferences.URL.getString(preferences));
.withHeaderBackground(R.drawable.header) .addProfiles( new ProfileDrawerItem() .withEmail(user.first_name) .withIcon(photo),
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 }
private void updateUserProfile() { final String username = Preferences.USERNAME.getString(PreferenceManager.getDefaultSharedPreferences(this)); if(username != null) { final User user = getRealm().where(User.class).equalTo(User.USER_ID, username).findFirst(); if (user != null) { profileDrawerItem.withName(user.getDisplayName()); final String encodedImage = user.getAvatar(); if (encodedImage != null) { Bitmap avatarBitmap = BitmapFactory.decodeStream(new Base64InputStream(new ByteArrayInputStream(encodedImage.getBytes()), Base64.DEFAULT)); profileDrawerItem.withIcon(avatarBitmap); } else { profileDrawerItem.withIcon(R.mipmap.ic_launcher_round); } if (accountHeader != null) accountHeader.updateProfile(profileDrawerItem); } else { profileDrawerItem.withIcon(R.mipmap.ic_launcher_round); } } else { profileDrawerItem.withIcon(R.mipmap.ic_launcher_round); } }
IProfile newProfile = new ProfileDrawerItem().withName(projectName).withIcon(disk).withOnDrawerItemClickListener(this); mProfiles.add(newProfile);
color(getResources().getColor(R.color.md_dark_primary_text)).sizeDp(100); conference_message_profile_item = new ProfileDrawerItem(). withName("Userlist"). withIcon(drawer_header_icon);
@Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { //sample usage of the onProfileChanged listener //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; } })
@Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { //sample usage of the onProfileChanged listener //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; } })
@Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { //sample usage of the onProfileChanged listener //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; } })
profile = new ProfileDrawerItem().withName("Mike Penz").withEmail("mikepenz@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile)); profile2 = new ProfileDrawerItem().withName("Max Muster").withEmail("max.mustermann@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile2)).withIdentifier(2); profile3 = new ProfileDrawerItem().withName("Felix House").withEmail("felix.house@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile3)); profile4 = new ProfileDrawerItem().withName("Mr. X").withEmail("mister.x.super@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile4)).withIdentifier(4); profile5 = new ProfileDrawerItem().withName("Batman").withEmail("batman@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile5));
final IProfile profile = new ProfileDrawerItem().withName("Mike Penz").withEmail("mikepenz@gmail.com").withIcon(R.drawable.profile); final IProfile profile2 = new ProfileDrawerItem().withName("Max Muster").withEmail("max.mustermann@gmail.com").withIcon(R.drawable.profile2); final IProfile profile3 = new ProfileDrawerItem().withName("Felix House").withEmail("felix.house@gmail.com").withIcon(R.drawable.profile3); final IProfile profile4 = new ProfileDrawerItem().withName("Mr. X").withEmail("mister.x.super@gmail.com").withIcon(R.drawable.profile4); final IProfile profile5 = new ProfileDrawerItem().withName("Batman").withEmail("batman@gmail.com").withIcon(R.drawable.profile5);
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));
final IProfile profile = new ProfileDrawerItem().withName("Mike Penz").withEmail("mikepenz@gmail.com").withIcon(R.drawable.profile); final IProfile profile2 = new ProfileDrawerItem().withName("Max Muster").withEmail("max.mustermann@gmail.com").withIcon(R.drawable.profile2); final IProfile profile3 = new ProfileDrawerItem().withName("Felix House").withEmail("felix.house@gmail.com").withIcon(R.drawable.profile3); final IProfile profile4 = new ProfileDrawerItem().withName("Mr. X").withEmail("mister.x.super@gmail.com").withIcon(R.drawable.profile4); final IProfile profile5 = new ProfileDrawerItem().withName("Batman").withEmail("batman@gmail.com").withIcon(R.drawable.profile5);
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));