Here are the examples of the java api android.animation.ObjectAnimator.start() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
729 Examples
19
Source : VideoListFragment.java
with MIT License
from zzh12138
with MIT License
from zzh12138
private void initData() {
mAttr = getArguments().getParcelable("attr");
NewsBean bean = getArguments().getParcelable("news");
mList = new ArrayList<>(5);
mList.add(bean);
mAdapter = new VideoListAdapter(mList, getContext());
mAdapter.setAttach(getArguments().getBoolean("isAttach", false));
mAdapter.setAttr(mAttr);
mAdapter.setOnAnimationFinishListener(this);
mAdapter.setOnMessageClickListener(this);
mAdapter.setOnVideoPlayClickListener(this);
mRecycler.setAdapter(mAdapter);
mRecycler.setLayoutManager(new LinearLayoutManager(getContext()));
mRecycler.sereplacedemAnimator(new FadeInUpAnimator());
mRecycler.addItemDecoration(new EmptyItemDecoration(Util.dip2px(getContext(), 40)));
mBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isShowComment) {
closeCommentFragment();
} else {
if (onBackClickListener != null) {
onBackClickListener.removeVideoListFragment();
}
}
}
});
// 背景颜色从透明黑色过度到黑色
ObjectAnimator animator = ObjectAnimator.ofInt(mRoot, "backgroundColor", 0x00000000, 0xff000000);
animator.setEvaluator(new ArgbEvaluator());
animator.setDuration(DURATION);
animator.start();
if (!mAdapter.isAttach()) {
// 不需要过渡动画,直接请求数据
onAnimationEnd();
}
}
19
Source : CommentFragment.java
with MIT License
from zzh12138
with MIT License
from zzh12138
private void initData() {
mAttr = getArguments().getParcelable("attr");
// 背景色动画
ObjectAnimator animator = ObjectAnimator.ofInt(mRoot, "backgroundColor", 0x00000000, 0xff000000);
animator.setEvaluator(new ArgbEvaluator());
animator.setDuration(DURATION);
animator.start();
location = new int[2];
mContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
// 绘制完毕,开始执行动画
mContainer.getViewTreeObserver().removeOnPreDrawListener(this);
mContainer.getLocationOnScreen(location);
mContainer.setTranslationX(mAttr.getX() - location[0]);
mContainer.setTranslationY(mAttr.getY() - location[1]);
mContainer.setScaleX(mAttr.getWidth() / (float) mContainer.getMeasuredWidth());
mContainer.setScaleY(mAttr.getHeight() / (float) mContainer.getMeasuredHeight());
mRecycler.setAlpha(0);
mTextView.setAlpha(0);
mClose.setAlpha(0);
mCommentNum.setAlpha(0);
mContainer.animate().translationX(0).translationY(0).scaleX(1).scaleY(1).setDuration(DURATION);
mRecycler.animate().alpha(1).setDuration(DURATION);
mTextView.animate().alpha(1).setDuration(DURATION);
mClose.animate().alpha(1).setDuration(DURATION);
mCommentNum.animate().alpha(1).setDuration(DURATION);
replacedistPlayer.get().play(mContainer, null);
return true;
}
});
mRecycler.setLayoutManager(new LinearLayoutManager(getContext()));
mAdapter = new CommentAdapter(getContext(), mList);
mRecycler.setAdapter(mAdapter);
}
19
Source : CommentFragment.java
with MIT License
from zzh12138
with MIT License
from zzh12138
public void closeFragment() {
mRecycler.animate().alpha(0).setDuration(DURATION);
mTextView.animate().alpha(0).setDuration(DURATION);
mClose.animate().alpha(0).setDuration(DURATION);
mCommentNum.animate().alpha(0).setDuration(DURATION);
mContainer.animate().translationY(mAttr.getY() - location[1]).setDuration(DURATION);
ObjectAnimator animator = ObjectAnimator.ofInt(mRoot, "backgroundColor", 0xff000000, 0x00000000);
animator.setEvaluator(new ArgbEvaluator());
animator.setDuration(DURATION);
animator.start();
}
19
Source : ControllerCover.java
with MIT License
from zzh12138
with MIT License
from zzh12138
private void setTopContainerState(final boolean state) {
if (mControllerTopEnable) {
mTopContainer.clearAnimation();
cancelTopAnimation();
mTopAnimator = ObjectAnimator.ofFloat(mTopContainer, "alpha", state ? 0 : 1, state ? 1 : 0).setDuration(300);
mTopAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
if (state) {
mTopContainer.setVisibility(View.VISIBLE);
}
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (!state) {
mTopContainer.setVisibility(View.GONE);
}
}
});
mTopAnimator.start();
} else {
mTopContainer.setVisibility(View.GONE);
}
}
19
Source : ControllerCover.java
with MIT License
from zzh12138
with MIT License
from zzh12138
private void setBottomContainerState(final boolean state) {
mBottomContainer.clearAnimation();
cancelBottomAnimation();
mBottomAnimator = ObjectAnimator.ofFloat(mBottomContainer, "alpha", state ? 0 : 1, state ? 1 : 0).setDuration(300);
mBottomAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
if (state) {
mBottomContainer.setVisibility(View.VISIBLE);
}
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (!state) {
mBottomContainer.setVisibility(View.GONE);
}
}
});
mBottomAnimator.start();
if (state) {
PLog.d(getTag().toString(), "requestNotifyTimer...");
requestNotifyTimer();
} else {
PLog.d(getTag().toString(), "requestStopTimer...");
requestStopTimer();
}
}
19
Source : JZVideoPlayerStandard.java
with MIT License
from zzh12138
with MIT License
from zzh12138
public void changeUiToPlayingClear() {
Log.d(TAG, "changeUiToPlayingClear: ");
switch(currentScreen) {
case SCREEN_WINDOW_NORMAL:
case SCREEN_WINDOW_LIST:
setControlViewsVisibility(View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, isVideoList ? View.GONE : View.VISIBLE);
if (!isVideoList) {
animator.start();
}
if (isVideoList && !isShowedMuteTip) {
muteTextView.setVisibility(View.VISIBLE);
if (isVideoActivity && !videoActivityIsMute) {
muteTextView.setCompoundDrawables(enMuteDrawable, null, null, null);
muteTextView.setText("");
muteTextView.setBackground(null);
} else {
muteTextView.setCompoundDrawables(muteDrawable, null, null, null);
muteTextView.setBackgroundResource(R.drawable.bg_mute_text);
muteTextView.setText("点击开启声音");
muteTextView.postDelayed(new Runnable() {
@Override
public void run() {
if (muteTextView != null) {
muteTextView.setText("");
muteTextView.setBackground(null);
}
}
}, 3000);
}
isShowedMuteTip = true;
}
break;
case SCREEN_WINDOW_FULLSCREEN:
setControlViewsVisibility(View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE);
break;
case SCREEN_WINDOW_RECYCLE_VERTICAL_FULLSCREEN:
setControlViewsVisibility(View.VISIBLE, View.VISIBLE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE, View.GONE);
break;
default:
break;
}
}
19
Source : JZVideoPlayerStandard.java
with MIT License
from zzh12138
with MIT License
from zzh12138
public void showAnimationView() {
voiceLayout.setVisibility(VISIBLE);
animator.start();
muteTextView.setVisibility(GONE);
JZMediaManager.instance().jzMediaInterface.setVolume(0f, 0f);
isShowedMuteTip = false;
}
19
Source : VideoListFragment.java
with MIT License
from zzh12138
with MIT License
from zzh12138
public void showMask(JZVideoPlayer player) {
if (player != null && !isShowComment && mask.getVisibility() == View.GONE) {
int[] a = new int[2];
player.getLocationOnScreen(a);
a[1] -= getStatusBarHeight(getContext());
mask.setVisibility(View.VISIBLE);
mask.changeMaskLocation(a[1], a[1] + player.getHeight());
if (showAnimator == null) {
showAnimator = ObjectAnimator.ofFloat(mask, "alpha", 0f, 1f);
showAnimator.setDuration(150);
}
showAnimator.start();
}
}
19
Source : VideoListFragment.java
with MIT License
from zzh12138
with MIT License
from zzh12138
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.fragment_video_list, container, false);
unbinder = ButterKnife.bind(this, mView);
JZVideoPlayerStandard.videoActivityIsMute = true;
mLayoutManager = new LinearLayoutManager(getContext());
mRecycler.setLayoutManager(mLayoutManager);
mList = new ArrayList<>();
mList.add(mNews);
initRecyclerView();
if (!isAttach) {
getData();
mRecycler.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
mRecycler.getViewTreeObserver().removeOnPreDrawListener(this);
View v = mRecycler.getChildAt(0);
if (v != null) {
JZVideoPlayerStandard p = v.findViewById(R.id.player);
p.startButton.performClick();
}
return true;
}
});
}
bgAnimator = ObjectAnimator.ofInt(mRoot, "backgroundColor", 0x00000000, 0xff000000);
bgAnimator.setEvaluator(new ArgbEvaluator());
bgAnimator.setDuration(DURATION);
bgAnimator.start();
mBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onBackClickListener != null) {
onBackClickListener.onBackClick();
}
}
});
return mView;
}
19
Source : VideoCommentFragment.java
with MIT License
from zzh12138
with MIT License
from zzh12138
private void animate() {
animator = ObjectAnimator.ofInt(root, "backgroundColor", 0x00000000, 0xff000000);
animator.setEvaluator(new ArgbEvaluator());
animator.setDuration(DURATION);
animator.start();
container.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
container.getViewTreeObserver().removeOnPreDrawListener(this);
container.getLocationOnScreen(location);
container.setTranslationY(mAttr.getY() - location[1]);
container.animate().translationY(0).setDuration(DURATION);
JZVideoPlayerManager.getCurrentJzvd().attachToContainer(container);
container.postDelayed(new Runnable() {
@Override
public void run() {
if (close != null) {
close.setVisibility(View.VISIBLE);
}
if (recycler != null) {
recycler.setVisibility(View.VISIBLE);
}
}
}, DURATION);
return true;
}
});
}
19
Source : FileChooserActivity.java
with GNU General Public License v3.0
from zyl409214686
with GNU General Public License v3.0
from zyl409214686
private void startLoadingAnim() {
mDataBinding.aviLoading.setVisibility(View.VISIBLE);
mMoveAnim = ObjectAnimator.ofFloat(mDataBinding.aviLoading, "translationX", 0f, mUpdateBtnLeft);
mMoveAnim.setDuration(2000);
mMoveAnim.setRepeatCount(ValueAnimator.INFINITE);
mMoveAnim.start();
}
19
Source : FloatingSearchView.java
with Apache License 2.0
from zuoweitan
with Apache License 2.0
from zuoweitan
private void fadeIn(boolean enter) {
ValueAnimator backgroundAnim;
if (Build.VERSION.SDK_INT >= 19)
backgroundAnim = ObjectAnimator.ofInt(mBackgroundDrawable, "alpha", enter ? 255 : 0);
else {
backgroundAnim = ValueAnimator.ofInt(enter ? 0 : 255, enter ? 255 : 0);
backgroundAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int value = (Integer) animation.getAnimatedValue();
mBackgroundDrawable.setAlpha(value);
}
});
}
backgroundAnim.setDuration(enter ? DEFAULT_DURATION_ENTER : DEFAULT_DURATION_EXIT);
backgroundAnim.setInterpolator(enter ? DECELERATE : ACCELERATE);
backgroundAnim.start();
Drawable icon = unwrap(getIcon());
if (icon != null) {
ObjectAnimator iconAnim = ObjectAnimator.ofFloat(icon, "progress", enter ? 1 : 0);
iconAnim.setDuration(backgroundAnim.getDuration());
iconAnim.setInterpolator(backgroundAnim.getInterpolator());
iconAnim.start();
}
}
19
Source : NearbyAddContactActivity.java
with Apache License 2.0
from zom
with Apache License 2.0
from zom
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nearby);
setreplacedle("");
ImageView iv = (ImageView) findViewById(R.id.nearbyIcon);
mList = findViewById(R.id.nearbyList);
mList.setLayoutManager(new LinearLayoutManager(this));
mList.sereplacedemAnimator(new DefaulreplacedemAnimator());
NearbyListRecyclerViewAdapter adapter = new NearbyListRecyclerViewAdapter(this, new ArrayList<Contact>(contactList.values()));
mList.setAdapter(adapter);
ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(iv, PropertyValuesHolder.ofFloat("scaleX", 1.2f), PropertyValuesHolder.ofFloat("scaleY", 1.2f));
scaleDown.setDuration(310);
scaleDown.setInterpolator(new FastOutSlowInInterpolator());
scaleDown.setRepeatCount(ObjectAnimator.INFINITE);
scaleDown.setRepeatMode(ObjectAnimator.REVERSE);
scaleDown.start();
mApp = (ImApp) getApplication();
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Showing status
if (checkPlayServices()) {
String nearbyMessage = getIntent().getStringExtra(EXTRA_TEXT);
initNearby(nearbyMessage);
} else {
Toast.makeText(this, R.string.nearby_not_supported, Toast.LENGTH_LONG).show();
finish();
}
}
19
Source : BaseAnimator.java
with MIT License
from zj565061763
with MIT License
from zj565061763
@Override
public T start() {
mObjectAnimator.start();
return (T) this;
}
19
Source : MusicPlayerActivity.java
with Apache License 2.0
from zion223
with Apache License 2.0
from zion223
private void showPlayAnimator() {
// 唱针当前角度mNeddleiew.getRotation() : -25.0
if (mNeddleiew.getRotation() == -25.0) {
if (mNeddlePlayAnimator.isPaused()) {
mNeddlePlayAnimator.resume();
} else {
mNeddlePlayAnimator.start();
}
} else {
Log.e(TAG, "showPlayAnimator() 唱针状态不正常");
}
}
19
Source : MusicPlayerActivity.java
with Apache License 2.0
from zion223
with Apache License 2.0
from zion223
private void showPauseAnimator() {
// 唱针当前角度mNeddleiew.getRotation() : 0
if (mNeddleiew.getRotation() == 0) {
mNeddlePauseAnimator.start();
} else {
Log.e(TAG, "showPauseAnimator() 唱针状态不正常");
}
}
19
Source : IndictorView.java
with Apache License 2.0
from zion223
with Apache License 2.0
from zion223
/*
* 显示播放动画
*/
private void showPlayAnim() {
ObjectAnimator anims = mMusicPagerAdapter.getAnims(mViewPager.getCurrenreplacedem());
if (anims != null) {
if (anims.isPaused()) {
anims.resume();
} else {
anims.start();
}
}
}
19
Source : MusicPagerAdapter.java
with Apache License 2.0
from zion223
with Apache License 2.0
from zion223
private ObjectAnimator createAnim(ImageView imageView) {
imageView.setRotation(0);
ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, View.ROTATION.getName(), 0, 360);
animator.setDuration(10000);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
if (AudioController.getInstance().isStartState()) {
animator.start();
}
return animator;
}
19
Source : MineDelegate.java
with Apache License 2.0
from zion223
with Apache License 2.0
from zion223
/**
* 改变歌单的显示状态
*/
private void changePlayListVisibleStatus(GroupedRecyclerViewAdapter adapter, com.donkingliang.groupedadapter.holder.BaseViewHolder holder, int groupPosition) {
// 点击到header则执行 隐藏或显示动作 否则就进入歌单详情
ImageView changeView = holder.get(R.id.iv_mine_gedan_state);
// 是创建的还是收藏的
MultipleGroupPlaylistAdapter expandableAdapter = (MultipleGroupPlaylistAdapter) adapter;
// 显示动画
if ((boolean) changeView.getTag()) {
final ObjectAnimator hideRotate = ObjectAnimator.ofFloat(changeView, "rotation", 270f, 180f);
hideRotate.setDuration(300);
hideRotate.start();
expandableAdapter.collapseGroup(groupPosition, true);
changeView.setTag(false);
} else {
final ObjectAnimator showRotate = ObjectAnimator.ofFloat(changeView, "rotation", 180f, 270f);
showRotate.setDuration(300);
showRotate.start();
expandableAdapter.expandGroup(groupPosition, true);
changeView.setTag(true);
}
}
19
Source : TriangleSkewSpinIndicator.java
with Apache License 2.0
from zhouphenix
with Apache License 2.0
from zhouphenix
@Override
public List<Animator> createAnimation() {
List<Animator> animators = new ArrayList<>();
PropertyValuesHolder rotation5 = PropertyValuesHolder.ofFloat("rotationX", 0, 180, 180, 0, 0);
PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationY", 0, 0, 180, 180, 0);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6, rotation5);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
animator.setDuration(2500);
animator.start();
animators.add(animator);
return animators;
}
19
Source : SemiCircleSpinIndicator.java
with Apache License 2.0
from zhouphenix
with Apache License 2.0
from zhouphenix
@Override
public List<Animator> createAnimation() {
List<Animator> animators = new ArrayList<>();
ObjectAnimator rotateAnim = ObjectAnimator.ofFloat(getTarget(), "rotation", 0, 180, 360);
rotateAnim.setDuration(600);
rotateAnim.setRepeatCount(-1);
rotateAnim.start();
animators.add(rotateAnim);
return animators;
}
19
Source : BallRotateIndicator.java
with Apache License 2.0
from zhouphenix
with Apache License 2.0
from zhouphenix
@Override
public List<Animator> createAnimation() {
List<Animator> animators = new ArrayList<>();
ValueAnimator scaleAnim = ValueAnimator.ofFloat(0.5f, 1, 0.5f);
scaleAnim.setDuration(1000);
scaleAnim.setRepeatCount(-1);
scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
scaleFloat = (float) animation.getAnimatedValue();
postInvalidate();
}
});
scaleAnim.start();
ObjectAnimator rotateAnim = ObjectAnimator.ofFloat(getTarget(), "rotation", 0, 180, 360);
rotateAnim.setDuration(1000);
rotateAnim.setRepeatCount(-1);
rotateAnim.start();
animators.add(scaleAnim);
animators.add(rotateAnim);
return animators;
}
19
Source : BallPulseRiseIndicator.java
with Apache License 2.0
from zhouphenix
with Apache License 2.0
from zhouphenix
@Override
public List<Animator> createAnimation() {
PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationX", 0, 360);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
animator.setDuration(1500);
animator.start();
List<Animator> animators = new ArrayList<>();
animators.add(animator);
return animators;
}
19
Source : OperationLayout.java
with MIT License
from zhongjhATC
with MIT License
from zhongjhATC
/**
* 提示文本框 - 浮现渐现动画
*/
public void startTipAlphaAnimation() {
if (mIsFirst) {
ObjectAnimator animatorTxtTip = ObjectAnimator.ofFloat(mViewHolder.tvTip, "alpha", 1f, 0f);
animatorTxtTip.setDuration(500);
animatorTxtTip.start();
mIsFirst = false;
}
}
19
Source : OperationLayout.java
with MIT License
from zhongjhATC
with MIT License
from zhongjhATC
/**
* 提示文本框 - 浮现渐现动画,显示新的文字
*
* @param tip 提示文字
*/
public void setTipAlphaAnimation(String tip) {
mViewHolder.tvTip.setText(tip);
ObjectAnimator animatorTxtTip = ObjectAnimator.ofFloat(mViewHolder.tvTip, "alpha", 0f, 1f, 1f, 0f);
animatorTxtTip.setDuration(2500);
animatorTxtTip.start();
}
19
Source : MaterialAppBarLayout.java
with Apache License 2.0
from zhkrb
with Apache License 2.0
from zhkrb
private void startAnim(int value) {
setLayerType(View.LAYER_TYPE_HARDWARE, (Paint) null);
ObjectAnimator animator = ObjectAnimator.ofInt(this, "progress", value);
animator.setAutoCancel(true);
animator.setDuration(555);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
setLayerType(View.LAYER_TYPE_NONE, (Paint) null);
}
});
animator.start();
}
19
Source : FoldTextView.java
with Apache License 2.0
from zhkrb
with Apache License 2.0
from zhkrb
public void fold(boolean b) {
if (getLineCount() == 1) {
return;
}
if (isFold) {
mAnimator = ObjectAnimator.ofInt(this, "MaxHeight", mFoldHeight);
} else {
mAnimator = ObjectAnimator.ofInt(this, "MaxHeight", mUnFoldHeight);
}
mAnimator.setDuration(mAnimDuration);
mAnimator.setInterpolator(new FastOutSlowInInterpolator());
mAnimator.setAutoCancel(true);
// mAnimator.addUpdateListener(animation -> {
// //
// // });
mAnimator.start();
}
19
Source : DrawerArrowDrawable.java
with Apache License 2.0
from zhkrb
with Apache License 2.0
from zhkrb
public void setStateWithAnim(boolean isMenu, boolean useAnim) {
float prog = isMenu ? 0f : 1f;
if (prog == parameter) {
return;
}
if (useAnim) {
setParameter(prog);
return;
}
setFlip(isMenu);
ObjectAnimator animator = ObjectAnimator.ofFloat(this, "parameter", prog);
animator.setDuration(555);
animator.setAutoCancel(true);
animator.start();
}
19
Source : ArtboardView.java
with GNU General Public License v3.0
from zhihu
with GNU General Public License v3.0
from zhihu
private void onActionRelease() {
if (mCallback != null && Math.abs(mDragDistance) > mDragDismissDistance) {
mCallback.onDragDismiss(this, mIsDragDown);
} else {
if (mTransYAnim != null && mTransYAnim.isRunning()) {
mTransYAnim.cancel();
}
mTransYAnim = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, getTranslationY(), 0.0F);
mTransYAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float dragTo = (Float) animation.getAnimatedValue();
if (mCallback != null) {
mCallback.onDrag(ArtboardView.this, mDragDismissDistance, dragTo);
}
}
});
mTransYAnim.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
mTransYAnim.setInterpolator(PathInterpolatorCompat.create(0.4F, 0.0F, 0.2F, 1.0F));
mTransYAnim.start();
}
}
19
Source : DashReverseView.java
with Apache License 2.0
from zguop
with Apache License 2.0
from zguop
private void selectPoint(final TextView v) {
if (v != null && !v.isSelected()) {
final GradientDrawable drawable = (GradientDrawable) v.getBackground();
drawable.setColor(pointSelectColor);
ObjectAnimator rotation = ObjectAnimator.ofFloat(v, "rotation", 0, 180);
rotation.setDuration(300);
rotation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
}
});
rotation.start();
v.setSelected(true);
// AnimatorSet scale = new AnimatorSet();
// scale.playSequentially(ObjectAnimator.ofFloat(v, SCALE_X, 1.0f, 1.8f), ObjectAnimator.ofFloat(v, SCALE_Y, 1.0f, 1.8f));
// scale.setDuration(300);
}
}
19
Source : SmileView.java
with Apache License 2.0
from zenglingchao
with Apache License 2.0
from zenglingchao
public void objectX(View view) {
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10.0f, 0.0f, 10.0f, 0.0f, -10.0f, 0.0f, 10.0f, 0);
animator.setRepeatMode(ObjectAnimator.RESTART);
// animator.setRepeatCount(1);
animator.setDuration(1500);
animator.start();
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// 执行回弹动画
setBackUp();
}
});
}
19
Source : SmileView.java
with Apache License 2.0
from zenglingchao
with Apache License 2.0
from zenglingchao
public void objectY(View view) {
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", -10.0f, 0.0f, 10.0f, 0.0f, -10.0f, 0.0f, 10.0f, 0);
animator.setRepeatMode(ObjectAnimator.RESTART);
// animator.setRepeatCount(1);
animator.setDuration(1500);
animator.start();
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// 执行回弹动画
setBackUp();
}
});
}
19
Source : DepartmentViewModel.java
with Apache License 2.0
from zaihuishou
with Apache License 2.0
from zaihuishou
private void rotationArrow(ItemDepartmentBinding binding, boolean expanded) {
float start, target;
if (expanded) {
start = 0f;
target = 90f;
} else {
start = 90f;
target = 0f;
}
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(binding.arrow, View.ROTATION, start, target);
objectAnimator.setDuration(300);
objectAnimator.start();
}
19
Source : CompanyViewModel.java
with Apache License 2.0
from zaihuishou
with Apache License 2.0
from zaihuishou
/**
* play arrow animation
*
* @param binding
* @param expanded
*/
private void rotationArrow(ItemCompanyBinding binding, boolean expanded) {
float start, target;
if (expanded) {
start = 0f;
target = 90f;
} else {
start = 90f;
target = 0f;
}
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(binding.arrow, View.ROTATION, start, target);
objectAnimator.setDuration(300);
objectAnimator.start();
}
19
Source : DepartmentItem.java
with Apache License 2.0
from zaihuishou
with Apache License 2.0
from zaihuishou
@Override
public void onExpansionToggled(boolean expanded) {
float start, target;
if (expanded) {
mExpand.setText("unexpand");
start = 0f;
target = 90f;
} else {
mExpand.setText("expand");
start = 90f;
target = 0f;
}
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mArrow, View.ROTATION, start, target);
objectAnimator.setDuration(300);
objectAnimator.start();
}
19
Source : CompanyItem.java
with Apache License 2.0
from zaihuishou
with Apache License 2.0
from zaihuishou
@Override
public void onExpansionToggled(boolean expanded) {
float start, target;
if (expanded) {
start = 0f;
target = 90f;
} else {
start = 90f;
target = 0f;
}
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mArrow, View.ROTATION, start, target);
objectAnimator.setDuration(300);
objectAnimator.start();
}
19
Source : SettingPopup.java
with Apache License 2.0
from yuyangXu0222
with Apache License 2.0
from yuyangXu0222
private void setTheme(int theme) {
ObjectAnimator animator = ObjectAnimator.ofInt(mCardView, "cardBackgroundColor", mPopupColors[mTheme], mPopupColors[theme]).setDuration(500);
animator.setEvaluator(new ArgbEvaluator());
animator.start();
mTheme = theme;
setCurThemeBtn();
setCurSeekBarStyle();
setCurFlipStyleBtn();
mSwitchView.setMaskColor(mStrokeColors[mTheme]);
if (mListener != null)
mListener.onThemeChanged(mTheme);
}
19
Source : AnimationUtils.java
with Apache License 2.0
from yuvaraj119
with Apache License 2.0
from yuvaraj119
public static void scaleXY(RecyclerView.ViewHolder holder) {
holder.itemView.setScaleX(0);
holder.itemView.setScaleY(0);
PropertyValuesHolder propx = PropertyValuesHolder.ofFloat("scaleX", 1);
PropertyValuesHolder propy = PropertyValuesHolder.ofFloat("scaleY", 1);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(holder.itemView, propx, propy);
animator.setDuration(800);
animator.start();
}
19
Source : AnimationUtils.java
with Apache License 2.0
from yuvaraj119
with Apache License 2.0
from yuvaraj119
public static void animate(RecyclerView.ViewHolder holder, boolean goesDown) {
ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(holder.itemView, "translationY", goesDown == true ? 300 : -300, 0);
animatorTranslateY.setDuration(1000);
animatorTranslateY.start();
}
19
Source : AnimationUtils.java
with Apache License 2.0
from yuvaraj119
with Apache License 2.0
from yuvaraj119
public static void scaleY(RecyclerView.ViewHolder holder) {
holder.itemView.setScaleY(0);
PropertyValuesHolder propy = PropertyValuesHolder.ofFloat("scaleY", 1);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(holder.itemView, propy);
animator.setDuration(800);
animator.start();
}
19
Source : AnimationUtils.java
with Apache License 2.0
from yuvaraj119
with Apache License 2.0
from yuvaraj119
public static void scaleX(RecyclerView.ViewHolder holder) {
holder.itemView.setScaleX(0);
PropertyValuesHolder propx = PropertyValuesHolder.ofFloat("scaleX", 1);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(holder.itemView, propx);
animator.setDuration(800);
animator.start();
}
19
Source : ModeTransitionView.java
with Apache License 2.0
from Yuloran
with Apache License 2.0
from Yuloran
/**
* Snaps the shade to a given scroll distance and sets the icon alpha. If the shade
* is to snap back out, then hide the view after the animation.
*
* @param scrollDistance scaled user scroll distance
* @param alpha ending alpha of the icon drawable
* @param snapToFullScreen whether this snap animation snaps the shade to full screen
*/
private void snapShadeTo(final int scrollDistance, final int alpha, final boolean snapToFullScreen) {
if (mAnimationType == PULL_UP_SHADE || mAnimationType == PULL_DOWN_SHADE) {
ObjectAnimator scrollAnimator = ObjectAnimator.ofFloat(this, "scrollDistance", scrollDistance);
scrollAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
setScrollDistance(scrollDistance);
mIconDrawable.setAlpha(alpha);
mAnimationType = IDLE;
if (!snapToFullScreen) {
setVisibility(GONE);
}
if (mAnimationFinishedListener != null) {
mAnimationFinishedListener.onAnimationFinished(snapToFullScreen);
mAnimationFinishedListener = null;
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
scrollAnimator.setInterpolator(Gusterpolator.INSTANCE);
scrollAnimator.start();
}
}
19
Source : ModeTransitionView.java
with Apache License 2.0
from Yuloran
with Apache License 2.0
from Yuloran
/**
* Hides the cover view and notifies the
* {@link com.android.camera.app.CameraAppUI.AnimationFinishedListener} of whether
* the hide animation is successfully finished.
*
* @param animationFinishedListener a listener that will get notified when the
* animation is finished. Could be <code>null</code>.
*/
public void hideModeCover(final CameraAppUI.AnimationFinishedListener animationFinishedListener) {
if (mAnimationType != IDLE) {
// Nothing to hide.
if (animationFinishedListener != null) {
// Animation not successful.
animationFinishedListener.onAnimationFinished(false);
}
} else {
// Start fade out animation.
mAnimationType = FADE_OUT;
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(this, "alpha", 1f, 0f);
alphaAnimator.setDuration(FADE_OUT_DURATION_MS);
// Linear interpolation.
alphaAnimator.setInterpolator(null);
alphaAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
setVisibility(GONE);
setAlpha(1f);
if (animationFinishedListener != null) {
animationFinishedListener.onAnimationFinished(true);
mAnimationType = IDLE;
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
alphaAnimator.start();
}
}
19
Source : FilmstripBottomPanel.java
with Apache License 2.0
from Yuloran
with Apache License 2.0
from Yuloran
public void show() {
ObjectAnimator animator = ObjectAnimator.ofFloat(mLayout, "translationY", mLayout.getHeight(), 0.0f);
animator.setDuration(ANIM_DURATION);
animator.setInterpolator(Gusterpolator.INSTANCE);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mViewButton.updateClingVisibility();
}
});
mViewButton.hideClings();
animator.start();
}
19
Source : FilmstripBottomPanel.java
with Apache License 2.0
from Yuloran
with Apache License 2.0
from Yuloran
public void hide() {
int offset = mLayout.getHeight();
if (mLayout.getTranslationY() < offset) {
ObjectAnimator animator = ObjectAnimator.ofFloat(mLayout, "translationY", mLayout.getTranslationY(), offset);
animator.setDuration(ANIM_DURATION);
animator.setInterpolator(Gusterpolator.INSTANCE);
mViewButton.hideClings();
animator.start();
}
}
19
Source : AnimationManager.java
with Apache License 2.0
from Yuloran
with Apache License 2.0
from Yuloran
/**
* Starts flash animation.
*
* @params flashOverlay the overlay that will animate on alpha to make the flash impression
*/
public void startFlashAnimation(final View flashOverlay) {
// End the previous animation if the previous one is still running
if (mFlashAnim != null && mFlashAnim.isRunning()) {
mFlashAnim.cancel();
}
// Start new flash animation.
mFlashAnim = ObjectAnimator.ofFloat(flashOverlay, "alpha", AnimationManager.FLASH_ALPHA_START, AnimationManager.FLASH_ALPHA_END);
mFlashAnim.setDuration(AnimationManager.FLASH_DURATION);
mFlashAnim.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
flashOverlay.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animator) {
flashOverlay.setAlpha(0f);
flashOverlay.setVisibility(View.GONE);
mFlashAnim.removeAllListeners();
mFlashAnim = null;
}
@Override
public void onAnimationCancel(Animator animator) {
// Do nothing.
}
@Override
public void onAnimationRepeat(Animator animator) {
// Do nothing.
}
});
mFlashAnim.start();
}
19
Source : Windmill.java
with Apache License 2.0
from YugengWang
with Apache License 2.0
from YugengWang
public void startAnimation() {
// 乘以小于1的系数降低影响
mAnimator.setDuration((long) (10000 / (windSpeed * 0.80)));
mAnimator.start();
}
19
Source : TrimControllerOverlay.java
with Apache License 2.0
from yuchuangu85
with Apache License 2.0
from yuchuangu85
@Override
public void showPlaying() {
super.showPlaying();
if (ApiHelper.HAS_OBJECT_ANIMATION) {
// Add animation to hide the play button while playing.
ObjectAnimator anim = ObjectAnimator.ofFloat(mPlayPauseReplayView, "alpha", 1f, 0f);
anim.setDuration(200);
anim.start();
anim.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
hidePlayButtonIfPlaying();
}
@Override
public void onAnimationCancel(Animator animation) {
hidePlayButtonIfPlaying();
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
} else {
hidePlayButtonIfPlaying();
}
}
19
Source : BottomSheet.java
with Apache License 2.0
from yongjhih
with Apache License 2.0
from yongjhih
private void animateSettle(int initialOffset, final int targetOffset, float initialVelocity) {
if (settling)
return;
if (sheetOffsetHelper.getTopAndBottomOffset() == targetOffset) {
if (targetOffset >= dismissOffset) {
dispatchDismissCallback();
}
return;
}
settling = true;
final boolean dismissing = targetOffset == dismissOffset;
final long duration = computeSettleDuration(initialVelocity, dismissing);
final ObjectAnimator settleAnim = ObjectAnimator.ofInt(sheetOffsetHelper, ViewOffsetHelper.OFFSET_Y, initialOffset, targetOffset);
settleAnim.setDuration(duration);
settleAnim.setInterpolator(getSettleInterpolator(dismissing, initialVelocity));
settleAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
dispatchPositionChangedCallback();
if (dismissing) {
dispatchDismissCallback();
}
settling = false;
}
});
if (callbacks != null && !callbacks.isEmpty()) {
settleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (animation.getAnimatedFraction() > 0f) {
dispatchPositionChangedCallback();
}
}
});
}
settleAnim.start();
}
19
Source : EnergyTree.java
with Apache License 2.0
from YangsBryant
with Apache License 2.0
from YangsBryant
// 点击动画
public void start(View view) {
boolean isUp = (boolean) view.getTag(R.string.isUp);
float offset = (float) view.getTag(R.string.offset);
ObjectAnimator mAnimator;
if (isUp) {
mAnimator = ObjectAnimator.ofFloat(view, "translationY", view.getY() - offset, view.getY() + offset, view.getY() - offset);
} else {
mAnimator = ObjectAnimator.ofFloat(view, "translationY", view.getY() + offset, view.getY() - offset, view.getY() + offset);
}
mAnimator.setDuration(3000);
mAnimator.setInterpolator(new LinearInterpolator());
mAnimator.setRepeatMode(ValueAnimator.RESTART);
mAnimator.setRepeatCount(ValueAnimator.INFINITE);
mAnimator.start();
}
See More Examples