use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class CaptureUI method animateSlideIn.
public void animateSlideIn(View v, int delta, boolean forcePortrait) {
int orientation = getOrientation();
if (!forcePortrait)
orientation = 0;
ViewPropertyAnimator vp = v.animate();
float dest;
if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
switch(orientation) {
case 0:
dest = v.getX();
v.setX(-(dest - delta));
vp.translationX(dest);
break;
case 90:
dest = v.getY();
v.setY(-(dest + delta));
vp.translationY(dest);
break;
case 180:
dest = v.getX();
v.setX(-(dest + delta));
vp.translationX(dest);
break;
case 270:
dest = v.getY();
v.setY(-(dest - delta));
vp.translationY(dest);
break;
}
} else {
switch(orientation) {
case 0:
dest = v.getX();
v.setX(dest - delta);
vp.translationX(dest);
break;
case 90:
dest = v.getY();
v.setY(dest + delta);
vp.translationY(dest);
break;
case 180:
dest = v.getX();
v.setX(dest + delta);
vp.translationX(dest);
break;
case 270:
dest = v.getY();
v.setY(dest - delta);
vp.translationY(dest);
break;
}
}
vp.setDuration(ANIMATION_DURATION).start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class CaptureUI method animateFadeIn.
public void animateFadeIn(View 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 PhotoMenu 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 PhotoMenu method animateSlideOut.
private void animateSlideOut(final View v) {
if (v == null || mPreviewMenuStatus == PREVIEW_MENU_IN_ANIMATION)
return;
mPreviewMenuStatus = PREVIEW_MENU_IN_ANIMATION;
ViewPropertyAnimator vp = v.animate();
if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
vp.translationXBy(v.getWidth()).setDuration(ANIMATION_DURATION);
} else {
vp.translationXBy(-v.getWidth()).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) {
closeSceneMode();
mPreviewMenuStatus = PREVIEW_MENU_NONE;
}
@Override
public void onAnimationCancel(Animator animation) {
closeSceneMode();
mPreviewMenuStatus = PREVIEW_MENU_NONE;
}
});
vp.start();
}
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();
}
Aggregations