@Override
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   if (!mInitialized) return;
   if (mCurrentMode == MODE_VIDEO) {
     mSecondLevelIcon.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
     mCloseIcon.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
     requestLayout();
   } else {
     // We also disable the zoom button during snapshot.
     enableZoom(enabled);
   }
   mSecondLevelIcon.setEnabled(enabled);
   mCloseIcon.setEnabled(enabled);
 }
  @Override
  protected void onDraw(Canvas canvas) {
    int selectedIndex = getSelectedIndicatorIndex();

    // Draw the highlight arc if an indicator is selected or being pressed.
    // And skip the zoom control which index is zero.
    if (selectedIndex >= 1) {
      int degree = (int) Math.toDegrees(mChildRadians[selectedIndex]);
      float innerR = (float) mShutterButtonRadius;
      float outerR = (float) (mShutterButtonRadius + mStrokeWidth + EDGE_STROKE_WIDTH * 0.5);

      // Construct the path of the fan-shaped semi-transparent area.
      Path fanPath = new Path();
      mBackgroundRect.set(
          mCenterX - innerR, mCenterY - innerR, mCenterX + innerR, mCenterY + innerR);
      fanPath.arcTo(mBackgroundRect, -degree + HIGHLIGHT_DEGREES / 2, -HIGHLIGHT_DEGREES);
      mBackgroundRect.set(
          mCenterX - outerR, mCenterY - outerR, mCenterX + outerR, mCenterY + outerR);
      fanPath.arcTo(mBackgroundRect, -degree - HIGHLIGHT_DEGREES / 2, HIGHLIGHT_DEGREES);
      fanPath.close();

      mBackgroundPaint.setStrokeWidth(HIGHLIGHT_WIDTH);
      mBackgroundPaint.setStrokeCap(Paint.Cap.SQUARE);
      mBackgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE);
      mBackgroundPaint.setColor(HIGHLIGHT_FAN_COLOR);
      if (FeatureOption.MTK_THEMEMANAGER_APP) {
        int bgColor = res.getThemeMainColor();
        if (bgColor != 0) {
          bgColor &= 0x3FFFFFFF;
          mBackgroundPaint.setColor(bgColor);
        }
      }
      canvas.drawPath(fanPath, mBackgroundPaint);

      // Draw the highlight edge
      mBackgroundPaint.setStyle(Paint.Style.STROKE);
      mBackgroundPaint.setColor(HIGHLIGHT_COLOR);
      if (FeatureOption.MTK_THEMEMANAGER_APP) {
        int bgColor = res.getThemeMainColor();
        if (bgColor != 0) {
          mBackgroundPaint.setColor(bgColor);
        }
      }
      canvas.drawArc(
          mBackgroundRect,
          -degree - HIGHLIGHT_DEGREES / 2,
          HIGHLIGHT_DEGREES,
          false,
          mBackgroundPaint);
    }

    // Draw arc shaped indicator in time lapse recording.
    if (mTimeLapseInterval != 0) {
      // Setup rectangle and paint.
      mBackgroundRect.set(
          (float) (mCenterX - mShutterButtonRadius),
          (float) (mCenterY - mShutterButtonRadius),
          (float) (mCenterX + mShutterButtonRadius),
          (float) (mCenterY + mShutterButtonRadius));
      mBackgroundRect.inset(3f, 3f);
      mBackgroundPaint.setStrokeWidth(TIME_LAPSE_ARC_WIDTH);
      mBackgroundPaint.setStrokeCap(Paint.Cap.ROUND);
      mBackgroundPaint.setColor(TIME_LAPSE_ARC_COLOR);

      // Compute the start angle and sweep angle.
      long timeDelta = SystemClock.uptimeMillis() - mRecordingStartTime;
      long numberOfFrames = timeDelta / mTimeLapseInterval;
      float sweepAngle;
      if (numberOfFrames > mNumberOfFrames) {
        // The arc just acrosses 0 degree. Draw a full circle so it
        // looks better.
        sweepAngle = 360;
        mNumberOfFrames = numberOfFrames;
      } else {
        sweepAngle = timeDelta % mTimeLapseInterval * 360f / mTimeLapseInterval;
      }

      canvas.drawArc(mBackgroundRect, 0, sweepAngle, false, mBackgroundPaint);
      invalidate();
    }

    super.onDraw(canvas);
  }