Example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator.

Prototype

public AccelerateDecelerateInterpolator() 

Source Link

Usage

From source file:com.example.administrator.iclub21.view.SlideSwitch.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void moveToDest(final boolean toRight) {
    ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left);
    toDestAnim.setDuration(500);//from w  ww. ja va 2 s  .co m
    toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator());
    toDestAnim.start();
    toDestAnim.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            frontRect_left = (Integer) animation.getAnimatedValue();
            alpha = (int) (255 * (float) frontRect_left / (float) max_left);
            invalidateView();
        }
    });
    toDestAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (toRight) {
                isOpen = true;
                if (listener != null)
                    listener.open();
                frontRect_left_begin = max_left;
            } else {
                isOpen = false;
                if (listener != null)
                    listener.close();
                frontRect_left_begin = min_left;
            }
        }
    });
}

From source file:tw.medfirst.com.project.baseview.CoverFlowView.java

private void init() {
    setWillNotDraw(false);//from w ww  .j  a va  2 s .com
    setClickable(true);

    mChildTransfromer = new Matrix();
    mReflectionTransfromer = new Matrix();

    mTouchRect = new RectF();
    mTouchRect2 = new ArrayList<RectF>();
    for (int i = 0; i < VISIBLE_VIEWS * 2 + 1; i++) {
        RectF r = new RectF();
        mTouchRect2.add(r);
    }

    mImageRecorder = new SparseArray<int[]>();

    mDrawChildPaint = new Paint();
    mDrawChildPaint.setAntiAlias(true);
    mDrawChildPaint.setFlags(Paint.ANTI_ALIAS_FLAG);

    mCoverFlowPadding = new Rect();

    mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);

    mScroller = new Scroller(getContext(), new AccelerateDecelerateInterpolator());

    mRemoveReflectionPendingArray = new ArrayList<Integer>();
}

From source file:com.betterAlarm.deskclock.timer.TimerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.timer_fragment, container, false);
    mContentView = (ViewGroup) view;//from w w w  .  j a v  a  2s  .  c o m
    mTimerView = view.findViewById(R.id.timer_view);
    mSetupView = (TimerSetupView) view.findViewById(R.id.timer_setup);
    mViewPager = (VerticalViewPager) view.findViewById(R.id.vertical_view_pager);
    mPageIndicators[0] = (ImageView) view.findViewById(R.id.page_indicator0);
    mPageIndicators[1] = (ImageView) view.findViewById(R.id.page_indicator1);
    mPageIndicators[2] = (ImageView) view.findViewById(R.id.page_indicator2);
    mPageIndicators[3] = (ImageView) view.findViewById(R.id.page_indicator3);
    mCancel = (ImageButton) view.findViewById(R.id.timer_cancel);
    mCancel.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mAdapter.getCount() != 0) {
                final AnimatorListenerAdapter adapter = new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mSetupView.reset(); // Make sure the setup is cleared for next time
                        mSetupView.setScaleX(1.0f); // Reset the scale for setup view
                        goToPagerView();
                    }
                };
                createRotateAnimator(adapter, false).start();
            }
        }
    });
    mDeleteTransition = new AutoTransition();
    mDeleteTransition.setDuration(ANIMATION_TIME_MILLIS / 2);
    mDeleteTransition.setInterpolator(new AccelerateDecelerateInterpolator());

    return view;
}

From source file:ca.zadrox.dota2esportticker.ui.TeamDetailActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void createCircularReveal() {

    mHeaderTeamLogo.setVisibility(View.VISIBLE);
    mHeaderTeamLogo.setImageBitmap(mTeam.logo);

    if (mHeaderBox.isAttachedToWindow()) {
        mHeaderTeamLogo.setTranslationY(-UIUtils.calculateActionBarSize(this) - mHeaderTeamLogo.getHeight());

        mHeaderTeamLogo.animate().translationY(0).setDuration(100)
                .setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new Animator.AnimatorListener() {
                    @Override//from  w  ww  .  j ava  2  s.  com
                    public void onAnimationStart(Animator animation) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        int cx = (mHeaderBox.getLeft() + mHeaderBox.getRight()) / 2;
                        int cy = (mHeaderBox.getTop() + mHeaderBox.getBottom()) / 2;

                        int finalRadius = Math.max(mHeaderBox.getWidth(), mHeaderBox.getHeight());

                        final Animator anim = ViewAnimationUtils.createCircularReveal(mHeaderBox, cx, cy, 0,
                                finalRadius);

                        anim.setDuration(250);
                        anim.setInterpolator(new AccelerateDecelerateInterpolator());
                        anim.addListener(new Animator.AnimatorListener() {
                            @Override
                            public void onAnimationStart(Animator animation) {
                                mHeaderTeamName.setAlpha(1);
                                mHeaderTeamLogo.setImageBitmap(mTeam.logo);
                                mHeaderBox.setBackgroundColor(mTeam.palette
                                        .getDarkVibrantColor(getResources().getColor(R.color.theme_primary)));
                            }

                            @Override
                            public void onAnimationEnd(Animator animation) {

                            }

                            @Override
                            public void onAnimationCancel(Animator animation) {

                            }

                            @Override
                            public void onAnimationRepeat(Animator animation) {

                            }
                        });
                        anim.start();
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {

                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {

                    }
                }).start();

    } else {
        mHeaderTeamName.setAlpha(1);
        mHeaderTeamLogo.setImageBitmap(mTeam.logo);
        mHeaderBox.setBackgroundColor(
                mTeam.palette.getDarkVibrantColor(getResources().getColor(R.color.theme_primary)));
    }
}

From source file:com.druk.bonjour.browser.ui.fragment.ServiceBrowserFragment.java

protected void showError(final Throwable e) {
    getActivity().runOnUiThread(() -> {
        mRecyclerView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override/*from   w ww .  j a v a2 s .  c om*/
                    public void onAnimationEnd(Animator animation) {
                        mRecyclerView.setVisibility(View.GONE);
                    }
                }).start();
        mProgressView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mProgressView.setVisibility(View.GONE);
                    }
                }).start();
        mErrorView.setAlpha(0.0f);
        mErrorView.setVisibility(View.VISIBLE);
        mErrorView.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).start();
        mErrorView.findViewById(R.id.send_report).setOnClickListener(
                v -> Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e));
    });
}

From source file:ly.apps.android.rest.client.example.activities.MainActivity.java

private void animateContent() {

    ViewHelper.setRotation(imageViewIcon, 20);
    ViewHelper.setTranslationY(imageViewIcon, -100);
    ViewHelper.setTranslationX(textViewCity, 100);
    ViewHelper.setAlpha(linearLayoutContent, 0);
    ViewHelper.setTranslationY(descriptionTempContent, 200);
    ViewHelper.setTranslationY(contentBottom, 200);

    animate(imageViewIcon).setDuration(300).setInterpolator(new AccelerateInterpolator()).translationY(0)
            .setListener(new Animator.AnimatorListener() {
                @Override/*  w  ww .  j  av a 2s  .  c  om*/
                public void onAnimationStart(Animator animator) {

                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    iconFall(imageViewIcon, 10);
                }

                @Override
                public void onAnimationCancel(Animator animator) {

                }

                @Override
                public void onAnimationRepeat(Animator animator) {

                }
            }).start();

    animate(textViewCity).setDuration(1000).setInterpolator(new AccelerateDecelerateInterpolator())
            .translationX(0).start();

    animate(linearLayoutContent).setDuration(1000).alpha(1).start();

    animate(contentBottom).setDuration(1000).translationY(0).start();

    animate(descriptionTempContent).setDuration(1000).translationY(0).start();
}

From source file:cn.edu.zafu.easemob.imagecoverflow.CoverFlowView.java

private void init() {
    setWillNotDraw(false);//from w ww. j a  v  a  2 s .c o  m
    setClickable(true);

    mChildTransformer = new Matrix();
    mReflectionTransformer = new Matrix();

    mTouchRect = new RectF();

    mImageRecorder = new SparseArray<int[]>();

    mDrawChildPaint = new Paint();
    mDrawChildPaint.setAntiAlias(true);
    mDrawChildPaint.setFlags(Paint.ANTI_ALIAS_FLAG);

    mCoverFlowPadding = new Rect();

    mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);

    mScroller = new Scroller(getContext(), new AccelerateDecelerateInterpolator());
}

From source file:com.microsoft.mimickeralarm.mimics.ProgressButton.java

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mCenterX = w / 2;/*from   ww  w . ja  v a  2 s.co  m*/
    mCenterY = h / 2;
    mInitialRadius = Math.min(w, h) / 2
            - getContext().getResources().getDimensionPixelSize(R.dimen.progress_button_padding);
    mRadius = mInitialRadius;
    prepareDrawText(sWhite);

    float radius = mInitialRadius / 2f;
    mLoadingAnimationRect = new RectF(mCenterX - radius, mCenterY - radius, mCenterX + radius,
            mCenterY + radius);

    mInteractionHintAnimation = ObjectAnimator.ofFloat(this, "radius", mInitialRadius,
            mInitialRadius * INTERACTION_HINT_GROW_FACTOR, mInitialRadius);
    mInteractionHintAnimation.setDuration(INTERACTION_HINT_ANIMATION_DURATION);
    mInteractionHintAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    mInteractionHintAnimation.setRepeatCount(ValueAnimator.INFINITE);
    mInteractionHintAnimation.start();
}

From source file:com.ffmpegtest.VideoActivity.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void swapScaleType() {
    FFmpegSurfaceView view = (FFmpegSurfaceView) mVideoView;
    FFmpegSurfaceView.ScaleType scaleType = view.getScaleType();
    ScaleType newScaleType;//from  ww w .  j a v a  2 s .  c o  m
    if (ScaleType.CENTER_INSIDE.equals(scaleType)) {
        newScaleType = ScaleType.CENTER_CROP;
    } else if (ScaleType.CENTER_CROP.equals(scaleType)) {
        newScaleType = ScaleType.FIT_XY;
    } else {
        newScaleType = ScaleType.CENTER_INSIDE;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        view.setScaleType(newScaleType, true);
        RectF dst = new RectF();
        view.calculateRect(dst, newScaleType);
        ObjectAnimator anim = ObjectAnimator.ofObject(view, "destinationRect", new RectEvaluator(), dst);
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.start();
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        view.setScaleType(newScaleType, true);
        RectF dst = new RectF();
        view.calculateRect(dst, newScaleType);
        ObjectAnimator anim = ObjectAnimator.ofObject(view, new PropertyDestinationRect(), new RectEvaluator(),
                dst);
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.start();
    } else {
        view.setScaleType(newScaleType, false);
    }
}

From source file:com.druk.servicebrowser.ui.fragment.ServiceBrowserFragment.java

protected void showError(final Throwable e) {
    getActivity().runOnUiThread(new Runnable() {
        @Override//from www .  j av  a2 s.c o  m
        public void run() {
            mRecyclerView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            mRecyclerView.setVisibility(View.GONE);
                        }
                    }).start();
            mProgressView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            mProgressView.setVisibility(View.GONE);
                        }
                    }).start();
            mErrorView.setAlpha(0.0f);
            mErrorView.setVisibility(View.VISIBLE);
            mErrorView.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).start();
            mErrorView.findViewById(R.id.send_report).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
                }
            });
        }
    });
}