android.support.v4.view.ViewPropertyAnimatorListenerAdapter Java Examples
The following examples show how to use
android.support.v4.view.ViewPropertyAnimatorListenerAdapter.
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: TutoShowcase.java From TutoShowcase with Apache License 2.0 | 6 votes |
public void dismiss() { ViewCompat.animate(container) .alpha(0f) .setDuration(container.getResources().getInteger(android.R.integer.config_mediumAnimTime)) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewParent parent = view.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view); } if (listener != null) { listener.onDismissed(); } } }).start(); }
Example #2
Source File: MaterialViewPagerImageHelper.java From MaterialViewPager with Apache License 2.0 | 6 votes |
/** * change the image with a fade * * @param drawable * @param fadeDuration */ public static void setImageDrawable(final ImageView imageView, final Drawable drawable, final int fadeDuration) { final float alpha = ViewCompat.getAlpha(imageView); final ImageView viewToAnimate = imageView; fadeOut(viewToAnimate, fadeDuration, new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); //change the image when alpha=0 imageView.setImageDrawable(drawable); //then fade to alpha=1 fadeIn(viewToAnimate, alpha, fadeDuration, new ViewPropertyAnimatorListenerAdapter()); } }); }
Example #3
Source File: FloatLabelLayout.java From standardlib with Apache License 2.0 | 6 votes |
/** * Hide the label */ private void hideLabel(boolean animate) { if (animate) { float scale = mEditText.getTextSize() / mLabel.getTextSize(); ViewCompat.setScaleX(mLabel, 1f); ViewCompat.setScaleY(mLabel, 1f); ViewCompat.setTranslationY(mLabel, 0f); ViewCompat.animate(mLabel) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .scaleX(scale) .scaleY(scale) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }) .setInterpolator(mInterpolator).start(); } else { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }
Example #4
Source File: FloatLabelLayout.java From 365browser with Apache License 2.0 | 6 votes |
/** * Hide the label */ private void hideLabel(boolean animate) { if (animate) { float scale = mEditText.getTextSize() / mLabel.getTextSize(); ViewCompat.setScaleX(mLabel, 1f); ViewCompat.setScaleY(mLabel, 1f); ViewCompat.setTranslationY(mLabel, 0f); ViewCompat.animate(mLabel) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .scaleX(scale) .scaleY(scale) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }) .setInterpolator(mInterpolator).start(); } else { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }
Example #5
Source File: MainActivity.java From android-docs-samples with Apache License 2.0 | 6 votes |
private void showResults() { mIntroduction.setVisibility(View.GONE); if (mProgress.getVisibility() == View.VISIBLE) { ViewCompat.animate(mProgress) .alpha(0.f) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { view.setVisibility(View.INVISIBLE); } }); } if (mHidingResult) { ViewCompat.animate(mResults).cancel(); } if (mResults.getVisibility() == View.INVISIBLE) { mResults.setVisibility(View.VISIBLE); ViewCompat.setAlpha(mResults, 0.01f); ViewCompat.animate(mResults) .alpha(1.f) .setListener(null) .start(); } }
Example #6
Source File: MainActivity.java From android-docs-samples with Apache License 2.0 | 6 votes |
private void showProgress() { mIntroduction.setVisibility(View.GONE); if (mResults.getVisibility() == View.VISIBLE) { mHidingResult = true; ViewCompat.animate(mResults) .alpha(0.f) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { mHidingResult = false; view.setVisibility(View.INVISIBLE); } }); } if (mProgress.getVisibility() == View.INVISIBLE) { mProgress.setVisibility(View.VISIBLE); ViewCompat.setAlpha(mProgress, 0.f); ViewCompat.animate(mProgress) .alpha(1.f) .setListener(null) .start(); } }
Example #7
Source File: FloatLabelLayout.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Hide the label */ private void hideLabel(boolean animate) { if (animate) { float scale = mEditText.getTextSize() / mLabel.getTextSize(); ViewCompat.setScaleX(mLabel, 1f); ViewCompat.setScaleY(mLabel, 1f); ViewCompat.setTranslationY(mLabel, 0f); ViewCompat.animate(mLabel) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .scaleX(scale) .scaleY(scale) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }) .setInterpolator(mInterpolator).start(); } else { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }
Example #8
Source File: FloatLabelLayout.java From delion with Apache License 2.0 | 6 votes |
/** * Hide the label */ private void hideLabel(boolean animate) { if (animate) { float scale = mEditText.getTextSize() / mLabel.getTextSize(); ViewCompat.setScaleX(mLabel, 1f); ViewCompat.setScaleY(mLabel, 1f); ViewCompat.setTranslationY(mLabel, 0f); ViewCompat.animate(mLabel) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .scaleX(scale) .scaleY(scale) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }) .setInterpolator(mInterpolator).start(); } else { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }
Example #9
Source File: QuizActivity.java From android-topeka with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void revealFragmentContainerLollipop(final View clickedView, final FrameLayout fragmentContainer) { prepareCircularReveal(clickedView, fragmentContainer); ViewCompat.animate(clickedView) .scaleX(0) .scaleY(0) .alpha(0) .setInterpolator(mInterpolator) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { fragmentContainer.setVisibility(View.VISIBLE); clickedView.setVisibility(View.GONE); } }) .start(); fragmentContainer.setVisibility(View.VISIBLE); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(mCircularReveal).with(mColorChange); animatorSet.start(); }
Example #10
Source File: FloatLabelLayout.java From xifan with Apache License 2.0 | 5 votes |
/** * Hide the label */ private void hideLabel(boolean animate) { if (animate) { float scale = mEditText.getTextSize() / mLabel.getTextSize(); ViewCompat.setScaleX(mLabel, 1f); ViewCompat.setScaleY(mLabel, 1f); ViewCompat.setTranslationY(mLabel, 0f); ViewCompat.animate(mLabel) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .scaleX(scale) .scaleY(scale) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }) .setInterpolator(mInterpolator) .start(); } else { mLabel.setVisibility(INVISIBLE); mEditText.setHint(mHint); } }
Example #11
Source File: HelperTextInputLayout.java From ETHWallet with GNU General Public License v3.0 | 5 votes |
public void setHelperText(CharSequence _helperText) { mHelperText = _helperText; if (!this.mHelperTextEnabled) { if (TextUtils.isEmpty(mHelperText)) { return; } this.setHelperTextEnabled(true); } if (!TextUtils.isEmpty(mHelperText)) { this.mHelperView.setText(mHelperText); this.mHelperView.setVisibility(VISIBLE); ViewCompat.setAlpha(this.mHelperView, 0.0F); ViewCompat.animate(this.mHelperView) .alpha(1.0F).setDuration(200L) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(null).start(); } else if (this.mHelperView.getVisibility() == VISIBLE) { ViewCompat.animate(this.mHelperView) .alpha(0.0F).setDuration(200L) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(new ViewPropertyAnimatorListenerAdapter() { public void onAnimationEnd(View view) { mHelperView.setText(null); mHelperView.setVisibility(INVISIBLE); } }).start(); } this.sendAccessibilityEvent(2048); }
Example #12
Source File: HelperTextInputLayout.java From trust-wallet-android-source with GNU General Public License v3.0 | 5 votes |
public void setHelperText(CharSequence _helperText) { mHelperText = _helperText; if (!this.mHelperTextEnabled) { if (TextUtils.isEmpty(mHelperText)) { return; } this.setHelperTextEnabled(true); } if (!TextUtils.isEmpty(mHelperText)) { this.mHelperView.setText(mHelperText); this.mHelperView.setVisibility(VISIBLE); ViewCompat.setAlpha(this.mHelperView, 0.0F); ViewCompat.animate(this.mHelperView) .alpha(1.0F).setDuration(200L) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(null).start(); } else if (this.mHelperView.getVisibility() == VISIBLE) { ViewCompat.animate(this.mHelperView) .alpha(0.0F).setDuration(200L) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(new ViewPropertyAnimatorListenerAdapter() { public void onAnimationEnd(View view) { mHelperView.setText(null); mHelperView.setVisibility(INVISIBLE); } }).start(); } this.sendAccessibilityEvent(2048); }
Example #13
Source File: ExoPlayerView.java From DanDanPlayForAndroid with MIT License | 5 votes |
/** * 隐藏选取字幕提示 */ private void _hideSkipSub() { if (skipSubView.getVisibility() == GONE) { return; } ViewCompat.animate(skipSubView).translationX(-skipSubView.getWidth()).alpha(0).setDuration(500) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { skipSubView.setVisibility(GONE); } }).start(); }
Example #14
Source File: ExoPlayerView.java From DanDanPlayForAndroid with MIT License | 5 votes |
/** * 隐藏跳转提示 */ private void _hideSkipTip() { if (skipTipView.getVisibility() == GONE) { return; } ViewCompat.animate(skipTipView).translationX(-skipTipView.getWidth()).alpha(0).setDuration(500) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { skipTipView.setVisibility(GONE); } }).start(); mSkipPosition = INVALID_VALUE; }
Example #15
Source File: AnimateOnSubscribe.java From RxAnimations with Apache License 2.0 | 5 votes |
private Subscription createClearSubscription(final ViewPropertyAnimatorCompat animator) { return new ClearSubscription(() -> { animator.setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationCancel(final View view) { onAnimationCancelAction.call(view); } }); animator.cancel(); animator.setListener(null); }); }
Example #16
Source File: IjkPlayerView.java From DanDanPlayForAndroid with MIT License | 5 votes |
/** * 隐藏选取字幕提示 */ private void _hideSkipSub() { if (skipSubView.getVisibility() == GONE) { return; } ViewCompat.animate(skipSubView).translationX(-skipSubView.getWidth()).alpha(0).setDuration(500) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { skipSubView.setVisibility(GONE); } }).start(); }
Example #17
Source File: QuizActivity.java From CoolSignIn with Apache License 2.0 | 5 votes |
@Override public void onBackPressed() { if (mQuizFab == null) { // Skip the animation if icon or fab are not initialized. super.onBackPressed(); return; } else if (mContent != null && mContent == cameraPreviewfFragment) { switchContent(cameraPreviewfFragment, courseInfoFragment); mContent = courseInfoFragment; return; } ViewCompat.animate(mToolbarBack) .scaleX(0f) .scaleY(0f) .alpha(0f) .setDuration(100) .start(); ViewCompat.animate(mQuizFab) .scaleX(0f) .scaleY(0f) .setInterpolator(mInterpolator) .setStartDelay(100) .setListener(new ViewPropertyAnimatorListenerAdapter() { @SuppressLint("NewApi") @Override public void onAnimationEnd(View view) { if (isFinishing() || (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.JELLY_BEAN_MR1) && isDestroyed())) { return; } QuizActivity.super.onBackPressed(); } }) .start(); }
Example #18
Source File: IjkPlayerView.java From DanDanPlayForAndroid with MIT License | 5 votes |
/** * 隐藏跳转提示 */ private void _hideSkipTip() { if (skipTipView.getVisibility() == GONE) { return; } ViewCompat.animate(skipTipView).translationX(-skipTipView.getWidth()).alpha(0).setDuration(500) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { skipTipView.setVisibility(GONE); } }).start(); mSkipPosition = INVALID_VALUE; }
Example #19
Source File: MaterialViewPagerImageHelper.java From MaterialViewPager with Apache License 2.0 | 5 votes |
public static void fadeOut(View view, int fadeDuration, ViewPropertyAnimatorListenerAdapter listener) { //fade to alpha=0 ViewCompat.animate(view) .alpha(0) .setDuration(fadeDuration) .withLayer() .setInterpolator(new DecelerateInterpolator()) .setListener(listener); }
Example #20
Source File: MaterialViewPagerImageHelper.java From MaterialViewPager with Apache License 2.0 | 5 votes |
public static void fadeIn(View view, float alpha, int fadeDuration, ViewPropertyAnimatorListenerAdapter listener) { //fade to alpha=0 ViewCompat.animate(view) .alpha(alpha) .setDuration(fadeDuration) .withLayer() .setInterpolator(new AccelerateInterpolator()) .setListener(listener); }
Example #21
Source File: HelperTextInputLayout.java From alpha-wallet-android with MIT License | 5 votes |
public void setHelperText(CharSequence _helperText) { mHelperText = _helperText; if (!this.mHelperTextEnabled) { if (TextUtils.isEmpty(mHelperText)) { return; } this.setHelperTextEnabled(true); } if (!TextUtils.isEmpty(mHelperText)) { this.mHelperView.setText(mHelperText); this.mHelperView.setVisibility(VISIBLE); ViewCompat.setAlpha(this.mHelperView, 0.0F); ViewCompat.animate(this.mHelperView) .alpha(1.0F).setDuration(200L) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(null).start(); } else if (this.mHelperView.getVisibility() == VISIBLE) { ViewCompat.animate(this.mHelperView) .alpha(0.0F).setDuration(200L) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(new ViewPropertyAnimatorListenerAdapter() { public void onAnimationEnd(View view) { mHelperView.setText(null); mHelperView.setVisibility(INVISIBLE); } }).start(); } this.sendAccessibilityEvent(2048); }
Example #22
Source File: QuizActivity.java From android-topeka with Apache License 2.0 | 4 votes |
@Override public void onBackPressed() { if (mIcon == null || mQuizFab == null) { // Skip the animation if icon or fab are not initialized. super.onBackPressed(); return; } ViewCompat.animate(mToolbarBack) .scaleX(0f) .scaleY(0f) .alpha(0f) .setDuration(100) .start(); // Scale the icon and fab to 0 size before calling onBackPressed if it exists. ViewCompat.animate(mIcon) .scaleX(.7f) .scaleY(.7f) .alpha(0f) .setInterpolator(mInterpolator) .start(); ViewCompat.animate(mQuizFab) .scaleX(0f) .scaleY(0f) .setInterpolator(mInterpolator) .setStartDelay(100) .setListener(new ViewPropertyAnimatorListenerAdapter() { @SuppressLint("NewApi") @Override public void onAnimationEnd(View view) { if (isFinishing() || (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.JELLY_BEAN_MR1) && isDestroyed())) { return; } QuizActivity.super.onBackPressed(); } }) .start(); }