private void hideHint(final View view) { view.setPivotX(0); view.setPivotY(view.getHeight()); Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.ALPHA, 1f, 0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 0f)); iconAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); iconAnim.start(); }
private Animator createCollapsingAnimator(ArrowItemViewHolder newHolder, long duration) { if (arrow != null) { arrow.setVisibility(View.INVISIBLE); } final View oldView = itemView; final View newView = newHolder.itemView; final Animator backgroundAnimator = ObjectAnimator.ofPropertyValuesHolder(oldView, PropertyValuesHolder.ofInt(AnimatorUtils.BACKGROUND_ALPHA, 255, 0)); backgroundAnimator.setDuration(duration); final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(oldView, oldView, newView); boundsAnimator.setDuration(duration); boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(backgroundAnimator, boundsAnimator); return animatorSet; }
@Override public Animator buildAnimation(@NonNull ViewDefault viewDefault, @NonNull View viewToMorph, boolean isReversed) { float x = isReversed ? initialScaleX : targetScaleX; float y = isReversed ? initialScaleY : targetScaleY; viewDefault.setExpansionScaleX(x); viewDefault.setExpansionScaleY(y); PropertyValuesHolder[] parameters = new PropertyValuesHolder[2]; parameters[0] = PropertyValuesHolder.ofFloat(View.SCALE_X, x); parameters[1] = PropertyValuesHolder.ofFloat(View.SCALE_Y, y); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(viewToMorph, parameters); if (duration >= 0) { animator.setDuration(duration); } if (interpolator != null) { animator.setInterpolator(interpolator); } return animator; }
private Animator getRotation(AnimationBody animationBody, View view) { final float force = animationBody.getForce(); float[] rotationValues = { (float) Math.toDegrees(0), (float) Math.toDegrees(0.3f * force), (float) Math.toDegrees(-0.3f * force), (float) Math.toDegrees(0.3f * force), (float) Math.toDegrees(0f), (float) Math.toDegrees(0f) }; final PropertyValuesHolder pvhRotation = PropertyValuesHolder.ofKeyframe(View.ROTATION, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, rotationValues)); final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(view, pvhRotation); animation.setInterpolator(new LinearInterpolator()); return animation; }
public void open() { ViewGroup.LayoutParams layoutParams = layout3.getLayoutParams(); layoutParams.height = (int) (front.getHeight() * SCALE_OPENED / 4 * SCALE_OPENED); layout3.setLayoutParams(layoutParams); ViewCompat.setPivotY(back, 0); PropertyValuesHolder front1 = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0, -front.getHeight() / 4); PropertyValuesHolder front2 = PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1); frontAnimator = ObjectAnimator.ofPropertyValuesHolder(front, front1, front2); PropertyValuesHolder backX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.2f); PropertyValuesHolder backY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.2f); backAnimator = ObjectAnimator.ofPropertyValuesHolder(back, backX, backY); back.setPivotY(0); frontAnimator.start(); backAnimator.start(); front.setCardElevation(ELEVATION_OPENED); }
public ObjectAnimator getDisappearAnimator() { if (this.mIsInitialized && this.mDrawValuesReady) { Keyframe kf0 = Keyframe.ofFloat(0.0f, 1.0f); Keyframe kf1 = Keyframe.ofFloat(0.2f, this.mTransitionMidRadiusMultiplier); Keyframe kf2 = Keyframe.ofFloat(1.0f, this.mTransitionEndRadiusMultiplier); PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe ("animationRadiusMultiplier", new Keyframe[]{kf0, kf1, kf2}); kf0 = Keyframe.ofFloat(0.0f, 1.0f); kf1 = Keyframe.ofFloat(1.0f, 0.0f); PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", new Keyframe[]{kf0, kf1}); ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, new PropertyValuesHolder[]{radiusDisappear, fadeOut}).setDuration((long) 500); disappearAnimator.addUpdateListener(this.mInvalidateUpdateListener); return disappearAnimator; } Log.e(TAG, "RadialSelectorView was not ready for animation."); return null; }
/** * Returns an animator that animates the bounds of a single view. */ public static Animator getBoundsAnimator(View view, int fromLeft, int fromTop, int fromRight, int fromBottom, int toLeft, int toTop, int toRight, int toBottom) { view.setLeft(fromLeft); view.setTop(fromTop); view.setRight(fromRight); view.setBottom(fromBottom); return ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofInt(VIEW_LEFT, toLeft), PropertyValuesHolder.ofInt(VIEW_TOP, toTop), PropertyValuesHolder.ofInt(VIEW_RIGHT, toRight), PropertyValuesHolder.ofInt(VIEW_BOTTOM, toBottom)); }
@Override public void setData(Mail data) { this.mail = data; senderImageView.setImageResource(data.getSender().getImageRes()); senderNameView.setText(data.getSender().getName()); senderMailView.setText(data.getSender().getEmail()); subjectView.setText(data.getSubject()); contentView.setText(data.getText() + data.getText() + data.getText() + data.getText()); starView.setStarred(data.isStarred()); dateView.setText(format.format(data.getDate())); labelView.setMail(data); labelView.setVisibility(View.VISIBLE); replayView.setVisibility(View.VISIBLE); // Animate only if not restoring if (!isRestoringViewState()) { labelView.setAlpha(0f); labelView.animate().alpha(1f).setDuration(150).start(); PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("scaleX", 0, 1); PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("scaleY", 0, 1); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(replayView, holderX, holderY); animator.setInterpolator(new OvershootInterpolator()); animator.start(); } }
public ObjectAnimator getDisappearAnimator() { if (!mIsInitialized || !mDrawValuesReady) { Log.e(TAG, "RadialSelectorView was not ready for animation."); return null; } Keyframe kf0, kf1, kf2; float midwayPoint = 0.2f; int duration = 500; kf0 = Keyframe.ofFloat(0f, 1); kf1 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier); kf2 = Keyframe.ofFloat(1f, mTransitionEndRadiusMultiplier); PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe( "animationRadiusMultiplier", kf0, kf1, kf2); kf0 = Keyframe.ofFloat(0f, 1f); kf1 = Keyframe.ofFloat(1f, 0f); PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1); ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder( this, radiusDisappear, fadeOut).setDuration(duration); disappearAnimator.addUpdateListener(mInvalidateUpdateListener); return disappearAnimator; }
@Override public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) { animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1, 0), PropertyValuesHolder.ofFloat("translationX", view.getLeft(), view.getRight())); animator.setDuration(3 * PRE_DURATION); animator.setInterpolator(new AnticipateInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); resetView(view); if (action != null) { action.action(); } } }); return this; }
@Override public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) { animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1, 0), PropertyValuesHolder.ofFloat("translationY", 0, view.getHeight())); animator.setDuration(3 * PRE_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); resetView(view); if (action != null) { action.action(); } } }); return this; }
@Override public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) { animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1, 0), PropertyValuesHolder.ofFloat("scaleX", 1, 0), PropertyValuesHolder.ofFloat("scaleY", 1, 0) ); animator.setDuration(3 * PRE_DURATION); animator.setInterpolator(new AnticipateInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); resetView(view); if (action != null) { action.action(); } } }); return this; }
@Override public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) { animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1, 0), PropertyValuesHolder.ofFloat("rotation", 0, 360), PropertyValuesHolder.ofFloat("translationY", 0, view.getHeight()), PropertyValuesHolder.ofFloat("translationX", 0, view.getWidth())); animator.setDuration(5 * PRE_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); resetView(view); if (action != null) { action.action(); } } }); return this; }
@Override public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) { int offset = -view.getWidth() / 2; animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1, 0), PropertyValuesHolder.ofFloat("translationX", 0, - offset, -offset, offset, offset, 0), PropertyValuesHolder.ofFloat("rotation", 0, -30, -30, 30, 30, 0), PropertyValuesHolder.ofFloat("translationY", 0, 3 * view.getHeight()) ); animator.setDuration(5 * PRE_DURATION); animator.setInterpolator(new LinearInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); resetView(view); if (action != null) { action.action(); } } }); return this; }
@Override public SkinAnimator apply(@NonNull View view, @Nullable final Action action) { this.targetView = view; preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView, PropertyValuesHolder.ofFloat("scaleX", 1, 0.5f, 0.2f, 0.05f, 0.8f, 1), PropertyValuesHolder.ofFloat("scaleY", 1, 0.5f, 0.2f, 0.05f, 0.8f, 1), PropertyValuesHolder.ofFloat("rotationY", 0, 720)) .setDuration(PRE_DURATION * 3); preAnimator.setInterpolator(new LinearInterpolator()); view.postDelayed(new Runnable() { @Override public void run() { if(action != null){ action.action(); } } }, PRE_DURATION); preAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); return this; }
/** * アクションする削除アイコンの設定を更新します。 * * @param width 対象となるViewの幅 * @param height 対象となるViewの高さ * @param shape 対象となるViewの形状 */ void updateActionTrashIcon(float width, float height, float shape) { // アクションする削除アイコンが設定されていない場合は何もしない if (!hasActionTrashIcon()) { return; } // 拡大率の設定 mAnimationHandler.mTargetWidth = width; mAnimationHandler.mTargetHeight = height; final float newWidthScale = width / mActionTrashIconBaseWidth * shape; final float newHeightScale = height / mActionTrashIconBaseHeight * shape; mActionTrashIconMaxScale = Math.max(newWidthScale, newHeightScale); // ENTERアニメーション作成 mEnterScaleAnimator = ObjectAnimator.ofPropertyValuesHolder(mActionTrashIconView, PropertyValuesHolder.ofFloat(ImageView.SCALE_X, mActionTrashIconMaxScale), PropertyValuesHolder.ofFloat(ImageView.SCALE_Y, mActionTrashIconMaxScale)); mEnterScaleAnimator.setInterpolator(new OvershootInterpolator()); mEnterScaleAnimator.setDuration(TRASH_ICON_SCALE_DURATION_MILLIS); // Exitアニメーション作成 mExitScaleAnimator = ObjectAnimator.ofPropertyValuesHolder(mActionTrashIconView, PropertyValuesHolder.ofFloat(ImageView.SCALE_X, 1.0f), PropertyValuesHolder.ofFloat(ImageView.SCALE_Y, 1.0f)); mExitScaleAnimator.setInterpolator(new OvershootInterpolator()); mExitScaleAnimator.setDuration(TRASH_ICON_SCALE_DURATION_MILLIS); }
/** * keyframe */ private void keyFrame() { Keyframe keyframe0 = Keyframe.ofFloat(0f, 0); Keyframe keyframe1 = Keyframe.ofFloat(0.1f, 20f); Keyframe keyframe2 = Keyframe.ofFloat(0.2f, -20f); Keyframe keyframe3 = Keyframe.ofFloat(0.3f, 20f); Keyframe keyframe4 = Keyframe.ofFloat(0.4f, -20f); Keyframe keyframe5 = Keyframe.ofFloat(0.5f, 20f); Keyframe keyframe6 = Keyframe.ofFloat(0.6f, -20f); Keyframe keyframe7 = Keyframe.ofFloat(0.7f, 20f); Keyframe keyframe8 = Keyframe.ofFloat(0.8f, -20f); Keyframe keyframe9 = Keyframe.ofFloat(0.9f, 20f); Keyframe keyframe10 = Keyframe.ofFloat(1f, 0); PropertyValuesHolder holder = PropertyValuesHolder.ofKeyframe("rotation", keyframe0, keyframe1, keyframe2, keyframe3, keyframe4, keyframe5, keyframe6, keyframe7, keyframe8, keyframe9, keyframe10); Animator animator = ObjectAnimator.ofPropertyValuesHolder(content, holder); animator.setDuration(2000); animator.start(); }
public void moveAbsolute(View v, float addX, float addY, float rad, int mSec) { if(addX > mCurrentX)mDirection = 1; else mDirection = 0; PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("translationX", mCurrentX, addX); PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("translationY", mCurrentY, addY); PropertyValuesHolder holderRotaion = PropertyValuesHolder.ofFloat("rotation", mCurrentRad, mCurrentRad + rad); ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(v, holderX, holderY, holderRotaion); objectAnimator.setDuration(mSec); mCurrentX = addX; mCurrentY = addY; mCurrentRad = (mCurrentRad + rad) % 360; objectAnimator.start(); }
/** * Sets the {@link TableView} header visible or hides it. * * @param visible Whether the {@link TableView} header shall be visible or not. */ public void setHeaderVisible(boolean visible, int animationDuration) { if (visible && !isHeaderVisible()) { if (animationDuration > 0) { final Animator moveInAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", 0)); moveInAnimator.setDuration(animationDuration); layoutTransition.setAnimator(LayoutTransition.APPEARING, moveInAnimator); setLayoutTransition(layoutTransition); } else { setLayoutTransition(null); } addView(tableHeaderView, 0); } else if (!visible && isHeaderVisible()) { if (animationDuration > 0) { final Animator moveOutAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", -tableHeaderView.getHeight())); moveOutAnimator.setDuration(animationDuration); layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, moveOutAnimator); setLayoutTransition(layoutTransition); } else { setLayoutTransition(null); } removeView(tableHeaderView); } }
@Override public Animator getAnimationFor(AnimationBody animationBody, View view) { final float force = animationBody.getForce(); float[] valuesX = {1f, 1.3f * force, 0.7f, 1.3f * force, 1f, 1f}; float[] valuesY = {1f, 0.7f, 1.3f * force, 0.7f, 1f, 1f}; final PropertyValuesHolder scaleXPVH = ofKeyframe(View.SCALE_X, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, valuesX)); final PropertyValuesHolder scaleYPVH = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, valuesY)); final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(view, scaleXPVH, scaleYPVH); return animation; }
@Override public Animator getAnimationFor(AnimationBody animationBody, View view) { final float startRotation = view.getRotationX(); final float endRotation = startRotation + 180f; final PropertyValuesHolder rotationPVH = PropertyValuesHolder.ofFloat(View.ROTATION_X, startRotation, endRotation); final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(view, rotationPVH); return animation; }
@Override public Animator getAnimationFor(AnimationBody animationBody, View view) { final float force = animationBody.getForce(); float[] rotationValues = { (float) Math.toDegrees(0), (float) Math.toDegrees(0.3f * force), (float) Math.toDegrees(-0.3f * force), (float) Math.toDegrees(0.3f * force), (float) Math.toDegrees(0f), (float) Math.toDegrees(0f) }; final PropertyValuesHolder pvhRotation = PropertyValuesHolder.ofKeyframe(View.ROTATION, KeyFrameUtil.getKeyFrames(Flubber.FRACTIONS, rotationValues)); final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(view, pvhRotation); return animation; }
@Override public Animator getAnimationFor(AnimationBody animationBody, View view) { final float startRotation = view.getRotationY(); final float endRotation = startRotation + 180f; final PropertyValuesHolder rotationPVH = PropertyValuesHolder.ofFloat(View.ROTATION_Y, startRotation, endRotation); final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(view, rotationPVH); return animation; }
@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; }
public void firstHideLayout() { PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(GiftFrameLayout.this, alpha); animator.setStartDelay(0); animator.setDuration(0); animator.start(); }
@Override protected Runnable suicaRunner(final float x1, final float y1, final float x2, final float y2){ final float attackTime = 0.9f; Runnable runnable = new Runnable() { @Override public void run() { PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("translationX", x1, x2); PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("translationY", y1, y2); PropertyValuesHolder holderRotation = PropertyValuesHolder.ofFloat("rotation", 0, 359); ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(Ringo.this, holderX, holderY, holderRotation); objectAnimator.setDuration(mTime); objectAnimator.start(); Ringo.this.setEnabled(false); Ringo.this.setVisibility(View.VISIBLE); Ringo.this.setAlpha(0.5f); Ringo.this.postDelayed(new Runnable() { @Override public void run() { Ringo.this.setEnabled(true); Ringo.this.setAlpha(1.0f); } }, (int) (mTime * 0.5f)); Ringo.this.postDelayed(new Runnable() { @Override public void run() { if (!Ringo.this.mClicked) { damageButton.callOnClick(); } Ringo.this.setEnabled(false); Ringo.this.setAlpha(0.5f); } }, (int) (mTime * 0.7f)); } }; return runnable; }
private void showFilter(View view) { view.setVisibility(View.VISIBLE); Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, view.getHeight(), 0f)); iconAnim.setDuration(Constant.REVEAL_DURATION); iconAnim.start(); }
@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; }
public static ObjectAnimator ofViewAlphaAndScale(View target, float alpha, float scaleX, float scaleY) { return ofPropertyValuesHolder(target, PropertyValuesHolder.ofFloat(View.ALPHA, alpha), PropertyValuesHolder.ofFloat(View.SCALE_X, scaleX), PropertyValuesHolder.ofFloat(View.SCALE_Y, scaleY)); }
private void hideFilter(final View view) { view.setVisibility(View.VISIBLE); Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0f, view.getHeight())); iconAnim.setDuration(Constant.REVEAL_DURATION); iconAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); iconAnim.start(); }
public static ObjectAnimator ofPropertyValuesHolder(Object target, View view, PropertyValuesHolder... values) { ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(target, values); cancelOnDestroyActivity(anim); new FirstFrameAnimatorHelper(anim, view); return anim; }
private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete, final boolean stripEmptyScreens) { // XXX: Do we need to update LM workspace screens below? PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f); PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f); final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID); mRemoveEmptyScreenRunnable = new Runnable() { @Override public void run() { if (hasExtraEmptyScreen()) { mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID); mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID); removeView(cl); if (stripEmptyScreens) { stripEmptyScreens(); } // Update the page indicator to reflect the removed page. showPageIndicatorAtCurrentScroll(); } } }; ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha); oa.setDuration(duration); oa.setStartDelay(delay); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (mRemoveEmptyScreenRunnable != null) { mRemoveEmptyScreenRunnable.run(); } if (onComplete != null) { onComplete.run(); } } }); oa.start(); }
@Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { endCurrentAnimation(); if (mAlpha > MIN_VISIBLE_ALPHA) { mTargetView = v; mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofFloat(ALPHA, 1), PropertyValuesHolder.ofFloat(SHIFT, 1)); mCurrentAnimation.addListener(new ViewSetListener(v, true)); } else { setCurrentView(v); mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofFloat(ALPHA, 1)); } mLastFocusedView = v; } else { if (mLastFocusedView == v) { mLastFocusedView = null; endCurrentAnimation(); mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofFloat(ALPHA, 0)); mCurrentAnimation.addListener(new ViewSetListener(null, false)); } } // invalidate once invalidateDirty(); mLastFocusedView = hasFocus ? v : null; if (mCurrentAnimation != null) { mCurrentAnimation.addUpdateListener(this); mCurrentAnimation.setDuration(ANIM_DURATION).start(); } }
public AndroidVsIosHeaderView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); inflate(context, R.layout.layout_irecyclerview_bat_vs_supper_refresh_header_view, this); ivBatMan = (ImageView) findViewById(R.id.ivBatMan); ivSuperMan = (ImageView) findViewById(R.id.ivSuperMan); ivVs = (ImageView) findViewById(R.id.imageView); PropertyValuesHolder translationX1 = PropertyValuesHolder.ofFloat("translationX",0.0f,100.0f,0.0f); PropertyValuesHolder rotate = PropertyValuesHolder.ofFloat("rotationY",0.0f,380.0f,0.0f); PropertyValuesHolder translationX2 = PropertyValuesHolder.ofFloat("translationX",0.0f,-100.0f,0.0f); ObjectAnimator objectAnimator1 = ObjectAnimator.ofPropertyValuesHolder(ivBatMan, translationX1); objectAnimator1.setRepeatCount(ValueAnimator.INFINITE); objectAnimator1.setRepeatMode(ValueAnimator.INFINITE); ObjectAnimator objectAnimator2 = ObjectAnimator.ofPropertyValuesHolder(ivSuperMan,translationX2); objectAnimator2.setRepeatCount(ValueAnimator.INFINITE); objectAnimator2.setRepeatMode(ValueAnimator.INFINITE); ObjectAnimator objectAnimator3 = ObjectAnimator.ofPropertyValuesHolder(ivVs, rotate); objectAnimator3.setRepeatCount(ValueAnimator.INFINITE); objectAnimator3.setRepeatMode(ValueAnimator.INFINITE); Animation animation =new RotateAnimation(0f,360f, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f); Animation animation1 =new RotateAnimation(0f,-360f, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f); animation.setFillAfter(true); animation.setDuration(2000); animation.setRepeatCount(ValueAnimator.INFINITE); animation.setRepeatMode(ValueAnimator.INFINITE); animation1.setFillAfter(true); animation1.setDuration(2000); animation1.setRepeatCount(ValueAnimator.INFINITE); animation1.setRepeatMode(ValueAnimator.INFINITE); ivBatMan.setAnimation(animation); ivSuperMan.setAnimation(animation1); btnSexAnimatorSet = new AnimatorSet(); btnSexAnimatorSet.playTogether(objectAnimator1, objectAnimator2,objectAnimator3); btnSexAnimatorSet.setDuration(2000); btnSexAnimatorSet.start(); }
@Override public Animator getAnimationFor(AnimationBody animationBody, View view) { final float startY = DimensionUtils.dp2px(-800); final float endY = 0f; final PropertyValuesHolder translationPVH = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, startY, endY); final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(view, translationPVH); return animation; }
@SuppressLint("NewApi") private static void replace(ArrayList<PropertyValuesHolder> props, Object... args) { for (final Object killobject : args) { Tweener tween = sTweens.get(killobject); if (tween != null) { tween.animator.cancel(); if (props != null) { tween.animator.setValues( props.toArray(new PropertyValuesHolder[props.size()])); } else { sTweens.remove(tween); } } } }