本文整理汇总了Java中android.support.v4.view.ViewPropertyAnimatorListenerAdapter类的典型用法代码示例。如果您正苦于以下问题:Java ViewPropertyAnimatorListenerAdapter类的具体用法?Java ViewPropertyAnimatorListenerAdapter怎么用?Java ViewPropertyAnimatorListenerAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ViewPropertyAnimatorListenerAdapter类属于android.support.v4.view包,在下文中一共展示了ViewPropertyAnimatorListenerAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setImageDrawable
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
/**
* 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());
}
});
}
示例2: onDispose
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
@Override
protected void onDispose() {
animator.setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final View view) {
try {
animationCancelAction.accept(view);
} catch (Exception e) {
e.printStackTrace();
}
}
});
animator.cancel();
animator.setListener(null);
}
示例3: hideLabel
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
/**
* 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);
}
}
示例4: animateIn
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
private void animateIn(final CardView view) {
if (animInProgress)
return;
animInProgress = true;
view.setVisibility(View.VISIBLE);
ViewCompat.animate(view).translationX(shownPosX)
.setInterpolator(interpolator).withLayer()
.setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view1) {
super.onAnimationEnd(view1);
animInProgress = false;
if (currentPos > 400)
animateIn(view);
else animateOut(view);
}
})
.start();
}
示例5: animateOut
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
private void animateOut(final CardView view) {
if (animInProgress)
return;
animInProgress = true;
view.setVisibility(View.VISIBLE);
ViewCompat.animate(view).translationX(hiddenPosX)
.setInterpolator(interpolator).withLayer()
.setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view1) {
super.onAnimationEnd(view1);
animInProgress = false;
if (currentPos > 400)
animateIn(view);
else animateOut(view);
}
})
.start();
}
示例6: dismiss
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
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();
}
示例7: revealFragmentContainerLollipop
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
@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();
}
示例8: showProgress
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
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();
}
}
示例9: showResults
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
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();
}
}
示例10: animateActionButton
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
public void animateActionButton() {
if (View.VISIBLE == mActionButton.getVisibility()) {
ViewCompat.animate(mActionButton).scaleX(0.0F).scaleY(0.0F).alpha(0.0F)
.setInterpolator(INTERPOLATOR).withLayer()
.setListener(new ViewPropertyAnimatorListenerAdapter() {
public void onAnimationEnd(View view) {
mActionButton.setVisibility(View.GONE);
animateActionButton();
}
})
.start();
} else {
setActionButtonColor();
mActionButton.setVisibility(View.VISIBLE);
ViewCompat.animate(mActionButton).scaleX(1.0F).scaleY(1.0F).alpha(1.0F)
.setInterpolator(INTERPOLATOR).withLayer().setListener(null)
.start();
}
}
示例11: hideLabel
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
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);
}
}
示例12: _hideSkipTip
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
/**
* 隐藏跳转提示
*/
private void _hideSkipTip() {
if (mLlSkipLayout.getVisibility() == GONE) {
return;
}
ViewCompat.animate(mLlSkipLayout).translationX(-mLlSkipLayout.getWidth()).alpha(0).setDuration(500)
.setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
mLlSkipLayout.setVisibility(GONE);
}
}).start();
mSkipPosition = INVALID_VALUE;
}
示例13: fadeOut
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
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);
}
示例14: fadeIn
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
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);
}
示例15: hideLabel
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; //导入依赖的package包/类
/**
* 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);
}
}