MCPcopy Create free account
hub / github.com/GcsSloop/AndroidNote / SearchView

Class SearchView

CustomView/Advance/Code/SearchView.java:10–254  ·  view source on GitHub ↗

Author: GcsSloop Created Date: 16/5/31 Copyright (C) 2016 GcsSloop. GitHub: https://github.com/GcsSloop

Source from the content-addressed store, hash-verified

8 * GitHub: https://github.com/GcsSloop
9 */
10public class SearchView extends View {
11
12 // 画笔
13 private Paint mPaint;
14
15 // View 宽高
16 private int mViewWidth;
17 private int mViewHeight;
18
19 public SearchView(Context context) {
20 this(context,null);
21 }
22
23 public SearchView(Context context, AttributeSet attrs) {
24 super(context, attrs);
25 initAll();
26 }
27
28 public void initAll() {
29
30 initPaint();
31
32 initPath();
33
34 initListener();
35
36 initHandler();
37
38 initAnimator();
39
40 // 进入开始动画
41 mCurrentState = State.STARTING;
42 mStartingAnimator.start();
43
44 }
45
46 // 这个视图拥有的状态
47 public static enum State {
48 NONE,
49 STARTING,
50 SEARCHING,
51 ENDING
52 }
53
54 // 当前的状态(非常重要)
55 private State mCurrentState = State.NONE;
56
57 // 放大镜与外部圆环
58 private Path path_srarch;
59 private Path path_circle;
60
61 // 测量Path 并截取部分的工具
62 private PathMeasure mMeasure;
63
64 // 默认的动效周期 2s
65 private int defaultDuration = 2000;
66
67 // 控制各个过程的动画

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected