cale, 1.03f); ? ? ? ? zoomDuration = typedArray.getInt(R.styleable.RippleView_rv_zoomDuration, 200); ? ? ? ? typedArray.recycle(); ? ? ? ? paint = new Paint(); ? ? ? ? paint.setAntiAlias(true); ? ? ? ? paint.setStyle(Paint.Style.FILL); ? ? ? ? paint.setColor(rippleColor); ? ? ? ? paint.setAlpha(rippleAlpha); ? ? ? ? this.setWillNotDraw(false); ? ? ? ? ? gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { ? ? ? ? ? ? @Override ? ? ? ? ? ? public void onLongPress(MotionEvent event) { ? ? ? ? ? ? ? ? super.onLongPress(event); ? ? ? ? ? ? ? ? animateRipple(event); ? ? ? ? ? ? ? ? sendClickEvent(true); ? ? ? ? ? ? } ? ? ? ? ? ? ? @Override ? ? ? ? ? ? public boolean onSingleTapConfirmed(MotionEvent e) { ? ? ? ? ? ? ? ? return true; ? ? ? ? ? ? } ? ? ? ? ? ? ? @Override ? ? ? ? ? ? public boolean onSingleTapUp(MotionEvent e) { ? ? ? ? ? ? ? ? return true; ? ? ? ? ? ? } ? ? ? ? }); ? ? ? ? ? this.setDrawingCacheEnabled(true); ? ? ? ? this.setClickable(true); ? ? } ? ? ? @Override ? ? public void draw(Canvas canvas) { ? ? ? ? super.draw(canvas); ? ? ? ? if (animationRunning) { ? ? ? ? ? ? if (rippleDuration <= timer * frameRate) { ? ? ? ? ? ? ? ? animationRunning = false; ? ? ? ? ? ? ? ? timer = 0; ? ? ? ? ? ? ? ? durationEmpty = -1; ? ? ? ? ? ? ? ? timerEmpty = 0; ? ? ? ? ? ? ? ? canvas.restore(); ? ? ? ? ? ? ? ? invalidate(); ? ? ? ? ? ? ? ? if (onCompletionListener != null) onCompletionListener.onComplete(this); ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? } else ? ? ? ? ? ? ? ? canvasHandler.postDelayed(runnable, frameRate); ? ? ? ? ? ? ? if (timer == 0) ? ? ? ? ? ? ? ? canvas.save(); ? ? ? ? ? ? ? ? canvas.drawCircle(x, y, (radiusMax * (((float) timer * frameRate) / rippleDuration)), paint); ? ? ? ? ? ? ? paint.setColor(Color.parseColor("#ffff4444")); ? ? ? ? ? ? ? if (rippleType == 1 && originBitmap != null && (((float) timer * frameRate) / rippleDuration) > 0.4f) { ? ? ? ? ? ? ? ? if (durationEmpty == -1) ? ? ? ? ? ? ? ? ? ? durationEmpty = rippleDuration - timer * frameRate; ? ? ? ? ? ? ? ? ? timerEmpty++; ? ? ? ? ? ? ? ? final Bitmap tmpBitmap = getCircleBitmap((int) ((radiusMax) * (((float) timerEmpty * frameRate) / (durationEmpty)))); ? ? ? ? ? ? ? ? canvas.drawBitmap(tmpBitmap, 0, 0, paint); ? ? ? ? ? ? ? ? tmpBitmap.recycle(); ? ? ? ? ? ? } ? ? ? ? ? ? ? paint.setColor(rippleColor); ? ? ? ? ? ? ? if (rippleType == 1) { ? ? ? ? ? ? ? ? if ((((float) timer * frameRate) / rippleDuration) > 0.6f) ? ? ? ? ? ? ? ? ? ? paint.setAlpha((int) (rippleAlpha - ((rippleAlpha) * (((float) timerEmpty * frameRate) / (durationEmpty))))); ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? paint.setAlpha(rippleAlpha); ? ? ? ? ? ? } ? ? ? ? ? ? else ? ? ? ? ? ? ? ? paint.setAlpha((int) (rippleAlpha - ((rippleAlpha) * (((float) timer * frameRate) / rippleDuration)))); ? ? ? ? ? ? ? timer++; ? ? ? ? } ? ? } ? ? ? @Override ? ? protected void onSizeChanged(int w, int h, int oldw, int oldh) { ? ? ? ? super.onSizeChanged(w, h, oldw, oldh); ? ? ? ? WIDTH = w; ? ? ? ? HEIGHT = h; ? ? ? ? ? scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); ? ? ? ? scaleAnimation.setDuration(zoomDuration); ? ? ? ? scaleAnimation.setRepeatMode(Animation.REVERSE); ? ? ? ? scaleAnimation.setRepeatCount(1); ? ? } ? ? ? /** ? ? * Launch Ripple animation for the current view with a MotionEvent ? ? * ? ? * @param event MotionEvent registered by the Ripple gesture listener ? ? */ ? ? public void animateRipple(MotionEvent event) { ? ? ? ? createAnimation(event.getX(), event.getY()); ? ? } ? ? ? /** ? ? * Launch Ripple animation for the current view centered at x and y position ? ? * ? ? * @param x Horizontal position of the ripple center ? ? * @param y Vertical position of the ripple center ? ? */ ? ? public void animateRipple(final float x, final flo |