use of com.hippo.yorozuya.SimpleAnimatorListener in project EhViewer by seven332.
the class GalleryCommentsScene method hideEditPanelWithAnimation.
private void hideEditPanelWithAnimation() {
if (null == mFab || null == mEditPanel) {
return;
}
mInAnimation = true;
int halfW = mEditPanel.getWidth() / 2;
int halfH = mEditPanel.getHeight() / 2;
Animator animator = ViewAnimationUtils.createCircularReveal(mEditPanel, halfW, halfH, (float) Math.hypot(halfW, halfH), 0.0f).setDuration(300L);
animator.addListener(new SimpleAnimatorListener() {
@Override
public void onAnimationEnd(Animator a) {
if (null == mFab || null == mEditPanel) {
return;
}
if (Looper.myLooper() != Looper.getMainLooper()) {
// Check it here to avoid crash.
return;
}
mEditPanel.setVisibility(View.GONE);
((View) mFab).setVisibility(View.VISIBLE);
int fabStartX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2);
int fabStartY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2);
mFab.setX(fabStartX);
mFab.setY(fabStartY);
mFab.setScaleX(0.0f);
mFab.setScaleY(0.0f);
mFab.setRotation(-45.0f);
mFab.animate().translationX(0.0f).translationY(0.0f).scaleX(1.0f).scaleY(1.0f).rotation(0.0f).setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR).setDuration(300L).setListener(new SimpleAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
mInAnimation = false;
}
}).start();
}
});
animator.start();
}
use of com.hippo.yorozuya.SimpleAnimatorListener in project EhViewer by seven332.
the class SearchBar method hideImeAndSuggestionsList.
private void hideImeAndSuggestionsList(boolean animation) {
// Hide ime
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(this.getWindowToken(), 0);
// Hide suggestions list
if (animation) {
ObjectAnimator oa = ObjectAnimator.ofFloat(this, "progress", 0f);
oa.setDuration(ANIMATE_TIME);
oa.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR);
oa.addListener(new SimpleAnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
mInAnimation = true;
}
@Override
public void onAnimationEnd(Animator animation) {
mListContainer.setVisibility(View.GONE);
mInAnimation = false;
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
oa.setAutoCancel(true);
}
oa.start();
} else {
setProgress(0f);
mListContainer.setVisibility(View.GONE);
}
}
use of com.hippo.yorozuya.SimpleAnimatorListener in project EhViewer by seven332.
the class ViewTransition method startAnimations.
private void startAnimations(final View hiddenView, final View shownView) {
ObjectAnimator oa1 = ObjectAnimator.ofFloat(hiddenView, "alpha", 0f);
oa1.setDuration(ANIMATE_TIME);
oa1.addListener(new SimpleAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
hiddenView.setVisibility(View.GONE);
mAnimator1 = null;
}
});
oa1.start();
mAnimator1 = oa1;
shownView.setVisibility(View.VISIBLE);
ObjectAnimator oa2 = ObjectAnimator.ofFloat(shownView, "alpha", 1f);
oa2.setDuration(ANIMATE_TIME);
oa2.addListener(new SimpleAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimator2 = null;
}
});
oa2.start();
mAnimator2 = oa2;
}
use of com.hippo.yorozuya.SimpleAnimatorListener in project EhViewer by seven332.
the class GalleryCommentsScene method showEditPanelWithAnimation.
private void showEditPanelWithAnimation() {
if (null == mFab || null == mEditPanel) {
return;
}
mInAnimation = true;
mFab.setTranslationX(0.0f);
mFab.setTranslationY(0.0f);
mFab.setScaleX(1.0f);
mFab.setScaleY(1.0f);
int fabEndX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2);
int fabEndY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2);
mFab.animate().x(fabEndX).y(fabEndY).scaleX(0.0f).scaleY(0.0f).setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR).setDuration(300L).setListener(new SimpleAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
if (null == mFab || null == mEditPanel) {
return;
}
((View) mFab).setVisibility(View.INVISIBLE);
mEditPanel.setVisibility(View.VISIBLE);
int halfW = mEditPanel.getWidth() / 2;
int halfH = mEditPanel.getHeight() / 2;
Animator animator = ViewAnimationUtils.createCircularReveal(mEditPanel, halfW, halfH, 0, (float) Math.hypot(halfW, halfH)).setDuration(300L);
animator.addListener(new SimpleAnimatorListener() {
@Override
public void onAnimationEnd(Animator a) {
mInAnimation = false;
}
});
animator.start();
}
}).start();
}
use of com.hippo.yorozuya.SimpleAnimatorListener in project EhViewer by seven332.
the class FabLayout method setPrimaryFabAnimation.
private void setPrimaryFabAnimation(final View child, final boolean expanded, boolean delay) {
float startRotation;
float endRotation;
float startScale;
float endScale;
Interpolator interpolator;
if (expanded) {
startRotation = -45.0f;
endRotation = 0.0f;
startScale = 0.0f;
endScale = 1.0f;
interpolator = AnimationUtils.FAST_SLOW_INTERPOLATOR;
} else {
startRotation = 0.0f;
endRotation = 0.0f;
startScale = 1.0f;
endScale = 0.0f;
interpolator = AnimationUtils.SLOW_FAST_INTERPOLATOR;
}
child.setScaleX(startScale);
child.setScaleY(startScale);
child.setRotation(startRotation);
child.animate().scaleX(endScale).scaleY(endScale).rotation(endRotation).setStartDelay(delay ? ANIMATE_TIME : 0L).setDuration(ANIMATE_TIME).setInterpolator(interpolator).setListener(new SimpleAnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
if (expanded) {
child.setVisibility(View.VISIBLE);
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (!expanded) {
child.setVisibility(View.INVISIBLE);
}
}
}).start();
}
Aggregations