use of android.view.animation.Transformation in project remusic by aa112901.
the class SwipeRefreshLayout method startScaleDownAnimation.
private void startScaleDownAnimation(AnimationListener listener) {
mScaleDownAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(1 - interpolatedTime);
}
};
mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION);
mHeadViewContainer.setAnimationListener(listener);
mHeadViewContainer.clearAnimation();
mHeadViewContainer.startAnimation(mScaleDownAnimation);
}
use of android.view.animation.Transformation in project Carbon by ZieIony.
the class MatrixHelper method getMatrix.
public static Matrix getMatrix(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
return view.getMatrix();
Animation animation = view.getAnimation();
if (animation == null)
return matrix;
Transformation transformation = new Transformation();
animation.getTransformation(view.getDrawingTime(), transformation);
return transformation.getMatrix();
}
use of android.view.animation.Transformation in project platform_frameworks_base by android.
the class View method setDisplayListProperties.
/**
* This method is called by getDisplayList() when a display list is recorded for a View.
* It pushes any properties to the RenderNode that aren't managed by the RenderNode.
*/
void setDisplayListProperties(RenderNode renderNode) {
if (renderNode != null) {
renderNode.setHasOverlappingRendering(getHasOverlappingRendering());
renderNode.setClipToBounds(mParent instanceof ViewGroup && ((ViewGroup) mParent).getClipChildren());
float alpha = 1;
if (mParent instanceof ViewGroup && (((ViewGroup) mParent).mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {
ViewGroup parentVG = (ViewGroup) mParent;
final Transformation t = parentVG.getChildTransformation();
if (parentVG.getChildStaticTransformation(this, t)) {
final int transformType = t.getTransformationType();
if (transformType != Transformation.TYPE_IDENTITY) {
if ((transformType & Transformation.TYPE_ALPHA) != 0) {
alpha = t.getAlpha();
}
if ((transformType & Transformation.TYPE_MATRIX) != 0) {
renderNode.setStaticMatrix(t.getMatrix());
}
}
}
}
if (mTransformationInfo != null) {
alpha *= getFinalAlpha();
if (alpha < 1) {
final int multipliedAlpha = (int) (255 * alpha);
if (onSetAlpha(multipliedAlpha)) {
alpha = 1;
}
}
renderNode.setAlpha(alpha);
} else if (alpha < 1) {
renderNode.setAlpha(alpha);
}
}
}
use of android.view.animation.Transformation in project ListViewCellDeleteAnimation by paraches.
the class MainActivity method collapse.
private void collapse(final View v, AnimationListener al) {
final int initialHeight = v.getMeasuredHeight();
Animation anim = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime == 1) {
v.setVisibility(View.GONE);
} else {
v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
v.requestLayout();
}
}
@Override
public boolean willChangeBounds() {
return true;
}
};
if (al != null) {
anim.setAnimationListener(al);
}
anim.setDuration(ANIMATION_DURATION);
v.startAnimation(anim);
}
use of android.view.animation.Transformation in project sweet-alert-dialog by pedant.
the class SuccessTickView method startTickAnim.
public void startTickAnim() {
// hide tick
mLeftRectWidth = 0;
mRightRectWidth = 0;
invalidate();
Animation tickAnim = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (0.54 < interpolatedTime && 0.7 >= interpolatedTime) {
// grow left and right rect to right
mLeftRectGrowMode = true;
mLeftRectWidth = mMaxLeftRectWidth * ((interpolatedTime - 0.54f) / 0.16f);
if (0.65 < interpolatedTime) {
mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
}
invalidate();
} else if (0.7 < interpolatedTime && 0.84 >= interpolatedTime) {
// shorten left rect from right, still grow right rect
mLeftRectGrowMode = false;
mLeftRectWidth = mMaxLeftRectWidth * (1 - ((interpolatedTime - 0.7f) / 0.14f));
mLeftRectWidth = mLeftRectWidth < MIN_LEFT_RECT_W ? MIN_LEFT_RECT_W : mLeftRectWidth;
mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
invalidate();
} else if (0.84 < interpolatedTime && 1 >= interpolatedTime) {
// restore left rect width, shorten right rect to const
mLeftRectGrowMode = false;
mLeftRectWidth = MIN_LEFT_RECT_W + (CONST_LEFT_RECT_W - MIN_LEFT_RECT_W) * ((interpolatedTime - 0.84f) / 0.16f);
mRightRectWidth = CONST_RIGHT_RECT_W + (MAX_RIGHT_RECT_W - CONST_RIGHT_RECT_W) * (1 - ((interpolatedTime - 0.84f) / 0.16f));
invalidate();
}
}
};
tickAnim.setDuration(750);
tickAnim.setStartOffset(100);
startAnimation(tickAnim);
}
Aggregations