本文整理汇总了Java中com.nineoldandroids.view.ViewPropertyAnimator类的典型用法代码示例。如果您正苦于以下问题:Java ViewPropertyAnimator类的具体用法?Java ViewPropertyAnimator怎么用?Java ViewPropertyAnimator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewPropertyAnimator类属于com.nineoldandroids.view包,在下文中一共展示了ViewPropertyAnimator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: liftingFromBottom
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param fromY initial Y position of view
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay) {
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, fromY);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
示例2: onActivityResult
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
Bundle bundle = data.getExtras();
ArrayList<AddedProduct> backList = (ArrayList<AddedProduct>) bundle.getSerializable("backap");
List<AddedProduct> newList = new ArrayList<>();
if (backList != null) {
newList.addAll(backList);
for (AddedProduct pro : backList) {
Integer proId = Integer.valueOf(pro.getProductId());
Integer count = pro.getCount();
mSelfHelpPlaceOrderAdapter.getCountMap().put(proId, count);
}
mSelfHelpPlaceOrderAdapter.setData(newList);
}
if (backList != null && backList.size() > 0) {
ToastUtil.show(getActivityContext(), "添加成功");
mRlSelfHelp.setVisibility(View.GONE);
mRlBottom.setVisibility(View.VISIBLE);
ViewPropertyAnimator.animate(mRlBottom).translationY(-CommonUtils.dip2px(getActivityContext(), 55));
mRvProduct.setVisibility(View.VISIBLE);
mRlSelectBar.setVisibility(View.GONE);
} else {
mRlSelfHelp.setVisibility(View.VISIBLE);
mRlBottom.setVisibility(View.GONE);
mRlSelectBar.setVisibility(View.GONE);
}
setTitleEditShow();
}
}
示例3: switchEditMode
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
private void switchEditMode() {
//强制隐藏键盘
InputMethodManager imm = (InputMethodManager) getSystemService(getActivityContext().INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mLlAll.getWindowToken(), 0); //强制隐藏键盘
if (!editMode) {
this.setTitleRightText(getString(R.string.titile_finish));
// setTitleLeftIcon(true, R.drawable.nav_add);
mRlSelectBar.setVisibility(View.VISIBLE);
ViewPropertyAnimator.animate(mRlBottom).setDuration(500).translationY(CommonUtils.dip2px(getActivityContext(), 55));
ViewPropertyAnimator.animate(mRlSelectBar).setDuration(500).translationY(-CommonUtils.dip2px(getActivityContext(), 55));
editMode = true;
} else {
mIntelligentPlaceOrderAdapter.clearSelect();
setTitleRightText(getString(R.string.title_edit));
ViewPropertyAnimator.animate(mRlBottom).setDuration(500).translationY(-CommonUtils.dip2px(getActivityContext(), 55));
ViewPropertyAnimator.animate(mRlSelectBar).setDuration(500).translationY(CommonUtils.dip2px(getActivityContext(), 55));
showBackBtn();
editMode = false;
}
mIntelligentPlaceOrderAdapter.setEditMode(editMode);
mIntelligentPlaceOrderAdapter.notifyDataSetChanged();
if (mIntelligentPlaceOrderAdapter != null && mIntelligentPlaceOrderAdapter.getItemCount() == 0) {
mRlBottom.setVisibility(View.INVISIBLE);
setTitleRightText("");
}
}
示例4: showCurrentWord
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
protected void showCurrentWord(String letter) {
currentWord.setText(letter);
if(!isScale){
isScale = true;
ViewPropertyAnimator.animate(currentWord).scaleX(1f)
.setInterpolator(new OvershootInterpolator())
.setDuration(450).start();
ViewPropertyAnimator.animate(currentWord).scaleY(1f)
.setInterpolator(new OvershootInterpolator())
.setDuration(450).start();
}
//先移除之前的任务
handler.removeCallbacksAndMessages(null);
//延时隐藏currentWord
handler.postDelayed(new Runnable() {
@Override
public void run() {
// currentWord.setVisibility(View.INVISIBLE);
ViewPropertyAnimator.animate(currentWord).scaleX(0f).setDuration(450).start();
ViewPropertyAnimator.animate(currentWord).scaleY(0f).setDuration(450).start();
isScale = false;
}
}, 1500);
}
示例5: onScroll
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
@Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (mLastFirstVisibleItem < firstVisibleItem) {
if (floatShowing) floatShowing = false;
if (!floatHiding) {
ViewPropertyAnimator.animate(view).translationY(500).setDuration(300);
floatHiding = true;
}
}
if (mLastFirstVisibleItem > firstVisibleItem) {
if (floatHiding) {
floatHiding = false;
}
if (!floatShowing) {
ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
floatShowing = true;
}
}
mLastFirstVisibleItem = firstVisibleItem;
if (onScrollListener != null)
onScrollListener.onScroll(absListView, firstVisibleItem, visibleItemCount, totalItemCount);
}
示例6: setTypeBanner
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
private void setTypeBanner(MyViewHolder myViewHolder) {
//以属性动画的形式放大
ViewPropertyAnimator.animate(myViewHolder.itemView).scaleX(1).setDuration(350).start();
ViewPropertyAnimator.animate(myViewHolder.itemView).scaleY(1).setDuration(350).start();
//自定义你的Holder,实现更多复杂的界面,不一定是图片翻页,其他任何控件翻页亦可。
myViewHolder.mConvenientBanner.setPages(
new CBViewHolderCreator<LocalImageHolderView>() {
@Override
public LocalImageHolderView createHolder() {
return new LocalImageHolderView();
}
}, mLocalImages)
//设置两个点图片作为翻页指示器,不设置则没有指示器,可以根据自己需求自行配合自己的指示器,不需要圆点指示器可用不设
.setPageIndicator(new int[]{R.drawable.page_switch_normal, R.drawable.page_switch_checked})
//设置指示器的方向
.setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.CENTER_HORIZONTAL);
}
示例7: setTypeNomal
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
private void setTypeNomal(MyViewHolder myViewHolder, int position) {
// Random r = new Random();
// int colr = Color.rgb(r.nextInt(256), r.nextInt(256), r.nextInt(256));
// myViewHolder.mCardView.setCardBackgroundColor(colr);
//以属性动画的形式放大
ViewPropertyAnimator.animate(myViewHolder.itemView).scaleX(1).setDuration(350).start();
ViewPropertyAnimator.animate(myViewHolder.itemView).scaleY(1).setDuration(350).start();
TextView comment_textView = myViewHolder.comment_TextView;
TextView date_textView = myViewHolder.date_TextView;
TextView title_textView = myViewHolder.title_TextView;
ImageView pic_imageView = myViewHolder.pic_ImageView;
comment_textView.setText(mData.get(position - 1).getFeedback());
date_textView.setText(DateUtils.dateFromat(mData.get(position - 1).getSenddate()));
title_textView.setText(mData.get(position - 1).getTitle());
//获取到图片地址
String litpic = mData.get(position - 1).getLitpic();
if (litpic == null) {
pic_imageView.setImageResource(R.drawable.product_default);
return;
}
//地址拼接
String imageUrl = API.DMGEAME_URL + litpic;
Picasso.with(mContext).load(imageUrl).error(R.drawable.product_default).into(pic_imageView);
}
示例8: onUpOrCancelMotionEvent
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
mBaseTranslationY = 0;
float headerTranslationY = ViewHelper.getTranslationY(mHeaderView);
int toolbarHeight = mToolbarView.getHeight();
if (scrollState == ScrollState.UP) {
if (toolbarHeight < mRecyclerView.getCurrentScrollY()) {
if (headerTranslationY != -toolbarHeight) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start();
}
}
} else if (scrollState == ScrollState.DOWN) {
if (toolbarHeight < mRecyclerView.getCurrentScrollY()) {
if (headerTranslationY != 0) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start();
}
}
}
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:23,代码来源:ScrollFromBottomRecyclerViewActivity.java
示例9: showFab
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
private void showFab(boolean animated) {
if (mFab == null) {
return;
}
if (!mFabIsShown) {
if (animated) {
ViewPropertyAnimator.animate(mFab).cancel();
ViewPropertyAnimator.animate(mFab).scaleX(1).scaleY(1).setDuration(200).start();
} else {
ViewHelper.setScaleX(mFab, 1);
ViewHelper.setScaleY(mFab, 1);
}
mFabIsShown = true;
} else {
// Ensure that FAB is shown
ViewHelper.setScaleX(mFab, 1);
ViewHelper.setScaleY(mFab, 1);
}
}
示例10: hideFab
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
private void hideFab(boolean animated) {
if (mFab == null) {
return;
}
if (mFabIsShown) {
if (animated) {
ViewPropertyAnimator.animate(mFab).cancel();
ViewPropertyAnimator.animate(mFab).scaleX(0).scaleY(0).setDuration(200).start();
} else {
ViewHelper.setScaleX(mFab, 0);
ViewHelper.setScaleY(mFab, 0);
}
mFabIsShown = false;
} else {
// Ensure that FAB is hidden
ViewHelper.setScaleX(mFab, 0);
ViewHelper.setScaleY(mFab, 0);
}
}
示例11: onUpOrCancelMotionEvent
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
mBaseTranslationY = 0;
float headerTranslationY = ViewHelper.getTranslationY(mHeaderView);
int toolbarHeight = mToolbarView.getHeight();
if (scrollState == ScrollState.UP) {
if (toolbarHeight < mListView.getCurrentScrollY()) {
if (headerTranslationY != -toolbarHeight) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start();
}
}
} else if (scrollState == ScrollState.DOWN) {
if (toolbarHeight < mListView.getCurrentScrollY()) {
if (headerTranslationY != 0) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start();
}
}
}
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:23,代码来源:ScrollFromBottomListViewActivity.java
示例12: onScrollChanged
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
if (mDragging) {
int toolbarHeight = mToolbarView.getHeight();
if (mFirstScroll) {
mFirstScroll = false;
float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);
if (-toolbarHeight < currentHeaderTranslationY) {
mBaseTranslationY = scrollY;
}
}
float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0);
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewHelper.setTranslationY(mHeaderView, headerTranslationY);
}
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:17,代码来源:StickyHeaderWebViewActivity.java
示例13: handleCancelEvent
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
@SuppressWarnings("UnusedParameters")
private boolean handleCancelEvent(final MotionEvent motionEvent) {
if (mVelocityTracker == null) {
return false;
}
if (mCurrentDismissData != null && mSwiping) {
ViewPropertyAnimator.animate(mCurrentDismissData.view)
.translationX(0)
.alpha(1)
.setDuration(mAnimationTime)
.setListener(null);
}
mVelocityTracker.recycle();
mVelocityTracker = null;
mDownX = 0;
mDownY = 0;
mCurrentDismissData = null;
mSwiping = false;
return false;
}
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:22,代码来源:SwipeDismissListViewTouchListener.java
示例14: liftingFromBottom
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
public static void liftingFromBottom(View view, float baseRotation, int duration,
int startDelay) {
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
示例15: liftingFromBottom
import com.nineoldandroids.view.ViewPropertyAnimator; //导入依赖的package包/类
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}