Java Code Examples for android.view.View.setAnimation()

The following are Jave code examples for showing how to use setAnimation() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Pocket-Plays-for-Twitch   File: AnimationService.java   Source Code and License Vote up 7 votes
public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
	final int ANIMATION_DURATION = 650;
	final int BASE_DELAY = 50;

	TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0);

	AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);

	final AnimationSet animationSet = new AnimationSet(true);
	animationSet.addAnimation(translationAnimation);
	animationSet.addAnimation(alphaAnimation);
	animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
	animationSet.setFillAfter(true);
	animationSet.setFillBefore(true);
	animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);

	aCard.setAnimation(animationSet);
}
 
Example 2
Project: airgram   File: View10.java   Source Code and License Vote up 6 votes
public static View10 wrap(View view) {
    View10 proxy = PROXIES.get(view);
    Animation animation = view.getAnimation();
    if (proxy == null || proxy != animation && animation != null) {
        proxy = new View10(view);
        PROXIES.put(view, proxy);
    } else if (animation == null) {
        view.setAnimation(proxy);
    }
    return proxy;
}
 
Example 3
Project: AndroidBackendlessChat   File: ChatSDKMessagesListAdapter.java   Source Code and License Vote up 6 votes
/**
 * Animating the sides of the row, For example animating the user profile image and the message date.
 * */
private void animateSides(View view, boolean fromLeft, Animation.AnimationListener animationListener){
    if (!isScrolling)
        return;

    if (fromLeft)
        view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_left));
    else view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_right));

    view.getAnimation().setAnimationListener(animationListener);
    view.animate();
}
 
Example 4
Project: chat-sdk-android-push-firebase   File: ChatSDKMessagesListAdapter.java   Source Code and License Vote up 6 votes
/**
 * Animating the sides of the row, For example animating the user profile image and the message date.
 * */
private void animateSides(View view, boolean fromLeft, Animation.AnimationListener animationListener){
    if (!isScrolling)
        return;

    if (fromLeft)
        view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_left));
    else view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_right));

    view.getAnimation().setAnimationListener(animationListener);
    view.animate();
}
 
Example 5
Project: chat-sdk-android-push-firebase   File: ChatSDKMessagesListAdapter.java   Source Code and License Vote up 6 votes
/**
 *  Animating the center part of the row, For example the image in an image message or the text in text message.
 * */
private void animateContent(View view, Animation.AnimationListener animationListener, boolean showFull){
    if (!isScrolling)
        return;

    view.setAnimation(AnimationUtils.loadAnimation(mActivity, showFull ? R.anim.fade_in_expand : R.anim.fade_in_half_and_expand));
    view.getAnimation().setAnimationListener(animationListener);
    view.animate();
}
 
Example 6
Project: PlusGram   File: View10.java   Source Code and License Vote up 6 votes
public static View10 wrap(View view) {
    View10 proxy = PROXIES.get(view);
    Animation animation = view.getAnimation();
    if (proxy == null || proxy != animation && animation != null) {
        proxy = new View10(view);
        PROXIES.put(view, proxy);
    } else if (animation == null) {
        view.setAnimation(proxy);
    }
    return proxy;
}
 
Example 7
Project: letv   File: FeedBackAnimFragment.java   Source Code and License Vote up 6 votes
private void startAnim(View widget) {
    int distance = widget.getHeight();
    widget.setVisibility(0);
    this.mFloatLayout.setVisibility(0);
    AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(200);
    alphaAnimation.setStartOffset(200);
    this.mFloatLayout.setAnimation(alphaAnimation);
    this.mAnimation = new TranslateAnimation(0.0f, 0.0f, (float) distance, 0.0f);
    this.mAnimation.setDuration(200);
    this.mAnimation.setStartOffset(200);
    widget.setAnimation(this.mAnimation);
    this.mAnimation.start();
    alphaAnimation.start();
}
 
Example 8
Project: CXJPadProject   File: AnimationUtil.java   Source Code and License Vote up 6 votes
public static void rotate(View v){
    //创建旋转动画 对象   fromDegrees:旋转开始的角度  toDegrees:结束的角度
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    //设置动画的显示时间
    rotateAnimation.setDuration(1000);
    //设置动画重复播放几次
    rotateAnimation.setRepeatCount(RotateAnimation.INFINITE);
    //设置动画插值器
    rotateAnimation.setInterpolator(new LinearInterpolator());
    //设置动画重复播放的方式,翻转播放
    rotateAnimation.setRepeatMode(Animation.RESTART);
    //拿着imageview对象来运行动画效果
    v.setAnimation(rotateAnimation);
}
 
Example 9
Project: boohee_v5.6   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
private AnimatorProxy(View view) {
    setDuration(0);
    setFillAfter(true);
    view.setAnimation(this);
    this.mView = new WeakReference(view);
}
 
Example 10
Project: airgram   File: View10.java   Source Code and License Vote up 5 votes
private View10(View view) {
    setDuration(0);
    setFillAfter(true);
    view.setAnimation(this);
    mView = new WeakReference<>(view);
}
 
Example 11
Project: CSipSimple   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
private AnimatorProxy(View view) {
    setDuration(0); //perform transformation immediately
    setFillAfter(true); //persist transformation beyond duration
    view.setAnimation(this);
    mView = new WeakReference<View>(view);
}
 
Example 12
Project: UiLib   File: ArcMenu.java   Source Code and License Vote up 5 votes
private Animation bindItemAnimation(final View child, final boolean isClicked, final long duration) {
    Animation animation = createItemDisapperAnimation(duration, isClicked);
    child.setAnimation(animation);

    return animation;
}
 
Example 13
Project: android-project-gallery   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
private AnimatorProxy(View view) {
    setDuration(0); //perform transformation immediately
    setFillAfter(true); //persist transformation beyond duration
    view.setAnimation(this);
    mView = new WeakReference<View>(view);
}
 
Example 14
Project: Nearby   File: BaseFragment.java   Source Code and License Vote up 5 votes
public void setFadeInAnimation(View view){
    Animation animation = new AlphaAnimation(0, 1);
    animation.setDuration(500);
    view.setAnimation(animation);
}
 
Example 15
Project: Nearby   File: BaseActivity.java   Source Code and License Vote up 5 votes
public void setFadeInAnimation(View view){
    Animation animation = new AlphaAnimation(0, 1);
    animation.setDuration(500);
    view.setAnimation(animation);
}
 
Example 16
Project: Nearby   File: BaseActivity.java   Source Code and License Vote up 5 votes
public void setFadeOutAnimation(View view){
    Animation animation = new AlphaAnimation(1, 0);
    animation.setDuration(500);
    view.setAnimation(animation);
}
 
Example 17
Project: PlusGram   File: View10.java   Source Code and License Vote up 5 votes
private View10(View view) {
    setDuration(0);
    setFillAfter(true);
    view.setAnimation(this);
    mView = new WeakReference<>(view);
}
 
Example 18
Project: exciting-app   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
private AnimatorProxy(View view) {
    setDuration(0); //perform transformation immediately
    setFillAfter(true); //persist transformation beyond duration
    view.setAnimation(this);
    mView = new WeakReference<View>(view);
}
 
Example 19
Project: FLFloatingButton   File: ArcMenu.java   Source Code and License Vote up 5 votes
private Animation bindItemAnimation(final View child, final boolean isClicked, final long duration) {
    Animation animation = createItemDisapperAnimation(duration, isClicked);
    child.setAnimation(animation);

    return animation;
}
 
Example 20
Project: FLFloatingButton   File: RayMenu.java   Source Code and License Vote up 5 votes
private Animation bindItemAnimation(final View child, final boolean isClicked, final long duration) {
	Animation animation = createItemDisapperAnimation(duration, isClicked);
	child.setAnimation(animation);

	return animation;
}