Java Code Examples for android.animation.Animator#setTarget()

The following examples show how to use android.animation.Animator#setTarget() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyPreviewDrawParams.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: PointIndicator.java    From IndicatorBox with MIT License 6 votes vote down vote up
/**
 * 添加单个指示器
 * @param backgroundResId
 * @param animator
 */
private void addIndicator(@DrawableRes int backgroundResId, Animator animator){
    if (animator.isRunning()){
        animator.end();
        animator.cancel();
    }
    View indicator = new View(getContext());
    indicator.setBackgroundResource(backgroundResId);
    addView(indicator, mIndicatorWidth, mIndicatorHeight);
    LayoutParams lp = (LayoutParams) indicator.getLayoutParams();
    if (mOrientation == LinearLayout.HORIZONTAL){
        lp.leftMargin = mIndicatorMargin;
        lp.rightMargin = mIndicatorMargin;
    }else if (mOrientation == LinearLayout.VERTICAL){
        lp.topMargin = mIndicatorMargin;
        lp.bottomMargin = mIndicatorMargin;
    }
    indicator.setLayoutParams(lp);
    animator.setTarget(indicator);
    animator.start();
}
 
Example 3
Source File: KeyPreviewDrawParams.java    From openboard with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: FlowLayout.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 5
Source File: CollapsingToolbarLayout.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setInAnimator(Animator inAnim) {
    if (this.inAnim != null)
        this.inAnim.setTarget(null);
    this.inAnim = inAnim;
    if (inAnim != null)
        inAnim.setTarget(this);
}
 
Example 6
Source File: AnimatedSVGDrawable.java    From SVG-Android with Apache License 2.0 5 votes vote down vote up
public void setupAnimators(Animator animator) {
    if (animator == null) {
        return;
    }
    animator.setTarget(mAnimatedSVGState.mSVGDrawable);
    if (mAnimatedSVGState.mAnimators == null) {
        mAnimatedSVGState.mAnimators = new ArrayList<>();
    }
    mAnimatedSVGState.mAnimators.add(animator);
}
 
Example 7
Source File: AnimatedSVGDrawable.java    From SVG-Android with Apache License 2.0 5 votes vote down vote up
private AnimatedSVGDrawableState(AnimatedSVGDrawableState copy, Callback owner, Resources res) {
    if (copy != null) {
        mChangingConfigurations = copy.mChangingConfigurations;
        if (copy.mSVGDrawable != null) {
            final ConstantState cs = copy.mSVGDrawable.getConstantState();
            if (cs != null) {
                if (res != null) {
                    mSVGDrawable = (SVGDrawable) cs.newDrawable(res);
                } else {
                    mSVGDrawable = (SVGDrawable) cs.newDrawable();
                }
            } else {
                return;
            }
            mSVGDrawable = (SVGDrawable) mSVGDrawable.mutate();
            mSVGDrawable.setCallback(owner);
            mSVGDrawable.setBounds(copy.mSVGDrawable.getBounds());
        }
        if (copy.mAnimators != null) {
            final int numAnimators = copy.mAnimators.size();
            mAnimators = new ArrayList<>(numAnimators);
            for (int i = 0; i < numAnimators; ++i) {
                Animator anim = copy.mAnimators.get(i);
                Animator animClone = anim.clone();
                animClone.setTarget(mSVGDrawable);
                mAnimators.add(animClone);
            }
        }
    }
}
 
Example 8
Source File: LinearLayout.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 9
Source File: EditText.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 10
Source File: View.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 11
Source File: MotionLayout.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 12
Source File: View.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setInAnimator(Animator inAnim) {
    if (this.inAnim != null)
        this.inAnim.setTarget(null);
    this.inAnim = inAnim;
    if (inAnim != null)
        inAnim.setTarget(this);
}
 
Example 13
Source File: Button.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 14
Source File: ConstraintLayout.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setInAnimator(Animator inAnim) {
    if (this.inAnim != null)
        this.inAnim.setTarget(null);
    this.inAnim = inAnim;
    if (inAnim != null)
        inAnim.setTarget(this);
}
 
Example 15
Source File: RecyclerView.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 16
Source File: ImageView.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setInAnimator(Animator inAnim) {
    if (this.inAnim != null)
        this.inAnim.setTarget(null);
    this.inAnim = inAnim;
    if (inAnim != null)
        inAnim.setTarget(this);
}
 
Example 17
Source File: KeyPreviewDrawParams.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
public Animator createDismissAnimator(final View target) {
    final Animator animator = AnimatorInflater.loadAnimator(
            target.getContext(), mDismissAnimatorResId);
    animator.setTarget(target);
    animator.setInterpolator(ACCELERATE_INTERPOLATOR);
    return animator;
}
 
Example 18
Source File: GridLayout.java    From Carbon with Apache License 2.0 5 votes vote down vote up
public void setOutAnimator(Animator outAnim) {
    if (this.outAnim != null)
        this.outAnim.setTarget(null);
    this.outAnim = outAnim;
    if (outAnim != null)
        outAnim.setTarget(this);
}
 
Example 19
Source File: LoginActivity.java    From Pharmacy-Android with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);

    mAnalytics = FirebaseAnalytics.getInstance(this);

    mAnimator = new ObjectAnimator();

    mIconAnimation =(Animator) AnimatorInflater.loadAnimator(this, R.animator.icon_loading_rotate);
    mIconAnimation.setTarget(appIconImageView);


   // final DigitsAuthButton authButton = (DigitsAuthButton) findViewById(R.id.button_auth);
    authButton.setAuthTheme(R.style.AppTheme);
    authButton.setText("Login");
    authButton.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary));


    authButton.setCallback(new AuthCallback() {
        @Override
        public void success(DigitsSession session, String phoneNumber) {
           // Log.d(TAG, "success: ph no: " + phoneNumber);
          //  Log.d(TAG, "Auth token" + session.getAuthToken());
            TwitterAuthConfig authConfig = TwitterCore.getInstance().getAuthConfig();
            mPhoneNumber = session.getPhoneNumber();

            DigitsOAuthSigning oAuthSigning = new DigitsOAuthSigning(authConfig,
                    (TwitterAuthToken) session.getAuthToken());
            Map<String, String> authHeaders = oAuthSigning.getOAuthEchoHeadersForVerifyCredentials();

            doLogin(authHeaders);

          //  Toast.makeText(LoginActivity.this, "Phone no: " + session.getPhoneNumber(), Toast.LENGTH_SHORT).show();
        }

        @Override
        public void failure(DigitsException error) {
            showLoginError();
        }
    });
}
 
Example 20
Source File: MainActivity.java    From Android-Basics-Codes with Artistic License 2.0 4 votes vote down vote up
public void loadXml(View v){
	//����xml��������Զ���
	Animator at = AnimatorInflater.loadAnimator(this, R.animator.objectanimator);
	at.setTarget(iv);
	at.start();
}