public class Drawer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Drawer.OnDrawerItemClickListener |
static interface |
Drawer.OnDrawerItemLongClickListener |
static interface |
Drawer.OnDrawerItemSelectedListener |
static interface |
Drawer.OnDrawerListener |
static interface |
Drawer.OnDrawerNavigationListener |
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
BUNDLE_DRAWER_CONTENT_SWITCHED |
protected static java.lang.String |
BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED |
protected static java.lang.String |
BUNDLE_SELECTION
BUNDLE param to store the selection
|
protected static java.lang.String |
BUNDLE_SELECTION_APPENDED |
protected static java.lang.String |
BUNDLE_STICKY_FOOTER_SELECTION |
protected static java.lang.String |
BUNDLE_STICKY_FOOTER_SELECTION_APPENDED |
protected DrawerBuilder |
mDrawerBuilder |
protected static java.lang.String |
PREF_USER_LEARNED_DRAWER
Per the design guidelines, you should show the drawer on launch until the user manually
expands it.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Drawer(DrawerBuilder drawerBuilder)
the protected Constructor for the result
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(IDrawerItem drawerItem)
Add a drawerItem at the end
|
void |
addItemAtPosition(IDrawerItem drawerItem,
int position)
Add a drawerItem at a specific position
|
void |
addItems(IDrawerItem... drawerItems)
add new Items to the current DrawerItem List
|
void |
addItemsAtPosition(int position,
IDrawerItem... drawerItems)
add new items to the current DrawerItem list at a specific position
|
void |
addStickyFooterItem(IDrawerItem drawerItem)
Add a footerDrawerItem at the end
|
void |
addStickyFooterItemAtPosition(IDrawerItem drawerItem,
int position)
Add a footerDrawerItem at a specific position
|
void |
closeDrawer()
close the drawer
|
void |
deselect()
deselects all selected items
|
void |
deselect(long identifier)
deselects the item with the given identifier
|
android.support.v7.app.ActionBarDrawerToggle |
getActionBarDrawerToggle()
get the ActionBarDrawerToggle
|
com.mikepenz.fastadapter.FastAdapter<IDrawerItem> |
getAdapter()
get the FastAdapter of the current drawer
|
android.widget.FrameLayout |
getContent()
get the container frameLayout of the current drawer
|
int |
getCurrentSelectedPosition()
get the current position of the selected drawer element
|
long |
getCurrentSelection()
get the current selected item identifier
|
int |
getCurrentStickyFooterSelectedPosition()
get the current position of the selected sticky footer element
|
protected DrawerBuilder |
getDrawerBuilder()
the protected getter of the mDrawerBuilder
only used internally to prevent the default behavior of some public methods
|
IDrawerItem |
getDrawerItem(long identifier)
returns the DrawerItem by the given identifier
|
IDrawerItem |
getDrawerItem(java.lang.Object tag)
returns the found drawerItem by the given tag
|
java.util.List<IDrawerItem> |
getDrawerItems()
get all drawerItems of the current drawer
|
android.support.v4.widget.DrawerLayout |
getDrawerLayout()
Get the DrawerLayout of the current drawer
|
android.view.View |
getFooter()
get the Footer View if set else NULL
|
com.mikepenz.fastadapter.adapters.FooterAdapter<IDrawerItem> |
getFooterAdapter()
get the FooterAdapter of the current drawer
|
android.view.View |
getHeader()
get the Header View if set else NULL
|
com.mikepenz.fastadapter.adapters.HeaderAdapter<IDrawerItem> |
getHeaderAdapter()
get the HeaderAdapter of the current drawer
|
com.mikepenz.fastadapter.adapters.ItemAdapter<IDrawerItem> |
getItemAdapter()
get the ItemAdapter of the current drawer
|
com.mikepenz.materialize.Materialize |
getMaterialize()
get the Materialize object used to beautify your activity
|
MiniDrawer |
getMiniDrawer()
gets the already generated MiniDrawer or creates a new one
|
Drawer.OnDrawerItemClickListener |
getOnDrawerItemClickListener()
method to get the OnDrawerItemClickListener
|
Drawer.OnDrawerItemLongClickListener |
getOnDrawerItemLongClickListener()
method to get the OnDrawerItemLongClickListener
|
Drawer.OnDrawerNavigationListener |
getOnDrawerNavigationListener()
method to get the OnDrawerNavigationListener
|
java.util.List<IDrawerItem> |
getOriginalDrawerItems()
get the original list of drawerItems
|
int |
getPosition(IDrawerItem drawerItem)
calculates the position of an drawerItem. searching by it's identifier
|
int |
getPosition(long identifier)
calculates the position of an drawerItem. searching by it's identifier
|
android.support.v7.widget.RecyclerView |
getRecyclerView()
get the listView of the current drawer
|
com.mikepenz.materialize.view.ScrimInsetsRelativeLayout |
getSlider()
get the slider layout of the current drawer.
|
android.view.View |
getStickyFooter()
get the StickyFooter View if set else NULL
|
int |
getStickyFooterPosition(IDrawerItem drawerItem)
calculates the position of an drawerItem. searching by it's identifier
|
int |
getStickyFooterPosition(long identifier)
calculates the position of an drawerItem inside the footer. searching by it's identfier
|
android.view.View |
getStickyHeader()
get the StickyHeader View if set else NULL
|
boolean |
isDrawerOpen()
Get the current state of the drawer.
|
void |
openDrawer()
Open the drawer
|
void |
removeAllItems()
Removes all items from drawer
|
void |
removeAllStickyFooterItems()
Removes all footerItems from drawer
|
void |
removeHeader()
method to remove the header of the list
|
void |
removeItem(long identifier)
Remove a drawerItem by the identifier
|
void |
removeItemByPosition(int position)
Remove a drawerItem at a specific position
|
void |
removeItems(long... identifiers)
remove a list of drawerItems by ther identifiers
|
void |
removeStickyFooterItemAtPosition(int position)
Remove a footerDrawerItem at a specific position
|
void |
resetDrawerContent()
helper method to reset to the original drawerContent
|
android.os.Bundle |
saveInstanceState(android.os.Bundle savedInstanceState)
add the values to the bundle for saveInstanceState
|
void |
setActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle actionBarDrawerToggle)
Add a custom ActionBarDrawerToggle which will be used in combination with this drawer.
|
void |
setFullscreen(boolean fullscreen)
set the insetsFrameLayout to display the content in fullscreen
under the statusBar and navigationBar
|
void |
setHeader(android.view.View view)
method to replace a previous set header
|
void |
setHeader(android.view.View view,
boolean divider)
method to replace a previous set header
|
void |
setHeader(android.view.View view,
boolean padding,
boolean divider)
method to replace a previous set header
|
void |
setItemAtPosition(IDrawerItem drawerItem,
int position)
Set a drawerItem at a specific position
|
void |
setItems(java.util.List<IDrawerItem> drawerItems)
Replace the current DrawerItems with a new ArrayList of items
|
void |
setOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener)
setter for the OnDrawerItemClickListener
|
void |
setOnDrawerItemLongClickListener(Drawer.OnDrawerItemLongClickListener onDrawerItemLongClickListener)
setter for the OnDrawerItemLongClickListener
|
void |
setOnDrawerNavigationListener(Drawer.OnDrawerNavigationListener onDrawerNavigationListener) |
boolean |
setSelection(IDrawerItem drawerItem)
set the current selection in the drawer
NOTE: This will trigger onDrawerItemSelected without a view!
|
boolean |
setSelection(IDrawerItem drawerItem,
boolean fireOnClick)
set the current selection in the drawer
NOTE: This will trigger onDrawerItemSelected without a view if you pass fireOnClick = true;
|
boolean |
setSelection(long identifier)
set the current selection in the drawer
NOTE: This will trigger onDrawerItemSelected without a view!
|
boolean |
setSelection(long identifier,
boolean fireOnClick)
set the current selection in the drawer
NOTE: This will trigger onDrawerItemSelected without a view if you pass fireOnClick = true;
|
boolean |
setSelectionAtPosition(int position)
set the current selection in the drawer
NOTE: This will trigger onDrawerItemSelected without a view!
|
boolean |
setSelectionAtPosition(int position,
boolean fireOnClick) |
void |
setStickyFooterItemAtPosition(IDrawerItem drawerItem,
int position)
Set a footerDrawerItem at a specific position
|
void |
setStickyFooterSelection(long identifier,
boolean fireOnClick)
set the current selection in the footer of the drawer
NOTE: This will trigger onDrawerItemSelected without a view if you pass fireOnClick = true;
|
void |
setStickyFooterSelectionAtPosition(int position)
set the current selection in the footer of the drawer
NOTE: This will trigger onDrawerItemSelected without a view!
|
void |
setStickyFooterSelectionAtPosition(int position,
boolean fireOnClick)
set the current selection in the footer of the drawer
NOTE: This will trigger onDrawerItemSelected without a view if you pass fireOnClick = true;
|
void |
setToolbar(android.app.Activity activity,
android.support.v7.widget.Toolbar toolbar)
Sets the toolbar which should be used in combination with the drawer
This will handle the ActionBarDrawerToggle for you.
|
void |
setToolbar(android.app.Activity activity,
android.support.v7.widget.Toolbar toolbar,
boolean recreateActionBarDrawerToggle)
Sets the toolbar which should be used in combination with the drawer
This will handle the ActionBarDrawerToggle for you.
|
void |
switchDrawerContent(Drawer.OnDrawerItemClickListener onDrawerItemClickListener,
Drawer.OnDrawerItemLongClickListener onDrawerItemLongClickListener,
java.util.List<IDrawerItem> drawerItems,
int drawerSelection)
method to switch the drawer content to new elements
|
boolean |
switchedDrawerContent()
information if the current drawer content is switched by alternative content (profileItems)
|
void |
updateBadge(long identifier,
StringHolder badge)
update the badge for a specific drawerItem
identified by its id
|
void |
updateIcon(long identifier,
ImageHolder image)
update the name for a specific drawerItem
identified by its id
|
void |
updateItem(IDrawerItem drawerItem)
update a specific drawer item :D
automatically identified by its id
|
void |
updateItemAtPosition(IDrawerItem drawerItem,
int position)
Update a drawerItem at a specific position
|
void |
updateName(long identifier,
StringHolder name)
update the name for a specific drawerItem
identified by its id
|
void |
updateStickyFooterItem(IDrawerItem drawerItem)
update a specific footerDrawerItem :D
automatically identified by it's id
|
void |
updateStickyFooterItemAtPosition(IDrawerItem drawerItem,
int position)
update a footerDrawerItem at a specific position
|
protected static final java.lang.String BUNDLE_SELECTION
protected static final java.lang.String BUNDLE_SELECTION_APPENDED
protected static final java.lang.String BUNDLE_STICKY_FOOTER_SELECTION
protected static final java.lang.String BUNDLE_STICKY_FOOTER_SELECTION_APPENDED
protected static final java.lang.String BUNDLE_DRAWER_CONTENT_SWITCHED
protected static final java.lang.String BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED
protected static final java.lang.String PREF_USER_LEARNED_DRAWER
protected final DrawerBuilder mDrawerBuilder
protected Drawer(DrawerBuilder drawerBuilder)
drawerBuilder - protected DrawerBuilder getDrawerBuilder()
public android.support.v4.widget.DrawerLayout getDrawerLayout()
public void setToolbar(@NonNull
android.app.Activity activity,
@NonNull
android.support.v7.widget.Toolbar toolbar)
activity - toolbar - the toolbar which is used in combination with the drawerpublic void setToolbar(@NonNull
android.app.Activity activity,
@NonNull
android.support.v7.widget.Toolbar toolbar,
boolean recreateActionBarDrawerToggle)
activity - toolbar - the toolbar which is used in combination with the drawerrecreateActionBarDrawerToggle - defines if the ActionBarDrawerToggle needs to be recreated with the new set Toolbarpublic void setActionBarDrawerToggle(@NonNull
android.support.v7.app.ActionBarDrawerToggle actionBarDrawerToggle)
actionBarDrawerToggle - public void openDrawer()
public void closeDrawer()
public boolean isDrawerOpen()
public void setFullscreen(boolean fullscreen)
fullscreen - public com.mikepenz.materialize.Materialize getMaterialize()
public MiniDrawer getMiniDrawer()
public com.mikepenz.materialize.view.ScrimInsetsRelativeLayout getSlider()
public android.widget.FrameLayout getContent()
public android.support.v7.widget.RecyclerView getRecyclerView()
public com.mikepenz.fastadapter.FastAdapter<IDrawerItem> getAdapter()
public com.mikepenz.fastadapter.adapters.HeaderAdapter<IDrawerItem> getHeaderAdapter()
public com.mikepenz.fastadapter.adapters.ItemAdapter<IDrawerItem> getItemAdapter()
public com.mikepenz.fastadapter.adapters.FooterAdapter<IDrawerItem> getFooterAdapter()
public java.util.List<IDrawerItem> getDrawerItems()
public android.view.View getHeader()
public android.view.View getStickyHeader()
public void setHeader(@NonNull
android.view.View view)
view - public void setHeader(@NonNull
android.view.View view,
boolean divider)
view - divider - public void setHeader(@NonNull
android.view.View view,
boolean padding,
boolean divider)
view - padding - divider - public void removeHeader()
public android.view.View getFooter()
public android.view.View getStickyFooter()
public android.support.v7.app.ActionBarDrawerToggle getActionBarDrawerToggle()
public int getPosition(@NonNull
IDrawerItem drawerItem)
drawerItem - public int getPosition(long identifier)
identifier - public IDrawerItem getDrawerItem(long identifier)
identifier - public IDrawerItem getDrawerItem(java.lang.Object tag)
tag - public int getStickyFooterPosition(@NonNull
IDrawerItem drawerItem)
drawerItem - public int getStickyFooterPosition(long identifier)
identifier - public int getCurrentSelectedPosition()
public long getCurrentSelection()
public int getCurrentStickyFooterSelectedPosition()
public void deselect()
public void deselect(long identifier)
identifier - the identifier to search forpublic boolean setSelection(long identifier)
identifier - the identifier to search forpublic boolean setSelection(long identifier,
boolean fireOnClick)
identifier - the identifier to search forfireOnClick - true if the click listener should be calledpublic void setStickyFooterSelection(long identifier,
boolean fireOnClick)
identifier - the identifier to search forfireOnClick - true if the click listener should be calledpublic boolean setSelection(@NonNull
IDrawerItem drawerItem)
drawerItem - the drawerItem to select (this requires a set identifier)public boolean setSelection(@NonNull
IDrawerItem drawerItem,
boolean fireOnClick)
drawerItem - the drawerItem to select (this requires a set identifier)fireOnClick - true if the click listener should be calledpublic boolean setSelectionAtPosition(int position)
position - the position to selectpublic boolean setSelectionAtPosition(int position,
boolean fireOnClick)
public void setStickyFooterSelectionAtPosition(int position)
position - the position to selectpublic void setStickyFooterSelectionAtPosition(int position,
boolean fireOnClick)
position - fireOnClick - public void updateItem(@NonNull
IDrawerItem drawerItem)
drawerItem - public void updateBadge(long identifier,
StringHolder badge)
identifier - badge - public void updateName(long identifier,
StringHolder name)
identifier - name - public void updateIcon(long identifier,
ImageHolder image)
identifier - image - public void updateItemAtPosition(@NonNull
IDrawerItem drawerItem,
int position)
drawerItem - position - public void addItem(@NonNull
IDrawerItem drawerItem)
drawerItem - public void addItemAtPosition(@NonNull
IDrawerItem drawerItem,
int position)
drawerItem - position - public void setItemAtPosition(@NonNull
IDrawerItem drawerItem,
int position)
drawerItem - position - public void removeItemByPosition(int position)
position - public void removeItem(long identifier)
identifier - public void removeItems(long... identifiers)
identifiers - public void removeAllItems()
public void addItems(@NonNull
IDrawerItem... drawerItems)
drawerItems - public void addItemsAtPosition(int position,
@NonNull
IDrawerItem... drawerItems)
position - drawerItems - public void setItems(@NonNull
java.util.List<IDrawerItem> drawerItems)
drawerItems - public void updateStickyFooterItem(@NonNull
IDrawerItem drawerItem)
drawerItem - public void updateStickyFooterItemAtPosition(@NonNull
IDrawerItem drawerItem,
int position)
drawerItem - position - public void addStickyFooterItem(@NonNull
IDrawerItem drawerItem)
drawerItem - public void addStickyFooterItemAtPosition(@NonNull
IDrawerItem drawerItem,
int position)
drawerItem - position - public void setStickyFooterItemAtPosition(@NonNull
IDrawerItem drawerItem,
int position)
drawerItem - position - public void removeStickyFooterItemAtPosition(int position)
position - public void removeAllStickyFooterItems()
public void setOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener)
onDrawerItemClickListener - public void setOnDrawerNavigationListener(Drawer.OnDrawerNavigationListener onDrawerNavigationListener)
public Drawer.OnDrawerItemClickListener getOnDrawerItemClickListener()
public Drawer.OnDrawerNavigationListener getOnDrawerNavigationListener()
public void setOnDrawerItemLongClickListener(Drawer.OnDrawerItemLongClickListener onDrawerItemLongClickListener)
onDrawerItemLongClickListener - public Drawer.OnDrawerItemLongClickListener getOnDrawerItemLongClickListener()
public boolean switchedDrawerContent()
public java.util.List<IDrawerItem> getOriginalDrawerItems()
public void switchDrawerContent(@NonNull
Drawer.OnDrawerItemClickListener onDrawerItemClickListener,
Drawer.OnDrawerItemLongClickListener onDrawerItemLongClickListener,
@NonNull
java.util.List<IDrawerItem> drawerItems,
int drawerSelection)
onDrawerItemClickListener - drawerItems - drawerSelection - public void resetDrawerContent()
public android.os.Bundle saveInstanceState(android.os.Bundle savedInstanceState)
savedInstanceState -