MaterialDrawer icon indicating copy to clipboard operation
MaterialDrawer copied to clipboard

Implement AccountHeaderish behaviour without flickering

Open couchcrew-thomas opened this issue 10 years ago • 3 comments

I want to implement a behaviour like the account header does:

A view inside the Header should replace the items with others. My current solution is to call drawer.removeAllItems() followed by drawer.addItems(myOtherItems...). This replaces the items as expected but the replacement takes ~500ms and flickers white. Also, the drawer scrolls to the bottom after replacement. Is there any way to mimic the AccountHeaders behaviour?

couchcrew-thomas avatar Feb 23 '16 11:02 couchcrew-thomas

@couchcrew-thomas you can even use the same API I use for the AccountHeader You can check out the source of the AccountHeader here: https://github.com/mikepenz/MaterialDrawer/blob/develop/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java#L1338 and the second spot here https://github.com/mikepenz/MaterialDrawer/blob/develop/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java#L1380

mikepenz avatar Feb 23 '16 11:02 mikepenz

Brilliant. switchDrawerContent(...) and resetDrawerContent() work as expected. Is there a way to preserve sticky footer items when switching content?

couchcrew-thomas avatar Feb 23 '16 13:02 couchcrew-thomas

@couchcrew-thomas hmmm it is the expected behavior that the switchDrawerContent also removes the sticky footer items. You may just simply readd them for the changed content too

mikepenz avatar Feb 23 '16 14:02 mikepenz