Example usage for android.animation AnimatorSet setStartDelay

List of usage examples for android.animation AnimatorSet setStartDelay

Introduction

In this page you can find the example usage for android.animation AnimatorSet setStartDelay.

Prototype

@Override
public void setStartDelay(long startDelay) 

Source Link

Document

The amount of time, in milliseconds, to delay starting the animation after #start() is called.

Usage

From source file:com.google.android.apps.muzei.MuzeiActivity.java

private void updateUiMode() {
    // TODO: this should really just use fragment transactions and transitions

    int newUiMode = UI_MODE_INTRO;
    if (mWallpaperActive) {
        newUiMode = UI_MODE_TUTORIAL;//w  ww .  j a  va2s  .co  m
        if (mSeenTutorial) {
            newUiMode = UI_MODE_ART_DETAIL;
        }
    }

    if (mUiMode == newUiMode) {
        return;
    }

    // Crossfade between main containers
    final View oldContainerView = getMainContainerForUiMode(mUiMode);
    final View newContainerView = getMainContainerForUiMode(newUiMode);

    if (oldContainerView != null) {
        oldContainerView.animate().alpha(0).setDuration(1000).withEndAction(new Runnable() {
            @Override
            public void run() {
                oldContainerView.setVisibility(View.GONE);
            }
        });
    }

    if (newContainerView != null) {
        if (newContainerView.getAlpha() == 1) {
            newContainerView.setAlpha(0);
        }
        newContainerView.setVisibility(View.VISIBLE);
        newContainerView.animate().alpha(1).setDuration(1000).withEndAction(null);
    }

    // Special work
    if (newUiMode == UI_MODE_INTRO) {
        final View activateButton = findViewById(R.id.activate_muzei_button);
        activateButton.setAlpha(0);
        final AnimatedMuzeiLogoFragment logoFragment = (AnimatedMuzeiLogoFragment) getFragmentManager()
                .findFragmentById(R.id.animated_logo_fragment);
        logoFragment.reset();
        logoFragment.setOnFillStartedCallback(new Runnable() {
            @Override
            public void run() {
                activateButton.animate().alpha(1f).setDuration(500);
            }
        });
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                logoFragment.start();
            }
        }, 1000);
    }

    if (mUiMode == UI_MODE_INTRO || newUiMode == UI_MODE_INTRO) {
        FragmentManager fm = getSupportFragmentManager();
        Fragment demoFragment = fm.findFragmentById(R.id.demo_view_container);
        if (newUiMode == UI_MODE_INTRO && demoFragment == null) {
            fm.beginTransaction()
                    .add(R.id.demo_view_container, MuzeiRendererFragment.createInstance(true, true)).commit();
        } else if (newUiMode != UI_MODE_INTRO && demoFragment != null) {
            fm.beginTransaction().remove(demoFragment).commit();
        }
    }

    if (newUiMode == UI_MODE_TUTORIAL) {
        float animateDistance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100,
                getResources().getDisplayMetrics());
        View mainTextView = findViewById(R.id.tutorial_main_text);
        mainTextView.setAlpha(0);
        mainTextView.setTranslationY(-animateDistance / 5);

        View subTextView = findViewById(R.id.tutorial_sub_text);
        subTextView.setAlpha(0);
        subTextView.setTranslationY(-animateDistance / 5);

        final View affordanceView = findViewById(R.id.tutorial_icon_affordance);
        affordanceView.setAlpha(0);
        affordanceView.setTranslationY(animateDistance);

        View iconTextView = findViewById(R.id.tutorial_icon_text);
        iconTextView.setAlpha(0);
        iconTextView.setTranslationY(animateDistance);

        AnimatorSet set = new AnimatorSet();
        set.setStartDelay(500);
        set.setDuration(250);
        set.playTogether(ObjectAnimator.ofFloat(mainTextView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(subTextView, View.ALPHA, 1f));
        set.start();

        set = new AnimatorSet();
        set.setStartDelay(2000);

        // Bug in older versions where set.setInterpolator didn't work
        Interpolator interpolator = new OvershootInterpolator();
        ObjectAnimator a1 = ObjectAnimator.ofFloat(affordanceView, View.TRANSLATION_Y, 0);
        ObjectAnimator a2 = ObjectAnimator.ofFloat(iconTextView, View.TRANSLATION_Y, 0);
        ObjectAnimator a3 = ObjectAnimator.ofFloat(mainTextView, View.TRANSLATION_Y, 0);
        ObjectAnimator a4 = ObjectAnimator.ofFloat(subTextView, View.TRANSLATION_Y, 0);
        a1.setInterpolator(interpolator);
        a2.setInterpolator(interpolator);
        a3.setInterpolator(interpolator);
        a4.setInterpolator(interpolator);
        set.setDuration(500).playTogether(ObjectAnimator.ofFloat(affordanceView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(iconTextView, View.ALPHA, 1f), a1, a2, a3, a4);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            set.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    ImageView emanateView = (ImageView) findViewById(R.id.tutorial_icon_emanate);
                    AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getResources()
                            .getDrawable(R.drawable.avd_tutorial_icon_emanate, getTheme());
                    emanateView.setImageDrawable(avd);
                    avd.start();
                }
            });
        }
        set.start();
    }

    mPanScaleProxyView.setVisibility(newUiMode == UI_MODE_ART_DETAIL ? View.VISIBLE : View.GONE);

    mUiMode = newUiMode;

    maybeUpdateArtDetailOpenedClosed();
}

From source file:com.flexible.flexibleadapter.AnimatorAdapter.java

/**
 * Animates the view based on the custom animator list built with {@link #getAnimators(View, int, boolean)}.
 *
 * @since 5.0.0-b1/*from   w  ww.  j  a  va 2  s.  co  m*/
 * @deprecated New system in place. Implement {@link FlexibleViewHolder#scrollAnimators(List, int, boolean)}
 * and add new animator(s) to the list of {@code animators}.
 */
@Deprecated
public final void animateView(final View itemView, int position) {
    //      if (DEBUG)
    //         Log.v(TAG, "shouldAnimate=" + shouldAnimate
    //               + " isFastScroll=" + isFastScroll
    //               + " isNotified=" + mAnimatorNotifierObserver.isPositionNotified()
    //               + " isReverseEnabled=" + isReverseEnabled
    //               + " mLastAnimatedPosition=" + mLastAnimatedPosition
    //               + (!isReverseEnabled ? " Pos>AniPos=" + (position > mLastAnimatedPosition) : "")
    //         );

    if (shouldAnimate && !isFastScroll && !mAnimatorNotifierObserver.isPositionNotified() && (isReverseEnabled
            || position > mLastAnimatedPosition || (position == 0 && mRecyclerView.getChildCount() == 0))) {

        //Cancel animation is necessary when fling
        cancelExistingAnimation(itemView.hashCode());

        //Retrieve user animators
        List<Animator> animators = getAnimators(itemView, position, position > mLastAnimatedPosition);

        //Add Alpha animator
        ViewCompat.setAlpha(itemView, 0);
        animators.add(ObjectAnimator.ofFloat(itemView, "alpha", 0f, 1f));
        Log.w(TAG, "Started Deprecated Animation on position " + position);

        //Execute the animations
        AnimatorSet set = new AnimatorSet();
        set.playTogether(animators);
        set.setInterpolator(mInterpolator);
        set.setDuration(mDuration);
        set.addListener(new HelperAnimatorListener(itemView.hashCode()));
        if (mEntryStep) {
            set.setStartDelay(calculateAnimationDelay(position));
        }
        set.start();
        mAnimators.put(itemView.hashCode(), set);

        //Animate only during initial loading?
        if (onlyEntryAnimation && mLastAnimatedPosition >= mMaxChildViews) {
            shouldAnimate = false;
        }
    }

    mAnimatorNotifierObserver.clearNotified();
    mLastAnimatedPosition = position;
}

From source file:com.google.android.apps.santatracker.village.Village.java

private void setIsDay(final boolean isDay, boolean smoothTransition) {
    ObjectAnimator sunAnim = ObjectAnimator.ofInt(this, "sunOffset", sunOffset, isDay ? 0 : mViewHeight);
    sunAnim.setInterpolator(new AnticipateOvershootInterpolator());
    sunAnim.setDuration(smoothTransition ? ImageWithAlphaAndSize.ANIM_DURATION : 0);
    sunAnim.addListener(new Animator.AnimatorListener() {
        @Override/*w ww .j a va 2 s  .  co  m*/
        public void onAnimationStart(Animator animation) {
            if (isDay) {
                mImageSun.setAlpha(ImageWithAlphaAndSize.OPAQUE);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (!isDay) {
                mImageSun.setAlpha(ImageWithAlphaAndSize.INVISIBLE);
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });

    AnimatorSet dayAnims = new AnimatorSet();
    dayAnims.playTogether(
            // Day values
            mImageSkyDay.fadeTransition(isDay, smoothTransition),
            mImageMountainsDay.fadeTransition(isDay, smoothTransition),
            mPaintMountainsDay.fadeTransition(isDay, smoothTransition));

    ObjectAnimator moonAnim = ObjectAnimator.ofInt(this, "moonOffset", moonOffset, isDay ? -mViewHeight : 0);
    moonAnim.setInterpolator(new AnticipateOvershootInterpolator());
    moonAnim.setDuration(smoothTransition ? ImageWithAlphaAndSize.ANIM_DURATION : 0);
    moonAnim.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {
            if (!isDay) {
                mImageMoon.setAlpha(ImageWithAlphaAndSize.OPAQUE);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (isDay) {
                mImageMoon.setAlpha(ImageWithAlphaAndSize.INVISIBLE);
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });

    AnimatorSet nightAnims = new AnimatorSet();
    nightAnims.playTogether(
            // Night values
            mImageSkyNight.fadeTransition(!isDay, !isDay && smoothTransition),
            mImageMountainsNight.fadeTransition(!isDay, !isDay && smoothTransition),
            mPaintMountainsNight.fadeTransition(!isDay, !isDay && smoothTransition));
    // When going to the day, delay night animation till after day time has kicked in
    if (isDay) {
        nightAnims.setStartDelay(ImageWithAlphaAndSize.ANIM_DURATION);
    }

    mFinalAnimations = nightAnims;

    sunAnim.start();
    dayAnims.start();
    moonAnim.start();
    nightAnims.start();
}

From source file:eu.davidea.flexibleadapter.AnimatorAdapter.java

protected void animateView(final RecyclerView.ViewHolder holder, final int position) {
    //FIXME: first completed visible item on rotation gets high delay

    //      if (DEBUG)
    //         Log.v(TAG, "shouldAnimate=" + shouldAnimate
    //               + " isFastScroll=" + isFastScroll
    //               + " isNotified=" + mAnimatorNotifierObserver.isPositionNotified()
    //               + " isReverseEnabled=" + isReverseEnabled
    //               + " mLastAnimatedPosition=" + mLastAnimatedPosition
    //               + (!isReverseEnabled ? " Pos>AniPos=" + (position > mLastAnimatedPosition) : "")
    //         );

    if (holder instanceof FlexibleViewHolder && shouldAnimate && !isFastScroll
            && !mAnimatorNotifierObserver.isPositionNotified()
            && (isReverseEnabled || position > mLastAnimatedPosition
                    || (position == 0 && mRecyclerView.getChildCount() == 0))) {

        //Cancel animation is necessary when fling
        int hashCode = holder.itemView.hashCode();
        cancelExistingAnimation(hashCode);

        //User animators
        List<Animator> animators = new ArrayList<>();
        FlexibleViewHolder flexibleViewHolder = (FlexibleViewHolder) holder;
        flexibleViewHolder.scrollAnimators(animators, position, position > mLastAnimatedPosition);

        //Execute the animations together
        AnimatorSet set = new AnimatorSet();
        set.playTogether(animators);/*from  w  w  w  .j  av a2 s . c  om*/
        set.setInterpolator(mInterpolator);
        set.setDuration(mDuration);
        set.addListener(new HelperAnimatorListener(hashCode));
        if (mEntryStep) {
            //Stop stepDelay when screen is filled
            set.setStartDelay(calculateAnimationDelay2(position));
        }
        set.start();
        mAnimators.put(hashCode, set);
        if (DEBUG)
            Log.d(TAG, "Started Animation on position " + position);

        //Animate only during initial loading?
        if (onlyEntryAnimation && position >= mMaxChildViews) {
            shouldAnimate = false;
        }
    }

    mAnimatorNotifierObserver.clearNotified();
    mLastAnimatedPosition = position;
}

From source file:eu.davidea.flexibleadapter.AnimatorAdapter.java

/**
 * Animates the view based on the custom animator list built with {@link #getAnimators(View, int, boolean)}.
 *
 * @since 5.0.0-b1/*from w ww  .  j  a v a2 s .  c  o m*/
 * @deprecated New system in place. Implement {@link FlexibleViewHolder#scrollAnimators(List, int, boolean)}
 * and add new animator(s) to the list of {@code animators}.
 */
@Deprecated
public final void animateView(final View itemView, int position) {
    //      if (DEBUG)
    //         Log.v(TAG, "shouldAnimate=" + shouldAnimate
    //               + " isFastScroll=" + isFastScroll
    //               + " isNotified=" + mAnimatorNotifierObserver.isPositionNotified()
    //               + " isReverseEnabled=" + isReverseEnabled
    //               + " mLastAnimatedPosition=" + mLastAnimatedPosition
    //               + (!isReverseEnabled ? " Pos>AniPos=" + (position > mLastAnimatedPosition) : "")
    //         );

    if (shouldAnimate && !isFastScroll && !mAnimatorNotifierObserver.isPositionNotified() && (isReverseEnabled
            || position > mLastAnimatedPosition || (position == 0 && mRecyclerView.getChildCount() == 0))) {

        //Cancel animation is necessary when fling
        cancelExistingAnimation(itemView.hashCode());

        //Retrieve user animators
        List<Animator> animators = getAnimators(itemView, position, position > mLastAnimatedPosition);

        //Add Alpha animator
        ViewCompat.setAlpha(itemView, 0);
        animators.add(ObjectAnimator.ofFloat(itemView, "alpha", 0f, 1f));
        if (DEBUG)
            Log.d(TAG, "Started Deprecated Animation on position " + position);

        //Execute the animations
        AnimatorSet set = new AnimatorSet();
        set.playTogether(animators);
        set.setInterpolator(mInterpolator);
        set.setDuration(mDuration);
        set.addListener(new HelperAnimatorListener(itemView.hashCode()));
        if (mEntryStep) {
            //set.setStartDelay(calculateAnimationDelay1(position));
            set.setStartDelay(calculateAnimationDelay2(position));
        }
        set.start();
        mAnimators.put(itemView.hashCode(), set);

        //Animate only during initial loading?
        if (onlyEntryAnimation && mLastAnimatedPosition >= mMaxChildViews) {
            shouldAnimate = false;
        }
    }

    mAnimatorNotifierObserver.clearNotified();
    mLastAnimatedPosition = position;
}

From source file:com.b44t.ui.ActionBar.BottomSheet.java

private void startOpenAnimation() {
    containerView.setVisibility(View.VISIBLE);

    if (!onCustomOpenAnimation()) {
        if (Build.VERSION.SDK_INT >= 20) {
            container.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }//w  w w . j a  v  a2 s  .co m
        containerView.setTranslationY(containerView.getMeasuredHeight());
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(ObjectAnimator.ofFloat(containerView, "translationY", 0),
                ObjectAnimator.ofInt(backDrawable, "alpha", 51));
        animatorSet.setDuration(200);
        animatorSet.setStartDelay(20);
        animatorSet.setInterpolator(new DecelerateInterpolator());
        animatorSet.addListener(new AnimatorListenerAdapterProxy() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) {
                    currentSheetAnimation = null;
                    if (delegate != null) {
                        delegate.onOpenAnimationEnd();
                    }
                    container.setLayerType(View.LAYER_TYPE_NONE, null);
                }
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) {
                    currentSheetAnimation = null;
                }
            }
        });
        animatorSet.start();
        currentSheetAnimation = animatorSet;
    }
}

From source file:kr.wdream.ui.ActionBar.BottomSheet.java

private void startOpenAnimation() {
    if (dismissed) {
        return;/* ww w  .j a v  a  2 s  .  c  o m*/
    }
    containerView.setVisibility(View.VISIBLE);

    if (!onCustomOpenAnimation()) {
        if (Build.VERSION.SDK_INT >= 20) {
            container.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }
        containerView.setTranslationY(containerView.getMeasuredHeight());
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(ObjectAnimator.ofFloat(containerView, "translationY", 0),
                ObjectAnimator.ofInt(backDrawable, "alpha", 51));
        animatorSet.setDuration(200);
        animatorSet.setStartDelay(20);
        animatorSet.setInterpolator(new DecelerateInterpolator());
        animatorSet.addListener(new AnimatorListenerAdapterProxy() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) {
                    currentSheetAnimation = null;
                    if (delegate != null) {
                        delegate.onOpenAnimationEnd();
                    }
                    container.setLayerType(View.LAYER_TYPE_NONE, null);
                }
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) {
                    currentSheetAnimation = null;
                }
            }
        });
        animatorSet.start();
        currentSheetAnimation = animatorSet;
    }
}

From source file:org.michaelbel.bottomsheet.BottomSheet.java

private void startOpenAnimation() {
    containerView.setVisibility(View.VISIBLE);

    if (Build.VERSION.SDK_INT >= 20) {
        container.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }//from  w  ww. ja v  a 2s. co m

    containerView.setTranslationY(containerView.getMeasuredHeight());
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(containerView, "translationY", 0),
            ObjectAnimator.ofInt(backDrawable, "alpha", 51));
    animatorSet.setDuration(200);
    animatorSet.setStartDelay(20);
    animatorSet.setInterpolator(new DecelerateInterpolator());
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) {
                currentSheetAnimation = null;
                container.setLayerType(View.LAYER_TYPE_NONE, null);
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            super.onAnimationCancel(animation);
            if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) {
                currentSheetAnimation = null;
            }
        }
    });
    animatorSet.start();
    currentSheetAnimation = animatorSet;
}

From source file:com.flexible.flexibleadapter.AnimatorAdapter.java

/**
 * Performs checks to scroll animate the itemView and in case, it animates the view.
 * <p><b>Note:</b> If you have to change at runtime the LayoutManager <i>and</i> add
 * Scrollable Headers too, consider to add them in post, using a {@code delay >= 0},
 * otherwise scroll animations on all items will not start correctly.</p>
 *
 * @param holder   the ViewHolder just bound
 * @param position the current item position
 *///w w w .j  a v a2 s  .com
@SuppressWarnings("ConstantConditions")
protected final void animateView(final RecyclerView.ViewHolder holder, final int position) {
    if (mRecyclerView == null)
        return;

    // Use always the max child count reached
    if (mMaxChildViews < mRecyclerView.getChildCount()) {
        mMaxChildViews = mRecyclerView.getChildCount();
    }
    // Animate only during initial loading?
    if (onlyEntryAnimation && mLastAnimatedPosition >= mMaxChildViews) {
        shouldAnimate = false;
    }
    int lastVisiblePosition = Utils.findLastVisibleItemPosition(mRecyclerView.getLayoutManager());
    //      if (DEBUG) {
    //         Log.v(TAG, "shouldAnimate=" + shouldAnimate
    //               + " isFastScroll=" + isFastScroll
    //               + " isNotified=" + mAnimatorNotifierObserver.isPositionNotified()
    //               + " isReverseEnabled=" + isReverseEnabled
    //               + " mLastAnimatedPosition=" + mLastAnimatedPosition
    //               + (!isReverseEnabled ? " Pos>LasVisPos=" + (position > lastVisiblePosition) : "")
    //               + " mMaxChildViews=" + mMaxChildViews
    //         );
    //      }
    if (holder instanceof FlexibleViewHolder && shouldAnimate && !isFastScroll
            && !mAnimatorNotifierObserver.isPositionNotified()
            && (position > lastVisiblePosition || isReverseEnabled || isScrollableHeaderOrFooter(position)
                    || (position == 0 && mMaxChildViews == 0))) {

        // Cancel animation is necessary when fling
        int hashCode = holder.itemView.hashCode();
        cancelExistingAnimation(hashCode);

        // User animators
        List<Animator> animators = new ArrayList<>();
        FlexibleViewHolder flexibleViewHolder = (FlexibleViewHolder) holder;
        flexibleViewHolder.scrollAnimators(animators, position, position >= lastVisiblePosition);

        // Execute the animations together
        AnimatorSet set = new AnimatorSet();
        set.playTogether(animators);
        set.setInterpolator(mInterpolator);
        // Single view duration
        long duration = mDuration;
        for (Animator animator : animators) {
            if (animator.getDuration() != DEFAULT_DURATION) {
                duration = animator.getDuration();
            }
        }
        //Log.v(TAG, "duration=" + duration);
        set.setDuration(duration);
        set.addListener(new HelperAnimatorListener(hashCode));
        if (mEntryStep) {
            // Stop stepDelay when screen is filled
            set.setStartDelay(calculateAnimationDelay(position));
        }
        set.start();
        mAnimators.put(hashCode, set);
        if (DEBUG)
            Log.v(TAG, "animateView    Scroll animation on position " + position);
    }
    mAnimatorNotifierObserver.clearNotified();
    // Update last animated position
    mLastAnimatedPosition = position;
}

From source file:arun.com.chromer.webheads.ui.views.BaseWebHead.java

/**
 * Opposite of {@link #getRevealAnimator(int)}. Reveal goes from max scale to 0 appearing to be
 * revealing in.//from   w ww  .j  ava  2s . co  m
 *
 * @param newWebHeadColor New themeColor of reveal
 * @param start           Runnable to run on start
 * @param end             Runnable to run on end
 */
void revealInAnimation(@ColorInt final int newWebHeadColor, @NonNull final Runnable start,
        @NonNull final Runnable end) {
    if (revealView == null || circleBg == null) {
        start.run();
        end.run();
    }
    revealView.clearAnimation();
    revealView.setColor(circleBg.getColor());
    revealView.setScaleX(1f);
    revealView.setScaleY(1f);
    revealView.setAlpha(1f);
    circleBg.setColor(newWebHeadColor);
    final AnimatorSet animator = new AnimatorSet();
    animator.playTogether(ObjectAnimator.ofFloat(revealView, "scaleX", 0f),
            ObjectAnimator.ofFloat(revealView, "scaleY", 0f));
    revealView.setLayerType(LAYER_TYPE_HARDWARE, null);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            start.run();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            webHeadColor = newWebHeadColor;
            indicator.setTextColor(getForegroundWhiteOrBlack(newWebHeadColor));
            revealView.setLayerType(LAYER_TYPE_NONE, null);
            revealView.setScaleX(0f);
            revealView.setScaleY(0f);
            end.run();
        }

    });
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.setDuration(400);
    animator.setStartDelay(100);
    animator.start();
}