Search in sources :

Example 86 with TranslateAnimation

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

the class AnimationController method slideIn.

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

Example 87 with TranslateAnimation

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

the class AnimationController method slideFadeIn.

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

Example 88 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project JustAndroid by chinaltz.

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 89 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 90 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project newsrob by marianokamp.

the class ShowArticleActivity method toggleFullScreenMode.

private void toggleFullScreenMode() {
    final View v = findViewById(R.id.outter_container);
    if (inFullScreenMode) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        if (false) {
            Animation animation = new TranslateAnimation(0f, 0f, 0f, v.getHeight());
            animation.setDuration(500);
            v.startAnimation(animation);
        }
        v.setVisibility(View.VISIBLE);
        hideTitlePreview();
        inFullScreenMode = false;
    } else {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        if (false) {
            Animation animation = new TranslateAnimation(0f, 0f, 0f, -v.getHeight());
            animation.setDuration(500);
            v.startAnimation(animation);
        }
        v.setVisibility(View.GONE);
        Toast.makeText(this, "- Fullscreen Mode -\n  (Tap twice to exit)", Toast.LENGTH_SHORT).show();
        inFullScreenMode = true;
    }
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) View(android.view.View) WebView(android.webkit.WebView) TextView(android.widget.TextView)

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