- Ground up refactor of the way the
MaterialDraweris used and integrated into the app. - Please consider carefully before upgrading to this version.
- Prior to v8 the
Drawerwould automatically inject theDrawerLayoutinto 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
DrawerLayoutinto your layout - Add
MaterialDrawerSliderViewas child to theDrawerLayout - Find the reference to the
MaterialDrawerSliderViewin yourActivity/Fragment - Use the
MaterialDrawerSliderViewto 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
FastAdapteras such migrating to the new version will require more effort. -
Update
FastAdapterto v4 and make all relevant adjustments to the providedDrawerItems- Check the
FastAdapterchangelog and migration guide
- Check the
-
Update
Android-Iconicsto v4- Ensure to update
Android-Iconicsfor your project, and use the updated kotlin icon dependencies - See the migration notes for
Android-Iconicsif 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
Guidelineis 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
FastAdapterdependency to v2.0.0 with this release - If you have
CustomDrawerItem's not based on theAbstractDrawerITemsmake sure you implement theunbindViewmethod, 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
DiffUtilswhich may provide the payload.
- add
void set(ImageView imageView, Uri uri, Drawable placeholder, String tag);toIDrawerImageLoaderinterface, similar to thetagprovided in the placeholder method
- Dropping support for API < 14. New MinSdkVersion is 14
- If you use the
FastAdapterplease read the upgrade notes for v1.6.0 (https://github.com/mikepenz/FastAdapter/releases/tag/v1.6.0)
- the
withOnMiniDrawerItemClickListenerwas renamed towithOnMiniDrawerItemOnClickListener - added new separate
OnMiniDrawerItemClickListenerwhich allows to hook into the default behavior, and prevent it if necessary - NOTE: this one now uses the
withOnMiniDrawerItemClickListenermethod.
- the
SecondaryDrawerItemis now a subclass of thePrimaryDrawerItem(extendsPrimaryDrawerItem). If you have anifwhich checks for the type withinstanceOfmake sure you check for theSecondaryDrawerItemfirst. (secondaryDrawerItem instanceOf PrimaryDrawerItem == true)
- if you use the
FastAdapterplease check out the release notes of v1.4.0 (https://github.com/mikepenz/FastAdapter/releases/tag/v1.4.0)
- the
expandingfunctionality is now handled by theFastAdapterso 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
inttolongas the internal adapter (FastAdapter) useslongto identify items (as theAdapterdoes) - v5.0.0 no longer sets the
FULL_SCREENflag to get the drawer below theStatusBarit now uses thefitsSystemWindowseverywhere. This should improve compatiblity with a lot of things like theCoordinatorLayoutand should also improve compatiblity with future Android updates - removed the following methods:
- DrawerUIUtils.getScreenWidth -> moved to UIUtils from the
Materializelibrary - DrawerBuilder.withTranslucentStatusBarProgrammatically -> no longer necessary as we now depend on the
fitsSystemWindowsflag StatusBarColorcan now be set via theDrawer.getDrawerLayout().setStatusBarBackgroundColor(color)- DrawerBuilder.keyboardSupportEnabled ->
KeyboardUtilshould no longer be necessary StatusBaron API < 21 is no longer colored, because of the changed way how we display theDrawerunder theStatusBarDrawerItemschanged. Please take a look at theCustomDrawerItemsfrom the sample or the default ones, to add the changes to yourCustomDrawerItems- ...
- it is now possible to let the
Drawermanage theMiniDrawer. Enable this viawithGenerateMiniDrawer(true). Afterwards remove theMiniDrawercalls inside the listeners, those are now done within theDrawer. You can get theMiniDrawerresult object viaDrawer.getMiniDrawer();
- added new method
withHeaderPaddingto the drawer andwithPaddingBelowHeaderto the header to control the padding separately from thedividerwhich can be controlled viawithHeaderDivider
- depends on the latest
v23.1.0support libraries. Those also require you to havecompileSDKVersion 23
- new
placeholder(Context ctx, String tag)to theIDrawerImageLoaderinterface - new
AbstractDrawerImageLoaderto simplify theDrawerImageLoaderusage. See the new implementation in theCustomApplication - to keep the old behavior just change from
new DrawerImageLoader.IDrawerImageLoader() {tonew AbstractDrawerImageLoader() {for theDrawerImageLoader.init - add new
tagto 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 theidentifierof the current selection ornullgetCurrentSelectedPosition()was added- renamed all
*Footer*methods to*StickyFooter*to prevent confusion
- depends on the latest
v23support libraries. Those also require you to havecompileSDKVersion 23 - change the
onItemClicklistener toonItemClick(View view, int i, IDrawerItem iDrawerItem) - modify the import of the
AccountHeaderandAccountHeaderBuilderto
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.AccountHeaderBuilder- the
identifiershould now be set for theDrawerItemsas it is used now as default for all update/modify/.. actions - rename
withCheckable()towithSelectable() - rename
set*methods of theDrawerItemstowith*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,updateBadgethose methods take now anidentifierand the specificHolderobject - all
get*methods of theDrawerItemswill now return aHolderobject for the specific type, making it easier to work with types likeString,StringRes,Color,ColorRes,ColorInt, ..
- the MaterialDrawer now only includes the
coreof 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
ListViewto aRecyclerView - rename methods with
*ListView*to*RecyclerView* - the
IDrawerIteminterface was extended to better reflect aRecyclerViewand to improve performance - added an
AbstractDrawerItemto implement some common methods - see the SectionDrawerItem for an easy example