@@ -0,0 +1,3347 @@
+package com.baurine.instamaterial.ui.view;%0A%0Aimport android.animation.Animator;%0Aimport android.animation.AnimatorListenerAdapter;%0Aimport android.animation.ObjectAnimator;%0Aimport android.annotation.TargetApi;%0Aimport android.content.Context;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Color;%0Aimport android.graphics.Paint;%0Aimport android.os.Build;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0Aimport android.view.animation.AccelerateInterpolator;%0Aimport android.view.animation.Interpolator;%0A%0Apublic class RevealBackgroundView extends View %7B%0A%0A    private static final int STATE_NOT_STARTED = 0;%0A    private static final int STATE_FILL_STARTED = 1;%0A    private static final int STATE_FINISHED = 2;%0A%0A    private static final Interpolator INTERPOLATOR = new AccelerateInterpolator();%0A    private static final int FILL_TIME = 400;%0A%0A    private int mState = STATE_NOT_STARTED;%0A%0A    private Paint mFillPaint;%0A    private int mCurRadius;%0A    private ObjectAnimator mRevealAnimator;%0A%0A    private int mStartLocationX, mStartLocationY;%0A%0A    private OnStateChangeListener mListener;%0A%0A    public RevealBackgroundView(Context context) %7B%0A        super(context);%0A        init();%0A    %7D%0A%0A    public RevealBackgroundView(Context context, AttributeSet attrs) %7B%0A        super(context, attrs);%0A        init();%0A    %7D%0A%0A    public RevealBackgroundView(Context context, AttributeSet attrs, int defStyleAttr) %7B%0A        super(context, attrs, defStyleAttr);%0A        init();%0A    %7D%0A%0A    @TargetApi(Build.VERSION_CODES.LOLLIPOP)%0A    public RevealBackgroundView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) %7B%0A        super(context, attrs, defStyleAttr, defStyleRes);%0A        init();%0A    %7D%0A%0A    private void init() %7B%0A        mFillPaint = new Paint();%0A        mFillPaint.setStyle(Paint.Style.FILL);%0A        mFillPaint.setColor(Color.WHITE);%0A    %7D%0A%0A    public void startFromLocation(int%5B%5D tapLocationOnScreen) %7B%0A        changeState(STATE_FILL_STARTED);%0A        mStartLocationX = tapLocationOnScreen%5B0%5D;%0A        mStartLocationY = tapLocationOnScreen%5B1%5D;%0A        mRevealAnimator = ObjectAnimator.ofInt(this, %22mCurRadius%22, 0, getWidth() + getHeight())%0A                .setDuration(FILL_TIME);%0A        mRevealAnimator.setInterpolator(INTERPOLATOR);%0A        mRevealAnimator.addListener(new AnimatorListenerAdapter() %7B%0A            @Override%0A            public void onAnimationEnd(Animator animation) %7B%0A                changeState(STATE_FINISHED);%0A            %7D%0A        %7D);%0A        mRevealAnimator.start();%0A    %7D%0A%0A    public void setToFinishedFrame() %7B%0A        changeState(STATE_FINISHED);%0A        invalidate();%0A    %7D%0A%0A    @Override%0A    protected void onDraw(Canvas canvas) %7B%0A        if (mState == STATE_FINISHED) %7B%0A            canvas.drawRect(0, 0, getWidth(), getHeight(), mFillPaint);%0A        %7D else %7B%0A            canvas.drawCircle(mStartLocationX, mStartLocationY, mCurRadius, mFillPaint);%0A        %7D%0A    %7D%0A%0A    private void changeState(int state) %7B%0A        if (mState == state) %7B%0A            return;%0A        %7D%0A%0A        mState = state;%0A        if (mListener != null) %7B%0A            mListener.onStateChange(state);%0A        %7D%0A    %7D%0A%0A    public void setOnStateChangeListener(OnStateChangeListener listener) %7B%0A        mListener = listener;%0A    %7D%0A%0A    public interface OnStateChangeListener %7B%0A        void onStateChange(int state);%0A    %7D%0A%0A%7D%0A

add RevealBackgroundView