Java Code Examples for android.animation.AnimatorListenerAdapter

The following examples show how to use android.animation.AnimatorListenerAdapter. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: Android   Source File: MainActivity.java    License: 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 2
Source Project: FimiX8-RE   Source File: X8MainAiFlyController.java    License: 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 3
Source Project: FimiX8-RE   Source File: X8MainCameraSettingController.java    License: 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 4
Source Project: FimiX8-RE   Source File: X8AiAerialPhotographExcuteController.java    License: 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 5
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 6
Source Project: FimiX8-RE   Source File: X8AiAutoPhototExcuteController.java    License: 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 7
Source Project: timecat   Source File: IntroCard.java    License: 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 8
Source Project: FimiX8-RE   Source File: X8AiLineExcuteController.java    License: 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 9
Source Project: ScaleTouchListener   Source File: ScaleTouchListener.java    License: 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 10
Source Project: FimiX8-RE   Source File: X8AiScrewExcuteController.java    License: 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 11
Source Project: WanAndroid   Source File: AnimHelper.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void showIn(final View v) {
    v.setVisibility(View.VISIBLE);
    v.setAlpha(0f);
    v.setTranslationY(v.getHeight());
    v.animate()
            .setDuration(200)
            .translationY(0)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                }
            })
            .alpha(1f)
            .start();
}
 
Example 12
/**
 * 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 13
Source Project: animation-samples   Source File: StreetViewFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onBackPressed() {
    if (isRestored) {
        getFragmentManager().popBackStack();
    } else {
        // Perform a circular conceal, then pop this fragment off the back stack.
        final FrameLayout view = ((FrameLayout) getView());
        //noinspection ConstantConditions
        Animator circularConceal = ViewUtils.createCircularConceal(mRevealCenter, mRevealWidth,
                view, INTERPOLATOR);
        circularConceal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
                getFragmentManager().popBackStack();
            }
        });
        circularConceal.start();
    }
}
 
Example 14
/**
 * 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 Project: ShizuruNotes   Source File: CalendarLayout.java    License: 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
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 17
Source Project: android_9.0.0_r45   Source File: Transition.java    License: 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 18
@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 19
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 20
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 21
Source Project: DanDanPlayForAndroid   Source File: SwitchThemeAnimView.java    License: 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 22
@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 23
Source Project: XPlayer2   Source File: LiveRoomActivity.java    License: 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;
}
 
Example 24
Source Project: RippleAnimation   Source File: RippleAnimation.java    License: 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 25
Source Project: TelePlus-Android   Source File: CheckBox.java    License: 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 26
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 27
Source Project: HaoReader   Source File: ExplosionField.java    License: 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 28
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 29
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 30
Source Project: RichEditorView   Source File: AnimatorUtil.java    License: 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();
        }
    });
}