Search in sources :

Example 81 with TranslateAnimation

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;
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation)

Example 82 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project weiciyuan by qii.

the class UserInfoFragment method displayCoverPicture.

private void displayCoverPicture() {
    if (cover.getDrawable() != null) {
        return;
    }
    // final int height = viewPager.getHeight();
    final int height = Utility.dip2px(200);
    final int width = Utility.getMaxLeftWidthOrHeightImageViewCanRead(height);
    final String picPath = userBean.getCover_image();
    blur.setAlpha(0f);
    blur.setOriImageUrl(picPath);
    ArrayList<ImageView> imageViewArrayList = new ArrayList<ImageView>();
    imageViewArrayList.add(cover);
    imageViewArrayList.add(blur);
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -100f, Animation.RELATIVE_TO_SELF, 0f);
    animation.setDuration(3000);
    animation.setInterpolator(new DecelerateInterpolator());
    ArrayList<Animation> animationArray = new ArrayList<Animation>();
    animationArray.add(animation);
    TimeLineBitmapDownloader.getInstance().display(imageViewArrayList, width, height, picPath, FileLocationMethod.cover, animationArray);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ArrayList(java.util.ArrayList) TranslateAnimation(android.view.animation.TranslateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) ImageView(android.widget.ImageView) BlurImageView(org.qii.weiciyuan.support.lib.BlurImageView) TimeLineAvatarImageView(org.qii.weiciyuan.support.lib.TimeLineAvatarImageView) TextPaint(android.text.TextPaint)

Example 83 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project smartmodule by carozhu.

the class OptAnimationLoader method createAnimationFromXml.

private static Animation createAnimationFromXml(Context c, XmlPullParser parser, AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException {
    Animation anim = null;
    // Make sure we are on a start tag.
    int type;
    int depth = parser.getDepth();
    while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
        if (type != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        if (name.equals("set")) {
            anim = new AnimationSet(c, attrs);
            createAnimationFromXml(c, parser, (AnimationSet) anim, attrs);
        } else if (name.equals("alpha")) {
            anim = new AlphaAnimation(c, attrs);
        } else if (name.equals("scale")) {
            anim = new ScaleAnimation(c, attrs);
        } else if (name.equals("rotate")) {
            anim = new RotateAnimation(c, attrs);
        } else if (name.equals("translate")) {
            anim = new TranslateAnimation(c, attrs);
        } else {
            try {
                anim = (Animation) Class.forName(name).getConstructor(Context.class, AttributeSet.class).newInstance(c, attrs);
            } catch (Exception te) {
                throw new RuntimeException("Unknown animation name: " + parser.getName() + " error:" + te.getMessage());
            }
        }
        if (parent != null) {
            parent.addAnimation(anim);
        }
    }
    return anim;
}
Also used : Context(android.content.Context) RotateAnimation(android.view.animation.RotateAnimation) AttributeSet(android.util.AttributeSet) ScaleAnimation(android.view.animation.ScaleAnimation) RotateAnimation(android.view.animation.RotateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) IOException(java.io.IOException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 84 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project smartmodule by carozhu.

the class AnimationController method slideOut.

public void slideOut(View view, long durationMillis, long delayMillis) {
    TranslateAnimation animation = new TranslateAnimation(rela2, 0, rela2, -1, rela2, 0, rela2, 0);
    baseOut(view, animation, durationMillis, delayMillis);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation)

Example 85 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project smartmodule by carozhu.

the class AnimationController method slideFadeOut.

public void slideFadeOut(View view, long durationMillis, long delayMillis) {
    TranslateAnimation animation1 = new TranslateAnimation(rela2, 0, rela2, -1, rela2, 0, rela2, 0);
    AlphaAnimation animation2 = new AlphaAnimation(1, 0);
    AnimationSet animation = new AnimationSet(false);
    animation.addAnimation(animation1);
    animation.addAnimation(animation2);
    baseOut(view, animation, durationMillis, delayMillis);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Aggregations

TranslateAnimation (android.view.animation.TranslateAnimation)229 Animation (android.view.animation.Animation)109 AlphaAnimation (android.view.animation.AlphaAnimation)90 AnimationSet (android.view.animation.AnimationSet)69 ScaleAnimation (android.view.animation.ScaleAnimation)44 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)30 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)27 View (android.view.View)22 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)22 TextView (android.widget.TextView)18 AnimationListener (android.view.animation.Animation.AnimationListener)17 LinearInterpolator (android.view.animation.LinearInterpolator)13 RotateAnimation (android.view.animation.RotateAnimation)13 ClipRectAnimation (android.view.animation.ClipRectAnimation)12 ListView (android.widget.ListView)12 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)12 ImageView (android.widget.ImageView)11 LayoutAnimationController (android.view.animation.LayoutAnimationController)8 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)8 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)8