use of android.view.animation.TranslateAnimation in project KJFrameForAndroid by kymjs.
the class KJScrollView method boundBack.
/**
* 将内容布局移动到原位置 可以在UP事件中调用, 也可以在其他需要的地方调用, 如手指移动到当前ScrollView外时
*/
private void boundBack() {
if (!isMoved) {
// 如果没有移动布局, 则跳过执行
return;
}
// 开启动画
TranslateAnimation anim = new TranslateAnimation(0, 0, contentView.getTop(), originalRect.top);
anim.setDuration(ANIM_TIME);
contentView.startAnimation(anim);
// 设置回到正常的布局位置
contentView.layout(originalRect.left, originalRect.top, originalRect.right, originalRect.bottom);
// 将标志位设回false
canPullDown = false;
canPullUp = false;
isMoved = false;
}
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);
}
use of android.view.animation.TranslateAnimation in project Crouton by keyboardsurfer.
the class DefaultAnimationsBuilder method buildDefaultSlideInDownAnimation.
/**
* @param croutonView
* The croutonView which gets animated.
*
* @return The default Animation for a showing {@link Crouton}.
*/
static Animation buildDefaultSlideInDownAnimation(View croutonView) {
if (!areLastMeasuredInAnimationHeightAndCurrentEqual(croutonView) || (null == slideInDownAnimation)) {
slideInDownAnimation = new TranslateAnimation(// X: from, to
0, // X: from, to
0, // Y: from, to
-croutonView.getMeasuredHeight(), // Y: from, to
0);
slideInDownAnimation.setDuration(DURATION);
setLastInAnimationHeight(croutonView.getMeasuredHeight());
}
return slideInDownAnimation;
}
use of android.view.animation.TranslateAnimation in project Crouton by keyboardsurfer.
the class DefaultAnimationsBuilder method buildDefaultSlideOutUpAnimation.
/**
* @param croutonView
* The croutonView which gets animated.
*
* @return The default Animation for a hiding {@link Crouton}.
*/
static Animation buildDefaultSlideOutUpAnimation(View croutonView) {
if (!areLastMeasuredOutAnimationHeightAndCurrentEqual(croutonView) || (null == slideOutUpAnimation)) {
slideOutUpAnimation = new TranslateAnimation(// X: from, to
0, // X: from, to
0, // Y: from, to
0, // Y: from, to
-croutonView.getMeasuredHeight());
slideOutUpAnimation.setDuration(DURATION);
setLastOutAnimationHeight(croutonView.getMeasuredHeight());
}
return slideOutUpAnimation;
}
use of android.view.animation.TranslateAnimation in project nmid-headline by miao1007.
the class PlatformListPage method initAnim.
private void initAnim() {
animShow = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0);
animShow.setDuration(300);
animHide = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1);
animHide.setDuration(300);
}
Aggregations