本文整理汇总了Java中android.support.v4.view.ViewPropertyAnimatorUpdateListener类的典型用法代码示例。如果您正苦于以下问题:Java ViewPropertyAnimatorUpdateListener类的具体用法?Java ViewPropertyAnimatorUpdateListener怎么用?Java ViewPropertyAnimatorUpdateListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ViewPropertyAnimatorUpdateListener类属于android.support.v4.view包,在下文中一共展示了ViewPropertyAnimatorUpdateListener类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAnimatorToHeadView
import android.support.v4.view.ViewPropertyAnimatorUpdateListener; //导入依赖的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);
}
});
}
示例2: ensureOrCancelAnimator
import android.support.v4.view.ViewPropertyAnimatorUpdateListener; //导入依赖的package包/类
/**
* Manage animation for Android >= KITKAT
*
* @param child
*/
private void ensureOrCancelAnimator(V child, boolean withAnimation) {
if (translationAnimator == null) {
translationAnimator = ViewCompat.animate(child);
translationAnimator.setDuration(withAnimation ? ANIM_DURATION : 0);
translationAnimator.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
@Override
public void onAnimationUpdate(View view) {
if (navigationPositionListener != null) {
navigationPositionListener.onPositionChange((int) (view.getMeasuredHeight() - view.getTranslationY() + snackBarY));
}
}
});
translationAnimator.setInterpolator(INTERPOLATOR);
} else {
translationAnimator.setDuration(withAnimation ? ANIM_DURATION : 0);
translationAnimator.cancel();
}
}
示例3: updateViewPropertiesToTaskTransform
import android.support.v4.view.ViewPropertyAnimatorUpdateListener; //导入依赖的package包/类
void updateViewPropertiesToTaskTransform(DeckChildViewTransform toTransform, int duration,
ViewPropertyAnimatorUpdateListener updateCallback) {
// Apply the transform
toTransform.applyToTaskView(this, duration, mConfig.fastOutSlowInInterpolator, false,
!mConfig.fakeShadows, updateCallback);
// Update the task progress
DVUtils.cancelAnimationWithoutCallbacks(mTaskProgressAnimator);
if (duration <= 0) {
setTaskProgress(toTransform.p);
} else {
mTaskProgressAnimator = ObjectAnimator.ofFloat(this, "taskProgress", toTransform.p);
mTaskProgressAnimator.setDuration(duration);
mTaskProgressAnimator.addUpdateListener(mUpdateDimListener);
mTaskProgressAnimator.start();
}
}
示例4: createAnimatorTranslationY
import android.support.v4.view.ViewPropertyAnimatorUpdateListener; //导入依赖的package包/类
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
viewPropertyAnimatorCompat.setDuration(200);
viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
viewPropertyAnimatorCompat.translationY(h);
viewPropertyAnimatorCompat.start();
viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
@Override
public void onAnimationUpdate(View view) {
float height = ViewCompat.getTranslationY(v);
fl.getLayoutParams().height = (int) height;
fl.requestLayout();
}
});
}
示例5: createAnimatorTranslationY
import android.support.v4.view.ViewPropertyAnimatorUpdateListener; //导入依赖的package包/类
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
viewPropertyAnimatorCompat.setDuration(250);
viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
viewPropertyAnimatorCompat.translationY(h);
viewPropertyAnimatorCompat.start();
viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
@Override
public void onAnimationUpdate(View view) {
float height = ViewCompat.getTranslationY(v);
fl.getLayoutParams().height = (int) height;
fl.requestLayout();
}
});
}
示例6: createAnimatorTranslationY
import android.support.v4.view.ViewPropertyAnimatorUpdateListener; //导入依赖的package包/类
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
viewPropertyAnimatorCompat.setDuration(200);
viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
viewPropertyAnimatorCompat.translationY(h);
viewPropertyAnimatorCompat.start();
viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
@Override
public void onAnimationUpdate(View view) {
float height = Math.abs(ViewCompat.getTranslationY(v));
fl.getLayoutParams().height = (int) height;
fl.requestLayout();
}
});
}
示例7: applyToTaskView
import android.support.v4.view.ViewPropertyAnimatorUpdateListener; //导入依赖的package包/类
/**
* Applies this transform to a view.
*/
public void applyToTaskView(View v, int duration, Interpolator interp, boolean allowLayers,
boolean allowShadows, ViewPropertyAnimatorUpdateListener updateCallback) {
// Check to see if any properties have changed, and update the task view
if (duration > 0) {
ViewPropertyAnimatorCompat anim = ViewCompat.animate(v);
boolean requiresLayers = false;
// Animate to the final state
if (hasTranslationYChangedFrom(v.getTranslationY())) {
anim.translationY(translationY);
}
if (allowShadows && hasTranslationZChangedFrom(ViewCompat.getTranslationZ(v))) {
anim.translationZ(translationZ);
}
if (hasScaleChangedFrom(v.getScaleX())) {
anim.scaleX(scale)
.scaleY(scale);
requiresLayers = true;
}
if (hasAlphaChangedFrom(v.getAlpha())) {
// Use layers if we animate alpha
anim.alpha(alpha);
requiresLayers = true;
}
if (requiresLayers && allowLayers) {
anim.withLayer();
}
if (updateCallback != null) {
anim.setUpdateListener(updateCallback);
} else {
anim.setUpdateListener(null);
}
anim.setStartDelay(startDelay)
.setDuration(duration)
.setInterpolator(interp)
.start();
} else {
// Set the changed properties
if (hasTranslationYChangedFrom(v.getTranslationY())) {
v.setTranslationY(translationY);
}
if (allowShadows && hasTranslationZChangedFrom(ViewCompat.getTranslationZ(v))) {
ViewCompat.setTranslationZ(v, translationZ);
}
if (hasScaleChangedFrom(v.getScaleX())) {
v.setScaleX(scale);
v.setScaleY(scale);
}
if (hasAlphaChangedFrom(v.getAlpha())) {
v.setAlpha(alpha);
}
}
}