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);
}
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);
}
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);
}
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);
}
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();
}
Aggregations