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);
}
});
}
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());
}
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;
}
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!!");
}
});
}
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();
}
Aggregations