@@ -30,16 +30,7 @@ BlurKit is faster than other blurring libraries due to a number of bitmap retrie
3030This results in an average work/frame time of 2-4ms, which will be a seamless experience for most users and apps.
3131
3232## Setup
33- First add this line to the repositories block to the app level ` build.gradle ` :
34- ``` groovy
35- repositories {
36- maven {
37- url "https://camerakit.bintray.com/other"
38- }
39- }
40- ```
41-
42- Then add __ BlurKit__ to the dependencies block of the same app level ` build.gradle ` :
33+ Add __ BlurKit__ to the dependencies block of the app level ` build.gradle ` :
4334``` groovy
4435dependencies {
4536 implementation 'io.alterac.blurkit:blurkit:1.0.0'
@@ -48,50 +39,42 @@ dependencies {
4839
4940## Usage
5041### BlurLayout
51- Add a ` BlurLayout ` to your layout just like any other view.
42+ Add a ` BlurLayout ` to your XML layout just like any other view.
5243
5344``` xml
54- <com .wonderkiln .blurkit.BlurLayout
45+ <io .alterac .blurkit.BlurLayout
5546 android : id =" @+id/blurLayout"
5647 android : layout_width =" 150dp"
57- android : layout_height =" 150dp" >
58-
59- <TextView
60- android : layout_width =" wrap_content"
61- android : layout_height =" wrap_content"
62- android : layout_gravity =" center"
63- android : text =" BlurKit!"
64- android : textColor =" @android:color/white" />
65-
66- </com .wonderkiln.blurkit.BlurLayout>
48+ android : layout_height =" 150dp" />
6749```
6850In the ` Main_Activity.java ` you need to override the ` onStart() ` and ` onStop() ` methods to include the ` BlurLayout ` functionality.
6951``` java
70- @Override
71- protected void onCreate(Bundle savedInstanceState) {
72- super . onCreate(savedInstanceState);
73- setContentView(R . layout. activity_main);
74- blurLayout = findViewById(R . id. blurLayout);
75- }
52+ BlurLayout blurLayout;
7653
77- @Override
78- protected void onStart() {
79- super . onStart();
80- blurLayout. startBlur();
54+ @Override
55+ protected void onCreate(Bundle savedInstanceState) {
56+ super . onCreate(savedInstanceState);
57+ setContentView(R . layout. activity_main);
58+ blurLayout = findViewById(R . id. blurLayout);
59+ }
8160
82- }
61+ @Override
62+ protected void onStart() {
63+ super . onStart();
64+ blurLayout. startBlur();
65+ }
8366
84- @Override
85- protected void onStop() {
86- blurLayout. pauseBlur();
87- super . onStop();
88- }
67+ @Override
68+ protected void onStop() {
69+ blurLayout. pauseBlur();
70+ super . onStop();
71+ }
8972```
9073
9174The layout background will continuously blur the content behind it. If you know your background content will be somewhat static, you can set the layout ` fps ` to ` 0 ` . At any time you can re-blur the background content by calling ` invalidate() ` on the ` BlurLayout ` .
9275
9376``` xml
94- <io .alterac.blurkit.BlurLayout xmlns : blurkit = " http://schemas.android.com/apk/res-auto "
77+ <io .alterac.blurkit.BlurLayout
9578 android : id =" @+id/blurLayout"
9679 android : layout_width =" 150dp"
9780 android : layout_height =" 150dp"
@@ -101,7 +84,7 @@ The layout background will continuously blur the content behind it. If you know
10184Other attributes you can configure are the blur radius and the downscale factor. Getting these to work together well can take some experimentation. The downscale factor is a performance optimization; the bitmap for the background content will be downsized by this factor before being drawn and blurred.
10285
10386``` xml
104- <io .alterac.blurkit.BlurLayout xmlns : blurkit = " http://schemas.android.com/apk/res-auto "
87+ <io .alterac.blurkit.BlurLayout
10588 android : id =" @+id/blurLayout"
10689 android : layout_width =" 150dp"
10790 android : layout_height =" 150dp"
@@ -146,7 +129,7 @@ BlurKit.getInstance().fastBlur(View src, int radius, float downscaleFactor);
146129- [ ] Enhance retrieval of background content to only include views drawn behind the ` BlurLayout ` .
147130
148131## License
149- BlurKit is [ MIT licensed] ( https://github.com/wonderkiln /blurkit-android/blob/master/LICENSE ) .
132+ BlurKit is [ MIT licensed] ( https://github.com/CameraKit /blurkit-android/blob/master/LICENSE ) .
150133
151134---
152135 Blurkit is a sister project of [ CameraKit] ( https://github.com/CameraKit/camerakit-android ) and maintained by the CameraKit team.
0 commit comments