MIGRATION.md
MaterialDrawer is used and integrated into the app.Drawer would automatically inject the DrawerLayout into the layout hierarchy, apply window flags, and take over control of the ActionBarDrawerToggle.
Materialize, Android-IconicsDrawerLayout into your layoutMaterialDrawerSliderView as child to the DrawerLayoutMaterialDrawerSliderView in your Activity / FragmentMaterialDrawerSliderView to fill the list / do updatesAccountHeader:
AccountHeaderViewattachToSliderView(slider)with(*) methods were replaced (kept as extension functions as legacy support) with propertiesNow 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 provided DrawerItems
FastAdapter changelog and migration guideUpdate Android-Iconics to v4
Android-Iconics for your project, and use the updated kotlin icon dependenciesAndroid-Iconics if you run into problemsThe 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.
<item name="material_drawer_header_selection_subtext">@color/material_drawer_header_selection_subtext</item> <!-- Defines the color of the subtext item in the header -->
<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 -->
ConstraintLayout
Guideline is required, for example)R.id.material_drawer_item. ViewHolder.itemView.getTag(R.id.material_drawer_item) will now return the IDrawerItem.IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
IMPORTANT IF YOU USE THE FASTADAPTER OR ABOUTLIBRARIES
IMPORTANT IF YOU IMPLEMENT CUSTOM-DRAWER-ITEMS OR USE THE FASTADAPTER
FastAdapter dependency to v2.0.0 with this releaseCustomDrawerItem's not based on the AbstractDrawerITems make sure you implement the unbindView method, and the new required methodsIMPORTANT IF YOU IMPLEMENT CUSTOM-DRAWER-ITEMS OR USE THE FASTADAPTER
bindView(ViewHolder holder, List payloads) instead of bindView(VH holder).DiffUtils which may provide the payload.void set(ImageView imageView, Uri uri, Drawable placeholder, String tag); to IDrawerImageLoader interface, similar to the tag provided in the placeholder methodFastAdapter please read the upgrade notes for v1.6.0 (https://github.com/mikepenz/FastAdapter/releases/tag/v1.6.0)withOnMiniDrawerItemClickListener was renamed to withOnMiniDrawerItemOnClickListenerOnMiniDrawerItemClickListener which allows to hook into the default behavior, and prevent it if necessarywithOnMiniDrawerItemClickListener method.SecondaryDrawerItem is now a subclass of the PrimaryDrawerItem (extends PrimaryDrawerItem). If you have an if which checks for the type with instanceOf make sure you check for the SecondaryDrawerItem first. (secondaryDrawerItem instanceOf PrimaryDrawerItem == true)FastAdapter please check out the release notes of v1.4.0 (https://github.com/mikepenz/FastAdapter/releases/tag/v1.4.0)expanding functionality is now handled by the FastAdapter so the toggling code is no longer needed. See the following diff for the change (just the DrawerActivity) https://github.com/mikepenz/MaterialDrawer/commit/88e9bdf8cccaac5aaf567ac6ffe682aeccba4f29int to long as the internal adapter (FastAdapter) uses long to identify items (as the Adapter does)FULL_SCREEN flag to get the drawer below the StatusBar it now uses the fitsSystemWindows everywhere. This should improve compatiblity with a lot of things like the CoordinatorLayout and should also improve compatiblity with future Android updatesMaterialize libraryfitsSystemWindows flagStatusBarColor can now be set via the Drawer.getDrawerLayout().setStatusBarBackgroundColor(color)KeyboardUtil should no longer be necessaryStatusBar on API < 21 is no longer colored, because of the changed way how we display the Drawer under the StatusBarDrawerItems changed. Please take a look at the CustomDrawerItems from the sample or the default ones, to add the changes to your CustomDrawerItemsDrawer manage the MiniDrawer. Enable this via withGenerateMiniDrawer(true). Afterwards remove the MiniDrawer calls inside the listeners, those are now done within the Drawer. You can get the MiniDrawer result object via Drawer.getMiniDrawer();withHeaderPadding to the drawer and withPaddingBelowHeader to the header to control the padding separately from the dividerwhich can be controlled via withHeaderDividerv23.1.0 support libraries. Those also require you to have compileSDKVersion 23placeholder(Context ctx, String tag) to the IDrawerImageLoader interfaceAbstractDrawerImageLoader to simplify the DrawerImageLoader usage. See the new implementation in the CustomApplicationnew DrawerImageLoader.IDrawerImageLoader() { to new AbstractDrawerImageLoader() { for the DrawerImageLoader.inittag to the placeholder, to be able to define different placeholders for different targetssetDivider() to withDividersetTypeface() use withTypeface() insteadgetCurrentSelection() will now return the identifier of the current selection or nullgetCurrentSelectedPosition() was added*Footer* methods to *StickyFooter* to prevent confusionv23 support libraries. Those also require you to have compileSDKVersion 23onItemClick listener to onItemClick(View view, int i, IDrawerItem iDrawerItem)AccountHeader and AccountHeaderBuilder toimport com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.AccountHeaderBuilder
identifier should now be set for the DrawerItems as it is used now as default for all update/modify/.. actionswithCheckable() to withSelectable()set* methods of the DrawerItems to with* methods as those were renamedsetSelection, setFooterSelection, removeItem, ... to *ByPosition (added the ByPosition)setSelectionByIdentifier, setFooterSelectionByIdentifier, ... to setSelection, setFooterSelection (removed the ByIdentifier)updateName, updateIcon, updateBadge those methods take now an identifier and the specific Holder objectget* methods of the DrawerItems will now return a Holder object for the specific type, making it easier to work with types like String, StringRes, Color, ColorRes, ColorInt, ..core of the Android-Iconics projectcompile '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
ListView to a RecyclerView*ListView* to *RecyclerView*IDrawerItem interface was extended to better reflect a RecyclerView and to improve performanceAbstractDrawerItem to implement some common methods