use of android.view.animation.ScaleAnimation in project android_frameworks_base by DirtyUnicorns.
the class DragState method createCancelAnimationLocked.
private Animation createCancelAnimationLocked() {
final AnimationSet set = new AnimationSet(false);
set.addAnimation(new ScaleAnimation(1, 0, 1, 0, mThumbOffsetX, mThumbOffsetY));
set.addAnimation(new AlphaAnimation(mOriginalAlpha, 0));
set.setDuration(ANIMATION_DURATION_MS);
set.setInterpolator(mCubicEaseOutInterpolator);
set.initialize(0, 0, 0, 0);
// Will start on the first call to getTransformation.
set.start();
return set;
}
use of android.view.animation.ScaleAnimation in project QLibrary by DragonsQC.
the class AnimationUtils method getAmplificationAnimation.
/**
* 获取一个放大动画
*
* @param durationMillis 时间
* @param animationListener 监听
* @return 返回一个放大的效果
*/
public static ScaleAnimation getAmplificationAnimation(long durationMillis, AnimationListener animationListener) {
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
scaleAnimation.setDuration(durationMillis);
scaleAnimation.setAnimationListener(animationListener);
return scaleAnimation;
}
use of android.view.animation.ScaleAnimation 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.ScaleAnimation in project WordPress-Android by wordpress-mobile.
the class StatsUIHelper method hideChildViews.
private static void hideChildViews(View groupView, int groupPosition, boolean animate) {
final ViewGroup childContainer = (ViewGroup) groupView.findViewById(R.id.layout_child_container);
if (childContainer == null) {
return;
}
if (childContainer.getVisibility() != View.GONE) {
if (animate) {
Animation expand = new ScaleAnimation(1.0f, 1.0f, 1.0f, 0.0f);
expand.setDuration(ANIM_DURATION);
expand.setInterpolator(getInterpolator());
expand.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
childContainer.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
childContainer.startAnimation(expand);
} else {
childContainer.setVisibility(View.GONE);
}
}
StatsUIHelper.setGroupChevron(false, groupView, groupPosition, animate);
}
use of android.view.animation.ScaleAnimation 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);
}
}
Aggregations