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 android_packages_apps_Dialer by LineageOS.
the class AnimUtils method fadeIn.
public static void fadeIn(final View fadeIn, int durationMs, int delay, final AnimationCallback callback) {
fadeIn.setAlpha(0);
final ViewPropertyAnimator animator = fadeIn.animate();
animator.cancel();
animator.setStartDelay(delay);
animator.alpha(1).withLayer().setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
fadeIn.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationCancel(Animator animation) {
fadeIn.setAlpha(1);
if (callback != null) {
callback.onAnimationCancel();
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (callback != null) {
callback.onAnimationEnd();
}
}
});
if (durationMs != DEFAULT_DURATION) {
animator.setDuration(durationMs);
}
animator.start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Dialer by LineageOS.
the class DialpadView method animateShow.
public void animateShow() {
// This is a hack; without this, the setTranslationY is delayed in being applied, and the
// numbers appear at their original position (0) momentarily before animating.
final AnimatorListenerAdapter showListener = new AnimatorListenerAdapter() {
};
for (int i = 0; i < BUTTON_IDS.length; i++) {
int delay = (int) (getKeyButtonAnimationDelay(BUTTON_IDS[i]) * DELAY_MULTIPLIER);
int duration = (int) (getKeyButtonAnimationDuration(BUTTON_IDS[i]) * DURATION_MULTIPLIER);
final DialpadKeyButton dialpadKey = (DialpadKeyButton) findViewById(BUTTON_IDS[i]);
ViewPropertyAnimator animator = dialpadKey.animate();
if (isLandscapeMode) {
// Landscape orientation requires translation along the X axis.
// For RTL locales, ensure we translate negative on the X axis.
dialpadKey.setTranslationX((isRtl ? -1 : 1) * translateDistance);
animator.translationX(0);
} else {
// Portrait orientation requires translation along the Y axis.
dialpadKey.setTranslationY(translateDistance);
animator.translationY(0);
}
animator.setInterpolator(AnimUtils.EASE_OUT_EASE_IN).setStartDelay(delay).setDuration(duration).setListener(showListener).start();
}
}
use of android.view.ViewPropertyAnimator in project Genius-Android by qiujuer.
the class BalloonMarker method onOpeningComplete.
@Override
public void onOpeningComplete() {
mNumber.setVisibility(View.VISIBLE);
ViewPropertyAnimator animator = mNumber.animate();
animator.alpha(1f);
animator.setDuration(100);
animator.start();
if (getParent() instanceof BalloonMarkerDrawable.MarkerAnimationListener) {
((BalloonMarkerDrawable.MarkerAnimationListener) getParent()).onOpeningComplete();
}
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Dialer by MoKee.
the class AnimUtils method fadeIn.
public static void fadeIn(final View fadeIn, int durationMs, int delay, final AnimationCallback callback) {
fadeIn.setAlpha(0);
final ViewPropertyAnimator animator = fadeIn.animate();
animator.cancel();
animator.setStartDelay(delay);
animator.alpha(1).withLayer().setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
fadeIn.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationCancel(Animator animation) {
fadeIn.setAlpha(1);
if (callback != null) {
callback.onAnimationCancel();
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (callback != null) {
callback.onAnimationEnd();
}
}
});
if (durationMs != DEFAULT_DURATION) {
animator.setDuration(durationMs);
}
animator.start();
}
Aggregations