├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── wingjay
│ │ └── blurimageview
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── wingjay
│ │ │ └── blurimageview
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable
│ │ ├── medium_nm_1.jpeg
│ │ ├── medium_nm_2.jpeg
│ │ ├── medium_nm_3.jpeg
│ │ ├── medium_nm_4.jpeg
│ │ ├── medium_sm_1.jpeg
│ │ ├── medium_sm_2.jpeg
│ │ ├── medium_sm_3.jpeg
│ │ └── medium_sm_4.jpeg
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── content_main.xml
│ │ ├── menu
│ │ └── menu_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── wingjay
│ └── blurimageview
│ └── ExampleUnitTest.java
├── assets
├── 2015-11-12_10_40_13_tmp.mp4
└── blurImageView_nm.gif
├── blurimageviewlib
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── wingjay
│ │ └── blurimageviewlib
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── wingjay
│ │ │ └── blurimageviewlib
│ │ │ ├── BlurImageView.java
│ │ │ ├── FastBlurUtil.java
│ │ │ └── LoadingCircleProgressView.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── wingjay
│ └── blurimageviewlib
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── sample.apk
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle/*
2 | *.idea
3 | *.iml
4 | */*.iml
5 | local.properties
6 | build/*
7 | app/app.iml
8 | # Git merge file
9 | #####################
10 | *.orig
11 |
12 | server/.idea/
13 |
14 | # PIL generated file
15 | #####################
16 | *.pkl
17 |
18 | # OS generated files #
19 | ######################
20 | .DS_Store
21 | .DS_Store?
22 | ._*
23 | .Spotlight-V100
24 | .Trashes
25 |
26 | # Tags #
27 | ########
28 | tags
29 |
30 | # Backup file #
31 | ###############
32 | *.bak
33 |
34 | # Vim Temp files #
35 | ##################
36 | .*.sw*
37 | .sw*
38 | *.un~
39 |
40 | .sass-cache
41 | .git
42 |
43 | # android
44 | ###########################
45 | android.iml
46 |
47 | Status API Training Shop Blog About Pricing
48 | © 2015 GitHub, Inc. Terms Privacy Security Contact Help
49 |
50 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## v2.0
2 | 1. Add error handling for small & big image loading failure
3 |
4 | ## v1.1
5 | 1. Show loading progressBar upon the blurry image
6 | 2. Improve sample code for other developers
7 |
8 | ## v0.1
9 | 1. Support display the loading progress and customize the progressView style2. Improve the sample
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://android-arsenal.com/details/1/2768)
2 |
3 |
4 | # BlurImageView
5 | BlurImageView For Android, you can load your image progressively like [Medium](https://medium.com/@wing_jay/thinking-about-the-way-of-loading-picture-by-medium-4adfe792b437).
6 |
7 | ### How it works?
8 | 1. First it will show user a blurry image;
9 | 2. At the same time, it starts to load the real image;
10 | 3. once loaded, replace the blurry one automatically.
11 |
12 |
13 |
14 | ### Playable apk
15 | You can [Download sample apk](https://github.com/wingjay/blurimageview/blob/master/sample.apk) and play on your phone. Try it!
16 |
17 | ### Why I do this?
18 | This lib is inspired by [Medium](https://medium.com/@wing_jay/thinking-about-the-way-of-loading-picture-by-medium-4adfe792b437) and users love this way of loading pics, Because a beautiful Blurry pic is always better than a blank area or an ugly thumbnail.
19 |
20 | ### How to get it?
21 | Simply add the dependency
22 | ```
23 | dependencies {
24 | compile 'com.wingjay:blurimageviewlib:2.0.1'
25 | }
26 | ```
27 |
28 | ### How to use it?
29 | ```java
30 | BlurImageView blurImageView = (BlurImageView) findViewById(R.id.XXX);
31 | blurImageView.setBlurImageByUrl(blurImageUrl);
32 | ```
33 | This will **load and blur** a image.
34 | ```
35 | BlurImageView fullBlurImageView = (BlurImageView) findViewById(R.id.XXX)
36 | fullBlurImageView.setFullImageByUrl(blurImageUrl, normalImageUrl);
37 | ```
38 | This will **load two images progressively**.
39 | ```
40 | blurImageView.setBlurFactor(blurFactor);
41 | ```
42 | This can set the factor of blurry, default 8 - 10.
43 | ```java
44 | blurImageView.setFailDrawable(Drawable failDrawable);
45 | blurImageView.setDefaultDrawable(Drawable defaultDrawable);
46 | ```
47 | Configure your own drawable for loading failure & default. Use null to remove them.
48 |
49 |
50 |
51 | ### Related resource
52 | Thanks for the algorithms: `Stack Blur`: http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
53 |
54 | ### Reach me - wingjay
55 |
56 | Weibo: http://weibo.com/u/1625892654
57 |
58 | Blog: http://wingjay.com/
59 |
60 | GitHub: https://github.com/wingjay
61 |
62 | Feel free to give me advices by
63 |
64 |
65 | 
66 |
67 | **Thanks!**
68 |
69 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.wingjay.blurimageview"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.0'
26 | compile 'com.android.support:design:23.1.0'
27 | compile 'com.jakewharton:butterknife:7.0.1'
28 | compile project(':blurimageviewlib')
29 | compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
30 | }
31 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/jay/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/wingjay/blurimageview/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageview;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
15 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wingjay/blurimageview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageview;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Color;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.Toolbar;
9 | import android.text.Html;
10 | import android.view.View;
11 | import android.widget.Button;
12 | import android.widget.TextView;
13 |
14 | import com.wingjay.blurimageviewlib.BlurImageView;
15 |
16 | import butterknife.Bind;
17 | import butterknife.ButterKnife;
18 | import butterknife.OnClick;
19 |
20 | public class MainActivity extends AppCompatActivity {
21 |
22 | @Bind(R.id.fast_blur_btn)
23 | Button fastBlurBtn;
24 |
25 | @Bind(R.id.full_blur_image_view)
26 | BlurImageView blurImageView;
27 |
28 | @Bind(R.id.image_indicator)
29 | TextView imageIndicator;
30 |
31 | @Bind(R.id.about_author)
32 | TextView aboutAuthor;
33 |
34 | boolean alreadyLoad = false;
35 |
36 | int[] mediumSmRes = {
37 | R.drawable.medium_sm_1,
38 | R.drawable.medium_sm_2,
39 | R.drawable.medium_sm_3,
40 | R.drawable.medium_sm_4
41 | };
42 |
43 | int[] mediumNmRes = {
44 | R.drawable.medium_nm_1,
45 | R.drawable.medium_nm_2,
46 | R.drawable.medium_nm_3,
47 | R.drawable.medium_nm_4
48 | };
49 |
50 | String[] mediumSmUrl = {
51 | "http://upload-images.jianshu.io/upload_images/1825662-4c4e9bc7148749b7.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/62",
52 | "http://upload-images.jianshu.io/upload_images/1977600-c562e582d45a4dee.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/62",
53 | "http://upload-images.jianshu.io/upload_images/1761761-704c9d7ed34d112b.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/62",
54 | "http://upload-images.jianshu.io/upload_images/2557965-b224163bc8a4a695.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/62"
55 | };
56 |
57 | String[] mediumNmUrl = {
58 | "http://upload-images.jianshu.io/upload_images/1825662-4c4e9bc7148749b7.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/620",
59 | "http://upload-images.jianshu.io/upload_images/1977600-c562e582d45a4dee.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/620",
60 | "http://upload-images.jianshu.io/upload_images/1761761-704c9d7ed34d112b.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/620",
61 | "http://upload-images.jianshu.io/upload_images/2557965-b224163bc8a4a695.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/620"
62 | };
63 |
64 | int[] blurImageViewProgressBgColor = {
65 | Color.BLACK,
66 | Color.BLACK,
67 | Color.parseColor("#E29C45"),
68 | Color.parseColor("#E29C45"),
69 | };
70 |
71 | int[] blurImageViewProgressClor = {
72 | Color.WHITE,
73 | Color.parseColor("#789262"),
74 | Color.parseColor("#7BCFA6"),
75 | Color.parseColor("#519A73"),
76 | };
77 |
78 |
79 | int currentIndex = 0;
80 | int getResIndex() {
81 | if (currentIndex > 3) {
82 | currentIndex = currentIndex - 4;
83 | }
84 | return currentIndex;
85 | }
86 |
87 | @Override
88 | protected void onCreate(Bundle savedInstanceState) {
89 | super.onCreate(savedInstanceState);
90 | setContentView(R.layout.activity_main);
91 |
92 | ButterKnife.bind(this);
93 |
94 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
95 | setSupportActionBar(toolbar);
96 | String aboutAuthorString = "Find me here: wingjay (https://github.com/wingjay)";
97 | aboutAuthor.setText(Html.fromHtml(aboutAuthorString));
98 | aboutAuthor.setOnClickListener(new View.OnClickListener() {
99 | @Override
100 | public void onClick(View v) {
101 | Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/wingjay"));
102 | startActivity(browserIntent);
103 | }
104 | });
105 |
106 | }
107 |
108 | @OnClick(R.id.fast_blur_btn)
109 | void doFastBlur() {
110 | if (!alreadyLoad) {
111 | customizeBlurImageView();
112 |
113 | int blurFactor = BlurImageView.DEFAULT_BLUR_FACTOR;
114 | blurImageView.setBlurFactor(blurFactor);
115 | blurImageView.setFullImageByUrl(mediumSmUrl[getResIndex()], mediumNmUrl[getResIndex()]);
116 |
117 | alreadyLoad = true;
118 | fastBlurBtn.setText("Click and Clear current image");
119 | imageIndicator.setText((getResIndex() + 1) + "/" + mediumNmUrl.length);
120 | } else {
121 | blurImageView.clear();
122 |
123 | currentIndex++;
124 | alreadyLoad = false;
125 | fastBlurBtn.setText("Click to load new Image");
126 | }
127 | }
128 |
129 | private void customizeBlurImageView() {
130 | blurImageView.setProgressBarBgColor(blurImageViewProgressBgColor[getResIndex()]);
131 | blurImageView.setProgressBarColor(blurImageViewProgressClor[getResIndex()]);
132 | }
133 |
134 | @Override
135 | protected void onDestroy() {
136 | blurImageView.cancelImageRequestForSafty();
137 | super.onDestroy();
138 | }
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_nm_1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_nm_1.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_nm_2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_nm_2.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_nm_3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_nm_3.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_nm_4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_nm_4.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_sm_1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_sm_1.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_sm_2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_sm_2.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_sm_3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_sm_3.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/medium_sm_4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/drawable/medium_sm_4.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
23 |
24 |
31 |
32 |
37 |
38 |
44 |
45 |
50 |
51 |
57 |
58 |
64 |
65 |
66 |
67 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BlurImageView
3 | Settings
4 |
5 | Here is a Full blur imageView which will load two images, small one and normal one the small one will be blurry and once the normal one is loaded,replace the small one automatically.\nIn addition, it will cache image by itself.
6 |
7 |
8 | 上面是一个完整的BlurImageView,为了展示虚化加载效果,它会首先去获取小图并虚化显示给用户;同时去获取大图,一旦大图加载完毕,便进行显示.\n另外,BlurImageView会自动缓存图片.
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/test/java/com/wingjay/blurimageview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/assets/2015-11-12_10_40_13_tmp.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/assets/2015-11-12_10_40_13_tmp.mp4
--------------------------------------------------------------------------------
/assets/blurImageView_nm.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/assets/blurImageView_nm.gif
--------------------------------------------------------------------------------
/blurimageviewlib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/blurimageviewlib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 | apply plugin: 'com.jfrog.bintray'
4 | // Remember update version when library updates
5 | //./gradlew install; ./gradlew bintrayUpload
6 | // https://bintray.com/wingjay/maven/BlurImageView
7 | version = "2.0.1"
8 |
9 | android {
10 | resourcePrefix "wingjay_"
11 |
12 | compileSdkVersion 23
13 | buildToolsVersion "23.0.2"
14 |
15 | defaultConfig {
16 | minSdkVersion 15
17 | targetSdkVersion 23
18 | versionCode 1
19 | versionName "1.0"
20 | }
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | }
26 | }
27 | }
28 |
29 | dependencies {
30 | compile fileTree(dir: 'libs', include: ['*.jar'])
31 | testCompile 'junit:junit:4.12'
32 | compile 'com.android.support:appcompat-v7:23.1.0'
33 | compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
34 | }
35 | def siteUrl = 'https://github.com/wingjay/BlurImageView' // 项目的主页
36 | def gitUrl = 'https://github.com/wingjay/BlurImageView.git' // Git仓库的url
37 | group = "com.wingjay" // Maven Group ID for the artifact,一般填你唯一的包名
38 | install {
39 | repositories.mavenInstaller {
40 | // This generates POM.xml with proper parameters
41 | pom {
42 | project {
43 | packaging 'aar'
44 | // Add your description here
45 | name 'BlurImageView, you can load your image like Medium.First show user a blurry image, At the same time, load the real image, once loaded, replace the blurry one automatically' //项目描述
46 | url siteUrl
47 | // Set your license
48 | licenses {
49 | license {
50 | name 'The Apache Software License, Version 2.0'
51 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
52 | }
53 | }
54 | developers {
55 | developer {
56 | id 'wingjay' //填写开发者基本信息
57 | name 'wingjay'
58 | email 'yinjiesh@126.com'
59 | }
60 | }
61 | scm {
62 | connection gitUrl
63 | developerConnection gitUrl
64 | url siteUrl
65 | }
66 | }
67 | }
68 | }
69 | }
70 | task sourcesJar(type: Jar) {
71 | from android.sourceSets.main.java.srcDirs
72 | classifier = 'sources'
73 | }
74 | task javadoc(type: Javadoc) {
75 | source = android.sourceSets.main.java.srcDirs
76 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
77 | }
78 | task javadocJar(type: Jar, dependsOn: javadoc) {
79 | classifier = 'javadoc'
80 | from javadoc.destinationDir
81 | }
82 | artifacts {
83 | archives javadocJar
84 | archives sourcesJar
85 | }
86 | Properties properties = new Properties()
87 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
88 | bintray {
89 | user = properties.getProperty("bintray.user")
90 | key = properties.getProperty("bintray.apikey")
91 | configurations = ['archives']
92 | pkg {
93 | repo = "maven" //发布到Bintray的那个仓库里,默认账户有四个库,我们这里上传到maven库
94 | name = "BlurImageView" //发布到Bintray上的项目名字
95 | websiteUrl = siteUrl
96 | vcsUrl = gitUrl
97 | licenses = ["Apache-2.0"]
98 | publish = true
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/blurimageviewlib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/jay/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/blurimageviewlib/src/androidTest/java/com/wingjay/blurimageviewlib/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageviewlib;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/blurimageviewlib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/blurimageviewlib/src/main/java/com/wingjay/blurimageviewlib/BlurImageView.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageviewlib;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.graphics.Canvas;
7 | import android.graphics.Color;
8 | import android.graphics.ColorFilter;
9 | import android.graphics.Paint;
10 | import android.graphics.drawable.ColorDrawable;
11 | import android.graphics.drawable.Drawable;
12 | import android.util.AttributeSet;
13 | import android.util.Log;
14 | import android.view.View;
15 | import android.widget.ImageView;
16 | import android.widget.RelativeLayout;
17 |
18 | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
19 | import com.nostra13.universalimageloader.core.DisplayImageOptions;
20 | import com.nostra13.universalimageloader.core.ImageLoader;
21 | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
22 | import com.nostra13.universalimageloader.core.assist.FailReason;
23 | import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
24 | import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
25 | import com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener;
26 | import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
27 |
28 | /**
29 | * This imageView can show blur image.
30 | * Then it will be expanded to automatically display one image with two styles
31 | * one is small and blurry, another is the origin image,So here are two urls for these two images.
32 | */
33 | public class BlurImageView extends RelativeLayout {
34 |
35 | public final static int DEFAULT_BLUR_FACTOR = 8;
36 | private Context mContext;
37 |
38 | private int mBlurFactor = DEFAULT_BLUR_FACTOR;
39 |
40 | private String mBlurImageUrl, mOriginImageUrl;
41 | private int greyColor = Color.parseColor("#66CCCCCC");
42 | private Drawable defaultDrawable = new ColorDrawable(greyColor);
43 | private Drawable failDrawable = new Drawable() {
44 | Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
45 | @Override
46 | public void draw(Canvas canvas) {
47 | canvas.drawColor(greyColor);
48 | String failString = "load failure";
49 | canvas.translate((canvas.getWidth() - textPaint.measureText(failString)) / 2,
50 | canvas.getHeight()/2);
51 | textPaint.setColor(Color.DKGRAY);
52 | textPaint.setTextSize(30);
53 | canvas.drawText(failString, 0, failString.length(), textPaint);
54 | }
55 |
56 | @Override
57 | public void setAlpha(int alpha) {}
58 |
59 | @Override
60 | public void setColorFilter(ColorFilter colorFilter) {}
61 |
62 | @Override
63 | public int getOpacity() {
64 | return 0;
65 | }
66 | };
67 | private ImageLoader imageLoader;
68 | private DisplayImageOptions displayImageOptions;
69 |
70 | private ImageView imageView;
71 | private LoadingCircleProgressView loadingCircleProgressView;
72 |
73 | private boolean enableProgress = true;
74 |
75 | public BlurImageView(Context context) {
76 | this(context, null);
77 | }
78 |
79 | public BlurImageView(Context context, AttributeSet attrs) {
80 | this(context, attrs, 0);
81 | }
82 |
83 | public BlurImageView(Context context, AttributeSet attrs, int defStyleAttr) {
84 | super(context, attrs, defStyleAttr);
85 | this.mContext = context.getApplicationContext();
86 | init();
87 | }
88 |
89 | private void init() {
90 | initUIL();
91 | imageLoader = ImageLoader.getInstance();
92 |
93 | initChildView();
94 | initDisplayImageOptions();
95 | }
96 |
97 | private void initUIL() {
98 | ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(mContext);
99 | config.threadPriority(Thread.NORM_PRIORITY - 2);
100 | config.denyCacheImageMultipleSizesInMemory();
101 | config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
102 | config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
103 | config.tasksProcessingOrder(QueueProcessingType.LIFO);
104 | config.writeDebugLogs(); // Remove for release app
105 |
106 | // Initialize ImageLoader with configuration.
107 | ImageLoader.getInstance().init(config.build());
108 | }
109 |
110 | private void initDisplayImageOptions() {
111 | displayImageOptions = new DisplayImageOptions.Builder()
112 | .cacheOnDisk(true)
113 | .considerExifParams(true)
114 | .bitmapConfig(Bitmap.Config.RGB_565)
115 | .build();
116 | }
117 |
118 | private void initChildView() {
119 | imageView = new ImageView(mContext);
120 | imageView.setLayoutParams(
121 | new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
122 | imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
123 | imageView.setImageDrawable(defaultDrawable);
124 |
125 | loadingCircleProgressView = new LoadingCircleProgressView(mContext);
126 | LayoutParams progressBarLayoutParams =
127 | new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
128 | progressBarLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
129 | loadingCircleProgressView.setLayoutParams(progressBarLayoutParams);
130 | loadingCircleProgressView.setVisibility(GONE);
131 |
132 | addView(imageView);
133 | addView(loadingCircleProgressView);
134 | }
135 |
136 | private SimpleImageLoadingListener blurLoadingListener = new SimpleImageLoadingListener() {
137 | @Override
138 | public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
139 | imageView.setImageDrawable(failDrawable);
140 | }
141 |
142 | @Override
143 | public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
144 | imageView.setImageBitmap(getBlurBitmap(loadedImage));
145 | }
146 | };
147 |
148 | private SimpleImageLoadingListener fullLoadingListener = new SimpleImageLoadingListener() {
149 | @Override
150 | public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
151 | imageView.setImageDrawable(failDrawable);
152 | Log.e("Image Load error", "cannot load Small image, please check url or network status");
153 | }
154 |
155 | @Override
156 | public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
157 | imageView.setImageBitmap(getBlurBitmap(loadedImage));
158 | imageLoader.displayImage(mOriginImageUrl, imageView, displayImageOptions,
159 | new ImageLoadingListener() {
160 | @Override
161 | public void onLoadingStarted(String imageUri, View view) {
162 | setLoadingProgressRatio(5, 100);
163 | }
164 |
165 | @Override
166 | public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
167 | setLoadingProgressRatio(5, 100);
168 | Log.e("Image Load error", "cannot load Big image, please check url or network status");
169 | }
170 |
171 | @Override
172 | public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
173 | setLoadingProgressRatio(100, 100);
174 | }
175 |
176 | @Override
177 | public void onLoadingCancelled(String imageUri, View view) {
178 | Log.w("Image Load cancel", "the image loading process is cancelled");
179 | setLoadingProgressRatio(100, 100);
180 | }
181 | },
182 | new ImageLoadingProgressListener() {
183 | @Override
184 | public void onProgressUpdate(String imageUri, View view, int current, int total) {
185 | if (!enableProgress) {
186 | return;
187 | }
188 | setLoadingProgressRatio(current, total);
189 | }
190 | });
191 | }
192 | };
193 |
194 | private void setLoadingProgressRatio(int current, int total) {
195 | if (current < total) {
196 | if (loadingCircleProgressView.getVisibility() == GONE) {
197 | loadingCircleProgressView.setVisibility(VISIBLE);
198 | }
199 | loadingCircleProgressView.setCurrentProgressRatio((float) current / total);
200 | } else {
201 | loadingCircleProgressView.setVisibility(GONE);
202 | }
203 | }
204 |
205 | /**
206 | * This method will fetch bitmap from resource and make it blurry, display
207 | * @param blurImageRes the image resource id which is needed to be blurry
208 | */
209 | public void setBlurImageByRes(int blurImageRes) {
210 | buildDrawingCache();
211 | Bitmap blurBitmap = FastBlurUtil.doBlur(getDrawingCache(), mBlurFactor, true);
212 | imageView.setImageBitmap(blurBitmap);
213 | }
214 |
215 | /**
216 | * This image won't be blurry.
217 | * @param originImageRes The origin image resource id.
218 | */
219 | public void setOriginImageByRes(int originImageRes) {
220 | Bitmap originBitmap = BitmapFactory.decodeResource(mContext.getResources(), originImageRes);
221 | imageView.setImageBitmap(originBitmap);
222 | }
223 |
224 | public void setBlurImageByUrl(String blurImageUrl) {
225 | mBlurImageUrl = blurImageUrl;
226 | cancelImageRequestForSafty();
227 | imageLoader.loadImage(blurImageUrl, blurLoadingListener);
228 | }
229 |
230 | public void setOriginImageByUrl(String originImageUrl) {
231 | mOriginImageUrl = originImageUrl;
232 | imageLoader.displayImage(originImageUrl, imageView);
233 | }
234 |
235 | /**
236 | * This will load two Images literally. The small size blurry one and the big size original one.
237 | * @param blurImageUrl This is a small image url and will be loaded fast and will be blurry
238 | * automatically.
239 | * @param originImageUrl After show the blurry image, it will load the origin image automatically
240 | * and replace the blurry one after finish loading.
241 | */
242 | public void setFullImageByUrl(String blurImageUrl, String originImageUrl) {
243 | mBlurImageUrl = blurImageUrl;
244 | mOriginImageUrl = originImageUrl;
245 | cancelImageRequestForSafty();
246 | imageLoader.loadImage(blurImageUrl, displayImageOptions, fullLoadingListener);
247 | }
248 |
249 | private Bitmap getBlurBitmap(Bitmap loadedBitmap) {
250 | // make this bitmap mutable
251 | loadedBitmap = loadedBitmap.copy(loadedBitmap.getConfig(), true);
252 | return FastBlurUtil.doBlur(loadedBitmap, getBlurFactor(), true);
253 | }
254 |
255 | private int getBlurFactor() {
256 | return mBlurFactor;
257 | }
258 |
259 | public void setBlurFactor(int blurFactor) {
260 | if (blurFactor < 0) {
261 | throw new IllegalArgumentException("blurFactor must not be less than 0");
262 | }
263 | mBlurFactor = blurFactor;
264 | }
265 |
266 | public void cancelImageRequestForSafty() {
267 | imageLoader.cancelDisplayTask(imageView);
268 | }
269 |
270 | public void clear() {
271 | cancelImageRequestForSafty();
272 | imageView.setImageBitmap(null);
273 | }
274 |
275 | /**
276 | * If you disable progress, then it won't show a loading progress view when you're loading image.
277 | * Default the progress view is enabled.
278 | */
279 | public void disableProgress() {
280 | this.enableProgress = false;
281 | }
282 |
283 | public void setProgressBarBgColor(int bgColor) {
284 | this.loadingCircleProgressView.setProgressBgColor(bgColor);
285 | }
286 |
287 | public void setProgressBarColor(int color) {
288 | this.loadingCircleProgressView.setProgressColor(color);
289 | }
290 |
291 | public void setFailDrawable(Drawable failDrawable) {
292 | this.failDrawable = failDrawable;
293 | }
294 |
295 | public void setDefaultDrawable(Drawable defaultDrawable) {
296 | this.defaultDrawable = defaultDrawable;
297 | }
298 |
299 | }
300 |
--------------------------------------------------------------------------------
/blurimageviewlib/src/main/java/com/wingjay/blurimageviewlib/FastBlurUtil.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageviewlib;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * Created by jay on 11/7/15.
7 | */
8 | public class FastBlurUtil {
9 |
10 | public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) {
11 |
12 | // Stack Blur v1.0 from
13 | // http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
14 | //
15 | // Java Author: Mario Klingemann
16 | // http://incubator.quasimondo.com
17 | // created Feburary 29, 2004
18 | // Android port : Yahel Bouaziz
19 | // http://www.kayenko.com
20 | // ported april 5th, 2012
21 |
22 | // This is a compromise between Gaussian Blur and Box blur
23 | // It creates much better looking blurs than Box Blur, but is
24 | // 7x faster than my Gaussian Blur implementation.
25 | //
26 | // I called it Stack Blur because this describes best how this
27 | // filter works internally: it creates a kind of moving stack
28 | // of colors whilst scanning through the image. Thereby it
29 | // just has to add one new block of color to the right side
30 | // of the stack and remove the leftmost color. The remaining
31 | // colors on the topmost layer of the stack are either added on
32 | // or reduced by one, depending on if they are on the right or
33 | // on the left side of the stack.
34 | //
35 | // If you are using this algorithm in your code please add
36 | // the following line:
37 | //
38 | // Stack Blur Algorithm by Mario Klingemann
39 |
40 | Bitmap bitmap;
41 | if (canReuseInBitmap) {
42 | bitmap = sentBitmap;
43 | } else {
44 | bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
45 | }
46 |
47 | if (radius < 1) {
48 | return (null);
49 | }
50 |
51 | int w = bitmap.getWidth();
52 | int h = bitmap.getHeight();
53 |
54 | int[] pix = new int[w * h];
55 | bitmap.getPixels(pix, 0, w, 0, 0, w, h);
56 |
57 | int wm = w - 1;
58 | int hm = h - 1;
59 | int wh = w * h;
60 | int div = radius + radius + 1;
61 |
62 | int r[] = new int[wh];
63 | int g[] = new int[wh];
64 | int b[] = new int[wh];
65 | int rsum, gsum, bsum, x, y, i, p, yp, yi, yw;
66 | int vmin[] = new int[Math.max(w, h)];
67 |
68 | int divsum = (div + 1) >> 1;
69 | divsum *= divsum;
70 | int dv[] = new int[256 * divsum];
71 | for (i = 0; i < 256 * divsum; i++) {
72 | dv[i] = (i / divsum);
73 | }
74 |
75 | yw = yi = 0;
76 |
77 | int[][] stack = new int[div][3];
78 | int stackpointer;
79 | int stackstart;
80 | int[] sir;
81 | int rbs;
82 | int r1 = radius + 1;
83 | int routsum, goutsum, boutsum;
84 | int rinsum, ginsum, binsum;
85 |
86 | for (y = 0; y < h; y++) {
87 | rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
88 | for (i = -radius; i <= radius; i++) {
89 | p = pix[yi + Math.min(wm, Math.max(i, 0))];
90 | sir = stack[i + radius];
91 | sir[0] = (p & 0xff0000) >> 16;
92 | sir[1] = (p & 0x00ff00) >> 8;
93 | sir[2] = (p & 0x0000ff);
94 | rbs = r1 - Math.abs(i);
95 | rsum += sir[0] * rbs;
96 | gsum += sir[1] * rbs;
97 | bsum += sir[2] * rbs;
98 | if (i > 0) {
99 | rinsum += sir[0];
100 | ginsum += sir[1];
101 | binsum += sir[2];
102 | } else {
103 | routsum += sir[0];
104 | goutsum += sir[1];
105 | boutsum += sir[2];
106 | }
107 | }
108 | stackpointer = radius;
109 |
110 | for (x = 0; x < w; x++) {
111 |
112 | r[yi] = dv[rsum];
113 | g[yi] = dv[gsum];
114 | b[yi] = dv[bsum];
115 |
116 | rsum -= routsum;
117 | gsum -= goutsum;
118 | bsum -= boutsum;
119 |
120 | stackstart = stackpointer - radius + div;
121 | sir = stack[stackstart % div];
122 |
123 | routsum -= sir[0];
124 | goutsum -= sir[1];
125 | boutsum -= sir[2];
126 |
127 | if (y == 0) {
128 | vmin[x] = Math.min(x + radius + 1, wm);
129 | }
130 | p = pix[yw + vmin[x]];
131 |
132 | sir[0] = (p & 0xff0000) >> 16;
133 | sir[1] = (p & 0x00ff00) >> 8;
134 | sir[2] = (p & 0x0000ff);
135 |
136 | rinsum += sir[0];
137 | ginsum += sir[1];
138 | binsum += sir[2];
139 |
140 | rsum += rinsum;
141 | gsum += ginsum;
142 | bsum += binsum;
143 |
144 | stackpointer = (stackpointer + 1) % div;
145 | sir = stack[(stackpointer) % div];
146 |
147 | routsum += sir[0];
148 | goutsum += sir[1];
149 | boutsum += sir[2];
150 |
151 | rinsum -= sir[0];
152 | ginsum -= sir[1];
153 | binsum -= sir[2];
154 |
155 | yi++;
156 | }
157 | yw += w;
158 | }
159 | for (x = 0; x < w; x++) {
160 | rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
161 | yp = -radius * w;
162 | for (i = -radius; i <= radius; i++) {
163 | yi = Math.max(0, yp) + x;
164 |
165 | sir = stack[i + radius];
166 |
167 | sir[0] = r[yi];
168 | sir[1] = g[yi];
169 | sir[2] = b[yi];
170 |
171 | rbs = r1 - Math.abs(i);
172 |
173 | rsum += r[yi] * rbs;
174 | gsum += g[yi] * rbs;
175 | bsum += b[yi] * rbs;
176 |
177 | if (i > 0) {
178 | rinsum += sir[0];
179 | ginsum += sir[1];
180 | binsum += sir[2];
181 | } else {
182 | routsum += sir[0];
183 | goutsum += sir[1];
184 | boutsum += sir[2];
185 | }
186 |
187 | if (i < hm) {
188 | yp += w;
189 | }
190 | }
191 | yi = x;
192 | stackpointer = radius;
193 | for (y = 0; y < h; y++) {
194 | // Preserve alpha channel: ( 0xff000000 & pix[yi] )
195 | pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum];
196 |
197 | rsum -= routsum;
198 | gsum -= goutsum;
199 | bsum -= boutsum;
200 |
201 | stackstart = stackpointer - radius + div;
202 | sir = stack[stackstart % div];
203 |
204 | routsum -= sir[0];
205 | goutsum -= sir[1];
206 | boutsum -= sir[2];
207 |
208 | if (x == 0) {
209 | vmin[y] = Math.min(y + r1, hm) * w;
210 | }
211 | p = x + vmin[y];
212 |
213 | sir[0] = r[p];
214 | sir[1] = g[p];
215 | sir[2] = b[p];
216 |
217 | rinsum += sir[0];
218 | ginsum += sir[1];
219 | binsum += sir[2];
220 |
221 | rsum += rinsum;
222 | gsum += ginsum;
223 | bsum += binsum;
224 |
225 | stackpointer = (stackpointer + 1) % div;
226 | sir = stack[stackpointer];
227 |
228 | routsum += sir[0];
229 | goutsum += sir[1];
230 | boutsum += sir[2];
231 |
232 | rinsum -= sir[0];
233 | ginsum -= sir[1];
234 | binsum -= sir[2];
235 |
236 | yi += w;
237 | }
238 | }
239 |
240 | bitmap.setPixels(pix, 0, w, 0, 0, w, h);
241 |
242 | return (bitmap);
243 | }
244 |
245 | }
246 |
--------------------------------------------------------------------------------
/blurimageviewlib/src/main/java/com/wingjay/blurimageviewlib/LoadingCircleProgressView.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageviewlib;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.RectF;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 |
11 | /**
12 | * A circle progressBar which can change with the real loading progress ratio.
13 | */
14 | public class LoadingCircleProgressView extends View {
15 |
16 | private float currentProgressRatio = 0.6f;
17 |
18 | private int defaultSize = 80;
19 | private int defaultStrokeWidth = 10;
20 | private int strokeWidth = defaultStrokeWidth;
21 | private int radius = (defaultSize) / 2 - defaultStrokeWidth;
22 |
23 | private Paint bgPaint;
24 | private RectF rectF;
25 | private Paint progressPaint;
26 |
27 | private int progressBgColor = Color.BLACK;
28 | private int progressColor = Color.WHITE;
29 |
30 | public LoadingCircleProgressView(Context context) {
31 | this(context, null);
32 | }
33 |
34 | public LoadingCircleProgressView(Context context, AttributeSet attrs) {
35 | this(context, attrs, 0);
36 | }
37 |
38 | public LoadingCircleProgressView(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | init();
41 | }
42 |
43 | private void init() {
44 | rectF = new RectF();
45 |
46 | bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
47 | bgPaint.setStyle(Paint.Style.STROKE);
48 | bgPaint.setStrokeWidth(defaultStrokeWidth);
49 | progressPaint = new Paint(bgPaint);
50 |
51 | setupPaintColor();
52 | }
53 |
54 | private void setupPaintColor() {
55 | progressBgColor = 0XAA000000 | progressBgColor;
56 | progressColor = 0XEE000000 | progressColor;
57 | bgPaint.setColor(progressBgColor);
58 | progressPaint.setColor(progressColor);
59 | }
60 |
61 | @Override
62 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
63 | int width = MeasureSpec.getSize(widthMeasureSpec);
64 | int height = MeasureSpec.getSize(heightMeasureSpec);
65 | if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY) {
66 | width = Math.max(width, defaultSize);
67 | } else {
68 | width = defaultSize;
69 | }
70 | if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) {
71 | height = Math.max(height, defaultSize);
72 | } else {
73 | height = defaultSize;
74 | }
75 | setMeasuredDimension(width, height);
76 |
77 | width = Math.min(width, height);
78 | height = width;
79 | strokeWidth = Math.min(width / 5, defaultStrokeWidth);
80 | radius = (width - strokeWidth) / 2;
81 | }
82 |
83 | @Override
84 | protected void onDraw(Canvas canvas) {
85 | super.onDraw(canvas);
86 | bgPaint.setStrokeWidth(strokeWidth - 2);
87 | progressPaint.setStrokeWidth(strokeWidth);
88 |
89 | // bg Arc
90 | rectF.set(getHalfStrokeWidth(), getHalfStrokeWidth(),
91 | radius * 2 - getHalfStrokeWidth(), radius * 2 - getHalfStrokeWidth());
92 | canvas.drawArc(rectF, 0, 360, false, bgPaint);
93 |
94 | // progress Arc
95 | canvas.rotate(-90, radius, radius);
96 | canvas.drawArc(rectF, 0, getCurrentDegree(), false, progressPaint);
97 |
98 | }
99 |
100 | public void setCurrentProgressRatio(float currentProgressRatio) {
101 | if (currentProgressRatio < 0.0f) {
102 | currentProgressRatio = 0.f;
103 | }
104 | if (currentProgressRatio > 1.f) {
105 | currentProgressRatio = 1.f;
106 | }
107 | this.currentProgressRatio = currentProgressRatio;
108 | invalidate();
109 | }
110 |
111 | public void setProgressBgColor(int progressBgColor) {
112 | this.progressBgColor = progressBgColor;
113 | setupPaintColor();
114 | invalidate();
115 | }
116 |
117 | public void setProgressColor(int progressColor) {
118 | this.progressColor = progressColor;
119 | setupPaintColor();
120 | invalidate();
121 | }
122 |
123 | private int getHalfStrokeWidth() {
124 | return strokeWidth / 2;
125 | }
126 |
127 | private int getCurrentDegree() {
128 | return Math.min(360, (int) (currentProgressRatio * 360));
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/blurimageviewlib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BlurImageViewLib
3 |
4 |
--------------------------------------------------------------------------------
/blurimageviewlib/src/test/java/com/wingjay/blurimageviewlib/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.wingjay.blurimageviewlib;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.0'
9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Oct 21 11:34:03 PDT 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/sample.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wingjay/BlurImageView/964f728c0360344b67f6a6700a5aaf827812f66d/sample.apk
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':blurimageviewlib'
2 |
--------------------------------------------------------------------------------