- Ground up refactor of the way the
MaterialDrawer
is used and integrated into the app. - Please consider carefully before upgrading to this version.
- Prior to v8 the
Drawer
would automatically inject theDrawerLayout
into the layout hierarchy, apply window flags, and take over control of theActionBarDrawerToggle
.- This may seem convenient for easy usecases, but created big problems for more advanced implementations where taking over window insets is expected
- v8 will no longer do any of this, and gives back all the control to the developer, no more unexpected layout flags, changes to the layout hierarchy or anything similar.
- The core principle behind v8 is to offer just the UI and give back all control to developers.
- Additionally v8 eliminates dependencies on
Materialize
,Android-Iconics
- v8 also now comes with better theming support and better dark mode support
- As v8 is ground up different in the way it is set up it is recommended to re-read the README and check out the sample again
- Basic upgrade procedure:
- Add
DrawerLayout
into your layout - Add
MaterialDrawerSliderView
as child to theDrawerLayout
- Find the reference to the
MaterialDrawerSliderView
in yourActivity
/Fragment
- Use the
MaterialDrawerSliderView
to fill the list / do updates
- Add
- Basic upgrade prodedure for the
AccountHeader
:- Create an instance of the
AccountHeaderView
- Attach to the slider via
attachToSliderView(slider)
- Create an instance of the
- Additionally v8 is more optimized for Kotlin meaning all legacy
with(*)
methods were replaced (kept as extension functions as legacy support) with properties
- Please report if additional upgrade notes are required
Now library is kotlin-first.
-
this release contains a big amount of changes, including many breaking API changes to make its implementation easier, and make the APIs better compatible with kotlin.
-
please note that the interface for items changed in the
FastAdapter
as such migrating to the new version will require more effort. -
Update
FastAdapter
to v4 and make all relevant adjustments to the providedDrawerItem
s- Check the
FastAdapter
changelog and migration guide
- Check the
-
Update
Android-Iconics
to v4- Ensure to update
Android-Iconics
for your project, and use the updated kotlin icon dependencies - See the migration notes for
Android-Iconics
if you run into problems
- Ensure to update
-
The general interfaces and everything stayed the same, and mainly everything was migrated to kotlin
If you have any issues during the migration, or any questions come up please open a github issue so we can improve the migration guide or the documentation.
- Further adjustments for the theme to properly meet the new material 2 design guidelines.
<item name="material_drawer_header_selection_subtext">@color/material_drawer_header_selection_subtext</item> <!-- Defines the color of the subtext item in the header -->
- With the introduction of the material 2 design behaviour, new theme attributes were added.
<item name="material_drawer_selected_legacy">@color/material_drawer_selected</item> <!-- Defines the color if legacy style (Material 1, is enabled) -->
<item name="material_drawer_legacy_style">true</item> <!-- Enables legacy Material 1 style -->
- Reworked the header views to be a lot more simple by using a
ConstraintLayout
- Any previously custom headers require to be adjusted to the new structure. (The statusbar
Guideline
is required, for example)
- Any previously custom headers require to be adjusted to the new structure. (The statusbar
- The viewHolder.item has no longer the item itself as tag directly. It is now defined with an id
R.id.material_drawer_item
.ViewHolder.itemView.getTag(R.id.material_drawer_item)
will now return theIDrawerItem
.
- Final upgrade to the new shiny androidX dependencies :)
IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
- You have to update your FastAdapter dependency to v3.2.1 with this release
- See the MIGRATION information of the FastAdapter https://github.com/mikepenz/FastAdapter/blob/develop/MIGRATION.md
IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
- You have to update your FastAdapter dependency to v3.0.0 with this release
- See the MIGRATION information of the FastAdapter https://github.com/mikepenz/FastAdapter/blob/develop/MIGRATION.md
IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
- You have to update your FastAdapter dependency to v2.5.0 with this release
- See the MIGRATION information of the FastAdapter https://github.com/mikepenz/FastAdapter/blob/develop/MIGRATION.md
IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
- You have to update your FastAdapter dependency to v2.1.0 with this release
- See the MIGRATION information of the FastAdapter https://github.com/mikepenz/FastAdapter/blob/develop/MIGRATION.md
IMPORTANT IF YOU IMPLEMENT CUSTOM-DRAWER-ITEMS OR USE THE FASTADAPTER
- You have to update your
FastAdapter
dependency to v2.0.0 with this release - If you have
CustomDrawerItem
's not based on theAbstractDrawerITems
make sure you implement theunbindView
method, and the new required methods - See the MIGRATION information of the FastAdapter https://github.com/mikepenz/FastAdapter/blob/develop/MIGRATION.md
IMPORTANT IF YOU IMPLEMENT CUSTOM-DRAWER-ITEMS OR USE THE FASTADAPTER
- This release brings a breaking interface change. Your items now have to implement
bindView(ViewHolder holder, List payloads)
instead ofbindView(VH holder)
. - The additional payload can be used to implement a more performant view updating when only parts of the item have changed. Please also refer to the
DiffUtils
which may provide the payload.
- add
void set(ImageView imageView, Uri uri, Drawable placeholder, String tag);
toIDrawerImageLoader
interface, similar to thetag
provided in the placeholder method
- Dropping support for API < 14. New MinSdkVersion is 14
- If you use the
FastAdapter
please read the upgrade notes for v1.6.0 (https://github.com/mikepenz/FastAdapter/releases/tag/v1.6.0)
- the
withOnMiniDrawerItemClickListener
was renamed towithOnMiniDrawerItemOnClickListener
- added new separate
OnMiniDrawerItemClickListener
which allows to hook into the default behavior, and prevent it if necessary - NOTE: this one now uses the
withOnMiniDrawerItemClickListener
method.
- the
SecondaryDrawerItem
is now a subclass of thePrimaryDrawerItem
(extendsPrimaryDrawerItem
). If you have anif
which checks for the type withinstanceOf
make sure you check for theSecondaryDrawerItem
first. (secondaryDrawerItem instanceOf PrimaryDrawerItem == true
)
- if you use the
FastAdapter
please check out the release notes of v1.4.0 (https://github.com/mikepenz/FastAdapter/releases/tag/v1.4.0)
- the
expanding
functionality is now handled by theFastAdapter
so the toggling code is no longer needed. See the following diff for the change (just theDrawerActivity
) https://github.com/mikepenz/MaterialDrawer/commit/88e9bdf8cccaac5aaf567ac6ffe682aeccba4f29
- the identifier was changed from
int
tolong
as the internal adapter (FastAdapter) useslong
to identify items (as theAdapter
does) - v5.0.0 no longer sets the
FULL_SCREEN
flag to get the drawer below theStatusBar
it now uses thefitsSystemWindows
everywhere. This should improve compatiblity with a lot of things like theCoordinatorLayout
and should also improve compatiblity with future Android updates - removed the following methods:
- DrawerUIUtils.getScreenWidth -> moved to UIUtils from the
Materialize
library - DrawerBuilder.withTranslucentStatusBarProgrammatically -> no longer necessary as we now depend on the
fitsSystemWindows
flag StatusBarColor
can now be set via theDrawer.getDrawerLayout().setStatusBarBackgroundColor(color)
- DrawerBuilder.keyboardSupportEnabled ->
KeyboardUtil
should no longer be necessary StatusBar
on API < 21 is no longer colored, because of the changed way how we display theDrawer
under theStatusBar
DrawerItems
changed. Please take a look at theCustomDrawerItems
from the sample or the default ones, to add the changes to yourCustomDrawerItems
- ...
- it is now possible to let the
Drawer
manage theMiniDrawer
. Enable this viawithGenerateMiniDrawer(true)
. Afterwards remove theMiniDrawer
calls inside the listeners, those are now done within theDrawer
. You can get theMiniDrawer
result object viaDrawer.getMiniDrawer();
- added new method
withHeaderPadding
to the drawer andwithPaddingBelowHeader
to the header to control the padding separately from thedivider
which can be controlled viawithHeaderDivider
- depends on the latest
v23.1.0
support libraries. Those also require you to havecompileSDKVersion 23
- new
placeholder(Context ctx, String tag)
to theIDrawerImageLoader
interface - new
AbstractDrawerImageLoader
to simplify theDrawerImageLoader
usage. See the new implementation in theCustomApplication
- to keep the old behavior just change from
new DrawerImageLoader.IDrawerImageLoader() {
tonew AbstractDrawerImageLoader() {
for theDrawerImageLoader.init
- add new
tag
to the placeholder, to be able to define different placeholders for different targets
- no more need to define an identifier for the items, they get one automatically. if you do not have logics which require you to do so, you are safe to forget about the identifier now.
- renamed
setDivider()
towithDivider
- remove
setTypeface()
usewithTypeface()
instead
getCurrentSelection()
will now return theidentifier
of the current selection ornull
getCurrentSelectedPosition()
was added- renamed all
*Footer*
methods to*StickyFooter*
to prevent confusion
- depends on the latest
v23
support libraries. Those also require you to havecompileSDKVersion 23
- change the
onItemClick
listener toonItemClick(View view, int i, IDrawerItem iDrawerItem)
- modify the import of the
AccountHeader
andAccountHeaderBuilder
to
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.AccountHeaderBuilder
- the
identifier
should now be set for theDrawerItems
as it is used now as default for all update/modify/.. actions - rename
withCheckable()
towithSelectable()
- rename
set*
methods of theDrawerItems
towith*
methods as those were renamed - rename all methods like
setSelection
,setFooterSelection
,removeItem
, ... to*ByPosition
(added the ByPosition) - rename all methods like
setSelectionByIdentifier
,setFooterSelectionByIdentifier
, ... tosetSelection
,setFooterSelection
(removed the ByIdentifier) - change
updateName
,updateIcon
,updateBadge
those methods take now anidentifier
and the specificHolder
object - all
get*
methods of theDrawerItems
will now return aHolder
object for the specific type, making it easier to work with types likeString
,StringRes
,Color
,ColorRes
,ColorInt
, ..
- the MaterialDrawer now only includes the
core
of the Android-Iconics project - add the fonts you use https://github.com/mikepenz/Android-Iconics#2-choose-your-desired-fonts
- pre MaterialDrawer v4.0.0 following fonts were included
compile 'com.mikepenz:google-material-typeface:1.2.0.1@aar' //Google Material Design Icons
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar' //FontAwesome **NOTE:** the packagename changed for this font
- changed the
ListView
to aRecyclerView
- rename methods with
*ListView*
to*RecyclerView*
- the
IDrawerItem
interface was extended to better reflect aRecyclerView
and to improve performance - added an
AbstractDrawerItem
to implement some common methods - see the SectionDrawerItem for an easy example