use of android.view.animation.TranslateAnimation in project caronae-android by caronae.
the class Util method expandOrCollapse.
public static void expandOrCollapse(final View v, boolean expand) {
TranslateAnimation anim;
if (expand) {
anim = new TranslateAnimation(0.0f, 0.0f, -v.getHeight(), 0.0f);
v.setVisibility(View.VISIBLE);
} else {
anim = new TranslateAnimation(0.0f, 0.0f, 0.0f, -v.getHeight());
Animation.AnimationListener collapselistener = new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
v.setVisibility(View.GONE);
}
};
anim.setAnimationListener(collapselistener);
}
anim.setDuration(300);
anim.setInterpolator(new AccelerateInterpolator(0.5f));
v.startAnimation(anim);
}
use of android.view.animation.TranslateAnimation in project FlycoDialog_Master by H07000223.
the class NormalListDialog method init.
private void init() {
widthScale(0.8f);
/**
* LayoutAnimation
*/
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 2f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0);
animation.setInterpolator(new DecelerateInterpolator());
animation.setDuration(550);
mLac = new LayoutAnimationController(animation, 0.12f);
mLac.setInterpolator(new DecelerateInterpolator());
}
use of android.view.animation.TranslateAnimation in project FlycoDialog_Master by H07000223.
the class ActionSheetDialog method init.
private void init() {
widthScale(0.95f);
/**
* LayoutAnimation
*/
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 6f, Animation.RELATIVE_TO_SELF, 0);
animation.setInterpolator(new DecelerateInterpolator());
animation.setDuration(350);
animation.setStartOffset(150);
mLac = new LayoutAnimationController(animation, 0.12f);
mLac.setInterpolator(new DecelerateInterpolator());
}
use of android.view.animation.TranslateAnimation in project SnackBar by MrEngineer13.
the class SnackContainer method init.
private void init() {
mInAnimationSet = new AnimationSet(false);
TranslateAnimation mSlideInAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
AlphaAnimation mFadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
mInAnimationSet.addAnimation(mSlideInAnimation);
mInAnimationSet.addAnimation(mFadeInAnimation);
mOutAnimationSet = new AnimationSet(false);
TranslateAnimation mSlideOutAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f);
AlphaAnimation mFadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
mOutAnimationSet.addAnimation(mSlideOutAnimation);
mOutAnimationSet.addAnimation(mFadeOutAnimation);
mOutAnimationSet.setDuration(ANIMATION_DURATION);
mOutAnimationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
removeAllViews();
if (!mSnacks.isEmpty()) {
sendOnHide(mSnacks.poll());
}
if (!isEmpty()) {
showSnack(mSnacks.peek());
} else {
setVisibility(View.GONE);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
use of android.view.animation.TranslateAnimation in project Lazy by l123456789jy.
the class ViewAnimationUtils method translate.
/*
* ************************************************************* 视图移动动画
* ********************************************************************
*/
/**
* 视图移动
*
* @param view 要移动的视图
* @param fromXDelta X轴开始坐标
* @param toXDelta X轴结束坐标
* @param fromYDelta Y轴开始坐标
* @param toYDelta Y轴结束坐标
* @param cycles 重复
* @param durationMillis 持续时间
* @param isBanClick 在执行动画的过程中是否禁止点击
*/
public static void translate(final View view, float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, float cycles, long durationMillis, final boolean isBanClick) {
TranslateAnimation translateAnimation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta);
translateAnimation.setDuration(durationMillis);
if (cycles > 0.0) {
translateAnimation.setInterpolator(new CycleInterpolator(cycles));
}
translateAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
if (isBanClick) {
view.setClickable(false);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (isBanClick) {
view.setClickable(true);
}
}
});
view.startAnimation(translateAnimation);
}
Aggregations