use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class PhotoMenu method animateFadeIn.
public void animateFadeIn(final ListView v) {
ViewPropertyAnimator vp = v.animate();
vp.alpha(1f).setDuration(ANIMATION_DURATION);
vp.start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class VideoMenu method animateFadeOut.
private void animateFadeOut(final ListView v, final int level) {
if (v == null || mPopupStatus == POPUP_IN_ANIMATION_FADE)
return;
mPopupStatus = POPUP_IN_ANIMATION_FADE;
ViewPropertyAnimator vp = v.animate();
vp.alpha(0f).setDuration(ANIMATION_DURATION);
vp.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (level == 1) {
mUI.dismissLevel1();
initializePopup();
mPopupStatus = POPUP_NONE;
mUI.cleanupListview();
} else if (level == 2) {
mUI.dismissLevel2();
mPopupStatus = POPUP_FIRST_LEVEL;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (level == 1) {
mUI.dismissLevel1();
initializePopup();
mPopupStatus = POPUP_NONE;
mUI.cleanupListview();
} else if (level == 2) {
mUI.dismissLevel2();
mPopupStatus = POPUP_FIRST_LEVEL;
}
}
});
vp.start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class VideoMenu method animateFadeIn.
public void animateFadeIn(final ListView v) {
ViewPropertyAnimator vp = v.animate();
vp.alpha(1f).setDuration(ANIMATION_DURATION);
vp.start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Dialer by MoKee.
the class CallCardFragment method doActionOnPredraw.
private void doActionOnPredraw(final boolean visible, final boolean isLayoutRtl, final View videoView, final float spaceBesideCallCard) {
float videoViewTranslation = 0f;
// Translate the call card to its pre-animation state.
if (!mIsLandscape) {
mPrimaryCallCardContainer.setTranslationY(visible ? -mPrimaryCallCardContainer.getHeight() : 0);
ViewGroup.LayoutParams p = videoView.getLayoutParams();
videoViewTranslation = p.height / 2 - spaceBesideCallCard / 2;
}
// Perform animation of video view.
ViewPropertyAnimator videoViewAnimator = videoView.animate().setInterpolator(AnimUtils.EASE_OUT_EASE_IN).setDuration(mVideoAnimationDuration);
if (mIsLandscape) {
videoViewAnimator.translationX(visible ? videoViewTranslation : 0);
} else {
videoViewAnimator.translationY(visible ? videoViewTranslation : 0);
}
videoViewAnimator.start();
// Animate the call card sliding.
ViewPropertyAnimator callCardAnimator = mPrimaryCallCardContainer.animate().setInterpolator(AnimUtils.EASE_OUT_EASE_IN).setDuration(mVideoAnimationDuration).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (!visible) {
mPrimaryCallCardContainer.setVisibility(View.GONE);
}
}
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
if (visible) {
mPrimaryCallCardContainer.setVisibility(View.VISIBLE);
}
}
});
if (mIsLandscape) {
float translationX = mPrimaryCallCardContainer.getWidth();
translationX *= isLayoutRtl ? 1 : -1;
callCardAnimator.translationX(visible ? 0 : translationX).start();
} else {
callCardAnimator.translationY(visible ? 0 : -mPrimaryCallCardContainer.getHeight()).start();
}
}
use of android.view.ViewPropertyAnimator in project apps-android-wikipedia by wikimedia.
the class FeedItemAnimator method animateMoveImpl.
void animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) {
final View view = holder.itemView;
final int deltaX = toX - fromX;
final int deltaY = toY - fromY;
if (deltaX != 0) {
view.animate().translationX(0);
}
if (deltaY != 0) {
view.animate().translationY(0);
}
// TODO: make EndActions end listeners instead, since end actions aren't called when
// vpas are canceled (and can't end them. why?)
// need listener functionality in VPACompat for this. Ick.
final ViewPropertyAnimator animation = view.animate();
mMoveAnimations.add(holder);
animation.setDuration(getMoveDuration()).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchMoveStarting(holder);
}
@Override
public void onAnimationCancel(Animator animator) {
if (deltaX != 0) {
view.setTranslationX(0);
}
if (deltaY != 0) {
view.setTranslationY(0);
}
}
@Override
public void onAnimationEnd(Animator animator) {
animation.setListener(null);
dispatchMoveFinished(holder);
mMoveAnimations.remove(holder);
dispatchFinishedWhenDone();
}
}).start();
}
Aggregations