Loading src/com/android/launcher3/LauncherAnimUtils.java +27 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.util.FloatProperty; import android.util.IntProperty; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.TextView; import com.android.launcher3.util.MultiScalePropertyFactory; Loading Loading @@ -115,6 +116,32 @@ public class LauncherAnimUtils { } }; public static final IntProperty<TextView> TEXT_COLOR = new IntProperty<TextView>("textColor") { @Override public Integer get(TextView view) { return view.getTextColors().getDefaultColor(); } @Override public void setValue(TextView view, int color) { view.setTextColor(color); } }; public static final IntProperty<TextView> HINT_TEXT_COLOR = new IntProperty<TextView>("hintTextColor") { @Override public Integer get(TextView view) { return view.getHintTextColors().getDefaultColor(); } @Override public void setValue(TextView view, int color) { view.setHintTextColor(color); } }; public static final FloatProperty<View> VIEW_TRANSLATE_X = View.TRANSLATION_X instanceof FloatProperty ? (FloatProperty) View.TRANSLATION_X : new FloatProperty<View>("translateX") { Loading src/com/android/launcher3/anim/AnimatedPropertySetter.java +12 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,18 @@ public class AnimatedPropertySetter extends PropertySetter { return anim; } @NonNull @Override public <T> Animator setColor(T target, IntProperty<T> property, int value, TimeInterpolator interpolator) { if (property.get(target) == value) { return NO_OP; } Animator anim = ObjectAnimator.ofArgb(target, property, value); anim.setInterpolator(interpolator); add(anim); return anim; } /** * Adds a callback to be run on every frame of the animation Loading src/com/android/launcher3/anim/PropertySetter.java +10 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,16 @@ public abstract class PropertySetter { return NO_OP; } /** * Updates a color property of the target using the provided interpolator */ @NonNull public <T> Animator setColor(T target, IntProperty<T> property, int value, TimeInterpolator interpolator) { property.setValue(target, value); return NO_OP; } /** * Runs the animation as part of setting the property */ Loading Loading
src/com/android/launcher3/LauncherAnimUtils.java +27 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.util.FloatProperty; import android.util.IntProperty; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.TextView; import com.android.launcher3.util.MultiScalePropertyFactory; Loading Loading @@ -115,6 +116,32 @@ public class LauncherAnimUtils { } }; public static final IntProperty<TextView> TEXT_COLOR = new IntProperty<TextView>("textColor") { @Override public Integer get(TextView view) { return view.getTextColors().getDefaultColor(); } @Override public void setValue(TextView view, int color) { view.setTextColor(color); } }; public static final IntProperty<TextView> HINT_TEXT_COLOR = new IntProperty<TextView>("hintTextColor") { @Override public Integer get(TextView view) { return view.getHintTextColors().getDefaultColor(); } @Override public void setValue(TextView view, int color) { view.setHintTextColor(color); } }; public static final FloatProperty<View> VIEW_TRANSLATE_X = View.TRANSLATION_X instanceof FloatProperty ? (FloatProperty) View.TRANSLATION_X : new FloatProperty<View>("translateX") { Loading
src/com/android/launcher3/anim/AnimatedPropertySetter.java +12 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,18 @@ public class AnimatedPropertySetter extends PropertySetter { return anim; } @NonNull @Override public <T> Animator setColor(T target, IntProperty<T> property, int value, TimeInterpolator interpolator) { if (property.get(target) == value) { return NO_OP; } Animator anim = ObjectAnimator.ofArgb(target, property, value); anim.setInterpolator(interpolator); add(anim); return anim; } /** * Adds a callback to be run on every frame of the animation Loading
src/com/android/launcher3/anim/PropertySetter.java +10 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,16 @@ public abstract class PropertySetter { return NO_OP; } /** * Updates a color property of the target using the provided interpolator */ @NonNull public <T> Animator setColor(T target, IntProperty<T> property, int value, TimeInterpolator interpolator) { property.setValue(target, value); return NO_OP; } /** * Runs the animation as part of setting the property */ Loading