Search in sources :

Example 46 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project TeamCityApp by vase4kin.

the class OverviewViewImpl method showPrompt.

/**
 * Show prompt
 *
 * @param secondaryText - secondary text
 * @param listener      - listener to receive callback when prompt is shown
 */
private void showPrompt(@StringRes int secondaryText, final OnboardingManager.OnPromptShownListener listener) {
    // Creating prompt
    final Toolbar toolbar = (Toolbar) mActivity.findViewById(R.id.toolbar);
    int color = ((ColorDrawable) toolbar.getBackground()).getColor();
    final MaterialTapTargetPrompt.Builder promptBuilder = new MaterialTapTargetPrompt.Builder(mActivity).setPrimaryText(R.string.title_onboarding_build_menu).setSecondaryText(secondaryText).setAnimationInterpolator(new FastOutSlowInInterpolator()).setIcon(R.drawable.ic_more_vert_black_24dp).setIconDrawableTintList(ColorStateList.valueOf(color)).setBackgroundColour(color).setCaptureTouchEventOutsidePrompt(true).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {

        @Override
        public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
            listener.onPromptShown();
        }
    });
    // Show prompt
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {

        @Override
        public void run() {
            final View child = toolbar.getChildAt(2);
            if (child instanceof ActionMenuView) {
                final ActionMenuView actionMenuView = ((ActionMenuView) child);
                promptBuilder.setTarget(actionMenuView.getChildAt(actionMenuView.getChildCount() - 1));
            }
            promptBuilder.show();
        }
    }, TIMEOUT_PROMPT);
}
Also used : Handler(android.os.Handler) BindView(butterknife.BindView) View(android.view.View) ErrorView(tr.xip.errorview.ErrorView) ActionMenuView(android.support.v7.widget.ActionMenuView) RecyclerView(android.support.v7.widget.RecyclerView) ColorDrawable(android.graphics.drawable.ColorDrawable) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt) ActionMenuView(android.support.v7.widget.ActionMenuView) Toolbar(android.support.v7.widget.Toolbar)

Example 47 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project TeamCityApp by vase4kin.

the class BuildListViewImpl method showFilterBuildsPrompt.

/**
 * {@inheritDoc}
 */
@Override
public void showFilterBuildsPrompt(final OnboardingManager.OnPromptShownListener listener) {
    int color = getToolbarColor();
    new MaterialTapTargetPrompt.Builder(mActivity).setTarget(R.id.filter_builds).setPrimaryText(R.string.title_onboarding_filter_builds).setSecondaryText(R.string.text_onboarding_filter_builds).setAnimationInterpolator(new FastOutSlowInInterpolator()).setIcon(R.drawable.ic_filter_list_white_24px).setIconDrawableTintList(ColorStateList.valueOf(color)).setBackgroundColour(color).setCaptureTouchEventOutsidePrompt(true).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {

        @Override
        public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
            listener.onPromptShown();
        }
    }).show();
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)

Example 48 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project NewPipe by TeamNewPipe.

the class AnimationUtils method animateSlideAndAlpha.

private static void animateSlideAndAlpha(final View view, boolean enterOrExit, long duration, long delay, final Runnable execOnEnd) {
    if (enterOrExit) {
        view.setTranslationY(-view.getHeight());
        view.setAlpha(0f);
        view.animate().setInterpolator(new FastOutSlowInInterpolator()).alpha(1f).translationY(0).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (execOnEnd != null)
                    execOnEnd.run();
            }
        }).start();
    } else {
        view.animate().setInterpolator(new FastOutSlowInInterpolator()).alpha(0f).translationY(-view.getHeight()).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
                if (execOnEnd != null)
                    execOnEnd.run();
            }
        }).start();
    }
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator)

Example 49 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project NewPipe by TeamNewPipe.

the class AnimationUtils method animateBackgroundColor.

/**
 * Animate the background color of a view
 */
public static void animateBackgroundColor(final View view, long duration, @ColorInt final int colorStart, @ColorInt final int colorEnd) {
    if (DEBUG) {
        Log.d(TAG, "animateBackgroundColor() called with: view = [" + view + "], duration = [" + duration + "], colorStart = [" + colorStart + "], colorEnd = [" + colorEnd + "]");
    }
    final int[][] EMPTY = new int[][] { new int[0] };
    ValueAnimator viewPropertyAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
    viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
    viewPropertyAnimator.setDuration(duration);
    viewPropertyAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            ViewCompat.setBackgroundTintList(view, new ColorStateList(EMPTY, new int[] { (int) animation.getAnimatedValue() }));
        }
    });
    viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            ViewCompat.setBackgroundTintList(view, new ColorStateList(EMPTY, new int[] { colorEnd }));
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            onAnimationEnd(animation);
        }
    });
    viewPropertyAnimator.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ArgbEvaluator(android.animation.ArgbEvaluator) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) ColorStateList(android.content.res.ColorStateList) ValueAnimator(android.animation.ValueAnimator)

Example 50 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project NewPipe by TeamNewPipe.

the class AnimationUtils method animateLightSlideAndAlpha.

private static void animateLightSlideAndAlpha(final View view, boolean enterOrExit, long duration, long delay, final Runnable execOnEnd) {
    if (enterOrExit) {
        view.setTranslationY(-view.getHeight() / 2);
        view.setAlpha(0f);
        view.animate().setInterpolator(new FastOutSlowInInterpolator()).alpha(1f).translationY(0).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (execOnEnd != null)
                    execOnEnd.run();
            }
        }).start();
    } else {
        view.animate().setInterpolator(new FastOutSlowInInterpolator()).alpha(0f).translationY(-view.getHeight() / 2).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
                if (execOnEnd != null)
                    execOnEnd.run();
            }
        }).start();
    }
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator)

Aggregations

FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)53 Animator (android.animation.Animator)20 ValueAnimator (android.animation.ValueAnimator)17 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)16 View (android.view.View)14 ObjectAnimator (android.animation.ObjectAnimator)11 AnimatorSet (android.animation.AnimatorSet)9 BindView (butterknife.BindView)8 RecyclerView (android.support.v7.widget.RecyclerView)5 TextView (android.widget.TextView)5 MaterialTapTargetPrompt (uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)5 ViewPropertyAnimatorListener (android.support.v4.view.ViewPropertyAnimatorListener)4 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)4 ExitFragmentTransition (com.kogitune.activity_transition.fragment.ExitFragmentTransition)3 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)3 ArgbEvaluator (android.animation.ArgbEvaluator)2 TargetApi (android.annotation.TargetApi)2 Rect (android.graphics.Rect)2 Handler (android.os.Handler)2 FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)2