use of android.view.animation.AnimationSet in project android_frameworks_base by DirtyUnicorns.
the class WindowStateAnimator method applyFadeoutDuringKeyguardExitAnimation.
private void applyFadeoutDuringKeyguardExitAnimation() {
long startTime = mAnimation.getStartTime();
long duration = mAnimation.getDuration();
long elapsed = mLastAnimationTime - startTime;
long fadeDuration = duration - elapsed;
if (fadeDuration <= 0) {
// Never mind, this would be no visible animation, so abort the animation change.
return;
}
AnimationSet newAnimation = new AnimationSet(false);
newAnimation.setDuration(duration);
newAnimation.setStartTime(startTime);
newAnimation.addAnimation(mAnimation);
Animation fadeOut = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.app_starting_exit);
fadeOut.setDuration(fadeDuration);
fadeOut.setStartOffset(elapsed);
newAnimation.addAnimation(fadeOut);
newAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), mAnimDx, mAnimDy);
mAnimation = newAnimation;
}
use of android.view.animation.AnimationSet in project simple-tool-tip by xizzhu.
the class ToolTipView method remove.
/**
* Removes the tool tip view from the view hierarchy.
*/
@UiThread
public void remove() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
container.setPivotX(pivotX);
container.setPivotY(pivotY);
container.animate().setDuration(ANIMATION_DURATION).alpha(0.0F).scaleX(0.0F).scaleY(0.0F).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
popupWindow.dismiss();
}
});
} else {
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(ANIMATION_DURATION);
animationSet.addAnimation(new AlphaAnimation(1.0F, 0.0F));
animationSet.addAnimation(new ScaleAnimation(1.0F, 0.0F, 1.0F, 0.0F, pivotX, pivotY));
animationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
// do nothing
}
@Override
public void onAnimationEnd(Animation animation) {
popupWindow.dismiss();
}
@Override
public void onAnimationRepeat(Animation animation) {
// do nothing
}
});
container.startAnimation(animationSet);
}
}
use of android.view.animation.AnimationSet in project PhotoNoter by yydcdut.
the class PGEditView method showBottomSecondMenuWithAnimation.
public void showBottomSecondMenuWithAnimation() {
mSecondMenusLayout.setVisibility(View.VISIBLE);
if (Build.VERSION.SDK_INT >= 11) {
float secondBottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_second_bottom_height);
TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, secondBottomHeight, 0f);
translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
translateAnimation.setDuration(ANIMATION_TIME);
mSecondMenusLayout.startAnimation(translateAnimation);
float bottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_bottom_height);
TranslateAnimation firstTranslateAnimation = new TranslateAnimation(0f, 0f, 0f, bottomHeight);
firstTranslateAnimation.setDuration(ANIMATION_TIME);
firstTranslateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
AlphaAnimation firstAlphaAnimation = new AlphaAnimation(1f, 0f);
firstAlphaAnimation.setDuration(ANIMATION_TIME);
firstAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(firstTranslateAnimation);
animationSet.addAnimation(firstAlphaAnimation);
animationSet.setAnimationListener(new AnimationAdapter() {
@Override
public void onAnimationEnd(Animation animation) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
mFirstHorizontalLayout.setVisibility(View.INVISIBLE);
}
});
}
});
mFirstHorizontalLayout.startAnimation(animationSet);
} else {
mFirstHorizontalLayout.setVisibility(View.INVISIBLE);
}
}
use of android.view.animation.AnimationSet in project PhotoNoter by yydcdut.
the class PGEditMenuItemView method deleteViewWithAnimation.
private void deleteViewWithAnimation(final View v) {
final ViewGroup parent = (ViewGroup) getParent();
final int index = parent.indexOfChild(this);
final int moveDis = getLayoutParams().width;
float deleteViewMoveWidth = 0.25f * getLayoutParams().width;
float deleteViewMoveHeight = 0.25f * getLayoutParams().height;
ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 0.5f, 1f, 0.5f);
scaleAnimation.setDuration(200l);
TranslateAnimation translateAnimation = new TranslateAnimation(0f, deleteViewMoveWidth, 0f, deleteViewMoveHeight);
translateAnimation.setDuration(200l);
AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(scaleAnimation);
animationSet.addAnimation(translateAnimation);
animationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
parent.post(new Runnable() {
@Override
public void run() {
PGEditMenuItemView.this.setVisibility(View.INVISIBLE);
}
});
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
this.startAnimation(animationSet);
if (index == parent.getChildCount() - 1) {
parent.post(new Runnable() {
@Override
public void run() {
parent.removeView(PGEditMenuItemView.this);
if (null != mOnDeleteViewClick) {
mOnDeleteViewClick.onClick(v);
}
}
});
return;
}
for (int i = index + 1; i < parent.getChildCount(); i++) {
final View childView = parent.getChildAt(i);
childView.clearAnimation();
TranslateAnimation leftTranslateAnimation = new TranslateAnimation(0f, -moveDis, 0f, 0f);
leftTranslateAnimation.setDuration(300l);
if (i == index + 1) {
leftTranslateAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
parent.post(new Runnable() {
@Override
public void run() {
parent.removeView(PGEditMenuItemView.this);
if (null != mOnDeleteViewClick) {
mOnDeleteViewClick.onClick(v);
}
((PGEditMenuItemView) childView).startRotateAnimation();
}
});
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
} else {
leftTranslateAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
parent.post(new Runnable() {
@Override
public void run() {
((PGEditMenuItemView) childView).startRotateAnimation();
}
});
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
childView.startAnimation(leftTranslateAnimation);
}
}
use of android.view.animation.AnimationSet in project UltimateAndroid by cymcsg.
the class RayLayout method createShrinkAnimation.
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
Aggregations