下面列出了android.util.Property#get ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
Float getActualPropertyValue(Property<T, Float> property) {
Float lastTarget = getLastTargetValue(property.getName());
if (lastTarget == null) {
lastTarget = property.get(mAnimationTarget);
}
return lastTarget;
}
private void animatePropertyBy(Property<View, Float> property, float byValue) {
if (hasView()) {
float fromValue = property.get(mView.get());
float toValue = fromValue + byValue;
animatePropertyBetween(property, fromValue, toValue);
}
}
@Override
@Nullable
public ObjectAnimator ofFloat(@Nullable View view, @NonNull Property<View, Float> property,
float startFraction, float endFraction) {
float start = property.get(view) * startFraction;
float end = property.get(view) * endFraction;
if (start == end) {
return null;
}
property.set(view, start);
return ObjectAnimator.ofFloat(view, property, end);
}
@Override
@Nullable
public ObjectAnimator ofInt(@Nullable View view, @NonNull Property<View, Integer> property,
float startFraction, float endFraction) {
int start = (int) (property.get(view) * startFraction);
int end = (int) (property.get(view) * endFraction);
if (start == end) {
return null;
}
property.set(view, start);
return ObjectAnimator.ofInt(view, property, end);
}
protected final AdditiveAnimation createAnimation(Property<V, Float> property, float targetValue) {
AdditiveAnimation animation = new AdditiveAnimation<>(mCurrentTarget, property, property.get(mCurrentTarget), targetValue);
animation.setCustomInterpolator(mCurrentCustomInterpolator);
return animation;
}
protected final AdditiveAnimation createAnimation(Property<V, Float> property, float targetValue, TypeEvaluator<Float> evaluator) {
AdditiveAnimation animation = new AdditiveAnimation<>(mCurrentTarget, property, property.get(mCurrentTarget), targetValue);
animation.setCustomTypeEvaluator(evaluator);
animation.setCustomInterpolator(mCurrentCustomInterpolator);
return animation;
}
protected final AdditiveAnimation createAnimation(Property<V, Float> property, Path path, PathEvaluator.PathMode mode, PathEvaluator sharedEvaluator) {
AdditiveAnimation animation = new AdditiveAnimation<>(mCurrentTarget, property, property.get(mCurrentTarget), path, mode, sharedEvaluator);
animation.setCustomInterpolator(mCurrentCustomInterpolator);
return animation;
}
private void animateProperty(Property<View, Float> property, float toValue) {
if (hasView()) {
float fromValue = property.get(mView.get());
animatePropertyBetween(property, fromValue, toValue);
}
}