use of android.animation.AnimatorSet in project TransitionPlayer by linfaxin.
the class AbsChangeValue method createAnimator.
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
AnimatorSet animatorSet = new AnimatorSet();
final View view = endValues.view;
for (String valueName : valueNames) {
Object startValue = startValues.values.get(propertyPrefix + valueName);
Object endValue = endValues.values.get(propertyPrefix + valueName);
if (startValue != null && endValue != null && startValue.getClass() != endValue.getClass())
continue;
Class c = null;
if (startValue != null)
c = startValue.getClass();
else if (endValue != null)
c = endValue.getClass();
if (c == null)
continue;
ObjectAnimator animator;
if (c == Float.class || c == float.class) {
animator = ObjectAnimator.ofFloat(view, valueName, (Float) startValue, (Float) endValue);
animatorSet.playTogether(animator);
} else if (c == Integer.class || c == int.class) {
animator = ObjectAnimator.ofInt(view, valueName, (Integer) startValue, (Integer) endValue);
animatorSet.playTogether(animator);
} else {
animator = ObjectAnimator.ofObject(view, valueName, typeEvaluator, startValue, endValue);
animatorSet.playTogether(animator);
}
setPropertyValue(view, valueName, startValue);
if (typeEvaluator != null)
animator.setEvaluator(typeEvaluator);
}
ArrayList<Animator> animators = animatorSet.getChildAnimations();
if (animators != null && animators.size() > 0) {
if (animators.size() == 1)
return animators.get(0);
return animatorSet;
}
return null;
}
use of android.animation.AnimatorSet in project TransitionPlayer by linfaxin.
the class ChangeRotate method createAnimator.
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
final View view = endValues.view;
float startValue = (Float) startValues.values.get(PROPNAME_NAME);
float startValueX = (Float) startValues.values.get(PROPNAME_NAME_X);
float startValueY = (Float) startValues.values.get(PROPNAME_NAME_Y);
float endValue = (Float) endValues.values.get(PROPNAME_NAME);
float endValueX = (Float) endValues.values.get(PROPNAME_NAME_X);
float endValueY = (Float) endValues.values.get(PROPNAME_NAME_Y);
AnimatorSet animatorSet = new AnimatorSet();
if (startValue != endValue) {
view.setRotation(startValue);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME, startValue, endValue));
}
if (startValueX != endValueX) {
view.setRotationX(startValueX);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME_X, startValueX, endValueX));
}
if (startValueY != endValueY) {
view.setRotationY(startValueY);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME_Y, startValueY, endValueY));
}
if (animatorSet.getChildAnimations() != null && animatorSet.getChildAnimations().size() > 0) {
return animatorSet;
}
return null;
}
use of android.animation.AnimatorSet in project TransitionPlayer by linfaxin.
the class ChangeScale method createAnimator.
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
final View view = endValues.view;
float startValueX = (Float) startValues.values.get(PROPNAME_NAME1);
float startValueY = (Float) startValues.values.get(PROPNAME_NAME2);
float endValueX = (Float) endValues.values.get(PROPNAME_NAME1);
float endValueY = (Float) endValues.values.get(PROPNAME_NAME2);
AnimatorSet animatorSet = new AnimatorSet();
if (startValueX != endValueX) {
view.setScaleX(startValueX);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME1, startValueX, endValueX));
}
if (startValueY != endValueY) {
view.setScaleY(startValueY);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME2, startValueY, endValueY));
}
if (animatorSet.getChildAnimations() != null && animatorSet.getChildAnimations().size() > 0) {
return animatorSet;
}
return null;
}
use of android.animation.AnimatorSet in project android-topeka by googlesamples.
the class QuizActivity method revealFragmentContainerLollipop.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void revealFragmentContainerLollipop(final View clickedView, final FrameLayout fragmentContainer) {
prepareCircularReveal(clickedView, fragmentContainer);
ViewCompat.animate(clickedView).scaleX(0).scaleY(0).alpha(0).setInterpolator(mInterpolator).setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
fragmentContainer.setVisibility(View.VISIBLE);
clickedView.setVisibility(View.GONE);
}
}).start();
fragmentContainer.setVisibility(View.VISIBLE);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(mCircularReveal).with(mColorChange);
animatorSet.start();
}
use of android.animation.AnimatorSet in project InstaMaterial by frogermcs.
the class TakePhotoActivity method animateShutter.
private void animateShutter() {
vShutter.setVisibility(View.VISIBLE);
vShutter.setAlpha(0.f);
ObjectAnimator alphaInAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0f, 0.8f);
alphaInAnim.setDuration(100);
alphaInAnim.setStartDelay(100);
alphaInAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
ObjectAnimator alphaOutAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0.8f, 0f);
alphaOutAnim.setDuration(200);
alphaOutAnim.setInterpolator(DECELERATE_INTERPOLATOR);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(alphaInAnim, alphaOutAnim);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
vShutter.setVisibility(View.GONE);
}
});
animatorSet.start();
}
Aggregations