mxn21 / FlowingDrawer

swipe display drawer with flowing & bouncing effects.
Apache License 2.0
2.57k stars 468 forks source link

A scrimColor / shadow issue #44

Closed qbai22 closed 7 years ago

qbai22 commented 7 years ago

I can't find a way to implement any activity shadowing as in your example gif, setScrimColor method is not available for FlowingDrawer object. Can you please help me?

mxn21 commented 7 years ago

you can check out the app/ folder and the sample app. There is no need to implement any activity. just put layout in the right way in xml . I don't understand what scrimColor mean ..

qbai22 commented 7 years ago

Thank you for your answer! I meant this shadow (see on picture). By default and in the sample app there is no any shadow overlay. So i wanted to ask how can i achieve it? shadow

mxn21 commented 7 years ago

HI, @qbai22 ,I haven't found a good way to set shadow .so I didn't use shadow. This needs to be improved.

syn3sthete commented 7 years ago

@qbai22 I have achieved the shadow effect by taking a long route.

  1. First create a window_dim.xml file in drawable folder and paste the below code: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#000000" /> </shape>

  2. Go to the activity where you want the shadow effect, after you have set the layout for the activity paste the below code: window.setForeground(ContextCompat.getDrawable(getBaseContext(), R.drawable.window_dim)); window.getForeground().setAlpha(0);

    NOTE: window the the view where you want the shadow effect.

  3. Now just use the OnDrawerStateChangeListener like the below code:

flowingDrawer.setOnDrawerStateChangeListener(new ElasticDrawer.OnDrawerStateChangeListener() { @Override public void onDrawerStateChange(int oldState, int newState) { } @Override public void onDrawerSlide(float openRatio, int offsetPixels) { window.getForeground().setAlpha(offsetPixels / 10); } });

This worked perfect for me, let me know if you have any doubts.

qbai22 commented 7 years ago

@syn3sthete wow you did a great job! Thanks i will try it in a short time!

syn3sthete commented 7 years ago

@qbai22 I am sure it will work because I was also looking solution for the same problem and implemented this, anyway let know how it worked for you and close the issue if the problem is fixed. Thanks :)

qbai22 commented 7 years ago

@syn3sthete all works great! Thanks