mmin18 / RealtimeBlurView

A realtime blurring overlay for Android (like iOS UIVisualEffectView)
Other
3.21k stars 350 forks source link

Context doesn't extend Activity #3

Closed gkravas closed 8 years ago

gkravas commented 8 years ago

On ViewTreeObserver.OnPreDrawListener.onPreDraw getContext() doesn't return an Activity but a ContextThemeWrapper. Activity extends ContextThemeWrapper. In my app I use only one activity and then handle fragments through back stack.

At line 194 View decor = ((Activity) getContext()).getWindow().getDecorView(); an exception is being thrown java.lang.ClassCastException: android.support.v7.view.ContextThemeWrapper cannot be cast to android.app.Activity.

It seems more appropriate to replace it with this View decor = ((Activity) ((ContextThemeWrapper) getContext()).getBaseContext()).getWindow().getDecorView();

mmin18 commented 8 years ago

Fixed in v1.0.4, can you check

gkravas commented 8 years ago

Nice :)