Search in sources :

Example 96 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project SearchView by lapism.

the class SearchAnimator method fadeClose.

static void fadeClose(final View view, int duration, final SearchEditText editText, final boolean shouldClearOnClose, final SearchView searchView, final SearchView.OnOpenCloseListener listener) {
    Animation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    anim.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            if (shouldClearOnClose && editText.length() > 0) {
                editText.getText().clear();
            }
            editText.clearFocus();
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.setVisibility(View.GONE);
            searchView.setVisibility(View.GONE);
            if (listener != null) {
                listener.onClose();
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    view.setAnimation(anim);
    view.setVisibility(View.GONE);
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 97 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project SearchView by lapism.

the class SearchAnimator method fadeIn.

static void fadeIn(View view, int duration) {
    Animation anim = new AlphaAnimation(0.0f, 1.0f);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    view.setAnimation(anim);
    view.setVisibility(View.VISIBLE);
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 98 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project SearchView by lapism.

the class SearchAnimator method fadeOpen.

static void fadeOpen(View view, int duration, final SearchEditText editText, final boolean shouldClearOnOpen, final SearchView.OnOpenCloseListener listener) {
    Animation anim = new AlphaAnimation(0.0f, 1.0f);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    anim.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            if (listener != null) {
                listener.onOpen();
            }
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (shouldClearOnOpen && editText.length() > 0) {
                editText.getText().clear();
            }
            editText.requestFocus();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    view.setAnimation(anim);
    view.setVisibility(View.VISIBLE);
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 99 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project SearchView by lapism.

the class SearchAnimator method fadeOut.

static void fadeOut(View view, int duration) {
    Animation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    view.setAnimation(anim);
    view.setVisibility(View.GONE);
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 100 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project SearchView by lapism.

the class SearchArrowDrawable method animate.

void animate(float state, int duration) {
    ObjectAnimator anim;
    if (state == STATE_ARROW) {
        anim = ObjectAnimator.ofFloat(this, PROGRESS, state, STATE_HAMBURGER);
    } else {
        anim = ObjectAnimator.ofFloat(this, PROGRESS, state, STATE_ARROW);
    }
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    anim.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Aggregations

AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)165 ValueAnimator (android.animation.ValueAnimator)38 ObjectAnimator (android.animation.ObjectAnimator)31 Animator (android.animation.Animator)30 View (android.view.View)30 AnimatorSet (android.animation.AnimatorSet)22 Animation (android.view.animation.Animation)19 Handler (android.os.Handler)15 NonNull (android.support.annotation.NonNull)12 TranslateAnimation (android.view.animation.TranslateAnimation)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)11 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)10 AlphaAnimation (android.view.animation.AlphaAnimation)10 ImageView (android.widget.ImageView)10 TextView (android.widget.TextView)10 Paint (android.graphics.Paint)9 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)9 LinearInterpolator (android.view.animation.LinearInterpolator)9 ScaleAnimation (android.view.animation.ScaleAnimation)9 PropertyValuesHolder (android.animation.PropertyValuesHolder)8