public class AccountHeaderBuilder
extends java.lang.Object
| Constructor and Description |
|---|
AccountHeaderBuilder() |
| Modifier and Type | Method and Description |
|---|---|
AccountHeaderBuilder |
addProfiles(IProfile... profiles)
add single ore more DrawerItems to the Drawer
|
AccountHeader |
build()
method to build the header view
|
protected void |
buildDrawerSelectionList()
helper method to build and set the drawer selection list
|
protected void |
buildProfiles()
helper method to build the views for the ui
|
protected void |
calculateProfiles()
helper method to calculate the order of the profiles
|
protected int |
getCurrentSelection()
get the current selection
|
protected void |
onProfileClick(android.view.View v,
boolean current) |
protected boolean |
switchProfiles(IProfile newSelection)
helper method to switch the profiles
|
protected void |
toggleSelectionList(android.content.Context ctx)
helper method to toggle the collection
|
protected void |
updateHeaderAndList()
small helper class to update the header and the list
|
AccountHeaderBuilder |
withAccountHeader(int resLayout)
You can pass a custom layout for the drawer lib. see the drawer.xml in layouts of this lib on GitHub
|
AccountHeaderBuilder |
withAccountHeader(android.view.View accountHeader)
You can pass a custom view for the drawer lib. note this requires the same structure as the drawer.xml
|
AccountHeaderBuilder |
withActivity(android.app.Activity activity)
Pass the activity you use the drawer in ;)
|
AccountHeaderBuilder |
withAlternativeProfileHeaderSwitching(boolean alternativeProfileHeaderSwitching)
enable the alternative profile header switching
|
AccountHeaderBuilder |
withCloseDrawerOnProfileListClick(boolean closeDrawerOnProfileListClick)
define if the drawer should close if the user clicks on a profile item if the selection list is shown
|
AccountHeaderBuilder |
withCompactStyle(boolean compactStyle)
Defines if we should use the compact style for the header.
|
AccountHeaderBuilder |
withCurrentProfileHiddenInList(boolean currentProfileHiddenInList)
hide the current selected profile from the list
|
AccountHeaderBuilder |
withDividerBelowHeader(boolean dividerBelowHeader)
Set this to false if you want no divider below the Header
|
AccountHeaderBuilder |
withDrawer(Drawer drawer) |
AccountHeaderBuilder |
withEmailTypeface(android.graphics.Typeface typeface)
Define the typeface which will be used for email textView in the AccountHeader.
|
AccountHeaderBuilder |
withHeaderBackground(android.graphics.drawable.Drawable headerBackground)
set the background for the slider as color
|
AccountHeaderBuilder |
withHeaderBackground(ImageHolder headerBackground)
set the background for the header via the ImageHolder class
|
AccountHeaderBuilder |
withHeaderBackground(int headerBackgroundRes)
set the background for the header as resource
|
AccountHeaderBuilder |
withHeaderBackgroundScaleType(android.widget.ImageView.ScaleType headerBackgroundScaleType)
define the ScaleType for the header background
|
AccountHeaderBuilder |
withHeightDp(int heightDp)
set the height for the header
|
AccountHeaderBuilder |
withHeightPx(int heightPx)
set the height for the header
|
AccountHeaderBuilder |
withHeightRes(int heightRes)
set the height for the header by resource
|
AccountHeaderBuilder |
withNameTypeface(android.graphics.Typeface typeface)
Define the typeface which will be used for name textView in the AccountHeader.
|
AccountHeaderBuilder |
withOnAccountHeaderItemLongClickListener(AccountHeader.OnAccountHeaderItemLongClickListener onAccountHeaderItemLongClickListener)
the on long click listener to be fired on profile longClick inside the list
|
AccountHeaderBuilder |
withOnAccountHeaderListener(AccountHeader.OnAccountHeaderListener onAccountHeaderListener)
add a listener for the accountHeader
|
AccountHeaderBuilder |
withOnAccountHeaderProfileImageListener(AccountHeader.OnAccountHeaderProfileImageListener onAccountHeaderProfileImageListener)
set click / longClick listener for the header images
|
AccountHeaderBuilder |
withOnAccountHeaderSelectionViewClickListener(AccountHeader.OnAccountHeaderSelectionViewClickListener onAccountHeaderSelectionViewClickListener)
set a onSelection listener for the selection box
|
AccountHeaderBuilder |
withOnlyMainProfileImageVisible(boolean onlyMainProfileImageVisible)
define if only the main (current selected) profile image should be visible
|
AccountHeaderBuilder |
withOnlySmallProfileImagesVisible(boolean onlySmallProfileImagesVisible)
define if only the small profile images should be visible
|
AccountHeaderBuilder |
withOnProfileClickDrawerCloseDelay(int onProfileClickDrawerCloseDelay)
Define the delay for the drawer close operation after a click.
|
AccountHeaderBuilder |
withPaddingBelowHeader(boolean paddingBelowHeader)
Set this to false if you want no padding below the Header
|
AccountHeaderBuilder |
withProfileImagesClickable(boolean profileImagesClickable)
enable or disable the profile images to be clickable
|
AccountHeaderBuilder |
withProfileImagesVisible(boolean profileImagesVisible)
define if the profile images in the header are shown or not
|
AccountHeaderBuilder |
withProfiles(java.util.List<IProfile> profiles)
set the arrayList of DrawerItems for the drawer
|
AccountHeaderBuilder |
withResetDrawerOnProfileListClick(boolean resetDrawerOnProfileListClick)
define if the drawer selection list should be reseted after the user clicks on a profile item if the selection list is shown
|
AccountHeaderBuilder |
withSavedInstance(android.os.Bundle savedInstance)
create the drawer with the values of a savedInstance
|
AccountHeaderBuilder |
withSelectionFirstLine(java.lang.String selectionFirstLine)
set this to define the first line in the selection area if there is no profile
note this will block any values from profiles!
|
AccountHeaderBuilder |
withSelectionFirstLineShown(boolean selectionFirstLineShown)
set this to false if you want to hide the first line of the selection box in the header (first line would be the name)
|
AccountHeaderBuilder |
withSelectionFistLineShown(boolean selectionFirstLineShown)
Deprecated.
replaced by
withSelectionFirstLineShown(boolean) |
AccountHeaderBuilder |
withSelectionListEnabled(boolean selectionListEnabled)
enable or disable the selection list
|
AccountHeaderBuilder |
withSelectionListEnabledForSingleProfile(boolean selectionListEnabledForSingleProfile)
enable or disable the selection list if there is only a single profile
|
AccountHeaderBuilder |
withSelectionSecondLine(java.lang.String selectionSecondLine)
set this to define the second line in the selection area if there is no profile
note this will block any values from profiles!
|
AccountHeaderBuilder |
withSelectionSecondLineShown(boolean selectionSecondLineShown)
set this to false if you want to hide the second line of the selection box in the header (second line would be the e-mail)
|
AccountHeaderBuilder |
withTextColor(int textColor)
set the background for the slider as color
|
AccountHeaderBuilder |
withTextColorRes(int textColorRes)
set the background for the slider as resource
|
AccountHeaderBuilder |
withThreeSmallProfileImages(boolean threeSmallProfileImages)
enable the extended profile icon view with 3 small header images instead of two
|
AccountHeaderBuilder |
withTranslucentStatusBar(boolean translucentStatusBar)
Set or disable this if you use a translucent statusbar
|
AccountHeaderBuilder |
withTypeface(android.graphics.Typeface typeface)
Define the typeface which will be used for all textViews in the AccountHeader
|
protected android.view.View mAccountHeader
protected android.widget.ImageView mAccountHeaderBackground
protected BezelImageView mCurrentProfileView
protected android.view.View mAccountHeaderTextSection
protected android.widget.ImageView mAccountSwitcherArrow
protected android.widget.TextView mCurrentProfileName
protected android.widget.TextView mCurrentProfileEmail
protected BezelImageView mProfileFirstView
protected BezelImageView mProfileSecondView
protected BezelImageView mProfileThirdView
protected IProfile mCurrentProfile
protected IProfile mProfileFirst
protected IProfile mProfileSecond
protected IProfile mProfileThird
protected boolean mSelectionListShown
protected int mAccountHeaderTextSectionBackgroundResource
protected android.app.Activity mActivity
protected boolean mCompactStyle
protected android.graphics.Typeface mTypeface
protected android.graphics.Typeface mNameTypeface
protected android.graphics.Typeface mEmailTypeface
protected DimenHolder mHeight
protected ColorHolder mTextColor
protected boolean mCurrentHiddenInList
protected boolean mSelectionFirstLineShown
protected boolean mSelectionSecondLineShown
protected java.lang.String mSelectionFirstLine
protected java.lang.String mSelectionSecondLine
protected boolean mPaddingBelowHeader
protected boolean mDividerBelowHeader
protected boolean mTranslucentStatusBar
protected ImageHolder mHeaderBackground
protected android.widget.ImageView.ScaleType mHeaderBackgroundScaleType
protected boolean mProfileImagesVisible
protected boolean mOnlyMainProfileImageVisible
protected boolean mOnlySmallProfileImagesVisible
protected java.lang.Boolean mCloseDrawerOnProfileListClick
protected boolean mResetDrawerOnProfileListClick
protected boolean mProfileImagesClickable
protected boolean mAlternativeProfileHeaderSwitching
protected boolean mThreeSmallProfileImages
protected int mOnProfileClickDrawerCloseDelay
protected AccountHeader.OnAccountHeaderProfileImageListener mOnAccountHeaderProfileImageListener
protected AccountHeader.OnAccountHeaderSelectionViewClickListener mOnAccountHeaderSelectionViewClickListener
protected boolean mSelectionListEnabledForSingleProfile
protected boolean mSelectionListEnabled
protected android.view.View mAccountHeaderContainer
protected java.util.List<IProfile> mProfiles
protected AccountHeader.OnAccountHeaderListener mOnAccountHeaderListener
protected AccountHeader.OnAccountHeaderItemLongClickListener mOnAccountHeaderItemLongClickListener
protected Drawer mDrawer
protected android.os.Bundle mSavedInstance
public AccountHeaderBuilder withActivity(@NonNull android.app.Activity activity)
activity - public AccountHeaderBuilder withCompactStyle(boolean compactStyle)
compactStyle - public AccountHeaderBuilder withTypeface(@NonNull android.graphics.Typeface typeface)
typeface - public AccountHeaderBuilder withNameTypeface(@NonNull android.graphics.Typeface typeface)
withTypeface(android.graphics.Typeface)typeface - withTypeface(android.graphics.Typeface)public AccountHeaderBuilder withEmailTypeface(@NonNull android.graphics.Typeface typeface)
withTypeface(android.graphics.Typeface)typeface - withTypeface(android.graphics.Typeface)public AccountHeaderBuilder withHeightPx(int heightPx)
heightPx - public AccountHeaderBuilder withHeightDp(int heightDp)
heightDp - public AccountHeaderBuilder withHeightRes(@DimenRes int heightRes)
heightRes - public AccountHeaderBuilder withTextColor(int textColor)
textColor - public AccountHeaderBuilder withTextColorRes(@ColorRes int textColorRes)
textColorRes - public AccountHeaderBuilder withCurrentProfileHiddenInList(boolean currentProfileHiddenInList)
currentProfileHiddenInList - @Deprecated public AccountHeaderBuilder withSelectionFistLineShown(boolean selectionFirstLineShown)
withSelectionFirstLineShown(boolean)selectionFirstLineShown - public AccountHeaderBuilder withSelectionFirstLineShown(boolean selectionFirstLineShown)
selectionFirstLineShown - public AccountHeaderBuilder withSelectionSecondLineShown(boolean selectionSecondLineShown)
selectionSecondLineShown - public AccountHeaderBuilder withSelectionFirstLine(java.lang.String selectionFirstLine)
selectionFirstLine - public AccountHeaderBuilder withSelectionSecondLine(java.lang.String selectionSecondLine)
selectionSecondLine - public AccountHeaderBuilder withPaddingBelowHeader(boolean paddingBelowHeader)
paddingBelowHeader - public AccountHeaderBuilder withDividerBelowHeader(boolean dividerBelowHeader)
dividerBelowHeader - public AccountHeaderBuilder withTranslucentStatusBar(boolean translucentStatusBar)
translucentStatusBar - public AccountHeaderBuilder withHeaderBackground(android.graphics.drawable.Drawable headerBackground)
headerBackground - public AccountHeaderBuilder withHeaderBackground(@DrawableRes int headerBackgroundRes)
headerBackgroundRes - public AccountHeaderBuilder withHeaderBackground(ImageHolder headerBackground)
headerBackground - public AccountHeaderBuilder withHeaderBackgroundScaleType(android.widget.ImageView.ScaleType headerBackgroundScaleType)
headerBackgroundScaleType - public AccountHeaderBuilder withProfileImagesVisible(boolean profileImagesVisible)
profileImagesVisible - public AccountHeaderBuilder withOnlyMainProfileImageVisible(boolean onlyMainProfileImageVisible)
onlyMainProfileImageVisible - public AccountHeaderBuilder withOnlySmallProfileImagesVisible(boolean onlySmallProfileImagesVisible)
onlySmallProfileImagesVisible - public AccountHeaderBuilder withCloseDrawerOnProfileListClick(boolean closeDrawerOnProfileListClick)
closeDrawerOnProfileListClick - public AccountHeaderBuilder withResetDrawerOnProfileListClick(boolean resetDrawerOnProfileListClick)
resetDrawerOnProfileListClick - public AccountHeaderBuilder withProfileImagesClickable(boolean profileImagesClickable)
profileImagesClickable - public AccountHeaderBuilder withAlternativeProfileHeaderSwitching(boolean alternativeProfileHeaderSwitching)
alternativeProfileHeaderSwitching - public AccountHeaderBuilder withThreeSmallProfileImages(boolean threeSmallProfileImages)
threeSmallProfileImages - public AccountHeaderBuilder withOnProfileClickDrawerCloseDelay(int onProfileClickDrawerCloseDelay)
onProfileClickDrawerCloseDelay - the delay in MS (-1 to disable)public AccountHeaderBuilder withOnAccountHeaderProfileImageListener(AccountHeader.OnAccountHeaderProfileImageListener onAccountHeaderProfileImageListener)
onAccountHeaderProfileImageListener - public AccountHeaderBuilder withOnAccountHeaderSelectionViewClickListener(AccountHeader.OnAccountHeaderSelectionViewClickListener onAccountHeaderSelectionViewClickListener)
onAccountHeaderSelectionViewClickListener - public AccountHeaderBuilder withSelectionListEnabledForSingleProfile(boolean selectionListEnabledForSingleProfile)
selectionListEnabledForSingleProfile - public AccountHeaderBuilder withSelectionListEnabled(boolean selectionListEnabled)
selectionListEnabled - public AccountHeaderBuilder withAccountHeader(@NonNull android.view.View accountHeader)
accountHeader - public AccountHeaderBuilder withAccountHeader(@LayoutRes int resLayout)
resLayout - public AccountHeaderBuilder withProfiles(@NonNull java.util.List<IProfile> profiles)
profiles - public AccountHeaderBuilder addProfiles(@NonNull IProfile... profiles)
profiles - public AccountHeaderBuilder withOnAccountHeaderListener(AccountHeader.OnAccountHeaderListener onAccountHeaderListener)
onAccountHeaderListener - public AccountHeaderBuilder withOnAccountHeaderItemLongClickListener(AccountHeader.OnAccountHeaderItemLongClickListener onAccountHeaderItemLongClickListener)
onAccountHeaderItemLongClickListener - public AccountHeaderBuilder withDrawer(@NonNull Drawer drawer)
drawer - public AccountHeaderBuilder withSavedInstance(android.os.Bundle savedInstance)
savedInstance - public AccountHeader build()
protected void calculateProfiles()
protected boolean switchProfiles(IProfile newSelection)
newSelection - protected void buildProfiles()
protected void onProfileClick(android.view.View v,
boolean current)
protected int getCurrentSelection()
protected void toggleSelectionList(android.content.Context ctx)
ctx - protected void buildDrawerSelectionList()
protected void updateHeaderAndList()