本文整理汇总了Java中android.support.v4.view.ViewPropertyAnimatorCompat类的典型用法代码示例。如果您正苦于以下问题:Java ViewPropertyAnimatorCompat类的具体用法?Java ViewPropertyAnimatorCompat怎么用?Java ViewPropertyAnimatorCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ViewPropertyAnimatorCompat类属于android.support.v4.view包,在下文中一共展示了ViewPropertyAnimatorCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
/**
* @param animate whether to animate the change
* @return this, to allow builder pattern
*/
public T show(boolean animate) {
mIsHidden = false;
if (isWeakReferenceValid()) {
TextView textView = mTextViewRef.get();
if (animate) {
textView.setScaleX(0);
textView.setScaleY(0);
textView.setVisibility(View.VISIBLE);
ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView);
animatorCompat.cancel();
animatorCompat.setDuration(mAnimationDuration);
animatorCompat.scaleX(1).scaleY(1);
animatorCompat.setListener(null);
animatorCompat.start();
} else {
textView.setScaleX(1);
textView.setScaleY(1);
textView.setVisibility(View.VISIBLE);
}
}
return getSubInstance();
}
示例2: animateMoveImpl
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
/**
* Preform your animation. You do not need to override this in most cases cause the default is pretty good.
* Listeners will be overridden
**/
protected ViewPropertyAnimatorCompat animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) {
final View view = holder.itemView;
final int deltaX = toX - fromX;
final int deltaY = toY - fromY;
ViewCompat.animate(view).cancel();
if (deltaX != 0) {
ViewCompat.animate(view).translationX(0);
}
if (deltaY != 0) {
ViewCompat.animate(view).translationY(0);
}
// TODO: make EndActions end listeners instead, since end actions aren't called when
// vpas are canceled (and can't end them. why?)
// need listener functionality in VPACompat for this. Ick.
return ViewCompat.animate(view).setInterpolator(null).setDuration(getMoveDuration());
}
示例3: subscribeActual
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
@Override
protected void subscribeActual(final CompletableObserver completableObserver) {
verifyMainThread();
final View view = viewWeakRef.get();
if (view == null) {
completableObserver.onComplete();
return;
}
final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);
completableObserver.onSubscribe(createAnimationDisposable(animator, onAnimationCancelAction));
if (preTransformActions != null) {
applyActions(preTransformActions, animator);
animator.setDuration(NONE).setStartDelay(NONE)
.withEndAction(() -> runAnimation(completableObserver, animator))
.start();
} else {
runAnimation(completableObserver, animator);
}
}
示例4: start
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public void start() {
if (!this.mIsStarted) {
Iterator i$ = this.mAnimators.iterator();
while (i$.hasNext()) {
ViewPropertyAnimatorCompat animator = (ViewPropertyAnimatorCompat) i$.next();
if (this.mDuration >= 0) {
animator.setDuration(this.mDuration);
}
if (this.mInterpolator != null) {
animator.setInterpolator(this.mInterpolator);
}
if (this.mListener != null) {
animator.setListener(this.mProxyListener);
}
animator.start();
}
this.mIsStarted = true;
}
}
示例5: animateToMode
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public void animateToMode(boolean toActionMode) {
ViewPropertyAnimatorCompat fadeOut;
ViewPropertyAnimatorCompat fadeIn;
if (toActionMode) {
showForActionMode();
} else {
hideForActionMode();
}
if (toActionMode) {
fadeOut = this.mDecorToolbar.setupAnimatorToVisibility(4, FADE_OUT_DURATION_MS);
fadeIn = this.mContextView.setupAnimatorToVisibility(0, FADE_IN_DURATION_MS);
} else {
fadeIn = this.mDecorToolbar.setupAnimatorToVisibility(0, FADE_IN_DURATION_MS);
fadeOut = this.mContextView.setupAnimatorToVisibility(8, FADE_OUT_DURATION_MS);
}
ViewPropertyAnimatorCompatSet set = new ViewPropertyAnimatorCompatSet();
set.playSequentially(fadeOut, fadeIn);
set.start();
}
示例6: animateToVisibility
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public void animateToVisibility(int visibility) {
if (this.mVisibilityAnim != null) {
this.mVisibilityAnim.cancel();
}
if (visibility == 0) {
if (getVisibility() != 0) {
ViewCompat.setAlpha(this, 0.0f);
}
ViewPropertyAnimatorCompat anim = ViewCompat.animate(this).alpha(1.0f);
anim.setDuration(200);
anim.setInterpolator(sAlphaInterpolator);
anim.setListener(this.mVisAnimListener.withFinalVisibility(anim, visibility));
anim.start();
return;
}
anim = ViewCompat.animate(this).alpha(0.0f);
anim.setDuration(200);
anim.setInterpolator(sAlphaInterpolator);
anim.setListener(this.mVisAnimListener.withFinalVisibility(anim, visibility));
anim.start();
}
示例7: setupAnimatorToVisibility
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public ViewPropertyAnimatorCompat setupAnimatorToVisibility(int visibility, long duration) {
if (this.mVisibilityAnim != null) {
this.mVisibilityAnim.cancel();
}
if (visibility == 0) {
if (getVisibility() != 0) {
ViewCompat.setAlpha(this, 0.0f);
}
ViewPropertyAnimatorCompat anim = ViewCompat.animate(this).alpha(1.0f);
anim.setDuration(duration);
anim.setListener(this.mVisAnimListener.withFinalVisibility(anim, visibility));
return anim;
}
anim = ViewCompat.animate(this).alpha(0.0f);
anim.setDuration(duration);
anim.setListener(this.mVisAnimListener.withFinalVisibility(anim, visibility));
return anim;
}
示例8: createAnimatorToHeadView
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public void createAnimatorToHeadView(final View v, final float angle)
{
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
viewPropertyAnimatorCompat.setDuration(200);
viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
viewPropertyAnimatorCompat.rotationX(90);
viewPropertyAnimatorCompat.start();
viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
@Override
public void onAnimationUpdate(View view) {
float height = ViewCompat.getTranslationY(mChildView);
mHeadLayout.setPivotX(mHeadLayout.getWidth() / 2);
mHeadLayout.setPivotY(height);
}
});
}
示例9: finishRefreshing
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public void finishRefreshing() {
if (mChildView != null) {
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
viewPropertyAnimatorCompat.setDuration(200);
viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
viewPropertyAnimatorCompat.translationY(0);
viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
viewPropertyAnimatorCompat.start();
if (mMaterialHeaderView != null) {
mMaterialHeaderView.onComplete(MaterialRefreshLayout.this);
} else if (mSunLayout != null) {
mSunLayout.onComplete(MaterialRefreshLayout.this);
}
if (refreshListener != null) {
refreshListener.onfinish();
}
}
isRefreshing = false;
progressValue = 0;
}
示例10: onCreateAnimation
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
@Override
protected void onCreateAnimation(MoveAnimationInfo info) {
final View view = info.holder.itemView;
final int deltaX = info.toX - info.fromX;
final int deltaY = info.toY - info.fromY;
if (deltaX != 0) {
ViewCompat.animate(view).translationX(0);
}
if (deltaY != 0) {
ViewCompat.animate(view).translationY(0);
}
final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);
animator.setDuration(getDuration());
animator.setInterpolator(MOVE_INTERPOLATOR);
startActiveItemAnimation(info, info.holder, animator);
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:21,代码来源:SwipeDismissItemAnimator.java
示例11: onCreateAnimation
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
@Override
protected void onCreateAnimation(MoveAnimationInfo info) {
final View view = info.holder.itemView;
final int deltaX = info.toX - info.fromX;
final int deltaY = info.toY - info.fromY;
if (deltaX != 0) {
ViewCompat.animate(view).translationX(0);
}
if (deltaY != 0) {
ViewCompat.animate(view).translationY(0);
}
final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);
animator.setDuration(getDuration());
startActiveItemAnimation(info, info.holder, animator);
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:20,代码来源:RefactoredDefaultItemAnimator.java
示例12: finishRefreshing
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public void finishRefreshing() {
if (mChildView != null) {
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
viewPropertyAnimatorCompat.setDuration(200);
viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
viewPropertyAnimatorCompat.translationY(0);
viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
viewPropertyAnimatorCompat.start();
if (materialHeadView != null) {
materialHeadView.onComlete(MaterialRefreshLayout.this);
}
if (refreshListener != null) {
refreshListener.onfinish();
}
}
isRefreshing = false;
progressValue = 0;
setProgressValue(0);
}
示例13: call
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
@Override
public void call(final CompletableSubscriber completableSubscriber) {
final View view = viewWeakRef.get();
if (view == null) {
completableSubscriber.onCompleted();
return;
}
final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);
completableSubscriber.onSubscribe(createClearSubscription(animator));
if (preTransformActions != null) {
applyActions(preTransformActions, animator);
animator.setDuration(NONE).setStartDelay(NONE)
.withEndAction(() -> runAnimation(completableSubscriber, animator))
.start();
} else {
runAnimation(completableSubscriber, animator);
}
}
示例14: finishRefreshing
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public void finishRefreshing() {
if (mChildView != null) {
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
viewPropertyAnimatorCompat.setDuration(200);
viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
viewPropertyAnimatorCompat.translationY(0);
viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
viewPropertyAnimatorCompat.start();
if (mMaterialHeaderView != null) {
mMaterialHeaderView.onComlete(MaterialRefreshLayout.this);
} else if (mSunLayout != null) {
mSunLayout.onComlete(MaterialRefreshLayout.this);
}
if (refreshListener != null) {
refreshListener.onfinish();
}
}
isRefreshing = false;
progressValue = 0;
}
示例15: start
import android.support.v4.view.ViewPropertyAnimatorCompat; //导入依赖的package包/类
public final void start()
{
if (this.mIsStarted) {
return;
}
Iterator localIterator = this.mAnimators.iterator();
while (localIterator.hasNext())
{
ViewPropertyAnimatorCompat localViewPropertyAnimatorCompat = (ViewPropertyAnimatorCompat)localIterator.next();
if (this.mDuration >= 0L) {
localViewPropertyAnimatorCompat.setDuration(this.mDuration);
}
if (this.mInterpolator != null) {
localViewPropertyAnimatorCompat.setInterpolator(this.mInterpolator);
}
if (this.mListener != null) {
localViewPropertyAnimatorCompat.setListener(this.mProxyListener);
}
localViewPropertyAnimatorCompat.start();
}
this.mIsStarted = true;
}