use of io.codetailps.animation.ReverseInterpolator in project PersistentSearch by KieronQuinn.
the class SearchBox method hideCircularly.
/***
* Hide the searchbox using the circle animation. Can be called regardless of result list length
* @param activity Activity
*/
public void hideCircularly(int x, int y, Activity activity) {
final FrameLayout layout = (FrameLayout) activity.getWindow().getDecorView().findViewById(android.R.id.content);
RelativeLayout root = (RelativeLayout) findViewById(R.id.search_root);
Resources r = getResources();
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics());
int finalRadius = (int) Math.max(layout.getWidth() * 1.5, px);
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(root, x, y, 0, finalRadius);
animator.setInterpolator(new ReverseInterpolator());
animator.setDuration(500);
animator.start();
animator.addListener(new SupportAnimator.AnimatorListener() {
@Override
public void onAnimationStart() {
}
@Override
public void onAnimationEnd() {
setVisibility(View.GONE);
}
@Override
public void onAnimationCancel() {
}
@Override
public void onAnimationRepeat() {
}
});
}
Aggregations