├── .gitignore
├── AndroidManifest.xml
├── LICENSE
├── MaterialDemo
├── AndroidManifest.xml
├── ic_launcher-web.png
├── libs
│ └── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ ├── layout
│ │ └── activity_main.xml
│ └── values
│ │ ├── strings.xml
│ │ └── styles.xml
└── src
│ └── com
│ └── example
│ └── materialdemo
│ └── MainActivity.java
├── proguard-project.txt
├── project.properties
├── readme.md
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
└── values
│ └── attrs.xml
└── src
└── org
└── simple
└── MaterialLayout.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.project
2 | *.classpath
3 | bin/
4 | gen/
5 | *.DS_Store
6 | */bin/
7 | */gen/
8 | .settings/
9 | # Built application files
10 | *.apk
11 | *.ap_
12 |
13 | # Files for the Dalvik VM
14 | *.dex
15 |
16 | # Java class files
17 | *.class
18 |
19 | # Generated files
20 | bin/
21 | gen/
22 |
23 | # Gradle files
24 | .gradle/
25 | build/
26 |
27 | # Local configuration file (sdk path, etc)
28 | local.properties
29 |
30 | # Proguard folder generated by Eclipse
31 | proguard/
32 |
33 | # Log Files
34 | *.log
35 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Mr.Simple
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/MaterialDemo/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/MaterialDemo/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/MaterialDemo/ic_launcher-web.png
--------------------------------------------------------------------------------
/MaterialDemo/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/MaterialDemo/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/MaterialDemo/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/MaterialDemo/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-10
15 | android.library.reference.1=..
16 |
--------------------------------------------------------------------------------
/MaterialDemo/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/MaterialDemo/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDemo/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/MaterialDemo/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDemo/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/MaterialDemo/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDemo/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/MaterialDemo/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDemo/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
21 |
22 |
32 |
33 |
40 |
41 |
47 |
48 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/MaterialDemo/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | MaterialDemo
5 | 点击一下
6 | TextView In ViewGroup
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MaterialDemo/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MaterialDemo/src/com/example/materialdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package com.example.materialdemo;
3 |
4 | import android.app.Activity;
5 | import android.os.Bundle;
6 |
7 | public class MainActivity extends Activity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_main);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-10
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | MaterialLayout
2 | ===================
3 | MaterialLayout是一个能够在低版本的Android 系统中实现点击布局中任何视图都会产生波纹效果的布局,它继承自RelativeLayout,因此能够当做普通的RelativeLayout使用,如果需要其他布局实现该功能,参考该布局实现即可。也可以使用Proxy代理所有的操作,将各个操作封装到一个代理类中,布局类只需要调用代理类来完成相应的工作即可,这样在多种布局都实现这种效果时能够避免代码重复。
4 | MaterialLayout的使用示例如下:
5 | ```xml
6 |
7 |
19 |
20 |
28 |
29 |
39 |
40 |
41 | ```
42 |
43 | 注意不要com.example.materialdemo替换为你工程的包名。
44 | 运行一下就可以看到效果了。
45 |
46 |
47 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hehonghui/materiallayout/3dbf400aceb39a06771a1089f96840fb2c208f90/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/org/simple/MaterialLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2015 bboyfeiyu@gmail.com ( mr.simple )
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package org.simple;
26 |
27 | import android.content.Context;
28 | import android.content.res.TypedArray;
29 | import android.graphics.Canvas;
30 | import android.graphics.Color;
31 | import android.graphics.Paint;
32 | import android.graphics.Point;
33 | import android.graphics.RectF;
34 | import android.util.AttributeSet;
35 | import android.view.MotionEvent;
36 | import android.view.View;
37 | import android.view.ViewGroup;
38 | import android.widget.RelativeLayout;
39 |
40 | import org.simple.materiallayout.R;
41 |
42 | /**
43 | * MaterialLayout是模拟Android 5.0中View被点击的波纹效果的布局,与其他的模拟Material
44 | * Desigin效果的View不同,所有在MaterialLayout布局下的子视图被点击时都会产生波纹效果,而不是某个特定的View才会有这样的效果.
45 | *
46 | * @author mrsimple
47 | */
48 | public class MaterialLayout extends RelativeLayout {
49 |
50 | private static final int DEFAULT_RADIUS = 10;
51 | private static final int DEFAULT_FRAME_RATE = 10;
52 | private static final int DEFAULT_DURATION = 200;
53 | private static final int DEFAULT_ALPHA = 255;
54 | private static final float DEFAULT_SCALE = 0.8f;
55 | private static final int DEFAULT_ALPHA_STEP = 5;
56 |
57 | /**
58 | * 动画帧率
59 | */
60 | private int mFrameRate = DEFAULT_FRAME_RATE;
61 | /**
62 | * 渐变动画持续时间
63 | */
64 | private int mDuration = DEFAULT_DURATION;
65 | /**
66 | *
67 | */
68 | private Paint mPaint = new Paint();
69 | /**
70 | * 被点击的视图的中心点
71 | */
72 | private Point mCenterPoint = null;
73 | /**
74 | * 视图的Rect
75 | */
76 | private RectF mTargetRectf;
77 | /**
78 | * 起始的圆形背景半径
79 | */
80 | private int mRadius = DEFAULT_RADIUS;
81 | /**
82 | * 最大的半径
83 | */
84 | private int mMaxRadius = DEFAULT_RADIUS;
85 |
86 | /**
87 | * 渐变的背景色
88 | */
89 | private int mCirclelColor = Color.LTGRAY;
90 | /**
91 | * 每次重绘时半径的增幅
92 | */
93 | private int mRadiusStep = 1;
94 | /**
95 | * 保存用户设置的alpha值
96 | */
97 | private int mBackupAlpha;
98 |
99 | /**
100 | * 圆形半径针对于被点击视图的缩放比例,默认为0.8
101 | */
102 | private float mCircleScale = DEFAULT_SCALE;
103 | /**
104 | * 颜色的alpha值, (0, 255)
105 | */
106 | private int mColorAlpha = DEFAULT_ALPHA;
107 | /**
108 | * 每次动画Alpha的渐变递减值
109 | */
110 | private int mAlphaStep = DEFAULT_ALPHA_STEP;
111 |
112 | private View mTargetView;
113 |
114 | /**
115 | * @param context
116 | */
117 | public MaterialLayout(Context context) {
118 | this(context, null);
119 | }
120 |
121 | public MaterialLayout(Context context, AttributeSet attrs) {
122 | super(context, attrs);
123 | init(context, attrs);
124 | }
125 |
126 | public MaterialLayout(Context context, AttributeSet attrs, int defStyle) {
127 | super(context, attrs, defStyle);
128 | init(context, attrs);
129 | }
130 |
131 | private void init(Context context, AttributeSet attrs) {
132 | if (isInEditMode()) {
133 | return;
134 | }
135 |
136 | if (attrs != null) {
137 | initTypedArray(context, attrs);
138 | }
139 |
140 | initPaint();
141 |
142 | this.setWillNotDraw(false);
143 | this.setDrawingCacheEnabled(true);
144 | }
145 |
146 | private void initTypedArray(Context context, AttributeSet attrs) {
147 | final TypedArray typedArray = context.obtainStyledAttributes(attrs,
148 | R.styleable.MaterialLayout);
149 | mCirclelColor = typedArray.getColor(R.styleable.MaterialLayout_color, Color.LTGRAY);
150 | mDuration = typedArray.getInteger(R.styleable.MaterialLayout_duration,
151 | DEFAULT_DURATION);
152 | mFrameRate = typedArray
153 | .getInteger(R.styleable.MaterialLayout_framerate, DEFAULT_FRAME_RATE);
154 | mColorAlpha = typedArray.getInteger(R.styleable.MaterialLayout_alpha, DEFAULT_ALPHA);
155 | mCircleScale = typedArray.getFloat(R.styleable.MaterialLayout_scale, DEFAULT_SCALE);
156 |
157 | typedArray.recycle();
158 |
159 | }
160 |
161 | private void initPaint() {
162 | mPaint.setAntiAlias(true);
163 | mPaint.setStyle(Paint.Style.FILL);
164 | mPaint.setColor(mCirclelColor);
165 | mPaint.setAlpha(mColorAlpha);
166 |
167 | // 备份alpha属性用于动画完成时重置
168 | mBackupAlpha = mColorAlpha;
169 | }
170 |
171 | /**
172 | * 点击的某个坐标点是否在View的内部
173 | *
174 | * @param touchView
175 | * @param x 被点击的x坐标
176 | * @param y 被点击的y坐标
177 | * @return 如果点击的坐标在该view内则返回true,否则返回false
178 | */
179 | private boolean isInFrame(View touchView, float x, float y) {
180 | initViewRect(touchView);
181 | return mTargetRectf.contains(x, y);
182 | }
183 |
184 | /**
185 | * 获取点中的区域,屏幕绝对坐标值,这个高度值也包含了状态栏和标题栏高度
186 | *
187 | * @param touchView
188 | */
189 | private void initViewRect(View touchView) {
190 | int[] location = new int[2];
191 | touchView.getLocationOnScreen(location);
192 | // 视图的区域
193 | mTargetRectf = new RectF(location[0], location[1], location[0]
194 | + touchView.getWidth(), location[1] + touchView.getHeight());
195 |
196 | }
197 |
198 | /**
199 | * 减去状态栏和标题栏的高度
200 | */
201 | private void removeExtraHeight() {
202 | int[] location = new int[2];
203 | this.getLocationOnScreen(location);
204 | // 减去两个该布局的top,这个top值就是状态栏的高度
205 | mTargetRectf.top -= location[1];
206 | mTargetRectf.bottom -= location[1];
207 | // 计算中心点坐标
208 | int centerHorizontal = (int) (mTargetRectf.left + mTargetRectf.right) / 2;
209 | int centerVertical = (int) ((mTargetRectf.top + mTargetRectf.bottom) / 2);
210 | // 获取中心点
211 | mCenterPoint = new Point(centerHorizontal, centerVertical);
212 |
213 | }
214 |
215 | private View findTargetView(ViewGroup viewGroup, float x, float y) {
216 | int childCount = viewGroup.getChildCount();
217 | // 迭代查找被点击的目标视图
218 | for (int i = 0; i < childCount; i++) {
219 | View childView = viewGroup.getChildAt(i);
220 | if (childView instanceof ViewGroup) {
221 | return findTargetView((ViewGroup) childView, x, y);
222 | } else if (isInFrame(childView, x, y)) { // 否则判断该点是否在该View的frame内
223 | return childView;
224 | }
225 | }
226 |
227 | return null;
228 | }
229 |
230 | private boolean isAnimEnd() {
231 | return mRadius >= mMaxRadius;
232 | }
233 |
234 | private void calculateMaxRadius(View view) {
235 | // 取视图的最长边
236 | int maxLength = Math.max(view.getWidth(), view.getHeight());
237 | // 计算Ripple圆形的半径
238 | mMaxRadius = (int) ((maxLength / 2) * mCircleScale);
239 |
240 | int redrawCount = mDuration / mFrameRate;
241 | // 计算每次动画半径的增值
242 | mRadiusStep = (mMaxRadius - DEFAULT_RADIUS) / redrawCount;
243 | // 计算每次alpha递减的值
244 | mAlphaStep = (mColorAlpha - 100) / redrawCount;
245 | }
246 |
247 | /**
248 | * 处理ACTION_DOWN触摸事件, 注意这里获取的是Raw x, y,
249 | * 即屏幕的绝对坐标,但是这个当屏幕中有状态栏和标题栏时就需要去掉这些高度,因此得到mTargetRectf后其高度需要减去该布局的top起点
250 | * ,也就是标题栏和状态栏的总高度.
251 | *
252 | * @param event
253 | */
254 | private void deliveryTouchDownEvent(MotionEvent event) {
255 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
256 | mTargetView = findTargetView(this, event.getRawX(), event.getRawY());
257 | if (mTargetView != null) {
258 | removeExtraHeight();
259 | // 计算相关数据
260 | calculateMaxRadius(mTargetView);
261 | // 重绘视图
262 | invalidate();
263 | }
264 | }
265 | }
266 |
267 | @Override
268 | public boolean onInterceptTouchEvent(MotionEvent event) {
269 | deliveryTouchDownEvent(event);
270 | return super.onInterceptTouchEvent(event);
271 | }
272 |
273 | @Override
274 | protected void dispatchDraw(Canvas canvas) {
275 | super.dispatchDraw(canvas);
276 | // 绘制Circle
277 | drawRippleIfNecessary(canvas);
278 | }
279 |
280 | private void drawRippleIfNecessary(Canvas canvas) {
281 | if (isFoundTouchedSubView()) {
282 | // 计算新的半径和alpha值
283 | mRadius += mRadiusStep;
284 | mColorAlpha -= mAlphaStep;
285 |
286 | // 裁剪一块区域,这块区域就是被点击的View的区域.通过clipRect来获取这块区域,使得绘制操作只能在这个区域范围内的进行,
287 | // 即使绘制的内容大于这块区域,那么大于这块区域的绘制内容将不可见. 这样保证了背景层只能绘制在被点击的视图的区域
288 | canvas.clipRect(mTargetRectf);
289 | mPaint.setAlpha(mColorAlpha);
290 | // 绘制背景圆形,也就是
291 | canvas.drawCircle(mCenterPoint.x, mCenterPoint.y, mRadius, mPaint);
292 | }
293 |
294 | if (isAnimEnd()) {
295 | reset();
296 | } else {
297 | invalidateDelayed();
298 | }
299 | }
300 |
301 | /**
302 | * 发送重绘消息
303 | */
304 | private void invalidateDelayed() {
305 | this.postDelayed(new Runnable() {
306 |
307 | @Override
308 | public void run() {
309 | invalidate();
310 | }
311 | }, mFrameRate);
312 | }
313 |
314 | /**
315 | * 判断是否找到被点击的子视图
316 | *
317 | * @return
318 | */
319 | private boolean isFoundTouchedSubView() {
320 | return mCenterPoint != null && mTargetView != null;
321 | }
322 |
323 | private void reset() {
324 | mCenterPoint = null;
325 | mTargetRectf = null;
326 | mRadius = DEFAULT_RADIUS;
327 | mColorAlpha = mBackupAlpha;
328 | mTargetView = null;
329 | invalidate();
330 | }
331 |
332 | }
333 |
--------------------------------------------------------------------------------