/**
  * 可见性改变的得时候调用,设置动画的启动或者结束
  *
  * @param v
  */
 @Override
 public void setVisibility(int v) {
   if (getVisibility() != v) {
     super.setVisibility(v);
     if (v == GONE || v == INVISIBLE) {
       mIndicatorController.setAnimationStatus(BaseIndicatorController.AnimStatus.END);
     } else {
       mIndicatorController.setAnimationStatus(BaseIndicatorController.AnimStatus.START);
     }
   }
 }
 /** 设置动画效果 */
 void applyAnimation() {
   mIndicatorController.initAnimation();
 }
 /**
  * 绘制图形
  *
  * @param canvas
  */
 void drawIndicator(Canvas canvas) {
   mIndicatorController.draw(canvas, mPaint);
 }
 /** VIew销毁的时候执行的操作,结束动画 */
 @Override
 protected void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   mIndicatorController.setAnimationStatus(BaseIndicatorController.AnimStatus.CANCEL);
 }
 private void applyIndicator() {
   switch (mIndicatorId) {
     case BallPulse:
       mIndicatorController = new BallPulseIndicator();
       break;
     case BallGridPulse:
       mIndicatorController = new BallGridPulseIndicator();
       break;
     case BallClipRotate:
       mIndicatorController = new BallClipRotateIndicator();
       break;
     case BallClipRotatePulse:
       mIndicatorController = new BallClipRotatePulseIndicator();
       break;
     case SquareSpin:
       mIndicatorController = new SquareSpinIndicator();
       break;
     case BallClipRotateMultiple:
       mIndicatorController = new BallClipRotateMultipleIndicator();
       break;
     case BallPulseRise:
       mIndicatorController = new BallPulseRiseIndicator();
       break;
     case BallRotate:
       mIndicatorController = new BallRotateIndicator();
       break;
     case CubeTransition:
       mIndicatorController = new CubeTransitionIndicator();
       break;
     case BallZigZag:
       mIndicatorController = new BallZigZagIndicator();
       break;
     case BallZigZagDeflect:
       mIndicatorController = new BallZigZagDeflectIndicator();
       break;
     case BallTrianglePath:
       mIndicatorController = new BallTrianglePathIndicator();
       break;
     case BallScale:
       mIndicatorController = new BallScaleIndicator();
       break;
     case LineScale:
       mIndicatorController = new LineScaleIndicator();
       break;
     case LineScaleParty:
       mIndicatorController = new LineScalePartyIndicator();
       break;
     case BallScaleMultiple:
       mIndicatorController = new BallScaleMultipleIndicator();
       break;
     case BallPulseSync:
       mIndicatorController = new BallPulseSyncIndicator();
       break;
     case BallBeat:
       mIndicatorController = new BallBeatIndicator();
       break;
     case LineScalePulseOut:
       mIndicatorController = new LineScalePulseOutIndicator();
       break;
     case LineScalePulseOutRapid:
       mIndicatorController = new LineScalePulseOutRapidIndicator();
       break;
     case BallScaleRipple:
       mIndicatorController = new BallScaleRippleIndicator();
       break;
     case BallScaleRippleMultiple:
       mIndicatorController = new BallScaleRippleMultipleIndicator();
       break;
     case BallSpinFadeLoader:
       mIndicatorController = new BallSpinFadeLoaderIndicator();
       break;
     case LineSpinFadeLoader:
       mIndicatorController = new LineSpinFadeLoaderIndicator();
       break;
     case TriangleSkewSpin:
       mIndicatorController = new TriangleSkewSpinIndicator();
       break;
     case Pacman:
       mIndicatorController = new PacmanIndicator();
       break;
     case BallGridBeat:
       mIndicatorController = new BallGridBeatIndicator();
       break;
     case SemiCircleSpin:
       mIndicatorController = new SemiCircleSpinIndicator();
       break;
   }
   mIndicatorController.setTarget(this);
 }