Exemple #1
0
  private void init() {
    Resources res = getContext().getResources();

    mHandler = new Handler();
    mDelayedCancel =
        new Runnable() {
          @Override
          public void run() {
            cancelCircle(false);
          }
        };

    mAnimationOut = new CircleViewAnimation(this, 0, 0);
    mAnimationOut.setInterpolator(new AccelerateDecelerateInterpolator());
    mAnimationOut.setDuration(res.getInteger(android.R.integer.config_mediumAnimTime));

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.WHITE);
    mPaint.setStrokeWidth(2);

    mRadiusTarget = res.getDimension(R.dimen.circle_radius_target);
    mRadiusDecreaseThreshold = res.getDimension(R.dimen.circle_radius_decrease_threshold);

    mDrawable = res.getDrawable(R.drawable.ic_unlock);
    mDrawable.setBounds(0, 0, mDrawable.getIntrinsicWidth(), mDrawable.getIntrinsicHeight());

    setRadius(0);
  }
Exemple #2
0
  private void cancelCircle(boolean unlockAnimation) {
    if (mCanceled) {
      return;
    }

    mCanceled = true;
    mCallback.onCircleEvent(mRadius, calculateRatio(), ACTION_CANCELED);

    mAnimationOut.setStartOffset(unlockAnimation ? 150 : 0);
    mAnimationOut.setRange(mRadius, 0f);
    startAnimation(mAnimationOut);
  }