Example usage for android.animation ObjectAnimator start

List of usage examples for android.animation ObjectAnimator start

Introduction

In this page you can find the example usage for android.animation ObjectAnimator start.

Prototype

@Override
    public void start() 

Source Link

Usage

From source file:com.mojtaba.materialdatetimepicker.date.DatePickerDialog.java

private void setCurrentView(final int viewIndex) {

    switch (viewIndex) {
    case MONTH_AND_DAY_VIEW:
        ObjectAnimator pulseAnimator = Utils.getPulseAnimator(mMonthAndDayView, 0.9f, 1.05f);
        if (mDelayAnimation) {
            pulseAnimator.setStartDelay(ANIMATION_DELAY);
            mDelayAnimation = false;/*from  w  w  w. j a  va  2s  .  com*/
        }
        mDayPickerView.onDateChanged();
        if (mCurrentView != viewIndex) {
            mMonthAndDayView.setSelected(true);
            mYearView.setSelected(false);
            mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW);
            mCurrentView = viewIndex;
        }
        pulseAnimator.start();

        String dayString = LanguageUtils.getPersianNumbers(mPersianCalendar.getPersianLongDate());
        mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString);
        Utils.tryAccessibilityAnnounce(mAnimator, mSelectDay);
        break;
    case YEAR_VIEW:
        pulseAnimator = Utils.getPulseAnimator(mYearView, 0.85f, 1.1f);
        if (mDelayAnimation) {
            pulseAnimator.setStartDelay(ANIMATION_DELAY);
            mDelayAnimation = false;
        }
        mYearPickerView.onDateChanged();
        if (mCurrentView != viewIndex) {
            mMonthAndDayView.setSelected(false);
            mYearView.setSelected(true);
            mAnimator.setDisplayedChild(YEAR_VIEW);
            mCurrentView = viewIndex;
        }
        pulseAnimator.start();

        String yearString = LanguageUtils.getPersianNumbers(String.valueOf(mPersianCalendar.getPersianYear()));
        mAnimator.setContentDescription(mYearPickerDescription + ": " + yearString);
        Utils.tryAccessibilityAnnounce(mAnimator, mSelectYear);
        break;
    }
}

From source file:com.lichen.teacher.apps.ActivityLive.java

private void startEditContainViewAnim() {
    if (!mEditContainViewVisibility)
        return;/* w  ww.ja  v  a2s  .c  om*/
    mEditContainView.setVisibility(View.VISIBLE);
    ObjectAnimator mEditContainViewAnim = ObjectAnimator.ofFloat(mEditContainView, "alpha", 1, 0)
            .setDuration(300);
    mEditContainViewAnim.addListener(mEditContainViewAnimListener);
    mEditContainViewAnim.start();
    mEditContainViewVisibility = false;
}

From source file:io.vit.vitio.Fragments.Today.TodayFragment.java

private void animateView() {
    PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && powerManager.isPowerSaveMode()) {
        return;/*from   w ww . j  a  v  a  2 s.com*/
    }
    //float dimension = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, getResources().getDisplayMetrics());
    ObjectAnimator objectAnimatorX = ObjectAnimator.ofFloat(ocassionImage, "scaleX", 1f, 0.8f);
    ObjectAnimator objectAnimatorY = ObjectAnimator.ofFloat(ocassionImage, "scaleY", 1f, 0.8f);
    objectAnimatorX.setDuration(6000);
    objectAnimatorY.setDuration(6000);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(objectAnimatorX, objectAnimatorY);
    animatorSet.setInterpolator(new LinearInterpolator());
    objectAnimatorX.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorX.setRepeatMode(ObjectAnimator.REVERSE);
    objectAnimatorY.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorY.setRepeatMode(ObjectAnimator.REVERSE);
    animatorSet.start();
    objectAnimatorX.start();
}

From source file:com.lichen.teacher.apps.ActivityLive.java

private void startHideControlBtnContainViewAnim() {
    mControlBtnContainView.setVisibility(View.VISIBLE);
    ObjectAnimator mmControlBtnContainViewAnim = ObjectAnimator.ofFloat(mControlBtnContainView, "alpha", 1, 0)
            .setDuration(300);// www  . ja v a2 s.  c  o  m
    mmControlBtnContainViewAnim.addListener(mHideControlBtnContainViewAnimListener);
    mmControlBtnContainViewAnim.start();
}

From source file:com.android.tv.settings.dialog.DialogFragment.java

private void fadeIn(View v) {
    v.setAlpha(0f);//  ww  w  . j  a  v a2  s . c o  m
    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(v, "alpha", 1f);
    alphaAnimator
            .setDuration(v.getContext().getResources().getInteger(android.R.integer.config_mediumAnimTime));
    alphaAnimator.start();
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 01??(View)??//w  ww . j a v  a2 s. co m
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void fadeIn(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "fadeIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_FADE_IN); // ???
    target.setScaleX(1.0f);
    target.setScaleY(1.0f);
    target.setAlpha(0.0f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 0f, 1f);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.test.slidebutton.SlideButton.java

/**
 * max_leftmin_left//  w  w  w.jav  a2 s. c  o  m
 * @param toRight
 */
private void moveTo(final boolean toRight) {
    ObjectAnimator anim = ObjectAnimator.ofInt(this, "sliderCurrentLeft", sliderCurrentLeft,
            toRight ? max_left : min_left);
    anim.setInterpolator(new OvershootInterpolator());
    anim.setDuration(200);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (toRight) {
                isOpen = true;
                if (listener != null) {
                    listener.open();
                }
                sliderCurrentLeft = sliderMoveStartLeft = max_left;
            } else {
                isOpen = false;
                if (listener != null) {
                    listener.close();
                }
                sliderCurrentLeft = sliderMoveStartLeft = min_left;
            }
            invalidateView();
        }
    });
    anim.start();
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 01??(View)??//from w ww. j  a v a 2 s.com
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void zoomIn(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "zoomIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_ZOOM_IN); // ???
    target.setScaleX(0.0f);
    target.setScaleY(0.0f);
    target.setAlpha(1.0f);
    final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 0.01f, 1f);
    final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 0.01f, 1f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 10??(View)??/*from www . jav a  2  s  .  co m*/
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void zoomOut(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "zoomIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_ZOOM_OUT); // ???
    target.setScaleX(1.0f);
    target.setScaleY(1.0f);
    target.setAlpha(1.0f);
    final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f);
    final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 10??(View)??/*from w  w w  . j a v  a2 s.co  m*/
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void fadeOut(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "fadeOut,target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    if (target.getVisibility() == View.VISIBLE) {
        target.setTag(R.id.anim_type, ANIM_FADE_OUT); // ??
        target.setScaleX(1.0f);
        target.setScaleY(1.0f);
        target.setAlpha(1.0f);
        final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 1f, 0f);
        objectAnimator.addListener(mAnimatorListener);
        if (BuildCheck.isAndroid4_3())
            objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
        objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
        objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
        objectAnimator.start(); // 
    }
}