File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,33 @@ public class SearchView extends View {
1616 private int mViewWidth ;
1717 private int mViewHeight ;
1818
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+
1946 // 这个视图拥有的状态
2047 public static enum State {
2148 NONE ,
@@ -57,24 +84,7 @@ public static enum State {
5784
5885 private int count = 0 ;
5986
60- public SearchView (Context context ) {
61- super (context );
62-
63- initPaint ();
64-
65- initPath ();
66-
67- initListener ();
6887
69- initHandler ();
70-
71- initAnimator ();
72-
73- // 进入开始动画
74- mCurrentState = State .STARTING ;
75- mStartingAnimator .start ();
76-
77- }
7888
7989 private void initPaint () {
8090 mPaint = new Paint ();
Original file line number Diff line number Diff line change @@ -21,6 +21,33 @@ public class SearchView extends View {
2121 private int mViewWidth;
2222 private int mViewHeight;
2323
24+ public SearchView (Context context ) {
25+ this (context,null );
26+ }
27+
28+ public SearchView (Context context , AttributeSet attrs ) {
29+ super (context, attrs);
30+ initAll();
31+ }
32+
33+ public void initAll () {
34+
35+ initPaint();
36+
37+ initPath();
38+
39+ initListener();
40+
41+ initHandler();
42+
43+ initAnimator();
44+
45+ // 进入开始动画
46+ mCurrentState = State . STARTING ;
47+ mStartingAnimator. start();
48+
49+ }
50+
2451 // 这个视图拥有的状态
2552 public static enum State {
2653 NONE ,
@@ -62,24 +89,7 @@ public class SearchView extends View {
6289
6390 private int count = 0 ;
6491
65- public SearchView (Context context ) {
66- super (context);
67-
68- initPaint();
69-
70- initPath();
71-
72- initListener();
7392
74- initHandler();
75-
76- initAnimator();
77-
78- // 进入开始动画
79- mCurrentState = State . STARTING ;
80- mStartingAnimator. start();
81-
82- }
8393
8494 private void initPaint () {
8595 mPaint = new Paint ();
You can’t perform that action at this time.
0 commit comments