mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Removing wrapper around ViewPropertyAnimator, and using ObjectAnimator
instead Bug: 35218222 Change-Id: Ic714cf7d20989cb45f07712e8a6f6659d0e3f30d
This commit is contained in:
50
src/com/android/launcher3/anim/PropertyListBuilder.java
Normal file
50
src/com/android/launcher3/anim/PropertyListBuilder.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.android.launcher3.anim;
|
||||
|
||||
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 PropertyValuesHolder[] build() {
|
||||
return mProperties.toArray(new PropertyValuesHolder[mProperties.size()]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user