android.animation.AnimatorListenerAdapter Java Examples

The following examples show how to use android.animation.AnimatorListenerAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void hideFloatingDateView(boolean animated) {
    if (floatingDateView.getTag() != null && !currentFloatingDateOnScreen && (!scrollingFloatingDate || currentFloatingTopIsNotMessage)) {
        floatingDateView.setTag(null);
        if (animated) {
            floatingDateAnimation = new AnimatorSet();
            floatingDateAnimation.setDuration(150);
            floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 0.0f));
            floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (animation.equals(floatingDateAnimation)) {
                        floatingDateAnimation = null;
                    }
                }
            });
            floatingDateAnimation.setStartDelay(500);
            floatingDateAnimation.start();
        } else {
            if (floatingDateAnimation != null) {
                floatingDateAnimation.cancel();
                floatingDateAnimation = null;
            }
            floatingDateView.setAlpha(0.0f);
        }
    }
}
 
Example #2
Source File: X8AiAerialPhotographExcuteController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void closeNextUi() {
    this.blank.setVisibility(8);
    if (this.isNextShow) {
        this.isNextShow = false;
        ObjectAnimator translationRight = ObjectAnimator.ofFloat(this.nextRootView, "translationX", new float[]{0.0f, (float) this.width});
        translationRight.setDuration(300);
        translationRight.start();
        translationRight.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                X8AiAerialPhotographExcuteController.this.nextRootView.setVisibility(8);
            }
        });
    }
    this.activity.taskFullScreen(false);
    if (this.mX8AiAerialPhotographNextUi.isSaveData()) {
        setSensity();
    }
}
 
Example #3
Source File: BaseDialogFragment.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Animate appearance of a view
 *
 * @param view         View to animate
 * @param toVisibility Visibility at the end of animation
 * @param toAlpha      Alpha at the end of animation
 * @param duration     Animation duration in ms
 */
public static void animateView(final View view, final int toVisibility, float toAlpha, int duration) {
    boolean show = toVisibility == View.VISIBLE;
    if (show) {
        view.setAlpha(0);
    }
    view.setVisibility(View.VISIBLE);
    view.animate()
            .setDuration(duration)
            .alpha(show ? toAlpha : 0)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    view.setVisibility(toVisibility);
                }
            });
}
 
Example #4
Source File: X8MainAiFlyController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void closeAiUi(boolean isShowOther, boolean isShowRightIcon) {
    this.menuState = X8AiFlyMenuEnum.ALL_ITEMS;
    this.aiFlyBlank.setVisibility(8);
    if (this.isShow) {
        this.isShow = false;
        ObjectAnimator translationRight = ObjectAnimator.ofFloat(this.contentView, "translationX", new float[]{0.0f, (float) this.width});
        translationRight.setDuration(300);
        translationRight.start();
        translationRight.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                X8MainAiFlyController.this.rlAiFly.setVisibility(4);
                X8MainAiFlyController.this.svAiItems.fullScroll(33);
                X8MainAiFlyController.this.onCloseConfirmUi();
            }
        });
    }
    this.listener.onCloseAiUi(isShowOther, isShowRightIcon);
}
 
Example #5
Source File: MainActivity.java    From Android with MIT License 6 votes vote down vote up
private static void slideUpNow(final View view, final int delay) {

        view.setTranslationY(view.getWidth());
        view.animate()
                .translationY(100)
                .alpha(1.0f)
                .setDuration(500)
                .setStartDelay(delay)
                .setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        view.setVisibility(View.VISIBLE);
                        view.setAlpha(1.f);
                    }
                });

    }
 
Example #6
Source File: X8MainCameraSettingController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void closeAiUi(boolean b) {
    enableGesture(true);
    if (this.isShow) {
        this.isShow = false;
        ObjectAnimator translationRight = ObjectAnimator.ofFloat(this.contentView, "translationX", new float[]{0.0f, (float) this.width});
        translationRight.setDuration(300);
        translationRight.start();
        translationRight.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                X8MainCameraSettingController.this.rlCameraSetting.setVisibility(8);
                X8MainCameraSettingController.this.curMenu = MenuMode.normal;
                if (X8MainCameraSettingController.this.evShutterISOController != null) {
                    X8MainCameraSettingController.this.evShutterISOController.setCurModle();
                }
            }
        });
    }
    if (this.cameraMainSetListener != null) {
        this.cameraMainSetListener.showTopAndBottom(b);
    }
    if (this.takePhotoSettingContoller != null) {
        this.takePhotoSettingContoller.closeUi();
    }
}
 
Example #7
Source File: X8AiAutoPhototExcuteController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void closeNextUi(final boolean b) {
    this.blank.setVisibility(8);
    if (this.isNextShow) {
        this.isNextShow = false;
        ObjectAnimator translationRight = ObjectAnimator.ofFloat(this.nextRootView, "translationX", new float[]{0.0f, (float) this.width});
        translationRight.setDuration(300);
        translationRight.start();
        translationRight.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                X8AiAutoPhototExcuteController.this.nextRootView.setVisibility(8);
                ((ViewGroup) X8AiAutoPhototExcuteController.this.nextRootView).removeAllViews();
                X8AiAutoPhototExcuteController.this.imgBack.setVisibility(0);
                X8AiAutoPhototExcuteController.this.flagSmall.setVisibility(0);
                if (b) {
                    X8AiAutoPhototExcuteController.this.imgNext.setVisibility(0);
                }
            }
        });
    }
}
 
Example #8
Source File: IntroCard.java    From timecat with Apache License 2.0 6 votes vote down vote up
public void hide() {
    post(new Runnable() {
        @Override
        public void run() {
            ObjectAnimator objectAnimator = ObjectAnimator.ofInt(IntroCard.this, "height", 0);
            objectAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    setVisibility(GONE);
                    if (mListener != null) {
                        mListener.onClick(IntroCard.this);
                    }
                }
            });
            objectAnimator.setDuration(500);
            objectAnimator.setInterpolator(new AnticipateInterpolator());
            objectAnimator.setRepeatCount(0);
            objectAnimator.start();
        }
    });
}
 
Example #9
Source File: X8AiLineExcuteController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void closeNextUi(final boolean b) {
    this.blank.setVisibility(8);
    this.imgBack.setVisibility(0);
    if (this.isNextShow) {
        this.isNextShow = false;
        ObjectAnimator translationRight = ObjectAnimator.ofFloat(this.nextRootView, "translationX", new float[]{0.0f, (float) this.width});
        translationRight.setDuration(300);
        translationRight.start();
        translationRight.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                X8AiLineExcuteController.this.nextRootView.setVisibility(8);
                ((ViewGroup) X8AiLineExcuteController.this.nextRootView).removeAllViews();
                X8AiLineExcuteController.this.imgBack.setVisibility(0);
                X8AiLineExcuteController.this.flagSmall.setVisibility(0);
                if (b) {
                    X8AiLineExcuteController.this.imgNext.setVisibility(0);
                }
            }
        });
    }
}
 
Example #10
Source File: ScaleTouchListener.java    From ScaleTouchListener with Apache License 2.0 6 votes vote down vote up
private void createAnimators() {
    alphaDownAnimator = ObjectAnimator.ofFloat(mView.get(), "alpha", config.getAlpha());
    alphaUpAnimator = ObjectAnimator.ofFloat(mView.get(), "alpha", 1.0f);
    scaleXDownAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleX", config.getScaleDown());
    scaleXUpAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleX", 1.0f);
    scaleYDownAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleY", config.getScaleDown());
    scaleYUpAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleY", 1.0f);

    downSet = new AnimatorSet();
    downSet.setDuration(config.getDuration());
    downSet.setInterpolator(new AccelerateInterpolator());
    downSet.playTogether(alphaDownAnimator, scaleXDownAnimator, scaleYDownAnimator);

    upSet = new AnimatorSet();
    upSet.setDuration(config.getDuration());
    upSet.setInterpolator(new FastOutSlowInInterpolator());
    upSet.playTogether(alphaUpAnimator, scaleXUpAnimator, scaleYUpAnimator);

    finalAnimationListener = new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            onClick(mView.get());
        }
    };
}
 
Example #11
Source File: X8AiScrewExcuteController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void closeNextUi(final boolean b) {
    this.blank.setVisibility(8);
    if (this.isNextShow) {
        this.isNextShow = false;
        ObjectAnimator translationRight = ObjectAnimator.ofFloat(this.nextRootView, "translationX", new float[]{0.0f, (float) this.width});
        translationRight.setDuration(300);
        translationRight.start();
        translationRight.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                X8AiScrewExcuteController.this.nextRootView.setVisibility(8);
                ((ViewGroup) X8AiScrewExcuteController.this.nextRootView).removeAllViews();
                X8AiScrewExcuteController.this.imgBack.setVisibility(0);
                X8AiScrewExcuteController.this.flagSmall.setVisibility(0);
                if (b) {
                    X8AiScrewExcuteController.this.tvPoint.setVisibility(0);
                }
            }
        });
    }
}
 
Example #12
Source File: VoIPActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void setEmojiTooltipVisible(boolean visible){
      emojiTooltipVisible=visible;
      if(tooltipAnim!=null)
    tooltipAnim.cancel();
hintTextView.setVisibility(View.VISIBLE);
ObjectAnimator oa=ObjectAnimator.ofFloat(hintTextView, "alpha", visible ? 1 : 0);
oa.setDuration(300);
oa.setInterpolator(CubicBezierInterpolator.DEFAULT);
oa.addListener(new AnimatorListenerAdapter(){
	@Override
	public void onAnimationEnd(Animator animation){
		tooltipAnim=null;
	}
});
tooltipAnim=oa;
oa.start();
  }
 
Example #13
Source File: BookFloatingActionMenu.java    From HaoReader with GNU General Public License v3.0 6 votes vote down vote up
private void animateShowLabelView(View labelView) {
    labelView.animate().cancel();
    if (labelView.getVisibility() != VISIBLE) {
        labelView.setTranslationX(1.0f * labelView.getWidth() / 2);
        labelView.setAlpha(0f);
    }
    labelView.animate().translationX(0f).alpha(1f)
            .setDuration(200L)
            .setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    labelView.setVisibility(VISIBLE);
                }
            })
            .start();
}
 
Example #14
Source File: BaseFragment.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Animate appearance of a view
 *
 * @param view         View to animate
 * @param toVisibility Visibility at the end of animation
 * @param toAlpha      Alpha at the end of animation
 * @param duration     Animation duration in ms
 */
public static void animateView(final View view, final int toVisibility, float toAlpha, int duration) {
    boolean show = toVisibility == View.VISIBLE;
    if (show) {
        view.setAlpha(0);
    }
    view.setVisibility(View.VISIBLE);
    view.animate()
            .setDuration(duration)
            .alpha(show ? toAlpha : 0)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    view.setVisibility(toVisibility);
                }
            });
}
 
Example #15
Source File: CalendarLayout.java    From ShizuruNotes with Apache License 2.0 6 votes vote down vote up
/**
 * 隐藏内容布局
 */
@SuppressLint("NewApi")
final void hideContentView() {
    if (mContentView == null)
        return;
    mContentView.animate()
            .translationY(getHeight() - mMonthView.getHeight())
            .setDuration(220)
            .setInterpolator(new LinearInterpolator())
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mContentView.setVisibility(INVISIBLE);
                    mContentView.clearAnimation();
                }
            });
}
 
Example #16
Source File: VerticalBannerView.java    From MusicPlayer_XiangDa with GNU General Public License v3.0 6 votes vote down vote up
private void performSwitch(){
    ObjectAnimator animator1 = ObjectAnimator.ofFloat(mFirstView,"translationY",mFirstView.getTranslationY()-mBannerHeight);
    ObjectAnimator animator2 = ObjectAnimator.ofFloat(mSecondView,"translationY",mSecondView.getTranslationY()-mBannerHeight);
    AnimatorSet set = new AnimatorSet();
    set.playTogether(animator1,animator2);
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mFirstView.setTranslationY(0);
            mSecondView.setTranslationY(0);
            View removedView = getChildAt(0);
            mPosition++;
            mAdapter.setItem(removedView,mAdapter.getItem(mPosition%mAdapter.getCount()));
            removeView(removedView);
            addView(removedView,1);
        }

    });
    set.setDuration(mAnimDuration);
    set.start();
}
 
Example #17
Source File: AnimatorUtil.java    From RichEditorView with Apache License 2.0 6 votes vote down vote up
static void hide(final LuBottomMenu luBottomMenu, final long duration){
    luBottomMenu.post(new Runnable() {
        @Override
        public void run() {
            luBottomMenu.animate()
                    .setDuration(duration)
                    .translationY(luBottomMenu.getHeight())
                    .alpha(0f)
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            super.onAnimationEnd(animation);
                            luBottomMenu.setVisibility(View.GONE);
                        }
                    }).start();
        }
    });
}
 
Example #18
Source File: Transition.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * This is a utility method used by subclasses to handle standard parts of
 * setting up and running an Animator: it sets the {@link #getDuration()
 * duration} and the {@link #getStartDelay() startDelay}, starts the
 * animation, and, when the animator ends, calls {@link #end()}.
 *
 * @param animator The Animator to be run during this transition.
 *
 * @hide
 */
protected void animate(Animator animator) {
    // TODO: maybe pass auto-end as a boolean parameter?
    if (animator == null) {
        end();
    } else {
        if (getDuration() >= 0) {
            animator.setDuration(getDuration());
        }
        if (getStartDelay() >= 0) {
            animator.setStartDelay(getStartDelay() + animator.getStartDelay());
        }
        if (getInterpolator() != null) {
            animator.setInterpolator(getInterpolator());
        }
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                end();
                animation.removeListener(this);
            }
        });
        animator.start();
    }
}
 
Example #19
Source File: PhotoPaintView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void closeStickersView() {
    if (stickersView == null || stickersView.getVisibility() != VISIBLE) {
        return;
    }
    pickingSticker = false;

    Animator a = ObjectAnimator.ofFloat(stickersView, "alpha", 1.0f, 0.0f);
    a.setDuration(200);
    a.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            stickersView.setVisibility(GONE);
        }
    });
    a.start();
}
 
Example #20
Source File: PhotoPaintView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void setDimVisibility(final boolean visible) {
    Animator animator;
    if (visible) {
        dimView.setVisibility(VISIBLE);
        animator = ObjectAnimator.ofFloat(dimView, "alpha", 0.0f, 1.0f);
    } else {
        animator = ObjectAnimator.ofFloat(dimView, "alpha", 1.0f, 0.0f);
    }
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (!visible) {
                dimView.setVisibility(GONE);
            }
        }
    });
    animator.setDuration(200);
    animator.start();
}
 
Example #21
Source File: ExplosionField.java    From HaoReader with GNU General Public License v3.0 6 votes vote down vote up
public void explode(Bitmap bitmap, Rect bound, long startDelay, final View view) {
    if(bitmap == null || bitmap.isRecycled()){
        return;
    }
    long currentDuration = customDuration;
    final ExplosionAnimator explosion = new ExplosionAnimator(this, bitmap, bound);
    explosion.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mExplosions.remove(animation);
            if (view != null) {
                view.setScaleX(1);
                view.setScaleY(1);
                view.setAlpha(1);
                view.setOnClickListener(mOnClickListener);//set event

            }
        }
    });
    explosion.setStartDelay(startDelay);
    explosion.setDuration(currentDuration);
    mExplosions.add(explosion);
    explosion.start();
}
 
Example #22
Source File: ChatActivityEnterView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void hideRecordedAudioPanel()
{
    audioToSendPath = null;
    audioToSend = null;
    audioToSendMessageObject = null;
    videoToSendMessageObject = null;
    videoTimelineView.destroy();
    AnimatorSet AnimatorSet = new AnimatorSet();
    AnimatorSet.playTogether(
            ObjectAnimator.ofFloat(recordedAudioPanel, "alpha", 0.0f)
    );
    AnimatorSet.setDuration(200);
    AnimatorSet.addListener(new AnimatorListenerAdapter()
    {
        @Override
        public void onAnimationEnd(Animator animation)
        {
            recordedAudioPanel.setVisibility(GONE);

        }
    });
    AnimatorSet.start();
}
 
Example #23
Source File: CheckBox.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void animateToCheckedState(boolean newCheckedState) {
    isCheckAnimation = newCheckedState;
    checkAnimator = ObjectAnimator.ofFloat(this, "progress", newCheckedState ? 1 : 0);
    checkAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (animation.equals(checkAnimator)) {
                checkAnimator = null;
            }
            if (!isChecked) {
                checkedText = null;
            }
        }
    });
    checkAnimator.setDuration(300);
    checkAnimator.start();
}
 
Example #24
Source File: TransitionFragmentContainer.java    From ClipPathLayout with Apache License 2.0 6 votes vote down vote up
@Override
public void addView(View child) {
    TransitionAdapter adapter = switchView(child);
    if (mHandler.hasMessages(MESSAGE_REMOVE_VIEW)) {
        mHandler.removeMessages(MESSAGE_REMOVE_VIEW);
    }
    mValueAnimator = adapter.getAnimator();
    mValueAnimator.setInterpolator(new AccelerateInterpolator());
    mValueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            sendRemoveViewMessage();
        }
    });
    mValueAnimator.setInterpolator(new AccelerateInterpolator());
    startAnimator();
}
 
Example #25
Source File: RippleAnimation.java    From RippleAnimation with Apache License 2.0 6 votes vote down vote up
private void initListener() {
    mAnimatorListener = new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (mOnAnimationEndListener != null) {
                mOnAnimationEndListener.onAnimationEnd();
            }
            isStarted = false;
            //动画播放完毕, 移除本View
            detachFromRootView();
        }
    };
    mAnimatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            //更新圆的半径
            mCurrentRadius = (int) (float) animation.getAnimatedValue() + mStartRadius;
            postInvalidate();
        }
    };
}
 
Example #26
Source File: AndroidUtilities.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public static void shakeView(final View view, final float x, final int num)
{
    if (view == null)
    {
        return;
    }
    if (num == 6)
    {
        view.setTranslationX(0);
        return;
    }
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(view, "translationX", AndroidUtilities.dp(x)));
    animatorSet.setDuration(50);
    animatorSet.addListener(new AnimatorListenerAdapter()
    {
        @Override
        public void onAnimationEnd(Animator animation)
        {
            shakeView(view, num == 5 ? 0 : -x, num + 1);
        }
    });
    animatorSet.start();
}
 
Example #27
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void hideFloatingDateView(boolean animated) {
    if (floatingDateView.getTag() != null && !currentFloatingDateOnScreen && (!scrollingFloatingDate || currentFloatingTopIsNotMessage)) {
        floatingDateView.setTag(null);
        if (animated) {
            floatingDateAnimation = new AnimatorSet();
            floatingDateAnimation.setDuration(150);
            floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 0.0f));
            floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (animation.equals(floatingDateAnimation)) {
                        floatingDateAnimation = null;
                    }
                }
            });
            floatingDateAnimation.setStartDelay(500);
            floatingDateAnimation.start();
        } else {
            if (floatingDateAnimation != null) {
                floatingDateAnimation.cancel();
                floatingDateAnimation = null;
            }
            floatingDateView.setAlpha(0.0f);
        }
    }
}
 
Example #28
Source File: SwitchThemeAnimView.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
private void initListener() {
    mAnimatorListener = new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            //动画播放完毕, 移除本View
            detachFromRootView();
            if (mOnAnimationEndListener != null) {
                mOnAnimationEndListener.onAnimationEnd();
            }
            isStarted = false;
        }
    };
    mAnimatorUpdateListener = animation -> {
        //更新圆的半径
        mCurrentRadius = (int) (float) animation.getAnimatedValue() + mStartRadius;
        postInvalidate();
    };
}
 
Example #29
Source File: PhotoEditToolCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    valueTextView.setTag(null);
    valueAnimation = new AnimatorSet();
    valueAnimation.playTogether(
            ObjectAnimator.ofFloat(valueTextView, "alpha", 0.0f),
            ObjectAnimator.ofFloat(nameTextView, "alpha", 1.0f));
    valueAnimation.setDuration(180);
    valueAnimation.setInterpolator(new DecelerateInterpolator());
    valueAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (animation.equals(valueAnimation)) {
                valueAnimation = null;
            }
        }
    });
    valueAnimation.start();
}
 
Example #30
Source File: LiveRoomActivity.java    From XPlayer2 with Apache License 2.0 6 votes vote down vote up
private void scale(float ratio) {
    if (scaleRatio == ratio) {
        return;
    }

    if (scaleAnimator != null) {
        scaleAnimator.cancel();
    }

    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", scaleRatio, ratio);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", scaleRatio, ratio);
    PropertyValuesHolder translationX = PropertyValuesHolder.ofFloat("translationX", 0);
    PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", 0);
    scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(mVideoView, scaleX, scaleY, translationX, translationY);
    scaleAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            animation.removeAllListeners();
            scaleAnimator = null;
        }
    });
    scaleAnimator.setDuration(150L).start();
    scaleRatio = ratio;
}