mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.67k stars 2.05k forks source link

Use without fitsSystemWindows #2613

Closed goodibunakov closed 4 years ago

goodibunakov commented 4 years ago

Hi Mike! Is there any way to use your lib without android:fitsSystemWindows="true"? I use one lib for youtube and if set android:fitsSystemWindows="true" videoframe not match parent when fullscreen on. But without fitsSystemWindows drawer looks crazy ))))

So, can you help?

mikepenz commented 4 years ago

@goodibunakov have you tried to handle the insets for your video frame by setting it to fitsSystemWindows = false?

or use something like that to handle insets? https://gist.github.com/PaeP3nguin/4e41f7e76be452fe2f78d3c534fb8dd1

v8 kind of tries to make full use of the system and just work with the APIs and insets the way they were meant.

previous v8 we would try to magically handle things which took away too much control from devs

goodibunakov commented 4 years ago

If I understood correctly, i can leave fitsSystemWindows="true" for DrawerLayout and put my videoView in InsetFrameLayout in xml?

mikepenz commented 4 years ago

so basically the fitsSystemWindow will tell the DrawerLayout that it can handle insets, and via that then the material drawer can handle its insets.

if you manually handle insets then for your video view that may be already sufficient. but you'd need to try it.

Also did you. have a look at the "FullscreenDrawer" sample activity?

It shows how the content can draw behind the statusbar

goodibunakov commented 4 years ago

Thanks Mike!

mikepenz commented 4 years ago

Please let me know if that helps. if not it would be great if you could create a sample to showcase the problem which makes it easier to assist / fix it :)

goodibunakov commented 4 years ago

Well, FullscreenDrawer helped. I use ViewCompat.setOnApplyWindowInsetsListener(root) { view, insets -> rootLayout.updatePadding(top = insets.systemWindowInsetTop) insets } where root is DrawerLayout and rootLayout is RelativeLayout inside DrawerLayout and it works!

mikepenz commented 4 years ago

Glad it works :)

goodibunakov commented 4 years ago

I'm sorry but... What determines the width of the shadow? How fix shadow shift? Maybe something like slider.method() in OnApplyWindowInsetsListener? изображение I use onConfigurationChanged() and shadow shift after first device rotate.

mikepenz commented 4 years ago

Which shadow @goodibunakov ? Is this reproducible in the sample app?

goodibunakov commented 4 years ago

Untitled-1 After rotate i have this. I cant find the way to fix it.

mikepenz commented 4 years ago

This doesn't seem to happen in the sample.

Could it be that you have a fitsSystemWindows flag somewhere in a not so good position perhaps?

goodibunakov commented 4 years ago

Mike, so what determines the width of the shadow? I mean this dark area.

mikepenz commented 4 years ago

Looks to me to be the fitsSystemWindows flag (from the Android system) which will apply the shadow for the navigation bar.

goodibunakov commented 4 years ago

In sample you set fitsSystemWindows = false (FullScreen) but you not use onConfigurationChanged(). If i remove android:configChanges from AndroidManifest everything is ok. But i have to use android:configChanges. And... I can't find what and where to do to fix this shadow :(

mikepenz commented 4 years ago

Usually those insets come from the system and are handled by it. but as you opt in to handle those manually :/

I guess that may results in the fitsSystemWindows true no longer working for the drawer itself.

does your theme somehow specify a transparent system UI?

goodibunakov commented 4 years ago

I have no transparency. I use youtube-player library. Activity has android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout" in manifest. After device rotate player goes to fullscreen it somehow set landscape. When player goes back - orientation again set portrait. And here i have my problem. fitsSystemWindows is setted for MaterialDrawerSliderView, not for DrawerLayout. If i set fitsSystemWindows for DrawerLayout, player fill not fullscreen, navigation bar stay.

mikepenz commented 4 years ago

this behavior can't be controlled by the view itself. either you want to be drawn behind system bars. that requires the fits system windows flags. or without it, it can't draw behind :(

I am afraid I don't know a good alternative to it :(