@@ -145,11 +145,6 @@ private void init() {
145145 mBackupButton .setOnClickListener (this );
146146 addView (mBackupButton );
147147 }
148-
149- mHandy = ((LayoutInflater ) getContext ().getSystemService (Context .LAYOUT_INFLATER_SERVICE )).inflate (R .layout .handy , null );
150- addView (mHandy );
151- ViewHelper .setAlpha (mHandy , 0f );
152-
153148 }
154149
155150 /**
@@ -444,6 +439,9 @@ private boolean makeVoidedRect() {
444439 }
445440
446441 public AnimatorSet animateGesture (float offsetStartX , float offsetStartY , float offsetEndX , float offsetEndY ) {
442+ mHandy = ((LayoutInflater ) getContext ().getSystemService (Context .LAYOUT_INFLATER_SERVICE )).inflate (R .layout .handy , null );
443+ addView (mHandy );
444+ ViewHelper .setAlpha (mHandy , 0f );
447445
448446 ObjectAnimator alphaIn = ObjectAnimator .ofFloat (mHandy , "alpha" , 0f , 1f ).setDuration (500 );
449447
@@ -460,8 +458,16 @@ public AnimatorSet animateGesture(float offsetStartX, float offsetStartY, float
460458
461459 AnimatorSet as = new AnimatorSet ();
462460 as .play (setUpX ).with (setUpY ).before (alphaIn ).before (moveX ).with (moveY ).before (alphaOut );
463- return as ;
461+ as . start () ;
464462
463+ Handler handler = new Handler ();
464+ Runnable runnable = new Runnable () {
465+ @ Override
466+ public void run () {
467+ removeView (mHandy );
468+ }
469+ };
470+ handler .postDelayed (runnable , 3000 );
465471 }
466472
467473 @ Override
@@ -596,6 +602,10 @@ public void setText(int titleText, int subText) {
596602 * @return a View representing the ghostly hand
597603 */
598604 public View getHand () {
605+ final View mHandy = ((LayoutInflater ) getContext ().getSystemService (Context .LAYOUT_INFLATER_SERVICE )).inflate (R .layout .handy , null );
606+ addView (mHandy );
607+ ViewHelper .setAlpha (mHandy , 0f );
608+
599609 return mHandy ;
600610 }
601611
0 commit comments