本文整理汇总了Java中android.animation.Animator.setTarget方法的典型用法代码示例。如果您正苦于以下问题:Java Animator.setTarget方法的具体用法?Java Animator.setTarget怎么用?Java Animator.setTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.Animator
的用法示例。
在下文中一共展示了Animator.setTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addIndicator
import android.animation.Animator; //导入方法依赖的package包/类
private void addIndicator(int orientation, @DrawableRes int backgroundDrawableId,
Animator animator) {
if (animator.isRunning()) {
animator.end();
animator.cancel();
}
View Indicator = new View(getContext());
Indicator.setBackgroundResource(backgroundDrawableId);
addView(Indicator, mIndicatorWidth, mIndicatorHeight);
LayoutParams lp = (LayoutParams) Indicator.getLayoutParams();
if (orientation == HORIZONTAL) {
lp.leftMargin = mIndicatorMargin;
lp.rightMargin = mIndicatorMargin;
} else {
lp.topMargin = mIndicatorMargin;
lp.bottomMargin = mIndicatorMargin;
}
Indicator.setLayoutParams(lp);
animator.setTarget(Indicator);
animator.start();
}
示例2: setupValues
import android.animation.Animator; //导入方法依赖的package包/类
public UDAnimatorSet setupValues(Animator animator) {
animator.setupStartValues();
if (mTarget != null && mAnimators != null) {
for (Animator anim : mAnimators) {
anim.setTarget(mTarget.getView());
anim.setupStartValues();
if (anim instanceof ValueAnimator) {
((ValueAnimator) anim).setRepeatCount(mRepeatCount);
((ValueAnimator) anim).setRepeatMode(mRepeatMode);
//TODO
}
}
if (animator instanceof AnimatorSet) {
((AnimatorSet) animator).playTogether(mAnimators);
}
}
return this;
}
示例3: createShowUpAnimator
import android.animation.Animator; //导入方法依赖的package包/类
public Animator createShowUpAnimator(final View target) {
if (mHasCustomAnimationParams) {
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_X, mShowUpStartXScale,
KEY_PREVIEW_SHOW_UP_END_SCALE);
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_Y, mShowUpStartYScale,
KEY_PREVIEW_SHOW_UP_END_SCALE);
final AnimatorSet showUpAnimator = new AnimatorSet();
showUpAnimator.play(scaleXAnimator).with(scaleYAnimator);
showUpAnimator.setDuration(mShowUpDuration);
showUpAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
return showUpAnimator;
}
final Animator animator = AnimatorInflater.loadAnimator(
target.getContext(), mShowUpAnimatorResId);
animator.setTarget(target);
animator.setInterpolator(DECELERATE_INTERPOLATOR);
return animator;
}
示例4: createDismissAnimator
import android.animation.Animator; //导入方法依赖的package包/类
public Animator createDismissAnimator(final View target) {
if (mHasCustomAnimationParams) {
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_X, mDismissEndXScale);
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_Y, mDismissEndYScale);
final AnimatorSet dismissAnimator = new AnimatorSet();
dismissAnimator.play(scaleXAnimator).with(scaleYAnimator);
final int dismissDuration = Math.min(mDismissDuration, mLingerTimeout);
dismissAnimator.setDuration(dismissDuration);
dismissAnimator.setInterpolator(ACCELERATE_INTERPOLATOR);
return dismissAnimator;
}
final Animator animator = AnimatorInflater.loadAnimator(
target.getContext(), mDismissAnimatorResId);
animator.setTarget(target);
animator.setInterpolator(ACCELERATE_INTERPOLATOR);
return animator;
}
示例5: handleMessage
import android.animation.Animator; //导入方法依赖的package包/类
public void handleMessage(Message msg) {
switch (msg.what) {
case DISMISS_SPLASH:
Animator animator = AnimatorInflater.loadAnimator(MainActivity.this, R.animator.splash);
animator.setTarget(splash_img);
animator.start();
break;
}
}
示例6: addIndicator
import android.animation.Animator; //导入方法依赖的package包/类
private void addIndicator(@DrawableRes int backgroundDrawableId, Animator animator) {
if (animator.isRunning()) animator.end();
View Indicator = new View(getContext());
Indicator.setBackgroundResource(backgroundDrawableId);
addView(Indicator, mIndicatorWidth, mIndicatorHeight);
LayoutParams lp = (LayoutParams) Indicator.getLayoutParams();
lp.leftMargin = mIndicatorMargin;
lp.rightMargin = mIndicatorMargin;
Indicator.setLayoutParams(lp);
animator.setTarget(Indicator);
animator.start();
}
示例7: next
import android.animation.Animator; //导入方法依赖的package包/类
public AnimatorComposer next(@NonNull Animator nextAnimator, View target) {
if (target != null) {
nextAnimator.setTarget(target);
}
latestAnimator.addListener(new AnimatorEndChain(nextAnimator));
latestAnimator = nextAnimator;
registeredAnimators.add(nextAnimator);
return this;
}
示例8: getAnimatorSetForSort
import android.animation.Animator; //导入方法依赖的package包/类
private AnimatorSet getAnimatorSetForSort(Animator[] animators, SortFunction sortFunction) {
List<SpruceTimedView> childrenWithTime;
List<View> children = new ArrayList<>();
for (int i = 0; i < viewGroup.getChildCount(); i++) {
children.add(viewGroup.getChildAt(i));
}
sortFunction.sortChildren(viewGroup, children);
childrenWithTime = sortFunction.getViewListWithTimeOffsets(viewGroup, children);
animatorSet = new AnimatorSet();
List<Animator> animatorsList = new ArrayList<>();
for (SpruceTimedView childView : childrenWithTime) {
for (Animator animatorChild : animators) {
Animator animatorCopy = animatorChild.clone();
animatorCopy.setTarget(childView.getView());
animatorCopy.start();
animatorCopy.cancel();
animatorCopy.setStartDelay(childView.getTimeOffset());
animatorsList.add(animatorCopy);
}
}
animatorSet.playTogether(animatorsList);
return animatorSet;
}
示例9: startAsPop
import android.animation.Animator; //导入方法依赖的package包/类
/**
* 对target截图然后设置给ImageView,让ImageView镜像在android.R.id.content的FrameLayout里面执行动画
*/
public void startAsPop()
{
final AnimatorSet animatorSet = getSet();
final ArrayList<Animator> listChild = animatorSet.getChildAnimations();
if (listChild == null || listChild.isEmpty())
{
return;
}
final HashMap<View, ImageView> mapTargetPoper = new HashMap<>();
for (Animator animator : listChild)
{
View target = (View) ((ObjectAnimator) animator).getTarget();
if (target == null)
{
continue;
}
if (!mapTargetPoper.containsKey(target))
{
final Context context = target.getContext();
if (context instanceof Activity)
{
PopImageView imageView = new PopImageView(context);
imageView.setDrawingCacheView(target);
imageView.attachTarget(target);
animator.setTarget(imageView);
mapTargetPoper.put(target, imageView);
}
} else
{
animator.setTarget(mapTargetPoper.get(target));
}
}
start();
}
示例10: start
import android.animation.Animator; //导入方法依赖的package包/类
private void start(Animator object, final OnPointDragListener removeListener) {
view.setVisibility(View.VISIBLE);
Animator copy = object.clone();
copy.setTarget(view);
copy.removeAllListeners();
copy.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
animation.removeListener(this);
end(removeListener);
}
});
copy.start();
}
示例11: startSelectedViewOutAnimation
import android.animation.Animator; //导入方法依赖的package包/类
private void startSelectedViewOutAnimation(final int position) {
Animator animator = mSelectionOutAnimator;
animator.setTarget(mSelectorHolder.itemView);
animator.start();
animator.addListener(new AbstractAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
//replace selected view
mSelectorHolder.bindItemWildcardHelper(mInputAdapter, position);
startSelectedViewInAnimation();
}
});
}
示例12: startUnreveal
import android.animation.Animator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startUnreveal() {
Animator animator = ViewAnimationUtils.createCircularReveal(previewChildView,
getCenterX(previewChildView),
getCenterY(previewChildView),
getRadius(previewChildView), morphView.getWidth() * 2);
animator.setTarget(previewChildView);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
previewChildView.animate().setListener(null);
frameView.setVisibility(View.INVISIBLE);
previewChildView.setVisibility(View.INVISIBLE);
morphView.setVisibility(View.VISIBLE);
morphView.animate()
.y(getHideY())
.scaleY(0.5f)
.scaleX(0.5f)
.setDuration(UNMORPH_MOVE_DURATION)
.setInterpolator(new AccelerateInterpolator())
.setListener(hideListener);
}
});
frameView.animate().alpha(1f).setDuration(UNMORPH_UNREVEAL_DURATION)
.setInterpolator(new AccelerateInterpolator());
animator.setDuration(UNMORPH_UNREVEAL_DURATION)
.setInterpolator(new AccelerateInterpolator());
animator.start();
}
示例13: onFadeFromXML
import android.animation.Animator; //导入方法依赖的package包/类
@OnClick(R.id.fadeFromXML)
public void onFadeFromXML() {
Animator animator = AnimatorInflater.loadAnimator(this, animateForward ? R.animator.fade_out : R.animator.fade_in);
animator.setTarget(icon);
animator.start();
animateForward = !animateForward;
}
示例14: AnimatedVectorDrawableCompatState
import android.animation.Animator; //导入方法依赖的package包/类
public AnimatedVectorDrawableCompatState(Context context, AnimatedVectorDrawableCompatState copy, Callback owner, Resources res) {
if (copy != null) {
this.mChangingConfigurations = copy.mChangingConfigurations;
if (copy.mVectorDrawable != null) {
ConstantState cs = copy.mVectorDrawable.getConstantState();
if (res != null) {
this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable(res);
} else {
this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable();
}
this.mVectorDrawable = (VectorDrawableCompat) this.mVectorDrawable.mutate();
this.mVectorDrawable.setCallback(owner);
this.mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds());
this.mVectorDrawable.setAllowCaching(false);
}
if (copy.mAnimators != null) {
int numAnimators = copy.mAnimators.size();
this.mAnimators = new ArrayList(numAnimators);
this.mTargetNameMap = new ArrayMap(numAnimators);
for (int i = 0; i < numAnimators; i++) {
Animator anim = (Animator) copy.mAnimators.get(i);
Animator animClone = anim.clone();
String targetName = (String) copy.mTargetNameMap.get(anim);
animClone.setTarget(this.mVectorDrawable.getTargetByName(targetName));
this.mAnimators.add(animClone);
this.mTargetNameMap.put(animClone, targetName);
}
}
}
}
示例15: setupAnimatorsForTarget
import android.animation.Animator; //导入方法依赖的package包/类
private void setupAnimatorsForTarget(String name, Animator animator) {
animator.setTarget(this.mAnimatedVectorState.mVectorDrawable.getTargetByName(name));
if (VERSION.SDK_INT < 21) {
setupColorAnimator(animator);
}
if (this.mAnimatedVectorState.mAnimators == null) {
this.mAnimatedVectorState.mAnimators = new ArrayList();
this.mAnimatedVectorState.mTargetNameMap = new ArrayMap();
}
this.mAnimatedVectorState.mAnimators.add(animator);
this.mAnimatedVectorState.mTargetNameMap.put(animator, name);
}