Search in sources :

Example 21 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project BeautifulRefreshLayout by android-cjj.

the class BeautifulRefreshLayout method init.

/**
     * 初始化
     */
private void init(AttributeSet attrs) {
    /**
         * attrs  需要在xml设置什么属性  自己自定义吧  啊哈哈
         */
    /**
         * 初始化headView
         */
    final View headView = LayoutInflater.from(getContext()).inflate(R.layout.view_head, null);
    final WaveView waveView = (WaveView) headView.findViewById(R.id.draweeView);
    final TextView tv_tip = (TextView) headView.findViewById(R.id.tv_tip);
    final RippleView rippleView = (RippleView) headView.findViewById(R.id.ripple);
    final RainView rain = (RainView) headView.findViewById(R.id.rain);
    rain.setVisibility(View.GONE);
    rippleView.setRippleListener(new RippleView.RippleListener() {

        @Override
        public void onRippleFinish() {
            if (listener != null) {
                listener.onRefresh(BeautifulRefreshLayout.this);
            }
        }
    });
    /**
         * 设置波浪的高度
         */
    setWaveHeight(DensityUtil.dip2px(getContext(), waveHeight));
    /**
         * 设置headView的高度
         */
    setHeaderHeight(DensityUtil.dip2px(getContext(), headHeight));
    /**
         * 设置headView
         */
    setHeaderView(headView);
    /**
         * 监听波浪变化监听
         */
    setPullWaveListener(new PullWaveListener() {

        @Override
        public void onPulling(RefreshLayout refreshLayout, float fraction) {
            float headW = DensityUtil.dip2px(getContext(), waveHeight);
            waveView.setHeadHeight((int) (DensityUtil.dip2px(getContext(), headHeight) * limitValue(1, fraction)));
            waveView.setWaveHeight((int) (headW * Math.max(0, fraction - 1)));
            waveView.invalidate();
            if (DensityUtil.dip2px(getContext(), headHeight) > (int) (DensityUtil.dip2px(getContext(), headHeight) * limitValue(1, fraction))) {
                tv_tip.setText("下拉下雨");
            } else {
                tv_tip.setText("松开下雨");
            }
        }

        @Override
        public void onPullReleasing(RefreshLayout refreshLayout, float fraction) {
            if (!refreshLayout.isRefreshing) {
            }
        }
    });
    /**
         * 松开后的监听
         */
    setPullToRefreshListener(new PullToRefreshListener() {

        @Override
        public void onRefresh(RefreshLayout refreshLayout) {
            tv_tip.setText("下雨中...");
            rain.setVisibility(View.VISIBLE);
            rain.StartRain();
            waveView.setHeadHeight((int) (DensityUtil.dip2px(getContext(), headHeight)));
            ValueAnimator animator = ValueAnimator.ofInt(waveView.getWaveHeight(), 0, -300, 0, -100, 0);
            animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
                    waveView.setWaveHeight((int) animation.getAnimatedValue());
                    waveView.invalidate();
                }
            });
            animator.setInterpolator(new BounceInterpolator());
            animator.setDuration(1000);
            animator.start();
            refreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    rippleView.startReveal();
                    rain.stopRain();
                }
            }, 3000);
        }
    });
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) ValueAnimator(com.nineoldandroids.animation.ValueAnimator) ImageView(android.widget.ImageView) TextView(android.widget.TextView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) TextView(android.widget.TextView)

Example 22 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project Rajawali by Rajawali.

the class AnimatedTextureViewFragment method onResume.

@Override
public void onResume() {
    super.onResume();
    ((View) mRenderSurface).animate().rotation(360.0f).setDuration(20000).setInterpolator(new BounceInterpolator());
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator)

Example 23 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project MaterialDesignLibrary by navasmdc.

the class ButtonFloat method hide.

public void hide() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
    animator.setInterpolator(new BounceInterpolator());
    animator.setDuration(1500);
    animator.start();
    isShow = false;
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) BounceInterpolator(android.view.animation.BounceInterpolator)

Example 24 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project PreLollipopTransition by takahirom.

the class SubActivity2 method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sub2);
    Intent intent = getIntent();
    exitTransition = ActivityTransition.with(intent).to(findViewById(R.id.sub_imageView)).interpolator(new BounceInterpolator()).enterListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            Log.d("TAG", "onEnterAnimationStart!! ");
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            Log.d("TAG", "onEnterAnimationEnd!!");
        }
    }).start(savedInstanceState);
    exitTransition.exitListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            Log.d("TAG", "onExitAnimationEnd!!");
        }

        @Override
        public void onAnimationStart(Animator animation) {
            Log.d("TAG", "onExitAnimationStart!!");
        }
    });
}
Also used : Animator(android.animation.Animator) BounceInterpolator(android.view.animation.BounceInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Intent(android.content.Intent)

Example 25 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project WordPress-Android by wordpress-mobile.

the class WPMainTabLayout method showNoteBadge.

/*
     * adds or removes the badge on the notifications tab depending on whether there are
     * unread notifications
    */
void showNoteBadge(boolean showBadge) {
    if (mNoteBadge == null)
        return;
    boolean isBadged = (mNoteBadge.getVisibility() == View.VISIBLE);
    if (showBadge == isBadged) {
        return;
    }
    float start = showBadge ? 0f : 1f;
    float end = showBadge ? 1f : 0f;
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, start, end);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, start, end);
    ObjectAnimator animScale = ObjectAnimator.ofPropertyValuesHolder(mNoteBadge, scaleX, scaleY);
    if (showBadge) {
        animScale.setInterpolator(new BounceInterpolator());
        animScale.setDuration(getContext().getResources().getInteger(android.R.integer.config_longAnimTime));
        animScale.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animation) {
                mNoteBadge.setVisibility(View.VISIBLE);
            }
        });
    } else {
        animScale.setInterpolator(new AccelerateInterpolator());
        animScale.setDuration(getContext().getResources().getInteger(android.R.integer.config_shortAnimTime));
        animScale.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mNoteBadge.setVisibility(View.GONE);
            }
        });
    }
    animScale.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) BounceInterpolator(android.view.animation.BounceInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Aggregations

BounceInterpolator (android.view.animation.BounceInterpolator)30 View (android.view.View)8 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)6 ImageView (android.widget.ImageView)6 ObjectAnimator (android.animation.ObjectAnimator)5 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)5 LinearInterpolator (android.view.animation.LinearInterpolator)5 TextView (android.widget.TextView)5 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 AnticipateInterpolator (android.view.animation.AnticipateInterpolator)4 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)4 Interpolator (android.view.animation.Interpolator)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 Scroller (android.widget.Scroller)4 Animator (android.animation.Animator)3 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)3 Animation (com.db.chart.animation.Animation)3 ValueAnimator (android.animation.ValueAnimator)2 SuppressLint (android.annotation.SuppressLint)2 DisplayMetrics (android.util.DisplayMetrics)2