View Filters
At the beginning the only purpose was to blur all layers below. Now you can do more :
- Blur background views easily
- Create custom filters and apply them to views backgrounds
Screenshot
Usage
First add jitpack to your projects build.gradle file
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Then add the dependency in modules build.gradle file
dependencies {
compile 'com.github.mirrajabi:view-effects:e355a1bac4'
}
Just do the normal ui stuff
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/root_view">
<View
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="100dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="10dp"
android:id="@+id/my_view"/>
</RelativeLayout>
Then in your code :
ViewFilter.getInstance(this)
//Use blur effect or implement your custom IRenderer
.setRenderer(new BlurRenderer(16))
.applyFilterOnView(findViewById(R.id.my_view),
findViewById(R.id.root_view));
You can also implement your own IRenderer and use it as the renderer. in some situations you might want the view background to handle it yourself
ViewFilter.getInstance(this)
.getFilteredBackgroundOfView(findViewById(R.id.my_view),
findViewById(R.id.root_view));