Files
lawnchair/src/com/android/launcher3/anim/PropertyListBuilder.java
Sunny Goyal f0b6db7fa8 Removing static launcher activity dependency from FirstFrameAnimationHelper
Static dependency does not work in the presence of multiple activities and
when the main activity is not Launcher (eg in fallback recents). Instead
creating FirstFrameAnimatorHelper on demand for individual animations.

Change-Id: I17bb69bbaaca92f0db994fb56fd784302c57d543
2018-08-13 16:10:18 -07:00

53 lines
1.5 KiB
Java

package com.android.launcher3.anim;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.view.View;
import java.util.ArrayList;
/**
* Helper class to build a list of {@link PropertyValuesHolder} for view properties
*/
public class PropertyListBuilder {
private final ArrayList<PropertyValuesHolder> mProperties = new ArrayList<>();
public PropertyListBuilder translationX(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.TRANSLATION_X, value));
return this;
}
public PropertyListBuilder translationY(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, value));
return this;
}
public PropertyListBuilder scaleX(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.SCALE_X, value));
return this;
}
public PropertyListBuilder scaleY(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.SCALE_Y, value));
return this;
}
/**
* Helper method to set both scaleX and scaleY
*/
public PropertyListBuilder scale(float value) {
return scaleX(value).scaleY(value);
}
public PropertyListBuilder alpha(float value) {
mProperties.add(PropertyValuesHolder.ofFloat(View.ALPHA, value));
return this;
}
public ObjectAnimator build(View view) {
return ObjectAnimator.ofPropertyValuesHolder(view,
mProperties.toArray(new PropertyValuesHolder[mProperties.size()]));
}
}