Search in sources :

Example 6 with ObjectAnimator

use of android.animation.ObjectAnimator in project mosby by sockeqwe.

the class DetailsFragment method setData.

@Override
public void setData(Mail data) {
    this.mail = data;
    senderImageView.setImageResource(data.getSender().getImageRes());
    senderNameView.setText(data.getSender().getName());
    senderMailView.setText(data.getSender().getEmail());
    subjectView.setText(data.getSubject());
    contentView.setText(data.getText() + data.getText() + data.getText() + data.getText());
    starView.setStarred(data.isStarred());
    dateView.setText(format.format(data.getDate()));
    labelView.setMail(data);
    labelView.setVisibility(View.VISIBLE);
    replayView.setVisibility(View.VISIBLE);
    // Animate only if not restoring
    if (!isRestoringViewState()) {
        labelView.setAlpha(0f);
        labelView.animate().alpha(1f).setDuration(150).start();
        PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("scaleX", 0, 1);
        PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("scaleY", 0, 1);
        ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(replayView, holderX, holderY);
        animator.setInterpolator(new OvershootInterpolator());
        animator.start();
    }
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(android.animation.ObjectAnimator) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Example 7 with ObjectAnimator

use of android.animation.ObjectAnimator in project SwitchButton by kyleduo.

the class UseActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_use);
    findView();
    LinearLayout toggleWrapper = (LinearLayout) findViewById(R.id.toggle_wrapper);
    for (int i = 0; i < toggleWrapper.getChildCount(); i++) {
        toggleWrapper.getChildAt(i).setOnClickListener(this);
    }
    LinearLayout checkWrapper = (LinearLayout) findViewById(R.id.check_wrapper);
    for (int i = 0; i < checkWrapper.getChildCount(); i++) {
        checkWrapper.getChildAt(i).setOnClickListener(this);
    }
    // work with listener
    mListenerSb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mListenerFinish.setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE);
        }
    });
    // work with delay
    mDelaySb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mDelaySb.setEnabled(false);
            mDelaySb.postDelayed(new Runnable() {

                @Override
                public void run() {
                    mDelaySb.setEnabled(true);
                }
            }, 1500);
        }
    });
    // work with stuff takes long
    mStartBt.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ObjectAnimator animator = ObjectAnimator.ofInt(mPb, "progress", 0, 1000);
            animator.setDuration(1000);
            animator.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                    mStartBt.setEnabled(false);
                    mLongSb.setChecked(false);
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    mStartBt.setEnabled(true);
                    mLongSb.setChecked(true);
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    mStartBt.setEnabled(true);
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }
            });
            animator.start();
        }
    });
    // check in check
    mForceOpenSb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (mForceOpenControlSb.isChecked()) {
                toast("Call mForceOpenSb.setChecked(true); in on CheckedChanged");
                mForceOpenSb.setChecked(true);
            }
        }
    });
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) TextView(android.widget.TextView) View(android.view.View) LinearLayout(android.widget.LinearLayout) CompoundButton(android.widget.CompoundButton)

Example 8 with ObjectAnimator

use of android.animation.ObjectAnimator in project Shuttle by timusus.

the class IntroductoryOverlay method fadeOut.

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void fadeOut(long duration) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(this, ALPHA_PROPERTY, INVISIBLE_VALUE);
    oa.setDuration(duration).addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animator) {
            setFtuShown();
            if (mListener != null) {
                mListener.onOverlayDismissed();
                mListener = null;
            }
            remove();
        }
    });
    oa.start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) TargetApi(android.annotation.TargetApi)

Example 9 with ObjectAnimator

use of android.animation.ObjectAnimator in project Shuttle by timusus.

the class ViewUtils method fadeOut.

public static void fadeOut(View view, @Nullable Action0 completion) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, 1f, 0f).setDuration(250);
    objectAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            view.setVisibility(View.GONE);
            objectAnimator.removeAllListeners();
            if (completion != null) {
                completion.call();
            }
        }
    });
    objectAnimator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 10 with ObjectAnimator

use of android.animation.ObjectAnimator in project Shuttle by timusus.

the class ViewUtils method fadeIn.

public static void fadeIn(View view, @Nullable Action0 completion) {
    view.setVisibility(View.VISIBLE);
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, 0f, 1f).setDuration(250);
    objectAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            animation.removeAllListeners();
            if (completion != null) {
                completion.call();
            }
        }
    });
    objectAnimator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)790 Animator (android.animation.Animator)313 AnimatorSet (android.animation.AnimatorSet)214 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)208 PropertyValuesHolder (android.animation.PropertyValuesHolder)128 ValueAnimator (android.animation.ValueAnimator)111 View (android.view.View)101 Paint (android.graphics.Paint)68 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)48 TextView (android.widget.TextView)48 ViewGroup (android.view.ViewGroup)45 Rect (android.graphics.Rect)35 LinearInterpolator (android.view.animation.LinearInterpolator)35 ImageView (android.widget.ImageView)31 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)30 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)29 OvershootInterpolator (android.view.animation.OvershootInterpolator)28 ArrayList (java.util.ArrayList)22 TargetApi (android.annotation.TargetApi)21 Interpolator (android.view.animation.Interpolator)20