本文整理汇总了Java中android.view.animation.BounceInterpolator类的典型用法代码示例。如果您正苦于以下问题:Java BounceInterpolator类的具体用法?Java BounceInterpolator怎么用?Java BounceInterpolator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BounceInterpolator类属于android.view.animation包,在下文中一共展示了BounceInterpolator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViewsAndEvents
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
@Override
protected void initViewsAndEvents() {
Presenter splashPresenter = new SplashPresenter(this, this);
splashPresenter.initialized();
ViewCompat.animate(fullscreenContent)
.scaleX(1.0f)
.scaleY(1.0f)
.translationY(-100)
.alpha(1f)
.setInterpolator(new BounceInterpolator())
.setStartDelay(DateUtils.SECOND_IN_MILLIS)
.setDuration(DateUtils.SECOND_IN_MILLIS * 2)
.start();
}
示例2: bindHelpButton
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
private void bindHelpButton() {
titleHelpButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ScaleAnimation bounce = new ScaleAnimation(1.2f, 1f, 1.2f, 1, helpButtonSizePx / 2, helpButtonSizePx / 2);
bounce.setDuration(600);
bounce.setInterpolator(new BounceInterpolator());
if (helpLayout.getVisibility() == View.GONE) {
showHelpOverlay();
titleHelpButton.setBackgroundResource(R.drawable.sr_close_icon);
titleHelpButton.startAnimation(bounce);
} else {
hideHelpOverlay();
titleHelpButton.setBackgroundResource(R.drawable.sr_info_icon);
titleHelpButton.startAnimation(bounce);
}
}
});
}
示例3: apply
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
this.targetView = view;
preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
PropertyValuesHolder.ofFloat("translationX",
view.getLeft(), view.getRight()))
.setDuration(PRE_DURATION * 3);
preAnimator.setInterpolator(new AccelerateInterpolator());
afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
PropertyValuesHolder.ofFloat("translationX",
view.getLeft() - view.getWidth(), view.getLeft()))
.setDuration(AFTER_DURATION * 3);
afterAnimator.setInterpolator(new BounceInterpolator());
preAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (action != null) {
action.action();
}
afterAnimator.start();
}
});
return this;
}
示例4: onFinishInflate
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
protected void onFinishInflate() {
super.onFinishInflate();
if (!isInEditMode()) {
TranslateAnimation translateAnimation = new TranslateAnimation(1, 2.0f, 1, 0.0f, 0, 0.0f, 0, 0.0f);
translateAnimation.setDuration(1500);
translateAnimation.setStartOffset(2500);
translateAnimation.setInterpolator(new BounceInterpolator());
animate().setStartDelay(5500).alpha(0.0f).setDuration(400).withEndAction(new Runnable() {
public void run() {
((ViewGroup) SplashScreenView.this.getParent()).removeView(SplashScreenView.this);
}
});
}
}
示例5: startBackAnimator
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
/**
* 启动动画 回弹效果
*
*/
private void startBackAnimator() {
PropertyValuesHolder xValuesHolder = PropertyValuesHolder.ofFloat("x", canvasRotateX, 0);
PropertyValuesHolder yValuesHolder = PropertyValuesHolder.ofFloat("y", canvasRotateY, 0);
touchAnimator = ValueAnimator.ofPropertyValuesHolder(xValuesHolder, yValuesHolder).setDuration(700);
touchAnimator.setInterpolator(new BounceInterpolator());
touchAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
canvasRotateY = (Float) animation.getAnimatedValue("y");
canvasRotateX = (Float) animation.getAnimatedValue("x");
invalidate();
}
});
touchAnimator.start();
}
示例6: ToolTip
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
public ToolTip(){
/* default values */
mTitle = "";
mDescription = "";
mBackgroundColor = Color.parseColor("#3498db");
mTextColor = Color.parseColor("#FFFFFF");
mEnterAnimation = new AlphaAnimation(0f, 1f);
mEnterAnimation.setDuration(1000);
mEnterAnimation.setFillAfter(true);
mEnterAnimation.setInterpolator(new BounceInterpolator());
mShadow = true;
// TODO: exit animation
mGravity = Gravity.CENTER;
}
示例7: onViewClicked
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
@OnClick({R.id.start_window, R.id.jump_other})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.start_window:
if (FloatWindow.get() != null) {
return;
}
FloatPlayerView floatPlayerView = new FloatPlayerView(getApplicationContext());
FloatWindow
.with(getApplicationContext())
.setView(floatPlayerView)
.setWidth(Screen.width, 0.4f)
.setHeight(Screen.width, 0.4f)
.setX(Screen.width, 0.8f)
.setY(Screen.height, 0.3f)
.setMoveType(MoveType.slide)
.setFilter(false)
.setMoveStyle(500, new BounceInterpolator())
.build();
FloatWindow.get().show();
break;
case R.id.jump_other:
startActivity(new Intent(this, EmptyActivity.class));
break;
}
}
示例8: initInterpolations
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
private void initInterpolations() {
ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
add(FastOutSlowInInterpolator.class);
add(BounceInterpolator.class);
add(LinearInterpolator.class);
add(DecelerateInterpolator.class);
add(CycleInterpolator.class);
add(AnticipateInterpolator.class);
add(AccelerateDecelerateInterpolator.class);
add(AccelerateInterpolator.class);
add(AnticipateOvershootInterpolator.class);
add(FastOutLinearInInterpolator.class);
add(LinearOutSlowInInterpolator.class);
add(OvershootInterpolator.class);
}};
try {
interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
示例9: setPosition
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
public void setPosition(Position position) {
this.position = position;
if (position == Position.BOTTOM) {
if (getLayoutParams() instanceof FrameLayout.LayoutParams) {
((LayoutParams) getLayoutParams()).gravity = Gravity.BOTTOM;
} else if (getLayoutParams() instanceof RelativeLayout.LayoutParams) {
((RelativeLayout.LayoutParams) getLayoutParams()).addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
}
setAnimationInterpolator(new LinearInterpolator(), null);
} else {
if (getLayoutParams() instanceof FrameLayout.LayoutParams) {
((LayoutParams) getLayoutParams()).gravity = Gravity.TOP;
} else if (getLayoutParams() instanceof RelativeLayout.LayoutParams) {
((RelativeLayout.LayoutParams) getLayoutParams()).addRule(RelativeLayout.ALIGN_PARENT_TOP);
}
setAnimationInterpolator(new BounceInterpolator(), null);
}
}
示例10: dropPinEffect
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
private void dropPinEffect(Marker marker) {
final Handler handler = new Handler();
final long start = SystemClock.uptimeMillis();
final long duration = 1500;
final Interpolator interpolator = new BounceInterpolator();
handler.post(new Runnable() {
@Override
public void run() {
long elapsed = SystemClock.uptimeMillis() - start;
float t = Math.max(1 - interpolator.getInterpolation((float) elapsed / duration), 0);
marker.setAnchor(0.5f, 1.0f + 14 * t);
if (t > 0.0) {
handler.postDelayed(this, 15);
} else {
marker.showInfoWindow();
}
}
});
}
示例11: setupView
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
private void setupView() {
// 这个Interpolator你可以设置别的 我这里选择的是有弹跳效果的Interpolator
Interpolator polator = new BounceInterpolator();
mScroller = new Scroller(mContext, polator);
// 获取屏幕分辨率
WindowManager wm = (WindowManager) (mContext
.getSystemService(Context.WINDOW_SERVICE));
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm);
mScreenHeigh = dm.heightPixels;
mScreenWidth = dm.widthPixels;
// 这里你一定要设置成透明背景,不然会影响你看到底层布局
this.setBackgroundColor(Color.argb(0, 0, 0, 0));
mImgView = new ImageView(mContext);
mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
mImgView.setScaleType(ImageView.ScaleType.FIT_XY);// 填充整个屏幕
// mImgView.setImageResource(R.drawable.ic_launcher); // 默认背景
mImgView.setBackgroundColor(Color.parseColor("#60000000"));
addView(mImgView);
}
示例12: onCreate
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
mContext = this;
users = getUsers();
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Toast.makeText(mContext, "Refresh success", Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false);
}
});
mRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.listView);
mRecyclerView.addItemDecoration(new VerticalSpaceItemDecoration(3));
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
// interpolator setting
mRecyclerView.setOpenInterpolator(new BounceInterpolator());
mRecyclerView.setCloseInterpolator(new BounceInterpolator());
mAdapter = new AppAdapter(this, users);
mRecyclerView.setAdapter(mAdapter);
}
示例13: onCreate
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
mContext = this;
users = getUsers();
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Toast.makeText(mContext, "Refresh success", Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false);
}
});
mRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.listView);
mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
mRecyclerView.addItemDecoration(new StaggeredSpaceItemDecoration(15, 0, 15, 45));
// interpolator setting
mRecyclerView.setOpenInterpolator(new BounceInterpolator());
mRecyclerView.setCloseInterpolator(new BounceInterpolator());
mAdapter = new AppAdapter(this, users);
mRecyclerView.setAdapter(mAdapter);
}
示例14: onCreate
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
mContext = this;
users = getUsers();
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Toast.makeText(mContext, "Refresh success", Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false);
}
});
mRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.listView);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
// interpolator setting
mRecyclerView.setOpenInterpolator(new BounceInterpolator());
mRecyclerView.setCloseInterpolator(new BounceInterpolator());
mAdapter = new AppAdapter(this, users);
mRecyclerView.setAdapter(mAdapter);
}
示例15: onCreate
import android.view.animation.BounceInterpolator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
mContext = this;
users = getUsers();
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Toast.makeText(mContext, "Refresh success", Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false);
}
});
mRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.listView);
mRecyclerView.addItemDecoration(new GridSpaceItemDecoration(3, 3));
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
mRecyclerView.setOpenInterpolator(new BounceInterpolator());
mRecyclerView.setCloseInterpolator(new BounceInterpolator());
mAdapter = new AppAdapter(this, users);
mRecyclerView.setAdapter(mAdapter);
}